summaryrefslogtreecommitdiff
path: root/examples/ReiLuaGui
diff options
context:
space:
mode:
authorjussi2022-12-05 21:52:49 +0200
committerjussi2022-12-05 21:52:49 +0200
commitdebffd94090082282042bab702202bc0ee90baaa (patch)
tree45cb9c439d608537a95701f49944a3aac1efa5f5 /examples/ReiLuaGui
parentb3d2a9c0a2772cee0aeb94ffc1a7ad74b5286b6f (diff)
downloadreilua-enhanced-debffd94090082282042bab702202bc0ee90baaa.tar.gz
reilua-enhanced-debffd94090082282042bab702202bc0ee90baaa.tar.bz2
reilua-enhanced-debffd94090082282042bab702202bc0ee90baaa.zip
ReiGui text input.
Diffstat (limited to 'examples/ReiLuaGui')
-rw-r--r--examples/ReiLuaGui/main.lua21
1 files changed, 19 insertions, 2 deletions
diff --git a/examples/ReiLuaGui/main.lua b/examples/ReiLuaGui/main.lua
index 1257ec1..f800a7d 100644
--- a/examples/ReiLuaGui/main.lua
+++ b/examples/ReiLuaGui/main.lua
@@ -10,6 +10,7 @@ local container = {}
-- local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/circle.png" )
local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/plain-circle.png" )
local checkTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/check-mark.png" )
+local textInput
RL_GenTextureMipmaps( circleTexture )
RL_GenTextureMipmaps( checkTexture )
@@ -22,7 +23,8 @@ function initGui()
container = Gui.container:new( {
bounds = Rect:new( 256, 120, 128, 128 ),
- -- spacing = 4,
+ -- spacing = 14,
+ -- drawScrollRect = true,
-- Haling = Gui.ALING.LEFT,
-- Haling = Gui.ALING.CENTER,
-- Valing = Gui.ALING.CENTER,
@@ -101,6 +103,21 @@ function initGui()
container:add( container2 )
panel:set2Top()
+
+ -- Text input.
+
+ textInput = Gui.element:new( {
+ bounds = Rect:new( 64, 360, 300, 32 ),
+ drawBounds = true,
+ color = Color:new( LIGHTGRAY ),
+ onClicked = function() Gui.setInputFocus( textInput ) end,
+ inputFocus = function() textInput.color = Color:new( BLUE ) end,
+ -- inputFocus = function() container:delete() end,
+ -- inputFocus = function() panel:set2Back() end,
+ inputUnfocus = function() textInput.color = Color:new( LIGHTGRAY ) end,
+ } )
+
+ textInput:add( Gui.text:new( { text = "", maxTextLen = 16, allowLineBreak = false } ) )
end
function init()
@@ -108,7 +125,6 @@ function init()
local mPos = RL_GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor )
winSize = RL_GetWindowSize()
- -- local winSize = { 1920, 1080 }
RL_SetWindowTitle( "ReiLua Gui" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
@@ -127,4 +143,5 @@ function draw()
RL_ClearBackground( RAYWHITE )
Gui.draw()
+ RL_DrawText( 0, "Work in progress GuiLib test.", { 10, 10 }, 30, 4, BLACK )
end