diff options
| author | jussi | 2024-03-29 20:51:43 +0200 |
|---|---|---|
| committer | jussi | 2024-03-29 20:51:43 +0200 |
| commit | b96960a1f97f815a6872fedc422ea950ed477cda (patch) | |
| tree | 5dd7cc471be60806744b9869358e43cf507202fe /examples | |
| parent | 523351609a36ceb48581aa8edab160037a634ea8 (diff) | |
| download | reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.gz reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.bz2 reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.zip | |
Raygui lib examples file browser.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/pong/main.lua | 8 | ||||
| -rw-r--r-- | examples/raygui_examples/calculator.lua | 2 | ||||
| -rw-r--r-- | examples/raygui_examples/file_browser.lua | 380 | ||||
| -rw-r--r-- | examples/raygui_examples/main.lua | 30 | ||||
| -rw-r--r-- | examples/raygui_extensions/property_list.lua | 5 | ||||
| -rw-r--r-- | examples/raygui_extensions/tree_view.lua | 15 | ||||
| -rw-r--r-- | examples/resources/lib/raygui.lua | 73 |
7 files changed, 480 insertions, 33 deletions
diff --git a/examples/pong/main.lua b/examples/pong/main.lua index f898ce3..f0867a6 100644 --- a/examples/pong/main.lua +++ b/examples/pong/main.lua @@ -1,5 +1,3 @@ --- Pong example using Vector2 library. - package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua" Vec2 = require "vector2" @@ -9,8 +7,8 @@ local winSize = Vec2:new( 800, 600 ) local monitor = 0 -- Constants. -local PLAYER_SPEED = 300 -local BALL_SPEED = 330 +local PLAYER_SPEED = 300 -- Pixels per second. +local BALL_SPEED = 330 -- Pixels per second. -- Game objects. local playerLeft = { @@ -42,7 +40,7 @@ local function reset() -- Short for if math random result 1, set BALL_SPEED otherwise set -BALL_SPEED. -- Could be replaced by normal if statement for easier readability. ball.vel.x = math.random( 0, 1 ) == 1 and BALL_SPEED or -BALL_SPEED - -- Start slow. + -- Start easy. ball.vel.y = 0 end diff --git a/examples/raygui_examples/calculator.lua b/examples/raygui_examples/calculator.lua index 1915c41..78253c0 100644 --- a/examples/raygui_examples/calculator.lua +++ b/examples/raygui_examples/calculator.lua @@ -19,7 +19,7 @@ function Calculator:new( pos ) { -- Callbacks. close = function() object:setVisible( false ) end, grab = function() object:set2Top() end, - drag = function( self ) object:setPosition( Vec2:new( self.bounds.x, self.bounds.y ) ) end + drag = function( this ) object:setPosition( Vec2:new( this.bounds.x, this.bounds.y ) ) end } ) object.display = Gui:Label( diff --git a/examples/raygui_examples/file_browser.lua b/examples/raygui_examples/file_browser.lua new file mode 100644 index 0000000..cdecfb0 --- /dev/null +++ b/examples/raygui_examples/file_browser.lua @@ -0,0 +1,380 @@ +local FileBrowser = {} +FileBrowser.__index = FileBrowser + +FileBrowser.MODES = { + OPEN = 1, + SAVE = 2, +} +FileBrowser.FILE_ICONS = { + DIR = 1, + FILE = 10, + [".wav"] = 11, + [".mp3"] = 11, + [".ogg"] = 11, + [".mid"] = 11, + [".png"] = 12, + [".jpg"] = 12, + [".jpeg"] = 12, + [".avi"] = 13, + [".mov"] = 13, + [".mp4"] = 13, + [".exe"] = 142, +} + +function FileBrowser:new( pos ) + local object = setmetatable( {}, FileBrowser ) + + object.padding = 4 + object.spacing = 4 + object.controls = {} + object.callbacks = {} -- open. + + local winSize = Vec2:new( 600, 490 ) + local iconButtonSize = Vec2:new( 28, 28 ) + local textButtonSize = Vec2:new( 72, 28 ) + + -- Window. + object.window = Gui:WindowBox( + Rect:new( pos.x, pos.y, winSize.x, winSize.y ), + "File Browser", + { -- callbacks. + close = function() object:setVisible( false ) end, + grab = function() object:set2Top() end, + drag = function( this ) object:setPosition( Vec2:new( this.bounds.x, this.bounds.y ) ) end + } + ) + + -- Ok button. + object.okButton = Gui:Button( + Rect:new( 0, 0, textButtonSize.x, textButtonSize.y ), + "Open", + { -- callbacks. + pressed = function() object:ok() end + } + ) + object.okButton.position = Vec2:new( + winSize.x - textButtonSize.x - object.padding, + winSize.y - textButtonSize.y - object.padding + ) + + -- Filter dropdown. + object.filterDropdown = Gui:DropdownBox( + Rect:new( 0, 0, textButtonSize.x, textButtonSize.y ), + "All\n.png\n.lua\n.wav\n.ogg\n.txt", + 0, -- active. + false, -- editMode. + { -- callbacks. + select = function() object:setFilter() end + }, + { -- styles. + properties = { + { RL.DROPDOWNBOX, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT }, + { RL.DROPDOWNBOX, RL.TEXT_PADDING, 8 }, + } + } + ) + object.filterDropdown.position = Vec2:new( + winSize.x - textButtonSize.x * 2 - object.padding * 2, + winSize.y - textButtonSize.y - object.padding + ) + + -- Back button. + object.backButton = Gui:Button( + Rect:new( 0, 0, iconButtonSize.x, iconButtonSize.y ), + RL.GuiIconText( 118, "" ), + { -- callbacks. + pressed = function() object:back() end + } + ) + object.backButton.position = Vec2:new( + winSize.x - iconButtonSize.x - object.padding, + Gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + object.padding + ) + + -- Search button. + object.searchToggle = Gui:Toggle( + Rect:new( 0, 0, iconButtonSize.x, iconButtonSize.y ), + RL.GuiIconText( 42, "" ), + false, -- active. + { -- callbacks. + pressed = function( this ) object:searchPressed( this.active ) end + } + ) + object.searchToggle.position = Vec2:new( + winSize.x - iconButtonSize.x * 2 - object.padding * 2, + Gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + object.padding + ) + + -- Path text box. + object.pathBox = Gui:TextBox( + Rect:new( 0, 0, winSize.x - iconButtonSize.x * 2 - object.padding * 4, iconButtonSize.y ), + "", + 256, + false, + { -- callbacks. + -- edit = function() object:editPathCallback() end, + textEdit = function() object:editPathCallback() end + } + ) + object.pathBox.position = Vec2:new( + object.padding, + Gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT + object.padding + ) + + -- File text box. + object.fileBox = Gui:TextBox( + Rect:new( 0, 0, winSize.x - textButtonSize.x * 2 - object.padding * 4, iconButtonSize.y ), + "", + 256, + false, + { -- callbacks. + -- edit = function() object:checkPath() end + } + ) + object.fileBox.position = Vec2:new( + object.padding, + winSize.y - object.okButton.bounds.height - object.padding + ) + + -- File List. + object.list = Gui:ListView( + Rect:new( 0, 0, + winSize.x - object.padding * 2, + winSize.y - Gui.RAYGUI_WINDOWBOX_STATUSBAR_HEIGHT - textButtonSize.y + - object.pathBox.bounds.height - object.padding * 3 - object.spacing + ), + "", + 0, -- scrollIndex. + 0, -- active. + { -- callbacks. + select = function() object:select() end + }, + { -- styles + properties = { + { RL.LISTVIEW, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT } + } + } + ) + object.list.position = Vec2:new( + object.padding, + object.pathBox.position.y + object.pathBox.bounds.height + object.padding + ) + + table.insert( object.controls, object.okButton ) + table.insert( object.controls, object.filterDropdown ) + table.insert( object.controls, object.backButton ) + table.insert( object.controls, object.searchToggle ) + table.insert( object.controls, object.list ) + table.insert( object.controls, object.pathBox ) + table.insert( object.controls, object.fileBox ) + + object.filter = nil + object.path = "" + object.file = "" + object.searchText = "" + object.files = {} + object.lastActive = 0 + object.mode = self.MODES.OPEN + + object:setPosition( pos ) + object:setVisible( false ) + + return object +end + +function FileBrowser:popup( mode, path, callback ) + self:setPath( path ) + self.mode = mode + + if self.mode == self.MODES.OPEN then + self.okButton.text = "Open" + self.callbacks.ok = callback + end + + self:setVisible( true ) +end + +function FileBrowser:editPathCallback() + if self.searchToggle.active then + self.searchText = self.pathBox.text + self:updateList() + else + self:checkPath() + end +end + +function FileBrowser:checkPath() + local path = self.pathBox.text + + self.searchToggle.active = false + self.searchText = "" + + if RL.FileExists( path ) and not RL.IsPathFile( path ) then + self:setPath( path ) + end +end + +function FileBrowser:back() + if self.searchToggle.active then + return + end + + for i = #self.pathBox.text, 1, -1 do + if self.pathBox.text:sub( i, i ) == "/" and i < #self.pathBox.text then + self.pathBox.text = self.pathBox.text:sub( 1, math.max( 1, i - 1 ) ) + self:checkPath() + + return + end + end +end + +function FileBrowser:setPath( path ) + if path:sub( 1, 2 ) == "//" then + path = path:sub( 2 ) + end + + self.lastActive = 0 + self.list.active = -1 + self.pathBox.text = path + self.path = path + + self:updateList() +end + +function FileBrowser:updateList() + self.list.text = "" + self.files = {} + local files = RL.LoadDirectoryFilesEx( self.path, self.filter, false ) + + table.sort( files, function( a, b ) return a < b end ) + + for i = #files, 1, -1 do + local filePath = files[i] + + -- Don't add unix hidden files. + if RL.GetFileName( filePath ):sub( 1, 1 ) ~= "." then + local record = { + path = filePath, + name = RL.GetFileName( filePath ), + isFile = RL.IsPathFile( filePath ), + sortValue = i + } + if record.isFile then + record.sortValue = record.sortValue + #files + end + + -- Search. + if self.searchText == "" or ( 0 < #self.searchText + and self.searchText:lower() == record.name:sub( 1, #self.searchText ):lower() ) then + table.insert( self.files, record ) + end + end + end + + table.sort( self.files, function( a, b ) return a.sortValue < b.sortValue end ) + + for i, file in ipairs( self.files ) do + local icon = self.FILE_ICONS.DIR + + if file.isFile then + local ext = RL.GetFileExtension( file.name ) + + if self.FILE_ICONS[ ext ] ~= nil then + icon = self.FILE_ICONS[ ext ] + else + icon = self.FILE_ICONS.FILE + end + end + + self.list.text = self.list.text..RL.GuiIconText( icon, file.name ) + + if i < #self.files then + self.list.text = self.list.text.."\n" + end + end +end + +function FileBrowser:select() + local index = self.list.active + 1 + local lastFile = self.files[ self.lastActive ] + + if 0 < index then + self.file = self.files[ index ].path + self.fileBox.text = self.files[ index ].name + elseif lastFile ~= nil then + -- Trigger if active pressed again, so index would be 0. + if index == 0 then + if RL.IsPathFile( lastFile.path ) then + self:ok() + else + self.pathBox.text = lastFile.path + self:checkPath() + end + end + end + + self.lastActive = index +end + +function FileBrowser:ok() + if self.mode == self.MODES.OPEN then + if RL.IsPathFile( self.file ) then + if self.callbacks.ok ~= nil then + self.callbacks.ok( self.file ) + end + else + self.pathBox.text = self.file + self:checkPath() + end + end +end + +function FileBrowser:searchPressed( active ) + if active then + self.pathBox.text = self.searchText + self.pathBox.active = true + Gui:editMode( self.pathBox ) -- Would not call edit callback if had one. + self.pathBox.editMode = true + else + self.searchText = "" + self.pathBox.text = self.path + self:checkPath() + end +end + +function FileBrowser:setFilter() + if self.filterDropdown.active == 0 then + self.filter = nil + else + self.filter = self.filterDropdown:getItem( self.filterDropdown.active ) + end + + self:updateList() + print( "self.filter", self.filter ) +end + +function FileBrowser:setPosition( pos ) + for _, control in ipairs( self.controls ) do + control:setPosition( pos + control.position ) + end +end + +function FileBrowser:set2Top() + Gui:set2Top( self.window ) + + for _, control in ipairs( self.controls ) do + Gui:set2Top( control ) + end +end + +function FileBrowser:setVisible( visible ) + self.visible = visible + self.window.visible = visible + + for _, control in ipairs( self.controls ) do + control.visible = visible + end +end + +return FileBrowser diff --git a/examples/raygui_examples/main.lua b/examples/raygui_examples/main.lua index 7670319..2fcf4c5 100644 --- a/examples/raygui_examples/main.lua +++ b/examples/raygui_examples/main.lua @@ -1,18 +1,28 @@ package.path = package.path..";"..RL.GetBasePath().."?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua" - Util = require( "utillib" ) Rect = require( "rectangle" ) Vec2 = require( "vector2" ) Color = require( "color" ) Raygui = require( "raygui" ) Calculator = require( "calculator" ) +FileBrowser = require( "file_browser" ) Gui = Raygui:new() +local showAllButton = nil local calculator = nil -local calculator2 = nil +local fileBrowser = nil + +local function loadFile( path ) + print( "Load file: "..path ) +end + +local function showAll() + calculator:setVisible( true ) + fileBrowser:setVisible( true ) +end function RL.init() local monitor = 0 @@ -29,8 +39,22 @@ function RL.init() RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 ) RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SPACING, 4 ) + RL.GuiLoadStyle( RL.GetBasePath().."../resources/styles/style_dark.rgs" ) + + showAllButton = Gui:Button( + Rect:new( 0, 0, 108, 28 ), + "Show All", + { -- callbacks. + pressed = function() showAll() end + } + ) + calculator = Calculator:new( Vec2:new( 32, 32 ) ) - calculator2 = Calculator:new( Vec2:new( 64, 65 ) ) + fileBrowser = FileBrowser:new( + Vec2:new( 250, 100 ) + ) + + fileBrowser:popup( fileBrowser.MODES.OPEN, RL.GetBasePath(), loadFile ) end function RL.update( delta ) diff --git a/examples/raygui_extensions/property_list.lua b/examples/raygui_extensions/property_list.lua index 6d218e6..d379d72 100644 --- a/examples/raygui_extensions/property_list.lua +++ b/examples/raygui_extensions/property_list.lua @@ -27,6 +27,7 @@ function PropertyList:new( bounds, text, callbacks, styles, tooltip ) object.visible = true object.disabled = false object.draggable = true + object.defaultControlHeight = 22 object.mouseScale = 1 -- Set this if drawing in different size to render texture for example. object:setSize( Vec2:new( object.bounds.width, object.bounds.height ) ) @@ -143,7 +144,7 @@ function PropertyList:addGroup( name, active, group ) }, { -- Styles. properties = { - { RL.TOGGLE, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT } + { RL.TOGGLE, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT }, } } ) @@ -233,7 +234,7 @@ function PropertyList:setSize( size ) self.bounds.width - scrollBarWidth - self.padding * 2 - borderWidth * 2, self.bounds.height - scrollBarWidth - self.padding * 2 - borderWidth * 2 ) - self.defaultControlSize = Vec2:new( self.content.width, 22 ) + self.defaultControlSize = Vec2:new( self.content.width, self.defaultControlHeight ) local _, _, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) self.view = Rect:new( view ) diff --git a/examples/raygui_extensions/tree_view.lua b/examples/raygui_extensions/tree_view.lua index dbccc0e..ac73d4a 100644 --- a/examples/raygui_extensions/tree_view.lua +++ b/examples/raygui_extensions/tree_view.lua @@ -39,8 +39,9 @@ function TreeView:new( bounds, text, callbacks, styles, tooltip ) object.draggable = true object.allowMove = true object.allowMultiselect = true - + object.defaultControlHeight = 22 object.mouseScale = 1 -- Set this if drawing in different size to render texture for example. + object.selectedItems = {} object:setSize( Vec2:new( object.bounds.width, object.bounds.height ) ) @@ -161,14 +162,12 @@ function TreeView:checkItem( controls, item, mode ) if 0 < #control.controls then self:checkItem( control.controls, item, mode ) end - if mode == self.RANGE_SELECT then - if self._idRange[1] <= control._id and control._id <= self._idRange[2] then - control.active = true - end + if mode == self.RANGE_SELECT and control.visible + and self._idRange[1] <= control._id and control._id <= self._idRange[2] then + control.active = true end if control.active then table.insert( self.selectedItems, control ) - -- table.insert( self.selectedItems, 1, control ) end end end @@ -245,7 +244,7 @@ function TreeView:itemSelect( item ) -- Item select. local mode = self.SINGLE_SELECT - + if self.allowMultiselect then if RL.IsKeyDown( RL.KEY_LEFT_CONTROL ) or RL.IsKeyDown( RL.KEY_RIGHT_CONTROL ) then mode = self.MULTI_SELECT @@ -384,7 +383,7 @@ function TreeView:setSize( size ) self.bounds.width - scrollBarWidth - self.padding * 2 - borderWidth * 2, self.bounds.height - scrollBarWidth - self.padding * 2 - borderWidth * 2 ) - self.defaultControlSize = Vec2:new( self.content.width, 22 ) + self.defaultControlSize = Vec2:new( self.content.width, self.defaultControlHeight ) local _, _, view = RL.GuiScrollPanel( self.bounds, self.text, self.content, self.scroll, self.view ) self.view = Rect:new( view ) diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua index c6c9d51..d4e515d 100644 --- a/examples/resources/lib/raygui.lua +++ b/examples/resources/lib/raygui.lua @@ -787,7 +787,7 @@ function Spinner:draw() self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y ) if result == 1 then - self._gui:editMode( self.editMode ) + self._gui:editMode( self ) self.editMode = not self.editMode end if self.value ~= oldValue then @@ -858,7 +858,7 @@ function ValueBox:draw() self._viewBoundsOffset:set( self.viewBounds.x - self.bounds.x, self.viewBounds.y - self.bounds.y ) if result == 1 then - self._gui:editMode( self.editMode ) + self._gui:editMode( self ) self.editMode = not self.editMode end if self.value ~= oldValue and self.callbacks.edit ~= nil then @@ -915,7 +915,7 @@ function TextBox:draw() RL.EndScissorMode() end if result == 1 then - self._gui:editMode( self.editMode ) + self._gui:editMode( self ) self.editMode = not self.editMode if not self.editMode and self.callbacks.edit ~= nil then @@ -1721,6 +1721,7 @@ function Raygui:new() object.grabPos = Vec2:new() object.scrolling = false object.textEdit = false + object.textEditControl = nil object.defaultTexture = RL.GetTextureDefault() object.defaultRect = Rect:new( 0, 0, 1, 1 ) -- For texture. object.defaultFont = RL.GuiGetFont() @@ -1874,6 +1875,13 @@ function Raygui:draw() self.scrolling = false end end + + local oldTextEditText = "" -- For checking if text has changed so we can call input callback. + + if self.textEdit then + oldTextEditText = self.textEditControl.text + end + -- Set mouse offset if gui is for example embedded to some control. RL.SetMouseOffset( self.mouseOffset ) @@ -1897,6 +1905,9 @@ function Raygui:draw() and self.tooltip.delay <= self.tooltip.timer then self:drawTooltip() end + if self.textEdit and oldTextEditText ~= self.textEditControl.text and self.textEditControl.callbacks.textEdit ~= nil then + self.textEditControl.callbacks.textEdit( self.textEditControl ) + end RL.GuiUnlock() RL.GuiEnable() @@ -1944,19 +1955,21 @@ function Raygui:remove( control ) end end -function Raygui:editMode( editMode ) - if not editMode then - for _, control in ipairs( self.controls ) do - if control.editMode then - control.editMode = false - - if control.callbacks.edit ~= nil then - control.callbacks.edit( control ) - end - end +function Raygui:editMode( control ) + if self.textEditControl ~= nil and not control.editMode then + self.textEditControl.editMode = false + + if self.textEditControl.callbacks.edit ~= nil then + self.textEditControl.callbacks.edit( self.textEditControl ) end end - self.textEdit = not editMode + self.textEdit = not control.editMode + + if self.textEdit then + self.textEditControl = control + else + self.textEditControl = nil + end end function Raygui:drawControl( control ) @@ -2016,6 +2029,7 @@ end ---@param text string ---@param callbacks table close, grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table WindowBox function Raygui:WindowBox( bounds, text, callbacks, styles, tooltip ) return self:addControl( WindowBox:new( bounds, text, callbacks, styles, tooltip ) ) @@ -2024,6 +2038,7 @@ end ---@param bounds Rectangle ---@param text string ---@param styles table|nil +---@param tooltip string|nil ---@return table GroupBox function Raygui:GroupBox( bounds, text, styles, tooltip ) return self:addControl( GroupBox:new( bounds, text, styles, tooltip ) ) @@ -2032,6 +2047,7 @@ end ---@param bounds Rectangle ---@param text string ---@param styles table|nil +---@param tooltip string|nil ---@return table Line function Raygui:Line( bounds, text, styles, tooltip ) return self:addControl( Line:new( bounds, text, styles, tooltip ) ) @@ -2041,6 +2057,7 @@ end ---@param text string ---@param callbacks table grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table Panel function Raygui:Panel( bounds, text, callbacks, styles, tooltip ) return self:addControl( Panel:new( bounds, text, callbacks, styles, tooltip ) ) @@ -2051,6 +2068,7 @@ end ---@param active integer ---@param callbacks table select, close, grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table GuiTabBar function Raygui:GuiTabBar( bounds, text, active, callbacks, styles, tooltip ) return self:addControl( GuiTabBar:new( bounds, text, active, callbacks, styles, tooltip ) ) @@ -2062,6 +2080,7 @@ end ---@param scroll Vector2 ---@param callbacks table scroll, grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table ScrollPanel function Raygui:ScrollPanel( bounds, text, content, scroll, callbacks, styles, tooltip ) return self:addControl( ScrollPanel:new( bounds, text, content, scroll, callbacks, styles, tooltip ) ) @@ -2070,6 +2089,7 @@ end ---@param bounds Rectangle ---@param text string ---@param styles table|nil +---@param tooltip string|nil ---@return table Label function Raygui:Label( bounds, text, styles, tooltip ) return self:addControl( Label:new( bounds, text, styles, tooltip ) ) @@ -2079,6 +2099,7 @@ end ---@param text string ---@param callbacks table pressed. ---@param styles table|nil +---@param tooltip string|nil ---@return table Button function Raygui:Button( bounds, text, callbacks, styles, tooltip ) return self:addControl( Button:new( bounds, text, callbacks, styles, tooltip ) ) @@ -2088,6 +2109,7 @@ end ---@param text string ---@param callbacks table pressed. ---@param styles table|nil +---@param tooltip string|nil ---@return table LabelButton function Raygui:LabelButton( bounds, text, callbacks, styles, tooltip ) return self:addControl( LabelButton:new( bounds, text, callbacks, styles, tooltip ) ) @@ -2098,6 +2120,7 @@ end ---@param active boolean ---@param callbacks table pressed. ---@param styles table|nil +---@param tooltip string|nil ---@return table Toggle function Raygui:Toggle( bounds, text, active, callbacks, styles, tooltip ) return self:addControl( Toggle:new( bounds, text, active, callbacks, styles, tooltip ) ) @@ -2108,6 +2131,7 @@ end ---@param active integer ---@param callbacks table select. ---@param styles table|nil +---@param tooltip string|nil ---@return table ToggleGroup function Raygui:ToggleGroup( bounds, text, active, callbacks, styles, tooltip ) return self:addControl( ToggleGroup:new( bounds, text, active, callbacks, styles, tooltip ) ) @@ -2118,6 +2142,7 @@ end ---@param checked boolean ---@param callbacks table pressed. ---@param styles table|nil +---@param tooltip string|nil ---@return table CheckBox function Raygui:CheckBox( bounds, text, checked, callbacks, styles, tooltip ) return self:addControl( CheckBox:new( bounds, text, checked, callbacks, styles, tooltip ) ) @@ -2128,6 +2153,7 @@ end ---@param active integer ---@param callbacks table select. ---@param styles table|nil +---@param tooltip string|nil ---@return table ComboBox function Raygui:ComboBox( bounds, text, active, callbacks, styles, tooltip ) return self:addControl( ComboBox:new( bounds, text, active, callbacks, styles, tooltip ) ) @@ -2139,6 +2165,7 @@ end ---@param editMode boolean ---@param callbacks table select. ---@param styles table|nil +---@param tooltip string|nil ---@return table DropdownBox function Raygui:DropdownBox( bounds, text, active, editMode, callbacks, styles, tooltip ) return self:addControl( DropdownBox:new( bounds, text, active, editMode, callbacks, styles, tooltip ) ) @@ -2152,6 +2179,7 @@ end ---@param editMode boolean ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table Spinner function Raygui:Spinner( bounds, text, value, minValue, maxValue, editMode, callbacks, styles, tooltip ) return self:addControl( Spinner:new( bounds, text, value, minValue, maxValue, editMode, callbacks, styles, tooltip ) ) @@ -2165,6 +2193,7 @@ end ---@param editMode boolean ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ValueBox function Raygui:ValueBox( bounds, text, value, minValue, maxValue, editMode, callbacks, styles, tooltip ) return self:addControl( ValueBox:new( bounds, text, value, minValue, maxValue, editMode, callbacks, styles, tooltip ) ) @@ -2176,6 +2205,7 @@ end ---@param editMode boolean ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table TextBox function Raygui:TextBox( bounds, text, textSize, editMode, callbacks, styles, tooltip ) return self:addControl( TextBox:new( bounds, text, textSize, editMode, callbacks, styles, tooltip ) ) @@ -2189,6 +2219,7 @@ end ---@param maxValue number ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table Slider function Raygui:Slider( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) return self:addControl( Slider:new( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) ) @@ -2202,6 +2233,7 @@ end ---@param maxValue number ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table SliderBar function Raygui:SliderBar( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) return self:addControl( SliderBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) ) @@ -2215,6 +2247,7 @@ end ---@param maxValue number ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ProgressBar function Raygui:ProgressBar( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) return self:addControl( ProgressBar:new( bounds, textLeft, textRight, value, minValue, maxValue, callbacks, styles, tooltip ) ) @@ -2223,6 +2256,7 @@ end ---@param bounds Rectangle ---@param text string ---@param styles table|nil +---@param tooltip string|nil ---@return table StatusBar function Raygui:StatusBar( bounds, text, styles, tooltip ) return self:addControl( StatusBar:new( bounds, text, styles, tooltip ) ) @@ -2231,6 +2265,7 @@ end ---@param bounds Rectangle ---@param text string ---@param styles table|nil +---@param tooltip string|nil ---@return table DummyRec function Raygui:DummyRec( bounds, text, styles, tooltip ) return self:addControl( DummyRec:new( bounds, text, styles, tooltip ) ) @@ -2242,6 +2277,7 @@ end ---@param subdivs integer ---@param callbacks table cellChange. ---@param styles table|nil +---@param tooltip string|nil ---@return table Grid function Raygui:Grid( bounds, text, spacing, subdivs, callbacks, styles, tooltip ) return self:addControl( Grid:new( bounds, text, spacing, subdivs, callbacks, styles, tooltip ) ) @@ -2253,6 +2289,7 @@ end ---@param active integer ---@param callbacks table select. ---@param styles table|nil +---@param tooltip string|nil ---@return table ListView function Raygui:ListView( bounds, text, scrollIndex, active, callbacks, styles, tooltip ) return self:addControl( ListView:new( bounds, text, scrollIndex, active, callbacks, styles, tooltip ) ) @@ -2265,6 +2302,7 @@ end ---@param focus integer ---@param callbacks table select. ---@param styles table|nil +---@param tooltip string|nil ---@return table ListViewEx function Raygui:ListViewEx( bounds, text, scrollIndex, active, focus, callbacks, styles, tooltip ) return self:addControl( ListViewEx:new( bounds, text, scrollIndex, active, focus, callbacks, styles, tooltip ) ) @@ -2276,6 +2314,7 @@ end ---@param buttons string ---@param callbacks table pressed, grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table MessageBox function Raygui:MessageBox( bounds, title, message, buttons, callbacks, styles, tooltip ) return self:addControl( MessageBox:new( bounds, title, message, buttons, callbacks, styles, tooltip ) ) @@ -2290,6 +2329,7 @@ end ---@param secretViewActive boolean ---@param callbacks table pressed, grab, drag. ---@param styles table|nil +---@param tooltip string|nil ---@return table TextInputBox function Raygui:TextInputBox( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callbacks, styles, tooltip ) return self:addControl( TextInputBox:new( bounds, title, message, buttons, text, textMaxSize, secretViewActive, callbacks, styles, tooltip ) ) @@ -2300,6 +2340,7 @@ end ---@param color Color ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ColorPicker function Raygui:ColorPicker( bounds, text, color, callbacks, styles, tooltip ) return self:addControl( ColorPicker:new( bounds, text, color, callbacks, styles, tooltip ) ) @@ -2310,6 +2351,7 @@ end ---@param color Color ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ColorPanel function Raygui:ColorPanel( bounds, text, color, callbacks, styles, tooltip ) return self:addControl( ColorPanel:new( bounds, text, color, callbacks, styles, tooltip ) ) @@ -2320,6 +2362,7 @@ end ---@param alpha number ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ColorBarAlpha function Raygui:ColorBarAlpha( bounds, text, alpha, callbacks, styles, tooltip ) return self:addControl( ColorBarAlpha:new( bounds, text, alpha, callbacks, styles, tooltip ) ) @@ -2330,6 +2373,7 @@ end ---@param value number ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ColorBarHue function Raygui:ColorBarHue( bounds, text, value, callbacks, styles, tooltip ) return self:addControl( ColorBarHue:new( bounds, text, value, callbacks, styles, tooltip ) ) @@ -2341,6 +2385,7 @@ end ---@param maxValue integer ---@param callbacks table edit. ---@param styles table|nil +---@param tooltip string|nil ---@return table ColorBarHue function Raygui:GuiScrollBar( bounds, value, minValue, maxValue, callbacks, styles, tooltip ) return self:addControl( GuiScrollBar:new( bounds, value, minValue, maxValue, callbacks, styles, tooltip ) ) |
