diff options
| author | jussi | 2024-06-26 22:28:13 +0300 |
|---|---|---|
| committer | jussi | 2024-06-26 22:28:13 +0300 |
| commit | e45564ea3f0f27c32264f98da80c6d3556256de0 (patch) | |
| tree | dd9fb36032fcd2aa791226c75826c9cec4a7c3ff /examples | |
| parent | c96306bcc3bc685297b8553d01d2eff163754afc (diff) | |
| download | reilua-enhanced-e45564ea3f0f27c32264f98da80c6d3556256de0.tar.gz reilua-enhanced-e45564ea3f0f27c32264f98da80c6d3556256de0.tar.bz2 reilua-enhanced-e45564ea3f0f27c32264f98da80c6d3556256de0.zip | |
Changed naming of gui functions set2Top and set2Back to setToTop and setToBack.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/ReiLuaGui_examples/calculator.lua | 14 | ||||
| -rw-r--r-- | examples/ReiLuaGui_examples/file_explorer.lua | 20 | ||||
| -rw-r--r-- | examples/gui/main.lua | 4 | ||||
| -rw-r--r-- | examples/raygui_examples/calculator.lua | 10 | ||||
| -rw-r--r-- | examples/raygui_examples/file_browser.lua | 8 | ||||
| -rw-r--r-- | examples/raygui_extensions/main.lua | 4 | ||||
| -rw-r--r-- | examples/raygui_extensions/property_list.lua | 2 | ||||
| -rw-r--r-- | examples/raygui_lib/main.lua | 10 | ||||
| -rw-r--r-- | examples/resources/lib/gui.lua | 32 | ||||
| -rw-r--r-- | examples/resources/lib/raygui.lua | 5 | ||||
| -rw-r--r-- | examples/textBoxed/main.lua | 10 |
11 files changed, 61 insertions, 58 deletions
diff --git a/examples/ReiLuaGui_examples/calculator.lua b/examples/ReiLuaGui_examples/calculator.lua index f6fcb7c..5bd2d7b 100644 --- a/examples/ReiLuaGui_examples/calculator.lua +++ b/examples/ReiLuaGui_examples/calculator.lua @@ -19,7 +19,7 @@ function Calculator:new( pos ) bounds = Rect:new( 0, 0, object.windowRect.width, object.HANDLE_HIGHT ), padding = 10, onClicked = function() - object:set2Top() + object:setToTop() object.dragPos = Vec2:newT( RL.GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y ) Gui.heldCallback = function() object:drag() end end, @@ -186,16 +186,16 @@ function Calculator:setVisible( visible ) end end -function Calculator:set2Top() - self.panel:set2Top() +function Calculator:setToTop() + self.panel:setToTop() for _, button in ipairs( self.buttons ) do - button:set2Top() + button:setToTop() end - self.handle:set2Top() - self.closeButton:set2Top() - self.display:set2Top() + self.handle:setToTop() + self.closeButton:setToTop() + self.display:setToTop() end function Calculator:addValue( value ) diff --git a/examples/ReiLuaGui_examples/file_explorer.lua b/examples/ReiLuaGui_examples/file_explorer.lua index 398adef..89fc173 100644 --- a/examples/ReiLuaGui_examples/file_explorer.lua +++ b/examples/ReiLuaGui_examples/file_explorer.lua @@ -19,7 +19,7 @@ function FileExplorer:new( pos ) bounds = Rect:new( 0, 0, object.windowRect.width, object.HANDLE_HIGHT ), padding = 10, onClicked = function() - object:set2Top() + object:setToTop() object.dragPos = Vec2:newT( RL.GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y ) Gui.heldCallback = function() object:drag() end end, @@ -305,15 +305,15 @@ function FileExplorer:setVisible( visible ) self.files:update() end -function FileExplorer:set2Top() - self.panel:set2Top() - self.handle:set2Top() - self.closeButton:set2Top() - self.pathBox:set2Top() - self.backButton:set2Top() - self.files:set2Top() - self.fileName:set2Top() - self.openButton:set2Top() +function FileExplorer:setToTop() + self.panel:setToTop() + self.handle:setToTop() + self.closeButton:setToTop() + self.pathBox:setToTop() + self.backButton:setToTop() + self.files:setToTop() + self.fileName:setToTop() + self.openButton:setToTop() end return FileExplorer diff --git a/examples/gui/main.lua b/examples/gui/main.lua index 5a178dc..06c98bc 100644 --- a/examples/gui/main.lua +++ b/examples/gui/main.lua @@ -21,6 +21,8 @@ local guiTabBarActive = 0 local colorPickerHSV = { 0, 0, 0 } local colorPanelHSV = { 0, 0, 0 } +local value = 0 + function RL.init() local monitor = 0 local mPos = RL.GetMonitorPosition( monitor ) @@ -121,4 +123,6 @@ function RL.draw() _, colorPickerHSV = RL.GuiColorPickerHSV( { 1024, 20, 150, 150 }, "GuiColorPuckerHSV", colorPickerHSV ) _, colorPanelHSV = RL.GuiColorPanelHSV( { 1230, 20, 150, 150 }, "GuiColorPuckerHSV", colorPanelHSV ) + + value = RL.GuiScrollBar( { 0, 0, 10, 200 }, value, 0, 100 ) end diff --git a/examples/raygui_examples/calculator.lua b/examples/raygui_examples/calculator.lua index 6274a0b..6faf11d 100644 --- a/examples/raygui_examples/calculator.lua +++ b/examples/raygui_examples/calculator.lua @@ -18,7 +18,7 @@ function Calculator:new( pos ) "Calculator", { -- Callbacks. close = function() object:setVisible( false ) end, - grab = function() object:set2Top() end, + grab = function() object:setToTop() end, drag = function( this ) object:setPosition( Vec2:new( this.bounds.x, this.bounds.y ) ) end } ) @@ -137,12 +137,12 @@ function Calculator:setPosition( pos ) end end -function Calculator:set2Top() - Gui:set2Top( self.window ) - Gui:set2Top( self.display ) +function Calculator:setToTop() + Gui:setToTop( self.window ) + Gui:setToTop( self.display ) for _, button in ipairs( self.buttons ) do - Gui:set2Top( button ) + Gui:setToTop( button ) end end diff --git a/examples/raygui_examples/file_browser.lua b/examples/raygui_examples/file_browser.lua index df6f244..e4705a6 100644 --- a/examples/raygui_examples/file_browser.lua +++ b/examples/raygui_examples/file_browser.lua @@ -39,7 +39,7 @@ function FileBrowser:new( pos ) "File Browser", { -- callbacks. close = function() object:setVisible( false ) end, - grab = function() object:set2Top() end, + grab = function() object:setToTop() end, drag = function( this ) object:setPosition( Vec2:new( this.bounds.x, this.bounds.y ) ) end } ) @@ -363,11 +363,11 @@ function FileBrowser:setPosition( pos ) end end -function FileBrowser:set2Top() - Gui:set2Top( self.window ) +function FileBrowser:setToTop() + Gui:setToTop( self.window ) for _, control in ipairs( self.controls ) do - Gui:set2Top( control ) + Gui:setToTop( control ) end end diff --git a/examples/raygui_extensions/main.lua b/examples/raygui_extensions/main.lua index a5d9760..3e9d2f1 100644 --- a/examples/raygui_extensions/main.lua +++ b/examples/raygui_extensions/main.lua @@ -75,7 +75,7 @@ local function addPropertyList() Rect:new( 20, 20, 256, 328 ), "Property List", { -- Callbacks. - grab = function( self ) Gui:set2Top( self ) end, + grab = function( self ) Gui:setToTop( self ) end, }, { -- Styles. properties = { @@ -272,7 +272,7 @@ local function addTreeView() "Tree View", { -- Callbacks. select = function( controls ) selected( controls ) end, - grab = function( self ) Gui:set2Top( self ) end, + grab = function( self ) Gui:setToTop( self ) end, }, { -- Styles. properties = { diff --git a/examples/raygui_extensions/property_list.lua b/examples/raygui_extensions/property_list.lua index 1a8c30f..266852e 100644 --- a/examples/raygui_extensions/property_list.lua +++ b/examples/raygui_extensions/property_list.lua @@ -87,7 +87,7 @@ function PropertyList:updateControl( control ) control.text = setGroupText( control.text:sub( 6 ), control.active ) -- Sub skips icon. end - self.gui:set2Back( control ) + self.gui:setToBack( control ) end function PropertyList:updateContent() diff --git a/examples/raygui_lib/main.lua b/examples/raygui_lib/main.lua index 95a733f..c787d2e 100644 --- a/examples/raygui_lib/main.lua +++ b/examples/raygui_lib/main.lua @@ -208,7 +208,7 @@ function RL.init() "WindowBox", { -- Callbacks. close = function( self ) self.visible = false end, - grab = function( self ) Gui:set2Top( self ) end, + grab = function( self ) Gui:setToTop( self ) end, }, { -- Styles. properties = { @@ -230,7 +230,7 @@ function RL.init() Rect:new( 400, 64, 256, 128 ), "Panel", { -- Callbacks. - grab = function( self ) Gui:set2Top( self ) end + grab = function( self ) Gui:setToTop( self ) end }, { -- Styles. properties = { @@ -255,7 +255,7 @@ function RL.init() Vec2:new( 0, 0 ), { -- Callbacks. scroll = function( self ) print( self.scroll ) end, - grab = function( self ) Gui:set2Top( self ) end + grab = function( self ) Gui:setToTop( self ) end } ) local listview = Gui:ListView( @@ -300,7 +300,7 @@ function RL.init() end end end, - grab = function( self ) Gui:set2Top( self ) end + grab = function( self ) Gui:setToTop( self ) end } ) local textinputbox = Gui:TextInputBox( @@ -317,7 +317,7 @@ function RL.init() print( "You pressed "..self:getItem( self.buttonIndex ) ) end end, - grab = function( self ) Gui:set2Top( self ) end + grab = function( self ) Gui:setToTop( self ) end } ) local colorpicker = Gui:ColorPicker( diff --git a/examples/resources/lib/gui.lua b/examples/resources/lib/gui.lua index 2bae0eb..de40dd0 100644 --- a/examples/resources/lib/gui.lua +++ b/examples/resources/lib/gui.lua @@ -95,11 +95,11 @@ function Gui.delete( cell ) end end -function Gui.set2Top( cell ) +function Gui.setToTop( cell ) Util.tableMove( Gui._cells, Gui.getId( cell ), 1, #Gui._cells ) end -function Gui.set2Back( cell ) +function Gui.setToBack( cell ) Util.tableMove( Gui._cells, Gui.getId( cell ), 1, 1 ) end @@ -518,12 +518,12 @@ function Element:delete() Gui.delete( self ) end -function Element:set2Top() - Gui.set2Top( self ) +function Element:setToTop() + Gui.setToTop( self ) end -function Element:set2Back() - Gui.set2Back( self ) +function Element:setToBack() + Gui.setToBack( self ) end -- Container. @@ -820,34 +820,34 @@ function Container:clear() self.cells = {} end -function Container:set2Top() - Gui.set2Top( self ) +function Container:setToTop() + Gui.setToTop( self ) for _, cell in ipairs( self.cells ) do - cell:set2Top() + cell:setToTop() end if self._VScrollbar ~= nil then - Gui.set2Top( self._VScrollbar ) + Gui.setToTop( self._VScrollbar ) end if self._HScrollbar ~= nil then - Gui.set2Top( self._HScrollbar ) + Gui.setToTop( self._HScrollbar ) end end -function Container:set2Back() +function Container:setToBack() if self._VScrollbar ~= nil then - Gui.set2Back( self._VScrollbar ) + Gui.setToBack( self._VScrollbar ) end if self._HScrollbar ~= nil then - Gui.set2Back( self._HScrollbar ) + Gui.setToBack( self._HScrollbar ) end for _, cell in ipairs( self.cells ) do - cell:set2Back() + cell:setToBack() end - Gui.set2Back( self ) + Gui.setToBack( self ) end function Container:draw() diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua index 1cd0269..437bc96 100644 --- a/examples/resources/lib/raygui.lua +++ b/examples/resources/lib/raygui.lua @@ -1922,11 +1922,10 @@ function Raygui:checkScrolling() end function Raygui:clickedInBounds( bounds ) - print( self._mousePressPos, bounds ) return RL.CheckCollisionPointRec( self._mousePressPos, bounds ) end -function Raygui:set2Top( control ) +function Raygui:setToTop( control ) for i, curControl in ipairs( self.controls ) do if control == curControl then Util.tableMove( self.controls, i, 1, #self.controls ) @@ -1936,7 +1935,7 @@ function Raygui:set2Top( control ) end end -function Raygui:set2Back( control ) +function Raygui:setToBack( control ) for i, curControl in ipairs( self.controls ) do if control == curControl then Util.tableMove( self.controls, i, 1, 1 ) diff --git a/examples/textBoxed/main.lua b/examples/textBoxed/main.lua index ce570c0..df731c3 100644 --- a/examples/textBoxed/main.lua +++ b/examples/textBoxed/main.lua @@ -3,6 +3,7 @@ local spacing = 1 local rect = { 100, 64, 200, 200 } local wordwrap = true local linkColor = RL.BLUE +local limitHeight = true local mouseCharId = 0 local textOffset = { 0, 0 } @@ -34,21 +35,21 @@ function RL.draw() mouseCharId, textOffset = RL.DrawTextBoxedEx( RL.GetFontDefault(), - "You can change the size of the box by pressing right mouse and toggle the wordwrap by pressing space. First we will write some text before the hyperlink to show that it is indeed is as powerful feature as adverticed.", + "\tYou can change the size of the box by pressing right mouse and toggle the wordwrap by pressing space. First we will write some text before the hyperlink to show that it is indeed is as powerful feature as adverticed.", rect, - textSize, spacing, wordwrap, RL.RED, { 0, 0 } + textSize, spacing, wordwrap, RL.RED, limitHeight, { 0, 0 } ) mouseCharId, textOffset = RL.DrawTextBoxedEx( RL.GetFontDefault(), " Hyperlink.", rect, - textSize, spacing, wordwrap, linkColor, textOffset + textSize, spacing, wordwrap, linkColor, limitHeight, textOffset ) RL.DrawTextBoxedEx( RL.GetFontDefault(), " Then we demonstrate this further by writin more text after the link. Isn't this just amazing! Don't forget to press left mouse to print text to your console when hovering mouse over the hyperlink.", rect, - textSize, spacing, wordwrap, RL.RED, textOffset + textSize, spacing, wordwrap, RL.RED, limitHeight, textOffset ) if 0 < mouseCharId then @@ -57,4 +58,3 @@ function RL.draw() linkColor = RL.BLUE end end - |
