diff options
| author | jussi | 2023-11-24 22:57:00 +0200 |
|---|---|---|
| committer | jussi | 2023-11-24 22:57:00 +0200 |
| commit | b3a956cff204f30edd36a426e471168e7c396801 (patch) | |
| tree | c82357cac13a1692809a7124ca29e2acb1ceb2de | |
| parent | a1887aa86694208549bee0ef46758d602ba79696 (diff) | |
| download | reilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.tar.gz reilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.tar.bz2 reilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.zip | |
Fixed raygui edit mode selection.
| -rw-r--r-- | changelog | 1 | ||||
| -rw-r--r-- | devnotes | 2 | ||||
| -rw-r--r-- | examples/raygui_lib/main.lua | 15 | ||||
| -rw-r--r-- | examples/resources/lib/raygui.lua | 21 |
4 files changed, 28 insertions, 11 deletions
@@ -24,6 +24,7 @@ DETAILED CHANGES: - ADDED: LoadSoundAlias and UnloadSoundAlias. - ADDED: GetApplicationDirectory. - FIXED: Snake example after Vector2Angle change. + - FIXED: Raygui edit mode selection. ------------------------------------------------------------------------ Release: ReiLua version 0.6.0 Using Raylib 4.5 @@ -3,8 +3,6 @@ Current { Backlog { * Platform specific API documentation. - * Raylibgui. - * Fix textbox focus. * Platform desktop SDL. * Text input not working on gui. Could this be Raylib issue? * Haptic functions. diff --git a/examples/raygui_lib/main.lua b/examples/raygui_lib/main.lua index bd8e63d..5bd187a 100644 --- a/examples/raygui_lib/main.lua +++ b/examples/raygui_lib/main.lua @@ -101,6 +101,13 @@ function RL.init() false, function( self ) print( "Set text "..self.text ) end ) + local textbox2 = Raygui.TextBox:new( + Rect:new( 32, 380, 256, 32 ), + "Name", + 32, + false, + function( self ) print( "Set text "..self.text ) end + ) local slider = Raygui.Slider:new( Rect:new( 50, 500, 256, 32 ), "min", @@ -255,14 +262,6 @@ function RL.init() end function RL.process( delta ) - if RL.IsKeyPressed( RL.KEY_R ) then - Raygui.set2Top( windowbox ) - end - - if RL.IsKeyPressed( RL.KEY_F ) then - Raygui.set2Back( windowbox ) - end - Raygui.process() end diff --git a/examples/resources/lib/raygui.lua b/examples/resources/lib/raygui.lua index 6fcd87b..715c8e4 100644 --- a/examples/resources/lib/raygui.lua +++ b/examples/resources/lib/raygui.lua @@ -55,6 +55,7 @@ local Raygui = { dragging = nil, grabPos = Vec2:new(), scrolling = false, + textEdit = false, } function Raygui.process() @@ -111,7 +112,7 @@ function Raygui.drag( element ) end function Raygui.draw() - if not Raygui.scrolling then + if not Raygui.scrolling and not Raygui.textEdit then RL.GuiLock() elseif RL.IsMouseButtonReleased( RL.MOUSE_BUTTON_LEFT ) then Raygui.scrolling = false @@ -158,6 +159,21 @@ function Raygui.remove( element ) end end +function Raygui.editMode( editMode ) + if not editMode then + for _, element in ipairs( Raygui.elements ) do + if element.editMode then + element.editMode = false + + if element.callback ~= nil then + element.callback( element ) + end + end + end + end + Raygui.textEdit = not editMode +end + --[[ Container/separator controls, useful for controls organization ]]-- @@ -881,6 +897,7 @@ function Spinner:draw() result, self.value = RL.GuiSpinner( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode ) if result == 1 then + Raygui.editMode( self.editMode ) self.editMode = not self.editMode end @@ -929,6 +946,7 @@ function ValueBox:draw() result, self.value = RL.GuiValueBox( self.bounds, self.text, self.value, self.minValue, self.maxValue, self.editMode ) if result == 1 then + Raygui.editMode( self.editMode ) self.editMode = not self.editMode end @@ -983,6 +1001,7 @@ function TextBox:draw() end if result == 1 then + Raygui.editMode( self.editMode ) self.editMode = not self.editMode if not self.editMode and self.callback ~= nil then |
