Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug text and moved logs to debug #82

Merged
merged 9 commits into from
Oct 18, 2024
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 @@
@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 @@
"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"

Check warning on line 632 in src/Main.jl

View check run for this annotation

Codecov / codecov/patch

src/Main.jl#L631-L632

Added lines #L631 - L632 were not covered by tests

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

Check warning on line 638 in src/Main.jl

View check run for this annotation

Codecov / codecov/patch

src/Main.jl#L634-L638

Added lines #L634 - L638 were not covered by tests
else
for i = eachindex(this.debugTextBoxes)
db_textbox = this.debugTextBoxes[i]
JulGame.update_text(db_textbox, statTexts[i])
JulGame.render(db_textbox, false)
end

Check warning on line 644 in src/Main.jl

View check run for this annotation

Codecov / codecov/patch

src/Main.jl#L640-L644

Added lines #L640 - L644 were not covered by tests
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
Loading