summaryrefslogtreecommitdiff
path: root/examples/raygui_extensions/sprite_button.lua
diff options
context:
space:
mode:
authorjussi2024-03-20 19:18:01 +0200
committerjussi2024-03-20 19:18:01 +0200
commit842e0efe360417556ad0e757d91ef05449bfc8ee (patch)
treed51e0734bf31082d3483f6c6a56eb1195372132a /examples/raygui_extensions/sprite_button.lua
parentae1d0b65f16b24f2e0db39cb8baef4af57b2a12f (diff)
downloadreilua-enhanced-842e0efe360417556ad0e757d91ef05449bfc8ee.tar.gz
reilua-enhanced-842e0efe360417556ad0e757d91ef05449bfc8ee.tar.bz2
reilua-enhanced-842e0efe360417556ad0e757d91ef05449bfc8ee.zip
Raygui tree view.
Diffstat (limited to 'examples/raygui_extensions/sprite_button.lua')
-rw-r--r--examples/raygui_extensions/sprite_button.lua7
1 files changed, 3 insertions, 4 deletions
diff --git a/examples/raygui_extensions/sprite_button.lua b/examples/raygui_extensions/sprite_button.lua
index 11bdf51..ba4b704 100644
--- a/examples/raygui_extensions/sprite_button.lua
+++ b/examples/raygui_extensions/sprite_button.lua
@@ -3,7 +3,7 @@ SpriteButton.__index = SpriteButton
function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip )
local object = setmetatable( {}, self )
- object._parent = nil
+ object._gui = nil
object.bounds = bounds:clone()
object.text = text
@@ -21,12 +21,11 @@ function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, c
end
function SpriteButton:update()
- -- print( self.tooltip )
return RL.CheckCollisionPointRec( RL.GetMousePosition(), self.bounds )
end
function SpriteButton:draw()
- if RL.IsMouseButtonDown( RL.MOUSE_BUTTON_LEFT ) and self:update() and not RL.GuiIsLocked() and not self._parent.scrolling then
+ if RL.IsMouseButtonDown( RL.MOUSE_BUTTON_LEFT ) and self:update() and not RL.GuiIsLocked() and not self._gui.scrolling then
RL.DrawTextureNPatchRepeat( self.buttonTexture, self.nPatchPressed, self.bounds, { 0, 0 }, 0.0, RL.WHITE )
else
RL.DrawTextureNPatchRepeat( self.buttonTexture, self.nPatchNormal, self.bounds, { 0, 0 }, 0.0, RL.WHITE )
@@ -34,7 +33,7 @@ function SpriteButton:draw()
local result = RL.GuiLabelButton( self.bounds, self.text )
- if result == 1 and self.callback ~= nil and self._parent:clickedInBounds( self.bounds ) then
+ if result == 1 and self.callback ~= nil and self._gui:clickedInBounds( self.bounds ) then
self.callback( self )
end
end