summaryrefslogtreecommitdiff
path: root/examples/ReiLuaGui_examples
diff options
context:
space:
mode:
authorjussi2023-12-01 00:26:43 +0200
committerjussi2023-12-01 00:26:43 +0200
commit4a783a156e1ab6ea9a8b69cd75db6aa33bb6eefc (patch)
treeadeb24d93282e527d2e4a33fbc3fd98f72086936 /examples/ReiLuaGui_examples
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/ReiLuaGui_examples')
-rw-r--r--examples/ReiLuaGui_examples/calculator.lua10
-rw-r--r--examples/ReiLuaGui_examples/file_explorer.lua20
-rw-r--r--examples/ReiLuaGui_examples/main.lua54
3 files changed, 42 insertions, 42 deletions
diff --git a/examples/ReiLuaGui_examples/calculator.lua b/examples/ReiLuaGui_examples/calculator.lua
index 8ebf0b6..a2ddfdf 100644
--- a/examples/ReiLuaGui_examples/calculator.lua
+++ b/examples/ReiLuaGui_examples/calculator.lua
@@ -27,7 +27,7 @@ function Calculator:new( pos )
object.handle:add( Gui.texture:new( {
bounds = object.handle.bounds:clone(),
- texture = bgrTexture,
+ texture = BgrTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
@@ -35,7 +35,7 @@ function Calculator:new( pos )
object.handle:add( Gui.texture:new( {
bounds = object.handle.bounds:clone(),
- texture = borderTexture,
+ texture = BorderTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
@@ -57,7 +57,7 @@ function Calculator:new( pos )
object.closeButton:add( Gui.texture:new( {
bounds = object.closeButton.bounds:clone(),
- texture = cancelTexture,
+ texture = CancelTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
} ) )
@@ -70,7 +70,7 @@ function Calculator:new( pos )
object.panel:add( Gui.texture:new( {
bounds = object.panel.bounds:clone(),
- texture = bgrTexture,
+ texture = BgrTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.GRAY ),
@@ -78,7 +78,7 @@ function Calculator:new( pos )
object.panel:add( Gui.texture:new( {
bounds = object.panel.bounds:clone(),
- texture = borderTexture,
+ texture = BorderTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
diff --git a/examples/ReiLuaGui_examples/file_explorer.lua b/examples/ReiLuaGui_examples/file_explorer.lua
index 72f6117..7ec6104 100644
--- a/examples/ReiLuaGui_examples/file_explorer.lua
+++ b/examples/ReiLuaGui_examples/file_explorer.lua
@@ -27,7 +27,7 @@ function FileExplorer:new( pos )
object.handle:add( Gui.texture:new( {
bounds = object.handle.bounds:clone(),
- texture = bgrTexture,
+ texture = BgrTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
@@ -35,7 +35,7 @@ function FileExplorer:new( pos )
object.handle:add( Gui.texture:new( {
bounds = object.handle.bounds:clone(),
- texture = borderTexture,
+ texture = BorderTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
@@ -57,7 +57,7 @@ function FileExplorer:new( pos )
object.closeButton:add( Gui.texture:new( {
bounds = object.closeButton.bounds:clone(),
- texture = cancelTexture,
+ texture = CancelTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
} ) )
@@ -70,7 +70,7 @@ function FileExplorer:new( pos )
object.panel:add( Gui.texture:new( {
bounds = object.panel.bounds:clone(),
- texture = bgrTexture,
+ texture = BgrTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.GRAY ),
@@ -78,7 +78,7 @@ function FileExplorer:new( pos )
object.panel:add( Gui.texture:new( {
bounds = object.panel.bounds:clone(),
- texture = borderTexture,
+ texture = BorderTexture,
HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER,
color = Color:new( RL.LIGHTGRAY ),
@@ -110,7 +110,7 @@ function FileExplorer:new( pos )
object.backButton:add( Gui.texture:new( {
bounds = Rect:new( 0, 0, object.HANDLE_HIGHT, object.HANDLE_HIGHT ),
- texture = backTexture,
+ texture = BackTexture,
HAling = Gui.ALING.CENTER,
color = Color:new( RL.BLACK )
} ) )
@@ -153,8 +153,8 @@ function FileExplorer:new( pos )
object.path = RL.GetBasePath()
-- Take last '/' away.
- if util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then
- object.path = util.utf8Sub( object.path, 1, utf8.len( object.path ) - 1 )
+ if Util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then
+ object.path = Util.utf8Sub( object.path, 1, utf8.len( object.path ) - 1 )
end
object.file = ""
@@ -228,11 +228,11 @@ function FileExplorer:updateFiles()
table.sort( folders, function( a, b ) return a < b end )
for _, folder in ipairs( folders ) do
- self:addFileToList( folder, folderTexture, { 150, 120, 80 }, function() self:changeDir( folder ) end )
+ self:addFileToList( folder, FolderTexture, { 150, 120, 80 }, function() self:changeDir( folder ) end )
end
for _, file in ipairs( files ) do
- self:addFileToList( file, filesTexture, RL.WHITE, function() self:fileSelect( file ) end )
+ self:addFileToList( file, FilesTexture, RL.WHITE, function() self:fileSelect( file ) end )
end
end
diff --git a/examples/ReiLuaGui_examples/main.lua b/examples/ReiLuaGui_examples/main.lua
index 29dace8..c2861c0 100644
--- a/examples/ReiLuaGui_examples/main.lua
+++ b/examples/ReiLuaGui_examples/main.lua
@@ -1,7 +1,7 @@
package.path = package.path..";"..RL.GetBasePath().."?.lua"
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
-util = require( "utillib" )
+Util = require( "utillib" )
Vec2 = require( "vector2" )
Rect = require( "rectangle" )
Color = require( "color" )
@@ -13,29 +13,29 @@ FileExplorer = require( "file_explorer" )
-- Textures.
-- Note that textures are global.
-cancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" )
-backTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" )
-folderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" )
-filesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" )
-borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
-bgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" )
-
-RL.GenTextureMipmaps( cancelTexture )
-RL.GenTextureMipmaps( backTexture )
-RL.GenTextureMipmaps( folderTexture )
-RL.GenTextureMipmaps( filesTexture )
-RL.GenTextureMipmaps( borderTexture )
-RL.GenTextureMipmaps( bgrTexture )
-
-RL.SetTextureFilter( cancelTexture, RL.TEXTURE_FILTER_TRILINEAR )
-RL.SetTextureFilter( backTexture, RL.TEXTURE_FILTER_TRILINEAR )
-RL.SetTextureFilter( folderTexture, RL.TEXTURE_FILTER_TRILINEAR )
-RL.SetTextureFilter( filesTexture, RL.TEXTURE_FILTER_TRILINEAR )
-RL.SetTextureFilter( borderTexture, RL.TEXTURE_FILTER_TRILINEAR )
-RL.SetTextureFilter( bgrTexture, RL.TEXTURE_FILTER_TRILINEAR )
-
-RL.SetTextureWrap( borderTexture, RL.TEXTURE_WRAP_REPEAT )
-RL.SetTextureWrap( bgrTexture, RL.TEXTURE_WRAP_REPEAT )
+CancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" )
+BackTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" )
+FolderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" )
+FilesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" )
+BorderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
+BgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" )
+
+RL.GenTextureMipmaps( CancelTexture )
+RL.GenTextureMipmaps( BackTexture )
+RL.GenTextureMipmaps( FolderTexture )
+RL.GenTextureMipmaps( FilesTexture )
+RL.GenTextureMipmaps( BorderTexture )
+RL.GenTextureMipmaps( BgrTexture )
+
+RL.SetTextureFilter( CancelTexture, RL.TEXTURE_FILTER_TRILINEAR )
+RL.SetTextureFilter( BackTexture, RL.TEXTURE_FILTER_TRILINEAR )
+RL.SetTextureFilter( FolderTexture, RL.TEXTURE_FILTER_TRILINEAR )
+RL.SetTextureFilter( FilesTexture, RL.TEXTURE_FILTER_TRILINEAR )
+RL.SetTextureFilter( BorderTexture, RL.TEXTURE_FILTER_TRILINEAR )
+RL.SetTextureFilter( BgrTexture, RL.TEXTURE_FILTER_TRILINEAR )
+
+RL.SetTextureWrap( BorderTexture, RL.TEXTURE_WRAP_REPEAT )
+RL.SetTextureWrap( BgrTexture, RL.TEXTURE_WRAP_REPEAT )
-- End of calculator definition.
@@ -43,7 +43,7 @@ local calculator = nil
local fileExplorer = nil
local showButton = nil
-function initGui()
+local function initGui()
showButton = Gui.element:new( {
bounds = Rect:new( 0, 0, 96, 32 ),
drawBounds = true,
@@ -65,7 +65,7 @@ function RL.init()
local monitor = 0
local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL.GetMonitorSize( monitor )
- winSize = RL.GetScreenSize()
+ local winSize = RL.GetScreenSize()
RL.SetWindowTitle( "ReiLuaGui examples" )
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
@@ -84,4 +84,4 @@ function RL.draw()
RL.ClearBackground( RL.RAYWHITE )
Gui.draw()
-end
+end \ No newline at end of file