From 5fee647b17258581cfeb8838a08c22a2d1046060 Mon Sep 17 00:00:00 2001 From: Kyle Conel Date: Mon, 19 Aug 2024 15:14:59 -0400 Subject: [PATCH] Added textbox.isActive --- src/SceneManagement/SceneReader.jl | 2 ++ src/SceneManagement/SceneWriter.jl | 1 + src/UI/TextBox.jl | 2 +- src/editor/JulGameEditor/Components/TextBoxFields.jl | 2 +- 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SceneManagement/SceneReader.jl b/src/SceneManagement/SceneReader.jl index 1c31412..849e9e3 100644 --- a/src/SceneManagement/SceneReader.jl +++ b/src/SceneManagement/SceneReader.jl @@ -114,6 +114,8 @@ module SceneReaderModule if uiElement.type == "TextBox" newUIElement = TextBox(uiElement.name, uiElement.fontPath, uiElement.fontSize, Vector2(uiElement.position.x, uiElement.position.y), uiElement.text, uiElement.isCenteredX, uiElement.isCenteredY) newUIElement.isWorldEntity = uiElement.isWorldEntity + isActive::Bool = !haskey(uiElement, "isActive") ? true : uiElement.isActive + newUIElement.isActive = isActive else newUIElement = ScreenButton(uiElement.name, uiElement.buttonUpSpritePath, uiElement.buttonDownSpritePath, Vector2(uiElement.size.x, uiElement.size.y), Vector2(uiElement.position.x, uiElement.position.y), uiElement.fontPath, uiElement.text, Vector2(uiElement.textOffset.x, uiElement.textOffset.y)) end diff --git a/src/SceneManagement/SceneWriter.jl b/src/SceneManagement/SceneWriter.jl index 0158cbf..9499c14 100644 --- a/src/SceneManagement/SceneWriter.jl +++ b/src/SceneManagement/SceneWriter.jl @@ -50,6 +50,7 @@ module SceneWriterModule "alpha" => uiElement.alpha, "fontPath" => normalize_path(uiElement.fontPath), "fontSize" => uiElement.fontSize, + "isActive" => uiElement.isActive, "isCenteredX" => uiElement.isCenteredX, "isCenteredY" => uiElement.isCenteredY, "isWorldEntity" => uiElement.isWorldEntity, diff --git a/src/UI/TextBox.jl b/src/UI/TextBox.jl index 2c11079..233a18c 100644 --- a/src/UI/TextBox.jl +++ b/src/UI/TextBox.jl @@ -50,7 +50,7 @@ module TextBoxModule end function UI.render(this::TextBox, debug::Bool) - if this.textTexture == C_NULL + if this.textTexture == C_NULL || !this.isActive return end diff --git a/src/editor/JulGameEditor/Components/TextBoxFields.jl b/src/editor/JulGameEditor/Components/TextBoxFields.jl index 8866dd3..f834b18 100644 --- a/src/editor/JulGameEditor/Components/TextBoxFields.jl +++ b/src/editor/JulGameEditor/Components/TextBoxFields.jl @@ -51,7 +51,7 @@ function show_textbox_fields(selectedTextBox, textBoxField) setfield!(selectedTextBox, textBoxField, Vector2(x, y)) JulGame.update_text(selectedTextBox, selectedTextBox.text) end - elseif fieldName == "autoSizeText" || fieldName == "isCenteredX" || fieldName == "isCenteredY" || fieldName == "isWorldEntity" + elseif fieldName == "autoSizeText" || fieldName == "isCenteredX" || fieldName == "isCenteredY" || fieldName == "isWorldEntity" || fieldName == "isActive" @c CImGui.Checkbox("$(textBoxField)", &Value) if Value != getfield(selectedTextBox, textBoxField)