Skip to content

Commit

Permalink
Fix debug text and moved logs to debug (#82)
Browse files Browse the repository at this point in the history
* Cleaned up logs and fixed debug font retrieval
  • Loading branch information
Kyjor authored Oct 18, 2024
1 parent 75c3a20 commit 0f1ff8b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions src/Main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ function initialize_scripts_and_components()
@debug "adding rigidbodies to global list"
if entity.rigidbody != C_NULL
push!(MAIN.scene.rigidbodies, entity.rigidbody)
end
end
@debug "adding colliders to global list"
if entity.collider != C_NULL
push!(MAIN.scene.colliders, entity.collider)
Expand Down Expand Up @@ -628,21 +628,21 @@ function game_loop(this::Main, startTime::Ref{UInt64} = Ref(UInt64(0)), lastPhys
"Mouse pos world: $(this.mousePositionWorld.x),$(this.mousePositionWorld.y)"
]

# if length(this.debugTextBoxes) == 0
# fontPath = joinpath(this.assets, "fonts", "FiraCode-Regular.ttf")

# for i = eachindex(statTexts)
# textBox = UI.TextBoxModule.TextBox("Debug text", fontPath, 40, Math.Vector2(0, 35 * i), statTexts[i], false, false)
# push!(this.debugTextBoxes, textBox)
# JulGame.initialize(textBox)
# end
# else
# for i = eachindex(this.debugTextBoxes)
# db_textbox = this.debugTextBoxes[i]
# JulGame.update_text(db_textbox, statTexts[i])
# JulGame.render(db_textbox, false)
# end
# end
if length(this.debugTextBoxes) == 0
fontPath = "FiraCode-Regular.ttf"

for i = eachindex(statTexts)
textBox = UI.TextBoxModule.TextBox("Debug text", fontPath, 40, Math.Vector2(0, 35 * i), statTexts[i], false, false)
push!(this.debugTextBoxes, textBox)
JulGame.initialize(textBox)
end
else
for i = eachindex(this.debugTextBoxes)
db_textbox = this.debugTextBoxes[i]
JulGame.update_text(db_textbox, statTexts[i])
JulGame.render(db_textbox, false)
end
end
end

if !JulGame.IS_EDITOR
Expand Down
8 changes: 4 additions & 4 deletions src/engine/Component/Collider.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,17 +208,17 @@ module ColliderModule
horizontalCollisionDir = None::CollisionDirection
verticalCollisionDir = None::CollisionDirection
if result[].x == b.x
println("colliding from left at depth $(depthHorizontal)")
@debug "colliding from left at depth $(depthHorizontal)"
horizontalCollisionDir = Left::CollisionDirection
elseif result[].x == a.x
println("colliding from right at depth $(depthHorizontal)")
@debug "colliding from right at depth $(depthHorizontal)"
horizontalCollisionDir = Right::CollisionDirection
end
if result[].y == b.y
println("colliding from top at depth $(depthVertical)")
@debug "colliding from top at depth $(depthVertical)"
verticalCollisionDir = Bottom::CollisionDirection
elseif result[].y == a.y
println("colliding from bottom at depth $(depthVertical)")
@debug "colliding from botrom at depth $(depthVertical)"
verticalCollisionDir = Top::CollisionDirection
end

Expand Down

0 comments on commit 0f1ff8b

Please sign in to comment.