diff options
| author | jussi | 2024-03-29 20:51:43 +0200 |
|---|---|---|
| committer | jussi | 2024-03-29 20:51:43 +0200 |
| commit | b96960a1f97f815a6872fedc422ea950ed477cda (patch) | |
| tree | 5dd7cc471be60806744b9869358e43cf507202fe /examples/raygui_examples/main.lua | |
| parent | 523351609a36ceb48581aa8edab160037a634ea8 (diff) | |
| download | reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.gz reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.tar.bz2 reilua-enhanced-b96960a1f97f815a6872fedc422ea950ed477cda.zip | |
Raygui lib examples file browser.
Diffstat (limited to 'examples/raygui_examples/main.lua')
| -rw-r--r-- | examples/raygui_examples/main.lua | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/examples/raygui_examples/main.lua b/examples/raygui_examples/main.lua index 7670319..2fcf4c5 100644 --- a/examples/raygui_examples/main.lua +++ b/examples/raygui_examples/main.lua @@ -1,18 +1,28 @@ package.path = package.path..";"..RL.GetBasePath().."?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua" - Util = require( "utillib" ) Rect = require( "rectangle" ) Vec2 = require( "vector2" ) Color = require( "color" ) Raygui = require( "raygui" ) Calculator = require( "calculator" ) +FileBrowser = require( "file_browser" ) Gui = Raygui:new() +local showAllButton = nil local calculator = nil -local calculator2 = nil +local fileBrowser = nil + +local function loadFile( path ) + print( "Load file: "..path ) +end + +local function showAll() + calculator:setVisible( true ) + fileBrowser:setVisible( true ) +end function RL.init() local monitor = 0 @@ -29,8 +39,22 @@ function RL.init() RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SIZE, 20 ) RL.GuiSetStyle( RL.DEFAULT, RL.TEXT_SPACING, 4 ) + RL.GuiLoadStyle( RL.GetBasePath().."../resources/styles/style_dark.rgs" ) + + showAllButton = Gui:Button( + Rect:new( 0, 0, 108, 28 ), + "Show All", + { -- callbacks. + pressed = function() showAll() end + } + ) + calculator = Calculator:new( Vec2:new( 32, 32 ) ) - calculator2 = Calculator:new( Vec2:new( 64, 65 ) ) + fileBrowser = FileBrowser:new( + Vec2:new( 250, 100 ) + ) + + fileBrowser:popup( fileBrowser.MODES.OPEN, RL.GetBasePath(), loadFile ) end function RL.update( delta ) |
