From 035893f9f61a3ea59818c3196afeaf68b44fd462 Mon Sep 17 00:00:00 2001 From: Kyle Conel Date: Sat, 11 Jan 2025 17:14:34 -0500 Subject: [PATCH] Feature: Add concept of hovering for screen buttons --- src/engine/Input/Input.jl | 1 + src/engine/UI/ScreenButton.jl | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/engine/Input/Input.jl b/src/engine/Input/Input.jl index 4401521f..eff9a7fc 100644 --- a/src/engine/Input/Input.jl +++ b/src/engine/Input/Input.jl @@ -134,6 +134,7 @@ module InputModule screenButton.mouseOverSprite = eventWasInsideThisButton if !eventWasInsideThisButton + screenButton.isHovered = false continue end insideAnyButton = true diff --git a/src/engine/UI/ScreenButton.jl b/src/engine/UI/ScreenButton.jl index e6117cc7..a9ab81a9 100644 --- a/src/engine/UI/ScreenButton.jl +++ b/src/engine/UI/ScreenButton.jl @@ -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, @@ -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