Skip to content

Commit

Permalink
Trying to fix concurrency errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Sep 26, 2024
1 parent 6d1899f commit 4b8513c
Show file tree
Hide file tree
Showing 11 changed files with 66 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/Math/Math.jl
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ module Math
export Vector3
export Vector3f
export Vector4
export Vector4f
end
2 changes: 1 addition & 1 deletion src/engine/SceneManagement/SceneBuilder.jl
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module SceneBuilderModule
MAIN.scene.entities = scene[1]
MAIN.scene.uiElements = scene[2]
MAIN.scene.camera = scene[3]
print("caMERA : $(MAIN.scene.camera)")

if size.x < MAIN.scene.camera.size.x && size.x > 0
MAIN.scene.camera.size = Vector2(size.x, MAIN.scene.camera.size.y)

Check warning on line 117 in src/engine/SceneManagement/SceneBuilder.jl

View check run for this annotation

Codecov / codecov/patch

src/engine/SceneManagement/SceneBuilder.jl#L117

Added line #L117 was not covered by tests
end
Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Background.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module BackgroundModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Background
parent

Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Fish.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module FishModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Fish
animator
endingY::Int32
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module GameManagerModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct GameManager
currentLevel::Int32
currentMusic
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module PlayerMovementModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct PlayerMovement
animator
cameraTarget
Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Saw.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module SawModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Saw
animator::AnimatorModule.Animator
endingY::Int32
Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Spider.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module SpiderModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Spider
animator
endingX::Int32
Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Title.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module TitleModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Title
fade
parent
Expand Down
8 changes: 7 additions & 1 deletion test/projects/ProfilingTest/Platformer/scripts/Water.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
module WaterModule
using JulGame
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)

mutable struct Water
main
offset
Expand Down
12 changes: 8 additions & 4 deletions test/projects/SmokeTest/scripts/TestScript.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
module TestScriptModule
using JulGame
using JulGame.Math
function conditional_using(pkg::Symbol)
if !haskey(Base.loaded_modules, pkg)
@eval using $(pkg)
end
end
conditional_using(:JulGame)
using Test
mutable struct TestScript
parent
Expand All @@ -16,7 +20,7 @@ module TestScriptModule
newAnimation = C_NULL
newAnimator = C_NULL
@testset "Engine Animation Tests" begin
newAnimation = AnimationModule.Animation(Vector4[Vector4(0,0,0,0)], Int32(60))
newAnimation = AnimationModule.Animation(Math.Vector4[Math.Vector4(0,0,0,0)], Int32(60))
@testset "Animation constructor" begin
@test newAnimation != C_NULL && newAnimation !== nothing
@test newAnimation.animatedFPS == 60
Expand Down Expand Up @@ -95,7 +99,7 @@ module TestScriptModule
@testset "UI Tests" begin
@testset "ScreenButton constructor" begin

newScreenButton = ScreenButtonModule.ScreenButton("Name", "ButtonUp.png", "ButtonDown.png", Vector2(256, 64), Vector2(), joinpath("FiraCode-Regular.ttf"), "test")
newScreenButton = ScreenButtonModule.ScreenButton("Name", "ButtonUp.png", "ButtonDown.png", Math.Vector2(256, 64), Math.Vector2(), joinpath("FiraCode-Regular.ttf"), "test")
push!(MAIN.scene.uiElements, newScreenButton)
@test newScreenButton != C_NULL && newScreenButton !== nothing
end
Expand Down

0 comments on commit 4b8513c

Please sign in to comment.