From 4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc Mon Sep 17 00:00:00 2001 From: jussi Date: Fri, 1 Dec 2023 00:26:43 +0200 Subject: Raygui wrapper library disable and styles for each element. --- examples/ReiLuaGui_examples/calculator.lua | 10 +- examples/ReiLuaGui_examples/file_explorer.lua | 20 +- examples/ReiLuaGui_examples/main.lua | 54 +-- examples/raygui_lib/main.lua | 80 +++-- examples/resources/lib/gui.lua | 2 +- examples/resources/lib/raygui.lua | 468 ++++++++------------------ 6 files changed, 242 insertions(+), 392 deletions(-) (limited to 'examples') diff --git a/examples/ReiLuaGui_examples/calculator.lua b/examples/ReiLuaGui_examples/calculator.lua index 8ebf0b6..a2ddfdf 100644 --- a/examples/ReiLuaGui_examples/calculator.lua +++ b/examples/ReiLuaGui_examples/calculator.lua @@ -27,7 +27,7 @@ function Calculator:new( pos ) object.handle:add( Gui.texture:new( { bounds = object.handle.bounds:clone(), - texture = bgrTexture, + texture = BgrTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), @@ -35,7 +35,7 @@ function Calculator:new( pos ) object.handle:add( Gui.texture:new( { bounds = object.handle.bounds:clone(), - texture = borderTexture, + texture = BorderTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), @@ -57,7 +57,7 @@ function Calculator:new( pos ) object.closeButton:add( Gui.texture:new( { bounds = object.closeButton.bounds:clone(), - texture = cancelTexture, + texture = CancelTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, } ) ) @@ -70,7 +70,7 @@ function Calculator:new( pos ) object.panel:add( Gui.texture:new( { bounds = object.panel.bounds:clone(), - texture = bgrTexture, + texture = BgrTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.GRAY ), @@ -78,7 +78,7 @@ function Calculator:new( pos ) object.panel:add( Gui.texture:new( { bounds = object.panel.bounds:clone(), - texture = borderTexture, + texture = BorderTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), diff --git a/examples/ReiLuaGui_examples/file_explorer.lua b/examples/ReiLuaGui_examples/file_explorer.lua index 72f6117..7ec6104 100644 --- a/examples/ReiLuaGui_examples/file_explorer.lua +++ b/examples/ReiLuaGui_examples/file_explorer.lua @@ -27,7 +27,7 @@ function FileExplorer:new( pos ) object.handle:add( Gui.texture:new( { bounds = object.handle.bounds:clone(), - texture = bgrTexture, + texture = BgrTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), @@ -35,7 +35,7 @@ function FileExplorer:new( pos ) object.handle:add( Gui.texture:new( { bounds = object.handle.bounds:clone(), - texture = borderTexture, + texture = BorderTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), @@ -57,7 +57,7 @@ function FileExplorer:new( pos ) object.closeButton:add( Gui.texture:new( { bounds = object.closeButton.bounds:clone(), - texture = cancelTexture, + texture = CancelTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, } ) ) @@ -70,7 +70,7 @@ function FileExplorer:new( pos ) object.panel:add( Gui.texture:new( { bounds = object.panel.bounds:clone(), - texture = bgrTexture, + texture = BgrTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.GRAY ), @@ -78,7 +78,7 @@ function FileExplorer:new( pos ) object.panel:add( Gui.texture:new( { bounds = object.panel.bounds:clone(), - texture = borderTexture, + texture = BorderTexture, HAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER, color = Color:new( RL.LIGHTGRAY ), @@ -110,7 +110,7 @@ function FileExplorer:new( pos ) object.backButton:add( Gui.texture:new( { bounds = Rect:new( 0, 0, object.HANDLE_HIGHT, object.HANDLE_HIGHT ), - texture = backTexture, + texture = BackTexture, HAling = Gui.ALING.CENTER, color = Color:new( RL.BLACK ) } ) ) @@ -153,8 +153,8 @@ function FileExplorer:new( pos ) object.path = RL.GetBasePath() -- Take last '/' away. - if util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then - object.path = util.utf8Sub( object.path, 1, utf8.len( object.path ) - 1 ) + if Util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then + object.path = Util.utf8Sub( object.path, 1, utf8.len( object.path ) - 1 ) end object.file = "" @@ -228,11 +228,11 @@ function FileExplorer:updateFiles() table.sort( folders, function( a, b ) return a < b end ) for _, folder in ipairs( folders ) do - self:addFileToList( folder, folderTexture, { 150, 120, 80 }, function() self:changeDir( folder ) end ) + self:addFileToList( folder, FolderTexture, { 150, 120, 80 }, function() self:changeDir( folder ) end ) end for _, file in ipairs( files ) do - self:addFileToList( file, filesTexture, RL.WHITE, function() self:fileSelect( file ) end ) + self:addFileToList( file, FilesTexture, RL.WHITE, function() self:fileSelect( file ) end ) end end diff --git a/examples/ReiLuaGui_examples/main.lua b/examples/ReiLuaGui_examples/main.lua index 29dace8..c2861c0 100644 --- a/examples/ReiLuaGui_examples/main.lua +++ b/examples/ReiLuaGui_examples/main.lua @@ -1,7 +1,7 @@ package.path = package.path..";"..RL.GetBasePath().."?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua" -util = require( "utillib" ) +Util = require( "utillib" ) Vec2 = require( "vector2" ) Rect = require( "rectangle" ) Color = require( "color" ) @@ -13,29 +13,29 @@ FileExplorer = require( "file_explorer" ) -- Textures. -- Note that textures are global. -cancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" ) -backTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" ) -folderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" ) -filesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" ) -borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" ) -bgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" ) - -RL.GenTextureMipmaps( cancelTexture ) -RL.GenTextureMipmaps( backTexture ) -RL.GenTextureMipmaps( folderTexture ) -RL.GenTextureMipmaps( filesTexture ) -RL.GenTextureMipmaps( borderTexture ) -RL.GenTextureMipmaps( bgrTexture ) - -RL.SetTextureFilter( cancelTexture, RL.TEXTURE_FILTER_TRILINEAR ) -RL.SetTextureFilter( backTexture, RL.TEXTURE_FILTER_TRILINEAR ) -RL.SetTextureFilter( folderTexture, RL.TEXTURE_FILTER_TRILINEAR ) -RL.SetTextureFilter( filesTexture, RL.TEXTURE_FILTER_TRILINEAR ) -RL.SetTextureFilter( borderTexture, RL.TEXTURE_FILTER_TRILINEAR ) -RL.SetTextureFilter( bgrTexture, RL.TEXTURE_FILTER_TRILINEAR ) - -RL.SetTextureWrap( borderTexture, RL.TEXTURE_WRAP_REPEAT ) -RL.SetTextureWrap( bgrTexture, RL.TEXTURE_WRAP_REPEAT ) +CancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" ) +BackTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" ) +FolderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" ) +FilesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" ) +BorderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" ) +BgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" ) + +RL.GenTextureMipmaps( CancelTexture ) +RL.GenTextureMipmaps( BackTexture ) +RL.GenTextureMipmaps( FolderTexture ) +RL.GenTextureMipmaps( FilesTexture ) +RL.GenTextureMipmaps( BorderTexture ) +RL.GenTextureMipmaps( BgrTexture ) + +RL.SetTextureFilter( CancelTexture, RL.TEXTURE_FILTER_TRILINEAR ) +RL.SetTextureFilter( BackTexture, RL.TEXTURE_FILTER_TRILINEAR ) +RL.SetTextureFilter( FolderTexture, RL.TEXTURE_FILTER_TRILINEAR ) +RL.SetTextureFilter( FilesTexture, RL.TEXTURE_FILTER_TRILINEAR ) +RL.SetTextureFilter( BorderTexture, RL.TEXTURE_FILTER_TRILINEAR ) +RL.SetTextureFilter( BgrTexture, RL.TEXTURE_FILTER_TRILINEAR ) + +RL.SetTextureWrap( BorderTexture, RL.TEXTURE_WRAP_REPEAT ) +RL.SetTextureWrap( BgrTexture, RL.TEXTURE_WRAP_REPEAT ) -- End of calculator definition. @@ -43,7 +43,7 @@ local calculator = nil local fileExplorer = nil local showButton = nil -function initGui() +local function initGui() showButton = Gui.element:new( { bounds = Rect:new( 0, 0, 96, 32 ), drawBounds = true, @@ -65,7 +65,7 @@ function RL.init() local monitor = 0 local mPos = RL.GetMonitorPosition( monitor ) local mSize = RL.GetMonitorSize( monitor ) - winSize = RL.GetScreenSize() + local winSize = RL.GetScreenSize() RL.SetWindowTitle( "ReiLuaGui examples" ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) @@ -84,4 +84,4 @@ function RL.draw() RL.ClearBackground( RL.RAYWHITE ) Gui.draw() -end +end \ No newline at end of file diff --git a/examples/raygui_lib/main.lua b/examples/raygui_lib/main.lua index 0e5a725..01cf49b 100644 --- a/examples/raygui_lib/main.lua +++ b/examples/raygui_lib/main.lua @@ -47,10 +47,13 @@ function RL.init() RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 ) RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SPACING, 4 ) RL.GuiSetStyle( RL.SPINNER, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_RIGHT ) + RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT ) - RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) ) - RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) ) - RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) ) + -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) ) + -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) ) + -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) ) + + RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_LINE_SPACING, 20 ) local label = Gui:Label( Rect:new( 16, 16, 64, 32 ), @@ -65,17 +68,26 @@ function RL.init() local button = Gui:Button( Rect:new( 245, 188, 64, 32 ), "Dog", - function() toggleGroup:setText( "Dog;Cat\nEagle" ) end, - texture, - textureRect + function() toggleGroup:setText( "Dog;Cat\nEagle" ) end ) + button.styles = { + { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) }, + { RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) }, + { RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) }, + } + button.texture = texture + button.textureRect = textureRect local checkbox = Gui:CheckBox( - Rect:new( 64, 128, 20, 20 ), - "Dog", + Rect:new( 116, 128, 20, 20 ), + "Visible", + toggleGroup.visible, + function( self ) toggleGroup.visible = self.checked end + ) + local toggle = Gui:Toggle( + Rect:new( 32, 160, 100, 32 ), + "Toggle", false, - nil, - texture, - textureRect + nil ) local combobox = Gui:ComboBox( Rect:new( 64, 256, 128, 32 ), @@ -128,10 +140,10 @@ function RL.init() 0, 0, 100, - function( self ) print( "Changed value "..self.value ) end, - texture, - textureRect + function( self ) print( "Changed value "..self.value ) end ) + slider.texture = texture + slider.textureRect = textureRect local sliderbar = Gui:SliderBar( Rect:new( 50, 550, 256, 32 ), "min", @@ -171,10 +183,13 @@ function RL.init() function( self ) self.visible = false end, -- Grab callback. function( self ) Gui:set2Top( self ) end, - nil, - texture, - textureRect + nil ) + windowbox.styles = { + { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) }, + } + windowbox.texture = texture + windowbox.textureRect = textureRect local groupbox = Gui:GroupBox( Rect:new( 400, 700, 256, 256 ), "GroupBox" @@ -189,15 +204,17 @@ function RL.init() -- Grab callback. function( self ) Gui:set2Top( self ) end ) + panel.styles = { + { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.MAGENTA ) }, + { RL.DEFAULT, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_CENTER }, + { RL.DEFAULT, RL.BACKGROUND_COLOR, RL.ColorToInt( RL.DARKBLUE ) }, + } tabBar = Gui:GuiTabBar( Rect:new( 700, 520, 700, 32 ), "Cat;Dog;Horse;Cow", 0, - -- function( self ) Gui:set2Top( self ) end nil, - closeTab, - texture, - textureRect + closeTab ) local scrollpanel = Gui:ScrollPanel( Rect:new( 800, 64, 256, 256 ), @@ -222,23 +239,26 @@ function RL.init() 0, 0, 0, - function( self ) print( self:getItem( self.active ) ) end, - texture, - textureRect + function( self ) print( self:getItem( self.active ) ) end ) + listviewex.styles = { + { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) }, + { RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) }, + { RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) }, + } + listviewex.texture = texture + listviewex.textureRect = textureRect local messagebox = Gui:MessageBox( Rect:new( 1100, 150, 300, 128 ), "Title", - "Message", - "Cancel;Ok", + "Should we disable\nwindow box?", + "No;Yes", function( self ) if 0 < self.buttonIndex then - print( "You pressed "..self:getItem( self.buttonIndex ) ) - if self.buttonIndex == 1 then - Gui:set2Back( windowbox ) + windowbox.disabled = false elseif self.buttonIndex == 2 then - Gui:set2Top( windowbox ) + windowbox.disabled = true end end end, diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua index da5909a..be5ec33 100644 --- a/examples/resources/lib/gui.lua +++ b/examples/resources/lib/gui.lua @@ -875,4 +875,4 @@ Gui.shape = Shape Gui.element = Element Gui.container = Container -return Gui +return Gui \ No newline at end of file diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua index d892783..a9e314d 100644 --- a/examples/resources/lib/raygui.lua +++ b/examples/resources/lib/raygui.lua @@ -52,8 +52,8 @@ end local WindowBox = {} WindowBox.__index = WindowBox -function WindowBox:new( bounds, text, callback, grabCallback, dragCallback, texture, textureRect ) - local object = setmetatable( {}, self ) +function WindowBox:new( bounds, text, callback, grabCallback, dragCallback ) + local object = setmetatable( {}, self ) object._parent = nil object.bounds = bounds:clone() @@ -61,10 +61,9 @@ function WindowBox:new( bounds, text, callback, grabCallback, dragCallback, text object.callback = callback object.grabCallback = grabCallback object.dragCallback = dragCallback - object.texture = texture - object.textureRect = textureRect - + object.visible = true + object.disabled = false object.draggable = true return object @@ -75,16 +74,8 @@ function WindowBox:process() end function WindowBox:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - local result = RL.GuiWindowBox( self.bounds, self.text ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end - if result == 1 and self.callback ~= nil then self.callback( self ) end @@ -108,6 +99,7 @@ function GroupBox:new( bounds, text ) object.text = text object.visible = true + object.disabled = false return object end @@ -139,6 +131,7 @@ function Line:new( bounds, text ) object.text = text object.visible = true + object.disabled = false return object end @@ -162,7 +155,7 @@ end local Panel = {} Panel.__index = Panel -function Panel:new( bounds, text, grabCallback, dragCallback, texture, textureRect ) +function Panel:new( bounds, text, grabCallback, dragCallback ) local object = setmetatable( {}, self ) object._parent = nil @@ -170,10 +163,9 @@ function Panel:new( bounds, text, grabCallback, dragCallback, texture, textureRe object.text = text object.grabCallback = grabCallback object.dragCallback = dragCallback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.draggable = true return object @@ -184,15 +176,7 @@ function Panel:process() end function Panel:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - RL.GuiPanel( self.bounds, self.text ) - - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end end function Panel:setPosition( pos ) @@ -206,17 +190,16 @@ end local GuiTabBar = {} GuiTabBar.__index = GuiTabBar -function GuiTabBar:new( bounds, text, active, callback, closeCallback, texture, textureRect ) +function GuiTabBar:new( bounds, text, active, callback, closeCallback ) local object = setmetatable( {}, self ) object._parent = nil object.bounds = bounds:clone() object.text = text object.active = active - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.callback = callback object.closeCallback = closeCallback @@ -231,15 +214,8 @@ function GuiTabBar:draw() local oldActive = self.active local result = -1 - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - result, self.active = RL.GuiTabBar( self.bounds, self.text, self.active ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.active ~= oldActive and self.callback ~= nil then self.callback( self ) end @@ -259,7 +235,7 @@ end local ScrollPanel = {} ScrollPanel.__index = ScrollPanel -function ScrollPanel:new( bounds, text, content, scroll, callback, grabCallback, dragCallback, texture, textureRect ) +function ScrollPanel:new( bounds, text, content, scroll, callback, grabCallback, dragCallback ) local object = setmetatable( {}, self ) object._parent = nil @@ -271,10 +247,9 @@ function ScrollPanel:new( bounds, text, content, scroll, callback, grabCallback, object.callback = callback object.grabCallback = grabCallback object.dragCallback = dragCallback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.draggable = true return object @@ -287,16 +262,8 @@ end function ScrollPanel:draw() local oldScroll = self.scroll:clone() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - local _, scroll, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end - self.view = Rect:new( view ) self.scroll = Vec2:new( scroll ) @@ -332,6 +299,7 @@ function Label:new( bounds, text ) object.text = text object.visible = true + object.disabled = false return object end @@ -355,17 +323,16 @@ end local Button = {} Button.__index = Button -function Button:new( bounds, text, callback, texture, textureRect ) +function Button:new( bounds, text, callback ) local object = setmetatable( {}, self ) object._parent = nil object.bounds = bounds:clone() object.text = text object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -375,16 +342,8 @@ function Button:process() end function Button:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - local result = RL.GuiButton( self.bounds, self.text ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end - if result == 1 and self.callback ~= nil then self.callback( self ) end @@ -410,6 +369,7 @@ function LabelButton:new( bounds, text, callback ) object.callback = callback object.visible = true + object.disabled = false return object end @@ -437,7 +397,7 @@ end local Toggle = {} Toggle.__index = Toggle -function Toggle:new( bounds, text, active, callback, texture, textureRect ) +function Toggle:new( bounds, text, active, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -445,10 +405,9 @@ function Toggle:new( bounds, text, active, callback, texture, textureRect ) object.text = text object.active = active object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -460,15 +419,8 @@ end function Toggle:draw() local oldActive = self.active - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.active = RL.GuiToggle( self.bounds, self.text, self.active ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.active ~= oldActive and self.callback ~= nil then self.callback( self ) end @@ -485,7 +437,7 @@ end local ToggleGroup = {} ToggleGroup.__index = ToggleGroup -function ToggleGroup:new( bounds, text, active, callback, texture, textureRect ) +function ToggleGroup:new( bounds, text, active, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -493,10 +445,9 @@ function ToggleGroup:new( bounds, text, active, callback, texture, textureRect ) object.text = text object.active = active object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.focusBounds = {} object:updateFocusBounds() @@ -549,15 +500,8 @@ end function ToggleGroup:draw() local oldActive = self.active - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.active = RL.GuiToggleGroup( self.bounds, self.text, self.active ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.active ~= oldActive and self.callback ~= nil then self.callback( self ) end @@ -576,7 +520,7 @@ end local CheckBox = {} CheckBox.__index = CheckBox -function CheckBox:new( bounds, text, checked, callback, texture, textureRect ) +function CheckBox:new( bounds, text, checked, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -584,10 +528,9 @@ function CheckBox:new( bounds, text, checked, callback, texture, textureRect ) object.text = text object.checked = checked object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.focusBounds = bounds:clone() object:updateFocusBounds() @@ -638,15 +581,8 @@ end function CheckBox:draw() local oldChecked = self.checked - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.checked = RL.GuiCheckBox( self.bounds, self.text, self.checked ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.checked ~= oldChecked and self.callback ~= nil then self.callback( self ) end @@ -666,7 +602,7 @@ end local ComboBox = {} ComboBox.__index = ComboBox -function ComboBox:new( bounds, text, active, callback, texture, textureRect ) +function ComboBox:new( bounds, text, active, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -674,10 +610,9 @@ function ComboBox:new( bounds, text, active, callback, texture, textureRect ) object.text = text object.active = active object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -689,15 +624,8 @@ end function ComboBox:draw() local oldActive = self.active - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.active = RL.GuiComboBox( self.bounds, self.text, self.active ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.active ~= oldActive and self.callback ~= nil then self.callback( self ) end @@ -714,7 +642,7 @@ end local DropdownBox = {} DropdownBox.__index = DropdownBox -function DropdownBox:new( bounds, text, active, editMode, callback, texture, textureRect ) +function DropdownBox:new( bounds, text, active, editMode, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -723,10 +651,9 @@ function DropdownBox:new( bounds, text, active, editMode, callback, texture, tex object.active = active object.editMode = editMode object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false object.editModeBounds = bounds:clone() object:updateFocusBounds() @@ -765,15 +692,8 @@ end function DropdownBox:draw() local result = 0 - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - result, self.active = RL.GuiDropdownBox( self.bounds, self.text, self.active, self.editMode ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if result == 1 then self.editMode = not self.editMode @@ -794,7 +714,7 @@ end local Spinner = {} Spinner.__index = Spinner -function Spinner:new( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) +function Spinner:new( bounds, text, value, minValue, maxValue, editMode, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -805,10 +725,9 @@ function Spinner:new( bounds, text, value, minValue, maxValue, editMode, callbac object.maxValue = maxValue object.editMode = editMode object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -821,15 +740,8 @@ function Spinner:draw() local result = 0 local oldValue = self.value - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - result, self.value = RL.GuiSpinner( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if result == 1 then self._parent:editMode( self.editMode ) self.editMode = not self.editMode @@ -850,7 +762,7 @@ end local ValueBox = {} ValueBox.__index = ValueBox -function ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) +function ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -861,10 +773,9 @@ function ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callba object.maxValue = maxValue object.editMode = editMode object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -877,15 +788,8 @@ function ValueBox:draw() local result = 0 local oldValue = self.value - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - result, self.value = RL.GuiValueBox( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if result == 1 then self._parent:editMode( self.editMode ) self.editMode = not self.editMode @@ -906,7 +810,7 @@ end local TextBox = {} TextBox.__index = TextBox -function TextBox:new( bounds, text, textSize, editMode, callback, texture, textureRect ) +function TextBox:new( bounds, text, textSize, editMode, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -915,11 +819,10 @@ function TextBox:new( bounds, text, textSize, editMode, callback, texture, textu object.textSize = textSize object.editMode = editMode object.callback = callback - object.texture = texture - object.textureRect = textureRect -- Option for preventing text to be drawn outside bounds. object.scissorMode = false object.visible = true + object.disabled = false return object end @@ -934,15 +837,9 @@ function TextBox:draw() if self.scissorMode then RL.BeginScissorMode( self.bounds ) end - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end result, self.text = RL.GuiTextBox( self.bounds, self.text, self.textSize, self.editMode ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.scissorMode then RL.EndScissorMode() end @@ -967,7 +864,7 @@ end local Slider = {} Slider.__index = Slider -function Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) +function Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -978,10 +875,9 @@ function Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, cal object.minValue = minValue object.maxValue = maxValue object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -993,15 +889,8 @@ end function Slider:draw() local oldValue = self.value - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.value = RL.GuiSlider( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.value ~= oldValue then self._parentscrolling = true @@ -1022,7 +911,7 @@ end local SliderBar = {} SliderBar.__index = SliderBar -function SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) +function SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1033,10 +922,9 @@ function SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, object.minValue = minValue object.maxValue = maxValue object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1048,15 +936,8 @@ end function SliderBar:draw() local oldValue = self.value - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.value = RL.GuiSliderBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.value ~= oldValue then self._parentscrolling = true @@ -1077,7 +958,7 @@ end local ProgressBar = {} ProgressBar.__index = ProgressBar -function ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) +function ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1088,10 +969,9 @@ function ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue object.minValue = minValue object.maxValue = maxValue object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1103,15 +983,8 @@ end function ProgressBar:draw() local oldValue = self.value - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.value = RL.GuiProgressBar( self.bounds, self.textLeft, self.textRight, self.value, self.minValue, self.maxValue ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.value ~= oldValue then self.callback( self ) end @@ -1128,16 +1001,15 @@ end local StatusBar = {} StatusBar.__index = StatusBar -function StatusBar:new( bounds, text, texture, textureRect ) +function StatusBar:new( bounds, text ) local object = setmetatable( {}, self ) object._parent = nil object.bounds = bounds:clone() object.text = text - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1147,15 +1019,7 @@ function StatusBar:process() end function StatusBar:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - RL.GuiStatusBar( self.bounds, self.text ) - - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end end function StatusBar:setPosition( pos ) @@ -1169,16 +1033,15 @@ end local DummyRec = {} DummyRec.__index = DummyRec -function DummyRec:new( bounds, text, texture, textureRect ) +function DummyRec:new( bounds, text ) local object = setmetatable( {}, self ) object._parent = nil object.bounds = bounds:clone() object.text = text - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1188,15 +1051,7 @@ function DummyRec:process() end function DummyRec:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - RL.GuiDummyRec( self.bounds, self.text ) - - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end end function DummyRec:setPosition( pos ) @@ -1222,6 +1077,7 @@ function Grid:new( bounds, text, spacing, subdivs, callback ) object.mouseCell = Vec2:new() object.visible = true + object.disabled = false return object end @@ -1257,7 +1113,7 @@ end local ListView = {} ListView.__index = ListView -function ListView:new( bounds, text, scrollIndex, active, callback, texture, textureRect ) +function ListView:new( bounds, text, scrollIndex, active, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1266,10 +1122,9 @@ function ListView:new( bounds, text, scrollIndex, active, callback, texture, tex object.scrollIndex = scrollIndex object.active = active object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1286,15 +1141,8 @@ function ListView:draw() local oldActive = self.active local oldScrollIndex = self.scrollIndex - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.scrollIndex, self.active = RL.GuiListView( self.bounds, self.text, self.scrollIndex, self.active ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.scrollIndex ~= oldScrollIndex then self._parentscrolling = true end @@ -1314,7 +1162,7 @@ end local ListViewEx = {} ListViewEx.__index = ListViewEx -function ListViewEx:new( bounds, text, scrollIndex, active, focus, callback, texture, textureRect ) +function ListViewEx:new( bounds, text, scrollIndex, active, focus, callback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1324,10 +1172,9 @@ function ListViewEx:new( bounds, text, scrollIndex, active, focus, callback, tex object.active = active object.focus = focus object.callback = callback - object.texture = texture - object.textureRect = textureRect object.visible = true + object.disabled = false return object end @@ -1344,15 +1191,8 @@ function ListViewEx:draw() local oldActive = self.active local oldScrollIndex = self.scrollIndex - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - _, self.scrollIndex, self.active, self.focus = RL.GuiListViewEx( self.bounds, self.text, self.scrollIndex, self.active, self.focus ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if self.scrollIndex ~= oldScrollIndex then self._parentscrolling = true end @@ -1372,7 +1212,7 @@ end local MessageBox = {} MessageBox.__index = MessageBox -function MessageBox:new( bounds, title, message, buttons, callback, grabCallback, dragCallback, texture, textureRect ) +function MessageBox:new( bounds, title, message, buttons, callback, grabCallback, dragCallback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1383,11 +1223,10 @@ function MessageBox:new( bounds, title, message, buttons, callback, grabCallback object.callback = callback object.grabCallback = grabCallback object.dragCallback = dragCallback - object.texture = texture - object.textureRect = textureRect object.buttonIndex = -1 object.visible = true + object.disabled = false object.draggable = true return object @@ -1402,15 +1241,8 @@ function MessageBox:process() end function MessageBox:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - self.buttonIndex = RL.GuiMessageBox( self.bounds, self.title, self.message, self.buttons ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if 0 <= self.buttonIndex and self.callback ~= nil then self.callback( self ) end @@ -1427,7 +1259,7 @@ end local TextInputBox = {} TextInputBox.__index = TextInputBox -function TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback, texture, textureRect ) +function TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback ) local object = setmetatable( {}, self ) object._parent = nil @@ -1441,11 +1273,10 @@ function TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, s object.callback = callback object.grabCallback = grabCallback object.dragCallback = dragCallback - object.texture = texture - object.textureRect = textureRect object.buttonIndex = -1 object.visible = true + object.disabled = false object.draggable = true return object @@ -1460,15 +1291,8 @@ function TextInputBox:process() end function TextInputBox:draw() - if self.texture ~= nil then - RL.SetShapesTexture( self.texture, self.textureRect ) - end - self.buttonIndex, self.text, self.secretViewActive = RL.GuiTextInputBox( self.bounds, self.title, self.message, self.buttons, self.text, self.textMaxSize, self.secretViewActive ) - if self.texture ~= nil then - RL.SetShapesTexture( self._parent.defaultTexture, self._parent.defaultRect ) - end if 0 <= self.buttonIndex and self.callback ~= nil then self.callback( self ) end @@ -1495,6 +1319,7 @@ function ColorPicker:new( bounds, text, color, callback ) object.callback = callback object.visible = true + object.disabled = false object.focusBounds = Rect:new() object:updateFocusBounds() @@ -1553,6 +1378,7 @@ function ColorPanel:new( bounds, text, color, callback ) object.callback = callback object.visible = true + object.disabled = false return object end @@ -1593,6 +1419,7 @@ function ColorBarAlpha:new( bounds, text, alpha, callback ) object.callback = callback object.visible = true + object.disabled = false return object end @@ -1635,6 +1462,7 @@ function ColorBarHue:new( bounds, text, value, callback ) object.callback = callback object.visible = true + object.disabled = false return object end @@ -1682,6 +1510,9 @@ function Raygui:new() object.defaultTexture = RL.GetTextureDefault() object.defaultRect = Rect:new( 0, 0, 1, 1 ) + object._lastDisabled = false -- Last element disabled state in draw. + object._lastStyles = {} + return object end @@ -1716,7 +1547,7 @@ function Raygui:drag( element ) local mousePos = Vec2:new( RL.GetMousePosition() ) local mouseOver = RL.CheckCollisionPointRec( mousePos, element.bounds ) - if element.draggable and element ~= self.dragging and RL.IsMouseButtonPressed( RL.MOUSE_BUTTON_LEFT ) + if not element.disabled and element.draggable and element ~= self.dragging and RL.IsMouseButtonPressed( RL.MOUSE_BUTTON_LEFT ) and mouseOver and mousePos.y - element.bounds.y <= self.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT then self.grabPos = mousePos - Vec2:new( element.bounds.x, element.bounds.y ) @@ -1741,6 +1572,19 @@ function Raygui:drag( element ) return mouseOver end +-- Add style before current draw that we can then return them. +function Raygui:_addLastStyle( style ) + local lastStyle = { style[1], style[2], RL.GuiGetStyle( style[1], style[2] ) } + + for i, slot in ipairs( self._lastStyles ) do + if slot == 0 then + self._lastStyles[i] = lastStyle + return + end + end + table.insert( self._lastStyles, lastStyle ) +end + function Raygui:draw() if self.locked then RL.GuiLock() @@ -1761,7 +1605,38 @@ function Raygui:draw() end if element.visible and element.draw ~= nil then - element:draw() + if self._lastDisabled ~= element.disabled then + if element.disabled then + RL.GuiDisable() + else + RL.GuiEnable() + end + self._lastDisabled = element.disabled + end + if element.styles ~= nil then + for _, style in ipairs( element.styles ) do + self:_addLastStyle( style ) + RL.GuiSetStyle( style[1], style[2], style[3] ) + end + end + if element.texture ~= nil then + RL.SetShapesTexture( element.texture, element.textureRect ) + end + + element:draw() + + if element.texture ~= nil then + RL.SetShapesTexture( self.defaultTexture, self.defaultRect ) + end + -- Set previous styles back. + if 0 < #self._lastStyles then + for j, style in ipairs( self._lastStyles ) do + if type( style ) == "table" then + RL.GuiSetStyle( style[1], style[2], style[3] ) + end + self._lastStyles[j] = 0 + end + end end end RL.GuiUnlock() @@ -1824,18 +1699,15 @@ end ---@alias Rectangle table ---@alias Vector2 table ---@alias Color table ----@alias Texture userdata ---@param bounds Rectangle ---@param text string ---@param callback function|nil ---@param grabCallback function|nil ---@param dragCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table WindowBox -function Raygui:WindowBox( bounds, text, callback, grabCallback, dragCallback, texture, textureRect ) - return self:addElement( WindowBox:new( bounds, text, callback, grabCallback, dragCallback, texture, textureRect ) ) +function Raygui:WindowBox( bounds, text, callback, grabCallback, dragCallback ) + return self:addElement( WindowBox:new( bounds, text, callback, grabCallback, dragCallback ) ) end ---@param bounds Rectangle @@ -1856,11 +1728,9 @@ end ---@param text string ---@param grabCallback function|nil ---@param dragCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table Panel -function Raygui:Panel( bounds, text, grabCallback, dragCallback, texture, textureRect ) - return self:addElement( Panel:new( bounds, text, grabCallback, dragCallback, texture, textureRect ) ) +function Raygui:Panel( bounds, text, grabCallback, dragCallback ) + return self:addElement( Panel:new( bounds, text, grabCallback, dragCallback ) ) end ---@param bounds Rectangle @@ -1868,11 +1738,9 @@ end ---@param active boolean ---@param callback function|nil ---@param closeCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table GuiTabBar -function Raygui:GuiTabBar( bounds, text, active, callback, closeCallback, texture, textureRect ) - return self:addElement( GuiTabBar:new( bounds, text, active, callback, closeCallback, texture, textureRect ) ) +function Raygui:GuiTabBar( bounds, text, active, callback, closeCallback ) + return self:addElement( GuiTabBar:new( bounds, text, active, callback, closeCallback ) ) end ---@param bounds Rectangle @@ -1882,11 +1750,9 @@ end ---@param callback function|nil ---@param grabCallback function|nil ---@param dragCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ScrollPanel -function Raygui:ScrollPanel( bounds, text, content, scroll, callback, grabCallback, dragCallback, texture, textureRect ) - return self:addElement( ScrollPanel:new( bounds, text, content, scroll, callback, grabCallback, dragCallback, texture, textureRect ) ) +function Raygui:ScrollPanel( bounds, text, content, scroll, callback, grabCallback, dragCallback ) + return self:addElement( ScrollPanel:new( bounds, text, content, scroll, callback, grabCallback, dragCallback ) ) end ---@param bounds Rectangle @@ -1899,11 +1765,9 @@ end ---@param bounds Rectangle ---@param text string ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table Button -function Raygui:Button( bounds, text, callback, texture, textureRect ) - return self:addElement( Button:new( bounds, text, callback, texture, textureRect ) ) +function Raygui:Button( bounds, text, callback ) + return self:addElement( Button:new( bounds, text, callback ) ) end ---@param bounds Rectangle @@ -1918,44 +1782,36 @@ end ---@param text string ---@param active boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table Toggle -function Raygui:Toggle( bounds, text, active, callback, texture, textureRect ) - return self:addElement( Toggle:new( bounds, text, active, callback, texture, textureRect ) ) +function Raygui:Toggle( bounds, text, active, callback ) + return self:addElement( Toggle:new( bounds, text, active, callback ) ) end ---@param bounds Rectangle ---@param text string ----@param active boolean +---@param active integer ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ToggleGroup -function Raygui:ToggleGroup( bounds, text, active, callback, texture, textureRect ) - return self:addElement( ToggleGroup:new( bounds, text, active, callback, texture, textureRect ) ) +function Raygui:ToggleGroup( bounds, text, active, callback ) + return self:addElement( ToggleGroup:new( bounds, text, active, callback ) ) end ---@param bounds Rectangle ---@param text string ---@param checked boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table CheckBox -function Raygui:CheckBox( bounds, text, checked, callback, texture, textureRect ) - return self:addElement( CheckBox:new( bounds, text, checked, callback, texture, textureRect ) ) +function Raygui:CheckBox( bounds, text, checked, callback ) + return self:addElement( CheckBox:new( bounds, text, checked, callback ) ) end ---@param bounds Rectangle ---@param text string ---@param active integer ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ComboBox -function Raygui:ComboBox( bounds, text, active, callback, texture, textureRect ) - return self:addElement( ComboBox:new( bounds, text, active, callback, texture, textureRect ) ) +function Raygui:ComboBox( bounds, text, active, callback ) + return self:addElement( ComboBox:new( bounds, text, active, callback ) ) end ---@param bounds Rectangle @@ -1963,11 +1819,9 @@ end ---@param active integer ---@param editMode boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table DropdownBox -function Raygui:DropdownBox( bounds, text, active, editMode, callback, texture, textureRect ) - return self:addElement( DropdownBox:new( bounds, text, active, editMode, callback, texture, textureRect ) ) +function Raygui:DropdownBox( bounds, text, active, editMode, callback ) + return self:addElement( DropdownBox:new( bounds, text, active, editMode, callback ) ) end ---@param bounds Rectangle @@ -1977,11 +1831,9 @@ end ---@param maxValue integer ---@param editMode boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table Spinner -function Raygui:Spinner( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) - return self:addElement( Spinner:new( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) ) +function Raygui:Spinner( bounds, text, value, minValue, maxValue, editMode, callback ) + return self:addElement( Spinner:new( bounds, text, value, minValue, maxValue, editMode, callback ) ) end ---@param bounds Rectangle @@ -1991,11 +1843,9 @@ end ---@param maxValue integer ---@param editMode boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ValueBox -function Raygui:ValueBox( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) - return self:addElement( ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callback, texture, textureRect ) ) +function Raygui:ValueBox( bounds, text, value, minValue, maxValue, editMode, callback ) + return self:addElement( ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callback ) ) end ---@param bounds Rectangle @@ -2003,11 +1853,9 @@ end ---@param textSize integer ---@param editMode boolean ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table TextBox -function Raygui:TextBox( bounds, text, textSize, editMode, callback, texture, textureRect ) - return self:addElement( TextBox:new( bounds, text, textSize, editMode, callback, texture, textureRect ) ) +function Raygui:TextBox( bounds, text, textSize, editMode, callback ) + return self:addElement( TextBox:new( bounds, text, textSize, editMode, callback ) ) end ---@param bounds Rectangle @@ -2017,11 +1865,9 @@ end ---@param minValue number ---@param maxValue number ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table Slider -function Raygui:Slider( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) - return self:addElement( Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) ) +function Raygui:Slider( bounds, textLeft, textRight, value, minValue, maxValue, callback ) + return self:addElement( Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) ) end ---@param bounds Rectangle @@ -2031,11 +1877,9 @@ end ---@param minValue number ---@param maxValue number ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table SliderBar -function Raygui:SliderBar( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) - return self:addElement( SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) ) +function Raygui:SliderBar( bounds, textLeft, textRight, value, minValue, maxValue, callback ) + return self:addElement( SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) ) end ---@param bounds Rectangle @@ -2045,29 +1889,23 @@ end ---@param minValue number ---@param maxValue number ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ProgressBar -function Raygui:ProgressBar( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) - return self:addElement( ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback, texture, textureRect ) ) +function Raygui:ProgressBar( bounds, textLeft, textRight, value, minValue, maxValue, callback ) + return self:addElement( ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callback ) ) end ---@param bounds Rectangle ---@param text string ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table StatusBar -function Raygui:StatusBar( bounds, text, texture, textureRect ) - return self:addElement( StatusBar:new( bounds, text, texture, textureRect ) ) +function Raygui:StatusBar( bounds, text ) + return self:addElement( StatusBar:new( bounds, text ) ) end ---@param bounds Rectangle ---@param text string ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table DummyRec -function Raygui:DummyRec( bounds, text, texture, textureRect ) - return self:addElement( DummyRec:new( bounds, text, texture, textureRect ) ) +function Raygui:DummyRec( bounds, text ) + return self:addElement( DummyRec:new( bounds, text ) ) end ---@param bounds Rectangle @@ -2085,11 +1923,9 @@ end ---@param scrollIndex integer ---@param active integer ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ListView -function Raygui:ListView( bounds, text, scrollIndex, active, callback, texture, textureRect ) - return self:addElement( ListView:new( bounds, text, scrollIndex, active, callback, texture, textureRect ) ) +function Raygui:ListView( bounds, text, scrollIndex, active, callback ) + return self:addElement( ListView:new( bounds, text, scrollIndex, active, callback ) ) end ---@param bounds Rectangle @@ -2098,11 +1934,9 @@ end ---@param active integer ---@param focus integer ---@param callback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table ListViewEx -function Raygui:ListViewEx( bounds, text, scrollIndex, active, focus, callback, texture, textureRect ) - return self:addElement( ListViewEx:new( bounds, text, scrollIndex, active, focus, callback, texture, textureRect ) ) +function Raygui:ListViewEx( bounds, text, scrollIndex, active, focus, callback ) + return self:addElement( ListViewEx:new( bounds, text, scrollIndex, active, focus, callback ) ) end ---@param bounds Rectangle @@ -2112,11 +1946,9 @@ end ---@param callback function|nil ---@param grabCallback function|nil ---@param dragCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table MessageBox -function Raygui:MessageBox( bounds, title, message, buttons, callback, grabCallback, dragCallback, texture, textureRect ) - return self:addElement( MessageBox:new( bounds, title, message, buttons, callback, grabCallback, dragCallback, texture, textureRect ) ) +function Raygui:MessageBox( bounds, title, message, buttons, callback, grabCallback, dragCallback ) + return self:addElement( MessageBox:new( bounds, title, message, buttons, callback, grabCallback, dragCallback ) ) end ---@param bounds Rectangle @@ -2129,11 +1961,9 @@ end ---@param callback function|nil ---@param grabCallback function|nil ---@param dragCallback function|nil ----@param texture Texture|nil ----@param textureRect Rectangle|nil ---@return table TextInputBox -function Raygui:TextInputBox( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback, texture, textureRect ) - return self:addElement( TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback, texture, textureRect ) ) +function Raygui:TextInputBox( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback ) + return self:addElement( TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callback, grabCallback, dragCallback ) ) end ---@param bounds Rectangle -- cgit v1.2.3