All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua"
|
||||
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||
|
||||
util = require( "utillib" )
|
||||
Vec2 = require( "vector2" )
|
||||
@@ -7,16 +7,16 @@ Color = require( "color" )
|
||||
Gui = require( "gui" )
|
||||
|
||||
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 borderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" )
|
||||
-- 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 borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
|
||||
local textInput
|
||||
|
||||
RL_GenTextureMipmaps( circleTexture )
|
||||
RL_GenTextureMipmaps( checkTexture )
|
||||
RL_SetTextureFilter( circleTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( checkTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL.GenTextureMipmaps( circleTexture )
|
||||
RL.GenTextureMipmaps( checkTexture )
|
||||
RL.SetTextureFilter( circleTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( checkTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
|
||||
function initGui()
|
||||
-- local label = Gui.label:new( { text = "Dog", bounds = { 32, 32, 96, 96 }, drawBounds = true, Haling = Gui.ALING.CENTER, Valing = Gui.ALING.TOP } )
|
||||
@@ -45,8 +45,8 @@ function initGui()
|
||||
local dog = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 128, 36 ),
|
||||
onClicked = function() panel:setPosition( Vec2:new( 290, 120 ) ) end,
|
||||
onMouseOver = function( self ) self.items[1].color = RED end,
|
||||
notMouseOver = function( self ) self.items[1].color = BLACK end,
|
||||
onMouseOver = function( self ) self.items[1].color = RL.RED end,
|
||||
notMouseOver = function( self ) self.items[1].color = RL.BLACK end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
|
||||
@@ -58,7 +58,7 @@ function initGui()
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
visible = true,
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH },
|
||||
} ) )
|
||||
|
||||
dog:add( Gui.texture:new( { bounds = Rect:new( 0, 0, 24, 24 ), texture = circleTexture, HAling = Gui.ALING.RIGHT, color = Color:new( 150, 150, 255 ) } ) )
|
||||
@@ -81,8 +81,8 @@ function initGui()
|
||||
local element = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 120, 30 ),
|
||||
onClicked = function() panel:setPosition( Vec2:new( 340, 380 ) ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
|
||||
@@ -97,18 +97,18 @@ function initGui()
|
||||
|
||||
local element = Gui.element:new( {
|
||||
bounds = itemBounds:clone(),
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
element:add( Gui.text:new( { text = "Dog" } ) )
|
||||
container2:add( element )
|
||||
|
||||
|
||||
element = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 78, 24 ),
|
||||
-- bounds = Rect:new( 0, 0, 78, 64 ),
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
element:add( Gui.text:new( { text = "Cat" } ) )
|
||||
@@ -123,39 +123,38 @@ function initGui()
|
||||
textInput = Gui.element:new( {
|
||||
bounds = Rect:new( 64, 360, 300, 32 ),
|
||||
drawBounds = true,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
onClicked = function() Gui.setInputFocus( textInput ) end,
|
||||
inputFocus = function() textInput.color = Color:new( BLUE ) end,
|
||||
inputFocus = function() textInput.color = Color:new( RL.BLUE ) end,
|
||||
-- inputFocus = function() container:delete() end,
|
||||
-- inputFocus = function() panel:set2Back() end,
|
||||
inputUnfocus = function() textInput.color = Color:new( LIGHTGRAY ) end,
|
||||
inputUnfocus = function() textInput.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
} )
|
||||
|
||||
textInput:add( Gui.text:new( { text = "", maxTextLen = 16, allowLineBreak = false } ) )
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowTitle( "ReiLuaGui Test" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "ReiLuaGui Test" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
initGui()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
Gui.process( Vec2:new( RL_GetMousePosition() ) )
|
||||
function RL.process( delta )
|
||||
Gui.process( Vec2:new( RL.GetMousePosition() ) )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
|
||||
Gui.draw()
|
||||
RL_DrawText( 0, "Work in progress GuiLib test.", { 10, 10 }, 30, 4, BLACK )
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user