Skip to content

Commit

Permalink
Feature: Add concept of hovering for screen buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyjor committed Jan 11, 2025
1 parent 2015647 commit 035893f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/engine/Input/Input.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ module InputModule

screenButton.mouseOverSprite = eventWasInsideThisButton
if !eventWasInsideThisButton
screenButton.isHovered = false
continue
end
insideAnyButton = true
Expand Down
3 changes: 2 additions & 1 deletion src/engine/UI/ScreenButton.jl
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ module ScreenButtonModule
this.currentTexture === nothing #|| this.textTexture === nothing
return
end

@assert SDL2.SDL_RenderCopyExF(
JulGame.Renderer::Ptr{SDL2.SDL_Renderer},
this.currentTexture,
Expand Down Expand Up @@ -152,7 +153,7 @@ module ScreenButtonModule
Base.invokelatest(eventToCall,(evt = evt, x = x, y = y))
end
elseif evt.type == SDL2.SDL_MOUSEMOTION
#println("mouse move")
this.isHovered = true
end
end

Expand Down

0 comments on commit 035893f

Please sign in to comment.