summaryrefslogtreecommitdiff
path: root/examples/raygui_lib
diff options
context:
space:
mode:
authorjussi2023-12-01 00:26:43 +0200
committerjussi2023-12-01 00:26:43 +0200
commit4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc (patch)
treeadeb24d93282e527d2e4a33fbc3fd98f72086936 /examples/raygui_lib
parenta5d40f70258644b4c631e6917f1883ce548ebbeb (diff)
downloadreilua-enhanced-4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc.tar.gz
reilua-enhanced-4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc.tar.bz2
reilua-enhanced-4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc.zip
Raygui wrapper library disable and styles for each element.
Diffstat (limited to 'examples/raygui_lib')
-rw-r--r--examples/raygui_lib/main.lua80
1 files changed, 50 insertions, 30 deletions
diff --git a/examples/raygui_lib/main.lua b/examples/raygui_lib/main.lua
index 0e5a725..01cf49b 100644
--- a/examples/raygui_lib/main.lua
+++ b/examples/raygui_lib/main.lua
@@ -47,10 +47,13 @@ function RL.init()
RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 )
RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SPACING, 4 )
RL.GuiSetStyle( RL.SPINNER, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_RIGHT )
+ RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_LEFT )
- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) )
- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) )
- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) )
+ -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) )
+ -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) )
+ -- RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) )
+
+ RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_LINE_SPACING, 20 )
local label = Gui:Label(
Rect:new( 16, 16, 64, 32 ),
@@ -65,17 +68,26 @@ function RL.init()
local button = Gui:Button(
Rect:new( 245, 188, 64, 32 ),
"Dog",
- function() toggleGroup:setText( "Dog;Cat\nEagle" ) end,
- texture,
- textureRect
+ function() toggleGroup:setText( "Dog;Cat\nEagle" ) end
)
+ button.styles = {
+ { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
+ { RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) },
+ { RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) },
+ }
+ button.texture = texture
+ button.textureRect = textureRect
local checkbox = Gui:CheckBox(
- Rect:new( 64, 128, 20, 20 ),
- "Dog",
+ Rect:new( 116, 128, 20, 20 ),
+ "Visible",
+ toggleGroup.visible,
+ function( self ) toggleGroup.visible = self.checked end
+ )
+ local toggle = Gui:Toggle(
+ Rect:new( 32, 160, 100, 32 ),
+ "Toggle",
false,
- nil,
- texture,
- textureRect
+ nil
)
local combobox = Gui:ComboBox(
Rect:new( 64, 256, 128, 32 ),
@@ -128,10 +140,10 @@ function RL.init()
0,
0,
100,
- function( self ) print( "Changed value "..self.value ) end,
- texture,
- textureRect
+ function( self ) print( "Changed value "..self.value ) end
)
+ slider.texture = texture
+ slider.textureRect = textureRect
local sliderbar = Gui:SliderBar(
Rect:new( 50, 550, 256, 32 ),
"min",
@@ -171,10 +183,13 @@ function RL.init()
function( self ) self.visible = false end,
-- Grab callback.
function( self ) Gui:set2Top( self ) end,
- nil,
- texture,
- textureRect
+ nil
)
+ windowbox.styles = {
+ { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
+ }
+ windowbox.texture = texture
+ windowbox.textureRect = textureRect
local groupbox = Gui:GroupBox(
Rect:new( 400, 700, 256, 256 ),
"GroupBox"
@@ -189,15 +204,17 @@ function RL.init()
-- Grab callback.
function( self ) Gui:set2Top( self ) end
)
+ panel.styles = {
+ { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.MAGENTA ) },
+ { RL.DEFAULT, RL.TEXT_ALIGNMENT, RL.TEXT_ALIGN_CENTER },
+ { RL.DEFAULT, RL.BACKGROUND_COLOR, RL.ColorToInt( RL.DARKBLUE ) },
+ }
tabBar = Gui:GuiTabBar(
Rect:new( 700, 520, 700, 32 ),
"Cat;Dog;Horse;Cow",
0,
- -- function( self ) Gui:set2Top( self ) end
nil,
- closeTab,
- texture,
- textureRect
+ closeTab
)
local scrollpanel = Gui:ScrollPanel(
Rect:new( 800, 64, 256, 256 ),
@@ -222,23 +239,26 @@ function RL.init()
0,
0,
0,
- function( self ) print( self:getItem( self.active ) ) end,
- texture,
- textureRect
+ function( self ) print( self:getItem( self.active ) ) end
)
+ listviewex.styles = {
+ { RL.DEFAULT, RL.TEXT_COLOR_NORMAL, RL.ColorToInt( RL.RED ) },
+ { RL.DEFAULT, RL.TEXT_COLOR_FOCUSED, RL.ColorToInt( RL.ORANGE ) },
+ { RL.DEFAULT, RL.TEXT_COLOR_PRESSED, RL.ColorToInt( RL.GREEN ) },
+ }
+ listviewex.texture = texture
+ listviewex.textureRect = textureRect
local messagebox = Gui:MessageBox(
Rect:new( 1100, 150, 300, 128 ),
"Title",
- "Message",
- "Cancel;Ok",
+ "Should we disable\nwindow box?",
+ "No;Yes",
function( self )
if 0 < self.buttonIndex then
- print( "You pressed "..self:getItem( self.buttonIndex ) )
-
if self.buttonIndex == 1 then
- Gui:set2Back( windowbox )
+ windowbox.disabled = false
elseif self.buttonIndex == 2 then
- Gui:set2Top( windowbox )
+ windowbox.disabled = true
end
end
end,