diff options
| author | jussi | 2024-03-21 23:18:35 +0200 |
|---|---|---|
| committer | jussi | 2024-03-21 23:18:35 +0200 |
| commit | 95f03bae31ab695f55c4cb4b166e0af80814d841 (patch) | |
| tree | 0cdf6a07a96537553b1439ba6b9d1d2c1814638c /examples/raygui_extensions/sprite_button.lua | |
| parent | a7528da4ebd937d8023796998eb6975707b2f026 (diff) | |
| download | reilua-enhanced-95f03bae31ab695f55c4cb4b166e0af80814d841.tar.gz reilua-enhanced-95f03bae31ab695f55c4cb4b166e0af80814d841.tar.bz2 reilua-enhanced-95f03bae31ab695f55c4cb4b166e0af80814d841.zip | |
Raygui lib callbacks to single table.
Diffstat (limited to 'examples/raygui_extensions/sprite_button.lua')
| -rw-r--r-- | examples/raygui_extensions/sprite_button.lua | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/examples/raygui_extensions/sprite_button.lua b/examples/raygui_extensions/sprite_button.lua index ba4b704..8a3027b 100644 --- a/examples/raygui_extensions/sprite_button.lua +++ b/examples/raygui_extensions/sprite_button.lua @@ -1,7 +1,7 @@ local SpriteButton = {} SpriteButton.__index = SpriteButton -function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip ) +function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip ) local object = setmetatable( {}, self ) object._gui = nil @@ -10,7 +10,7 @@ function SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, c object.buttonTexture = texture object.nPatchNormal = nPatchNormal object.nPatchPressed = nPatchPressed - object.callback = callback + object.callbacks = callbacks -- pressed. object.styles = styles object.tooltip = tooltip @@ -33,8 +33,8 @@ function SpriteButton:draw() local result = RL.GuiLabelButton( self.bounds, self.text ) - if result == 1 and self.callback ~= nil and self._gui:clickedInBounds( self.bounds ) then - self.callback( self ) + if result == 1 and self.callbacks.pressed ~= nil and self._gui:clickedInBounds( self.bounds ) then + self.callbacks.pressed( self ) end end @@ -44,8 +44,8 @@ function SpriteButton:setPosition( pos ) end function SpriteButton:register( gui ) - function gui:SpriteButton( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip ) - return self:addControl( SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callback, styles, tooltip ) ) + function gui:SpriteButton( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip ) + return self:addControl( SpriteButton:new( bounds, text, texture, nPatchNormal, nPatchPressed, callbacks, styles, tooltip ) ) end end |
