summaryrefslogtreecommitdiff
path: root/examples/resources/lib
diff options
context:
space:
mode:
authorjussi2023-11-24 22:57:00 +0200
committerjussi2023-11-24 22:57:00 +0200
commitb3a956cff204f30edd36a426e471168e7c396801 (patch)
treec82357cac13a1692809a7124ca29e2acb1ceb2de /examples/resources/lib
parenta1887aa86694208549bee0ef46758d602ba79696 (diff)
downloadreilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.tar.gz
reilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.tar.bz2
reilua-enhanced-b3a956cff204f30edd36a426e471168e7c396801.zip
Fixed raygui edit mode selection.
Diffstat (limited to 'examples/resources/lib')
-rw-r--r--examples/resources/lib/raygui.lua21
1 files changed, 20 insertions, 1 deletions
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