Skip to content

Commit

Permalink
Added logging, fixed screenbutton loading, fixed alpha not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Jan 11, 2025
1 parent ff1b660 commit 40e5240
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
13 changes: 0 additions & 13 deletions src/editor/JulGameEditor/Components/CameraWindow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ function show_camera_window(this::CameraWindow)

CImGui.Text("Starting Coordinates: $(this.camera.startingCoordinates.x), $(this.camera.startingCoordinates.y)")

# Temporary Float32 storage
start_x32 = Float32(this.camera.startingCoordinates.x)
start_y32 = Float32(this.camera.startingCoordinates.y)
isEdited = @c CImGui.InputFloat("Starting Coordinates X", &start_x32, 1)
if isEdited
this.camera.startingCoordinates = Vector2f(Float64(start_x32), this.camera.startingCoordinates.y)
end
CImGui.SameLine()
isEdited = @c CImGui.InputFloat("Starting Coordinates Y", &start_y32, 1)
if isEdited
this.camera.startingCoordinates = Vector2f(this.camera.startingCoordinates.x, Float64(start_y32))
end

# camera background color
# CImGui.Text("Background Color:")
# color_r = UInt8(this.camera.backgroundColor[1])
Expand Down
10 changes: 7 additions & 3 deletions src/editor/JulGameEditor/Editor.jl
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,13 @@ module Editor
config = Dict{String, String}()
if isfile(filename)
open(filename, "r") do file
for line in eachline(file)
key, value = split(line, "=")
config[key] = value
try
for line in eachline(file)
key, value = split(line, "=")
config[key] = value
end
catch e
@warn e
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion src/engine/Entity.jl
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module EntityModule
return
end

this.shape = InternalShape(this::Entity, shape.color, shape.isFilled, shape.offset, shape.size; isWorldEntity = shape.isWorldEntity, position = shape.position, layer = shape.layer)
this.shape = InternalShape(this::Entity, shape.color, shape.isFilled, shape.offset, shape.size; isWorldEntity = shape.isWorldEntity, position = shape.position, layer = shape.layer, alpha = shape.alpha)

return this.shape
end
Expand Down
2 changes: 1 addition & 1 deletion src/engine/UI/ScreenButton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ module ScreenButtonModule
end
@debug "Loading image from disk, there are $(length(JulGame.IMAGE_CACHE)) images in cache"

return CallSDLFunction(SDL2.IMG_Load, joinpath(fullPath))
return CallSDLFunction(SDL2.IMG_Load, joinpath(fullPath, imagePath))
end

function get_comma_separated_path(path::String)
Expand Down
5 changes: 4 additions & 1 deletion src/utils/Utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ function CallSDLFunction(func::Function, args...)
# Call SDL function and check for errors
ret = func(args...)
if (isa(ret, Number) && ret < 0) || ret == C_NULL
@error "$(unsafe_string(SDL2.SDL_GetError()))"
@error "SDL Error: $(unsafe_string(SDL2.SDL_GetError()))
|| with function $(func)
|| with args $(args)"

Base.show_backtrace(stdout, catch_backtrace())
end

Expand Down

0 comments on commit 40e5240

Please sign in to comment.