Skip to content

Commit

Permalink
Added textbox.isActive
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Aug 19, 2024
1 parent 06db43f commit 5fee647
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/SceneManagement/SceneReader.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/SceneManagement/SceneWriter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/UI/TextBox.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/editor/JulGameEditor/Components/TextBoxFields.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 5fee647

Please sign in to comment.