All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.

This commit is contained in:
jussi
2023-04-06 12:31:37 +03:00
parent 198a74c0aa
commit 2526c9732e
47 changed files with 8730 additions and 3196 deletions

1198
API.md

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
## About ## About
Idea of this project was to bring the power and simplicity of raylib to easy beginner friendly language like Lua in a very straight forward manner. It is loose binding to Raylib, some functions will not be included and some are added. The idea of pointing "main.lua" file and access functions "init", "process" and "draw" are borrowed from Löve game engine. Idea of this project was to bring the power and simplicity of raylib to easy beginner friendly language like Lua in a very straight forward manner. It is loose binding to Raylib, some functions will not be included and some are added. The idea of pointing "main.lua" file and access functions "init", "process" and "draw" are borrowed from Löve game framework.
Need for boilerplate code is minimal and in true Lua fashion (in better and worse) you don't need to worry about strict type rules since all Raylib types are lua tables or object id's. Also what Lua cannot handle, the engine is simple enough to be fairly easily extended with new functionality or by using Lua C-libraries. Need for boilerplate code is minimal and in true Lua fashion (in better and worse) you don't need to worry about strict type rules since all Raylib types are lua tables or object id's. Also what Lua cannot handle, the framework is simple enough to be fairly easily extended with new functionality or by using Lua C-libraries.
ReiLua is not planned to be a one-to-one binding to raylib. If you want more direct bindings, there are other projects like https://github.com/TSnake41/raylib-lua. ReiLua is not planned to be a one-to-one binding to raylib. If you want more direct bindings, there are other projects like https://github.com/TSnake41/raylib-lua.
@@ -35,33 +35,33 @@ List of some MISSING features that are planned to be included. For specific func
## Usage ## Usage
Application needs 'main.lua' or 'main' file as entry point. ReiLua executable will first look it from same directory. Alternatively, path to the folder where "main.lua" is located can be given as argument. There are three global Lua functions that the engine will call, 'init', 'process' and 'draw'. Application needs 'main.lua' or 'main' file as entry point. ReiLua executable will first look it from same directory. Alternatively, path to the folder where "main.lua" is located can be given as argument. There are five Lua functions that the framework will call, 'RL.init', 'RL.process', 'RL.draw', 'RL.log' and 'RL.exit'.
Example of basic "main.lua" file that will show basic windows with text. Example of basic "main.lua" file that will show basic windows with text.
``` ```
local textColor = BLACK local textColor = RL.BLACK
local textPos = { 192, 200 } local textPos = { 192, 200 }
function init() function RL.init()
RL_SetWindowTitle( "First window" ) RL.SetWindowTitle( "First window" )
end end
function process( delta ) function RL.process( delta )
if RL_IsKeyPressed( KEY_ENTER ) then if RL.IsKeyPressed( RL.KEY_ENTER ) then
textColor = BLUE textColor = BLUE
textPos = { 230, 230 } textPos = { 230, 230 }
end end
if RL_IsKeyPressed( KEY_SPACE ) then if RL.IsKeyPressed( RL.KEY_SPACE ) then
textColor = BLACK textColor = RL.BLACK
textPos = { 192, 200 } textPos = { 192, 200 }
end end
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL_DrawText( 0, "Congrats! You created your first window!", textPos, 20, 2, textColor ) RL.DrawText( 0, "Congrats! You created your first window!", textPos, 20, 2, textColor )
end end
``` ```
@@ -74,6 +74,7 @@ GameFolder
``` ```
Application should now start successfully from executable. All functionality can be found in "API". Application should now start successfully from executable. All functionality can be found in "API".
ReiLua_API.lua can be put into project folder to provide annotations when using Lua Language Server.
## Interpreter Mode ## Interpreter Mode
@@ -83,6 +84,14 @@ ReiLua can also be used to run single lua file using interpreter mode with argum
./Reilua -i hello.lua ./Reilua -i hello.lua
``` ```
## Generate API
Generate API.md and ReiLua_API.lua from build folder with command.
```
./Reilua -i ../doc_parser.lua
```
## Building ## Building
I think the simplest way would be to statically link Raylib and Lua to the same executable. Specially on Linux this would simplify distribution of games since different distros tend to use different versions of librarys. Of course if you plan to only experiment with it, this isn't so important. Current Raylib version 4.2.0. I think the simplest way would be to statically link Raylib and Lua to the same executable. Specially on Linux this would simplify distribution of games since different distros tend to use different versions of librarys. Of course if you plan to only experiment with it, this isn't so important. Current Raylib version 4.2.0.

5385
ReiLua_API.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,3 +1,14 @@
------------------------------------------------------------------------
Release: ReiLua version 0.5.0 Using Raylib 4.2
------------------------------------------------------------------------
KEY CHANGES:
- CHANGED: All ReiLua global variables and functions are now stored in global RL table.
- CHANGED: All examples are now changed to use new RL table method.
- ADDED: doc_parser creates also ReiLua_API.lua that can be used in projects with Lua Language Server.
Detailed changes:
- FIXED: uluaGetRay was looking for integers instead of tables.
------------------------------------------------------------------------ ------------------------------------------------------------------------
Release: ReiLua version 0.4.0 Using Raylib 4.2 Release: ReiLua version 0.4.0 Using Raylib 4.2
------------------------------------------------------------------------ ------------------------------------------------------------------------
@@ -14,20 +25,20 @@ KEY CHANGES:
- CHANGED: RL_DrawQuad3DTexture now takes vertex colors instead of just single color. - CHANGED: RL_DrawQuad3DTexture now takes vertex colors instead of just single color.
Detailed changes: Detailed changes:
ADDED: Help argument. - ADDED: Help argument.
CHANGED: RL_rlSetLineWidth renamed to RL_rlglSetLineWidth. - CHANGED: RL_rlSetLineWidth renamed to RL_rlglSetLineWidth.
CHANGED: RL_rlGetLineWidth renamed to RL_rlglGetLineWidth. - CHANGED: RL_rlGetLineWidth renamed to RL_rlglGetLineWidth.
FIXED: DrawRectangleGradient V and H expecting wrong arguments. - FIXED: DrawRectangleGradient V and H expecting wrong arguments.
ADDED: RL_LoadDirectoryFilesEx. - ADDED: RL_LoadDirectoryFilesEx.
FIXED: RL_DrawLineBezierQuad was called RL_DrawLineBezier in API. - FIXED: RL_DrawLineBezierQuad was called RL_DrawLineBezier in API.
ADDED: Color lib. - ADDED: Color lib.
FIXED: RL_DrawEllipse and RL_DrawEllipseLines expecting wrong arguments. - FIXED: RL_DrawEllipse and RL_DrawEllipseLines expecting wrong arguments.
ADDED: RL_IsPathFile. - ADDED: RL_IsPathFile.
ADDED: RL_SetMaterialShader. - ADDED: RL_SetMaterialShader.
ADDED: RL_GetFileLength. - ADDED: RL_GetFileLength.
ADDED: RL_LoadFontEx. - ADDED: RL_LoadFontEx.
FIXED: RL_ImageAlphaClear expecting wrong arguments. - FIXED: RL_ImageAlphaClear expecting wrong arguments.
ADDED: BLEND_ALPHA_PREMULTIPLY. - ADDED: BLEND_ALPHA_PREMULTIPLY.
CHANGED: RL_GetWindowSize renamed to RL_GetScreenSize. - CHANGED: RL_GetWindowSize renamed to RL_GetScreenSize.
ADDED: RL_GetKeyName and RL_GetKeyScancode. GLFW Functions. - ADDED: RL_GetKeyName and RL_GetKeyScancode. GLFW Functions.
ADDED: KEY_UNKNOWN. - ADDED: KEY_UNKNOWN.

View File

@@ -1,4 +1,5 @@
Current { Current {
* Set RL. for the rest of the examples.
} }
Backlog { Backlog {

View File

@@ -1,4 +1,4 @@
--Create api.md file from c sources. --Create api.md and ReiLua_API.lua files from c sources.
-- Export each module as separate .md file. -- Export each module as separate .md file.
local separate = false local separate = false
@@ -21,7 +21,65 @@ local function split( str, sep )
return t return t
end end
local apiFile = io.open( "API.md", "w" ) local function getParamType( param )
if param == "Color" or param == "Vector2" or param == "Vector3" or param == "Vector4"
or param == "Quaternion" or param == "Matrix" or param == "Rectangle" then
return "table"
elseif param == "float" then
return "number"
elseif param == "int" then
return "integer"
elseif param == "string" then
return "string"
elseif param == "bool" then
return "boolean"
else
return "any"
end
end
local function parseFunction( line )
local splitted = split( line, "(" )
local parString = splitted[2]:sub(2)
parString = parString:sub( 1, #parString - 2 )
local parameters = split( parString, "," )
local str = ""
local parStr = ""
for i, par in ipairs( parameters ) do
local sepPar = split( par, " " )
parStr = parStr..sepPar[2]
str = str.."---@param "..sepPar[2].." "
str = str..getParamType( sepPar[1] ).."\n"
if i < #parameters then
parStr = parStr..", "
end
end
local returnsAndFuncName = split( splitted[1], "=" )
for i, ret in ipairs( split( returnsAndFuncName[1]:sub(3), "," ) ) do
if ret:sub( 1, 1 ) == " " then
ret = ret:sub(2)
end
str = str.."---@return any "..ret.."\n"
end
str = str.."function "..returnsAndFuncName[ #returnsAndFuncName ]:sub(2)
if parStr ~= "" then
str = str.."( "..parStr.." )"
else
str = str.."()"
end
return str.." end\n"
end
local apiFile = io.open( "../API.md", "w" )
local luaApiFile = io.open( "../ReiLua_API.lua", "w" )
-- Header -- Header
apiFile:write( "# ReiLua API\n" ) apiFile:write( "# ReiLua API\n" )
@@ -29,24 +87,40 @@ apiFile:write( "# ReiLua API\n" )
-- Usage. -- Usage.
apiFile:write( "\n## Usage\n" ) apiFile:write( "\n## Usage\n" )
apiFile:write( "\nApplication needs 'main.lua' or 'main' file as entry point. ReiLua executable will first look it from same directory. Alternatively, path to the folder where \"main.lua\" is located can be given as argument. There are three global Lua functions that the engine will call, 'init', 'process' and 'draw'.\n" ) apiFile:write( "\nApplication needs 'main.lua' or 'main' file as entry point. ReiLua executable will first look it from same directory. Alternatively, path to the folder where \"main.lua\" is located can be given as argument. There are five Lua functions that the framework will call, 'RL.init', 'RL.process', 'RL.draw', 'RL.log' and 'RL.exit'.\n" )
apiFile:write( "\n---\n> function init()\n\ local FUNC_DESC = {
This function will be called first when 'main.lua' is found\n\n---\n" ) init = "This function will be called first when 'main.lua' is found",
apiFile:write( "\n> function process( delta )\n\ process = "This function will be called every frame during execution. It will get time duration from last frame on argument 'delta'",
This function will be called every frame during execution. It will get time duration from last frame on argument 'delta'\n\n---\n" ) draw = "This function will be called every frame after process and it should have all rendering related functions. Note: Engine will call Raylib functions 'BeginDrawing()' before this function call and 'EndDrawing()' after it. You can still use RL.BeginDrawing() and RL.EndDrawing() manually from anywhere.",
apiFile:write( "\n> function draw()\n\ log = "This function can be used for custom log message handling.",
This function will be called every frame after process and it should have all rendering related functions.\ exit = "This function will be called on program close. Cleanup could be done here.",
Note: Engine will call Raylib functions 'BeginDrawing()' before this function call and 'EndDrawing()' after it.\ }
You can still use RL_BeginDrawing() and RL_EndDrawing() manually from anywhere.\n\n---\n" )
apiFile:write( "\n> function log( logLevel, message )\n\ apiFile:write( "\n---\n> function RL.init()\n\n"..FUNC_DESC.init.."\n\n---\n" )
This function can be used for custom log message handling.\n\n---\n" ) apiFile:write( "\n> function RL.process( delta )\n\n"..FUNC_DESC.process.."\n\n---\n" )
apiFile:write( "\n> function exit()\n\ apiFile:write( "\n> function RL.draw()\n\n"..FUNC_DESC.draw.."\n\n---\n" )
This function will be called on program close. Cleanup could be done here.\n\n---\n" ) apiFile:write( "\n> function RL.log( logLevel, message )\n\n"..FUNC_DESC.log.."\n\n---\n" )
apiFile:write( "\n> function RL.exit()\n\n"..FUNC_DESC.exit.."\n\n---\n" )
luaApiFile:write( "-- Put this file into your project folder to provide annotations when using Lua language server.\n\n" )
luaApiFile:write( "RL={}\n\n" )
luaApiFile:write( "-- Functions.\n\n" )
luaApiFile:write(
"---"..FUNC_DESC.init.."\nfunction RL.init() end\n" )
luaApiFile:write(
"---"..FUNC_DESC.process.."\n---@param delta number\nfunction RL.process( delta ) end\n" )
luaApiFile:write(
"---"..FUNC_DESC.draw.."\nfunction RL.draw() end\n" )
luaApiFile:write(
"---"..FUNC_DESC.log.."\n---@param logLevel integer\n---@param message string\nfunction RL.log( logLevel, message ) end\n" )
luaApiFile:write(
"---"..FUNC_DESC.exit.."\nfunction RL.exit() end\n" )
-- Globals. -- Globals.
local srcFile = io.open( "src/lua_core.c", "r" ) local srcFile = io.open( "../src/lua_core.c", "r" )
local writing = false local writing = false
repeat repeat
@@ -61,9 +135,26 @@ repeat
if writing then if writing then
if lineSplit[1] == "\t/*" then if lineSplit[1] == "\t/*" then
apiFile:write( "\n## Globals - "..lineSplit[2].."\n" ) apiFile:write( "\n## Globals - "..lineSplit[2].."\n" )
luaApiFile:write( "\n-- Globals - "..lineSplit[2].."\n\n" )
else else
-- Remove comma from the end. -- Remove comma from the end.
apiFile:write( "\n"..lineSplit[2]:sub( 1, -2 ).."\n" ) local globalName = lineSplit[2]:sub( 1, -2 )
apiFile:write( "\n"..globalName.."\n" )
local value = RL[ globalName ]
globalName = "RL."..globalName
if value == nil then
luaApiFile:write( globalName.."=nil\n" )
elseif type( value ) == "table" then
-- All tables are colors.
luaApiFile:write( globalName.."={"
..math.tointeger( value[1] )..","..math.tointeger( value[2] )..","
..math.tointeger( value[3] )..","..math.tointeger( value[4] ).."}\n" )
else
luaApiFile:write( globalName.."="..value.."\n" )
end
end end
end end
@@ -172,8 +263,9 @@ local sourceFiles = {
} }
for _, src in ipairs( sourceFiles ) do for _, src in ipairs( sourceFiles ) do
srcFile = io.open( "src/"..src..".c", "r" ) srcFile = io.open( "../src/"..src..".c", "r" )
local line = "" local line = ""
local funcStr = ""
local p = false local p = false
if separate then if separate then
@@ -186,10 +278,20 @@ for _, src in ipairs( sourceFiles ) do
if line == "*/" then if line == "*/" then
p = false p = false
apiFile:write( "\n---\n" ) apiFile:write( "\n---\n" )
luaApiFile:write( funcStr.."\n" )
funcStr = ""
end end
if p then if p then
apiFile:write( line.."\n" ) apiFile:write( line.."\n" )
if line:sub( 1, 2 ) == "##" then
luaApiFile:write( "-- "..line:sub( 4 ).."\n" )
elseif line:sub( 1, 1 ) == ">" then
funcStr = parseFunction( line )
elseif line:sub( 1, 1 ) ~= "" then
luaApiFile:write( "---"..line.."\n" )
end
end end
if line == "/*" then if line == "/*" then

View File

@@ -7,62 +7,62 @@ local cameraSpeed = 100.0
local cameraRotSpeed = 100.0 local cameraRotSpeed = 100.0
local cameraZoomSpeed = 10.0 local cameraZoomSpeed = 10.0
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Camera 2D" ) RL.SetWindowTitle( "Camera 2D" )
tileTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" ) tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
camera = RL_CreateCamera2D() camera = RL.CreateCamera2D()
RL_SetCamera2DOffset( camera, { winSize[1] / 2, winSize[2] / 2 } ) RL.SetCamera2DOffset( camera, { winSize[1] / 2, winSize[2] / 2 } )
end end
function process( delta ) function RL.process( delta )
-- Move. -- Move.
if RL_IsKeyDown( KEY_RIGHT ) then if RL.IsKeyDown( RL.KEY_RIGHT ) then
cameraPos[1] = cameraPos[1] + cameraSpeed * delta cameraPos[1] = cameraPos[1] + cameraSpeed * delta
elseif RL_IsKeyDown( KEY_LEFT ) then elseif RL.IsKeyDown( RL.KEY_LEFT ) then
cameraPos[1] = cameraPos[1] - cameraSpeed * delta cameraPos[1] = cameraPos[1] - cameraSpeed * delta
end end
if RL_IsKeyDown( KEY_DOWN ) then if RL.IsKeyDown( RL.KEY_DOWN ) then
cameraPos[2] = cameraPos[2] + cameraSpeed * delta cameraPos[2] = cameraPos[2] + cameraSpeed * delta
elseif RL_IsKeyDown( KEY_UP ) then elseif RL.IsKeyDown( RL.KEY_UP ) then
cameraPos[2] = cameraPos[2] - cameraSpeed * delta cameraPos[2] = cameraPos[2] - cameraSpeed * delta
end end
-- Rotate. -- Rotate.
if RL_IsKeyDown( string.byte( "E" ) ) then -- Or RL_IsKeyDown( KEY_E ) if RL.IsKeyDown( string.byte( "E" ) ) then -- Or RL.IsKeyDown( KEY_E )
cameraRot = cameraRot + cameraRotSpeed * delta cameraRot = cameraRot + cameraRotSpeed * delta
elseif RL_IsKeyDown( string.byte( "Q" ) ) then elseif RL.IsKeyDown( string.byte( "Q" ) ) then
cameraRot = cameraRot - cameraRotSpeed * delta cameraRot = cameraRot - cameraRotSpeed * delta
end end
-- Zoom. -- Zoom.
if RL_IsKeyDown( string.byte( "R" ) ) then if RL.IsKeyDown( string.byte( "R" ) ) then
cameraZoom = cameraZoom + cameraZoomSpeed * delta cameraZoom = cameraZoom + cameraZoomSpeed * delta
elseif RL_IsKeyDown( string.byte( "F" ) ) then elseif RL.IsKeyDown( string.byte( "F" ) ) then
cameraZoom = cameraZoom - cameraZoomSpeed * delta cameraZoom = cameraZoom - cameraZoomSpeed * delta
end end
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL_SetCamera2DTarget( camera, cameraPos ) RL.SetCamera2DTarget( camera, cameraPos )
RL_SetCamera2DRotation( camera, cameraRot ) RL.SetCamera2DRotation( camera, cameraRot )
RL_SetCamera2DZoom( camera, cameraZoom ) RL.SetCamera2DZoom( camera, cameraZoom )
RL_BeginMode2D( camera ) RL.BeginMode2D( camera )
-- Draw wall. -- Draw wall.
for y = 0, 4 do for y = 0, 4 do
for x = 0, 6 do for x = 0, 6 do
RL_DrawTextureRec( tileTexture, { 0, 0, 32, 32 }, { x * 32, y * 32 }, WHITE ) RL.DrawTextureRec( tileTexture, { 0, 0, 32, 32 }, { x * 32, y * 32 }, RL.WHITE )
end end
end end
-- Draw hero. -- Draw hero.
RL_DrawTextureRec( tileTexture, { 3 * 32, 0, 32, 32 }, { cameraPos[1] - 16, cameraPos[2] - 16 }, WHITE ) RL.DrawTextureRec( tileTexture, { 3 * 32, 0, 32, 32 }, { cameraPos[1] - 16, cameraPos[2] - 16 }, RL.WHITE )
RL_EndMode2D() RL.EndMode2D()
end end

View File

@@ -20,7 +20,7 @@ function Calculator:new( pos )
padding = 10, padding = 10,
onClicked = function() onClicked = function()
object:set2Top() object:set2Top()
object.dragPos = Vec2:new( RL_GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y ) object.dragPos = Vec2:new( RL.GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y )
Gui.heldCallback = function() object:drag() end Gui.heldCallback = function() object:drag() end
end, end,
} ) } )
@@ -30,7 +30,7 @@ function Calculator:new( pos )
texture = bgrTexture, texture = bgrTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
} ) ) } ) )
object.handle:add( Gui.texture:new( { object.handle:add( Gui.texture:new( {
@@ -38,8 +38,8 @@ function Calculator:new( pos )
texture = borderTexture, texture = borderTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
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 },
} ) ) } ) )
object.handle:add( Gui.text:new( { text = "Calculator", fontSize = 20, VAling = Gui.ALING.CENTER } ) ) object.handle:add( Gui.text:new( { text = "Calculator", fontSize = 20, VAling = Gui.ALING.CENTER } ) )
@@ -51,8 +51,8 @@ function Calculator:new( pos )
onClicked = function() onClicked = function()
object:setVisible( false ) object:setVisible( false )
end, end,
onMouseOver = function( self ) self.items[1].color = Color:new( WHITE ) end, onMouseOver = function( self ) self.items[1].color = Color:new( RL.WHITE ) end,
notMouseOver = function( self ) self.items[1].color = Color:new( BLACK ) end, notMouseOver = function( self ) self.items[1].color = Color:new( RL.BLACK ) end,
} ) } )
object.closeButton:add( Gui.texture:new( { object.closeButton:add( Gui.texture:new( {
@@ -73,7 +73,7 @@ function Calculator:new( pos )
texture = bgrTexture, texture = bgrTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( GRAY ), color = Color:new( RL.GRAY ),
} ) ) } ) )
object.panel:add( Gui.texture:new( { object.panel:add( Gui.texture:new( {
@@ -81,8 +81,8 @@ function Calculator:new( pos )
texture = borderTexture, texture = borderTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
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 },
} ) ) } ) )
-- Display. -- Display.
@@ -91,7 +91,7 @@ function Calculator:new( pos )
bounds = Rect:new( 0, 0, object.windowRect.width - 16, object.DISPLAY_HIGHT ), bounds = Rect:new( 0, 0, object.windowRect.width - 16, object.DISPLAY_HIGHT ),
padding = 10, padding = 10,
drawBounds = true, drawBounds = true,
color = Color:new( WHITE ) color = Color:new( RL.WHITE )
} ) } )
object.display:add( Gui.text:new( { text = "", fontSize = 30, VAling = Gui.ALING.CENTER, maxTextLen = 8 } ) ) object.display:add( Gui.text:new( { text = "", fontSize = 30, VAling = Gui.ALING.CENTER, maxTextLen = 8 } ) )
@@ -108,8 +108,8 @@ function Calculator:new( pos )
table.insert( object.buttons, Gui.element:new( { table.insert( object.buttons, Gui.element:new( {
bounds = Rect:new( 0, 0, 40, 32 ), bounds = Rect:new( 0, 0, 40, 32 ),
drawBounds = true, drawBounds = true,
onMouseOver = function( self ) self.color = Color:new( WHITE ) end, onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
} ) ) } ) )
object.buttons[ #object.buttons ].pos = Vec2:new( 8 + x * 46, object.HANDLE_HIGHT + object.DISPLAY_HIGHT + 16 + y * 38 ) object.buttons[ #object.buttons ].pos = Vec2:new( 8 + x * 46, object.HANDLE_HIGHT + object.DISPLAY_HIGHT + 16 + y * 38 )
@@ -161,7 +161,7 @@ function Calculator:setPosition( pos )
end end
function Calculator:drag() function Calculator:drag()
local mousePos = Vec2:new( RL_GetMousePosition() ) local mousePos = Vec2:new( RL.GetMousePosition() )
local winPos = Vec2:new( self.handle.bounds.x, self.handle.bounds.y ) local winPos = Vec2:new( self.handle.bounds.x, self.handle.bounds.y )
self:setPosition( mousePos - self.dragPos ) self:setPosition( mousePos - self.dragPos )

View File

@@ -20,7 +20,7 @@ function FileExplorer:new( pos )
padding = 10, padding = 10,
onClicked = function() onClicked = function()
object:set2Top() object:set2Top()
object.dragPos = Vec2:new( RL_GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y ) object.dragPos = Vec2:new( RL.GetMousePosition() ) - Vec2:new( object.handle.bounds.x, object.handle.bounds.y )
Gui.heldCallback = function() object:drag() end Gui.heldCallback = function() object:drag() end
end, end,
} ) } )
@@ -30,7 +30,7 @@ function FileExplorer:new( pos )
texture = bgrTexture, texture = bgrTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
} ) ) } ) )
object.handle:add( Gui.texture:new( { object.handle:add( Gui.texture:new( {
@@ -38,8 +38,8 @@ function FileExplorer:new( pos )
texture = borderTexture, texture = borderTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
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 },
} ) ) } ) )
object.handle:add( Gui.text:new( { text = "File Explorer", fontSize = 20, VAling = Gui.ALING.CENTER } ) ) object.handle:add( Gui.text:new( { text = "File Explorer", fontSize = 20, VAling = Gui.ALING.CENTER } ) )
@@ -51,8 +51,8 @@ function FileExplorer:new( pos )
onClicked = function() onClicked = function()
object:setVisible( false ) object:setVisible( false )
end, end,
onMouseOver = function( self ) self.items[1].color = Color:new( WHITE ) end, onMouseOver = function( self ) self.items[1].color = Color:new( RL.WHITE ) end,
notMouseOver = function( self ) self.items[1].color = Color:new( BLACK ) end, notMouseOver = function( self ) self.items[1].color = Color:new( RL.BLACK ) end,
} ) } )
object.closeButton:add( Gui.texture:new( { object.closeButton:add( Gui.texture:new( {
@@ -73,7 +73,7 @@ function FileExplorer:new( pos )
texture = bgrTexture, texture = bgrTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( GRAY ), color = Color:new( RL.GRAY ),
} ) ) } ) )
object.panel:add( Gui.texture:new( { object.panel:add( Gui.texture:new( {
@@ -81,8 +81,8 @@ function FileExplorer:new( pos )
texture = borderTexture, texture = borderTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
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 },
} ) ) } ) )
-- Path. -- Path.
@@ -90,7 +90,7 @@ function FileExplorer:new( pos )
object.pathBox = Gui.element:new( { object.pathBox = Gui.element:new( {
bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 64, object.HANDLE_HIGHT ), bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 64, object.HANDLE_HIGHT ),
drawBounds = true, drawBounds = true,
color = Color:new( WHITE ), color = Color:new( RL.WHITE ),
-- onClicked = function() Gui.setInputFocus( object.pathBox ) end, -- onClicked = function() Gui.setInputFocus( object.pathBox ) end,
-- inputFocus = function() object.pathBox.color = Color:new( BLUE ) end, -- inputFocus = function() object.pathBox.color = Color:new( BLUE ) end,
-- inputUnfocus = function() object.pathBox.color = Color:new( WHITE ) end, -- inputUnfocus = function() object.pathBox.color = Color:new( WHITE ) end,
@@ -103,8 +103,8 @@ function FileExplorer:new( pos )
object.backButton = Gui.element:new( { object.backButton = Gui.element:new( {
bounds = Rect:new( 0, 0, 56, object.HANDLE_HIGHT ), bounds = Rect:new( 0, 0, 56, object.HANDLE_HIGHT ),
drawBounds = true, drawBounds = true,
onMouseOver = function( self ) self.color = Color:new( WHITE ) end, onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
onClicked = function() object:backDir() end, onClicked = function() object:backDir() end,
} ) } )
@@ -112,7 +112,7 @@ function FileExplorer:new( pos )
bounds = Rect:new( 0, 0, object.HANDLE_HIGHT, object.HANDLE_HIGHT ), bounds = Rect:new( 0, 0, object.HANDLE_HIGHT, object.HANDLE_HIGHT ),
texture = backTexture, texture = backTexture,
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
color = Color:new( BLACK ) color = Color:new( RL.BLACK )
} ) ) } ) )
-- Files. -- Files.
@@ -130,7 +130,7 @@ function FileExplorer:new( pos )
object.fileName = Gui.element:new( { object.fileName = Gui.element:new( {
bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 70, object.HANDLE_HIGHT ), bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 70, object.HANDLE_HIGHT ),
drawBounds = true, drawBounds = true,
color = Color:new( WHITE ), color = Color:new( RL.WHITE ),
} ) } )
object.fileName:add( Gui.text:new( { text = "", maxTextLen = 32, allowLineBreak = false, VAling = Gui.ALING.CENTER } ) ) object.fileName:add( Gui.text:new( { text = "", maxTextLen = 32, allowLineBreak = false, VAling = Gui.ALING.CENTER } ) )
@@ -140,17 +140,17 @@ function FileExplorer:new( pos )
object.openButton = Gui.element:new( { object.openButton = Gui.element:new( {
bounds = Rect:new( 0, 0, 64, object.HANDLE_HIGHT ), bounds = Rect:new( 0, 0, 64, object.HANDLE_HIGHT ),
drawBounds = true, drawBounds = true,
color = Color:new( WHITE ), color = Color:new( RL.WHITE ),
onClicked = function() object:openFile() end, onClicked = function() object:openFile() end,
onMouseOver = function( self ) self.color = Color:new( WHITE ) end, onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
} ) } )
object.openButton:add( Gui.text:new( { text = "Open", VAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER } ) ) object.openButton:add( Gui.text:new( { text = "Open", VAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER } ) )
-- Variables. -- Variables.
object.path = RL_GetBasePath() object.path = RL.GetBasePath()
-- Take last '/' away. -- Take last '/' away.
if util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then if util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then
@@ -189,7 +189,7 @@ function FileExplorer:changeDir( path )
end end
function FileExplorer:backDir() function FileExplorer:backDir()
self.path = RL_GetPrevDirectoryPath( self.path ) self.path = RL.GetPrevDirectoryPath( self.path )
self:updatePath() self:updatePath()
end end
@@ -197,11 +197,11 @@ end
function FileExplorer:fileSelect( file ) function FileExplorer:fileSelect( file )
self.file = file self.file = file
self.fileName.items[1]:set( RL_GetFileName( file ) ) self.fileName.items[1]:set( RL.GetFileName( file ) )
end end
function FileExplorer:openFile() function FileExplorer:openFile()
print( self.file, RL_GetFileLength( self.file ) ) print( self.file, RL.GetFileLength( self.file ) )
end end
function FileExplorer:updateFiles() function FileExplorer:updateFiles()
@@ -216,8 +216,8 @@ function FileExplorer:updateFiles()
local files = {} local files = {}
local folders = {} local folders = {}
for _, file in ipairs( RL_LoadDirectoryFiles( self.path ) ) do for _, file in ipairs( RL.LoadDirectoryFiles( self.path ) ) do
if RL_IsPathFile( file ) then if RL.IsPathFile( file ) then
table.insert( files, file ) table.insert( files, file )
else else
table.insert( folders, file ) table.insert( folders, file )
@@ -232,7 +232,7 @@ function FileExplorer:updateFiles()
end end
for _, file in ipairs( files ) do for _, file in ipairs( files ) do
self:addFileToList( file, filesTexture, WHITE, function() self:fileSelect( file ) end ) self:addFileToList( file, filesTexture, RL.WHITE, function() self:fileSelect( file ) end )
end end
end end
@@ -247,7 +247,7 @@ function FileExplorer:addFileToList( file, texture, color, func )
element:add( Gui.text:new( { element:add( Gui.text:new( {
bounds = Rect:new( 28, 0, 20, 20 ), bounds = Rect:new( 28, 0, 20, 20 ),
text = RL_GetFileName( file ), text = RL.GetFileName( file ),
fontSize = 20, fontSize = 20,
HAling = Gui.ALING.NONE, HAling = Gui.ALING.NONE,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
@@ -264,7 +264,7 @@ function FileExplorer:addFileToList( file, texture, color, func )
end end
function FileExplorer:drag() function FileExplorer:drag()
local mousePos = Vec2:new( RL_GetMousePosition() ) local mousePos = Vec2:new( RL.GetMousePosition() )
local winPos = Vec2:new( self.handle.bounds.x, self.handle.bounds.y ) local winPos = Vec2:new( self.handle.bounds.x, self.handle.bounds.y )
self:setPosition( mousePos - self.dragPos ) self:setPosition( mousePos - self.dragPos )

View File

@@ -1,5 +1,5 @@
package.path = package.path..";"..RL_GetBasePath().."?.lua" package.path = package.path..";"..RL.GetBasePath().."?.lua"
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
util = require( "utillib" ) util = require( "utillib" )
Vec2 = require( "vector2" ) Vec2 = require( "vector2" )
@@ -13,29 +13,29 @@ FileExplorer = require( "file_explorer" )
-- Textures. -- Textures.
-- Note that textures are global. -- Note that textures are global.
cancelTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/cancel.png" ) cancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" )
backTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/previous-button.png" ) backTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" )
folderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/open-folder.png" ) folderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" )
filesTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/files.png" ) filesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" )
borderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" ) borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
bgrTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_bgr.png" ) bgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" )
RL_GenTextureMipmaps( cancelTexture ) RL.GenTextureMipmaps( cancelTexture )
RL_GenTextureMipmaps( backTexture ) RL.GenTextureMipmaps( backTexture )
RL_GenTextureMipmaps( folderTexture ) RL.GenTextureMipmaps( folderTexture )
RL_GenTextureMipmaps( filesTexture ) RL.GenTextureMipmaps( filesTexture )
RL_GenTextureMipmaps( borderTexture ) RL.GenTextureMipmaps( borderTexture )
RL_GenTextureMipmaps( bgrTexture ) RL.GenTextureMipmaps( bgrTexture )
RL_SetTextureFilter( cancelTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( cancelTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( backTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( backTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( folderTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( folderTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( filesTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( filesTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( borderTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( borderTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( bgrTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( bgrTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureWrap( borderTexture, TEXTURE_WRAP_REPEAT ) RL.SetTextureWrap( borderTexture, RL.TEXTURE_WRAP_REPEAT )
RL_SetTextureWrap( bgrTexture, TEXTURE_WRAP_REPEAT ) RL.SetTextureWrap( bgrTexture, RL.TEXTURE_WRAP_REPEAT )
-- End of calculator definition. -- End of calculator definition.
@@ -51,8 +51,8 @@ function initGui()
calculator:setVisible( true ) calculator:setVisible( true )
fileExplorer:setVisible( true ) fileExplorer:setVisible( true )
end, end,
onMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, onMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
notMouseOver = function( self ) self.color = Color:new( GRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.GRAY ) end,
} ) } )
showButton:add( Gui.text:new( { text = "Show", VAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER } ) ) showButton:add( Gui.text:new( { text = "Show", VAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER } ) )
@@ -61,27 +61,27 @@ function initGui()
fileExplorer = FileExplorer:new( Vec2:new( 280, 96 ) ) fileExplorer = FileExplorer:new( Vec2:new( 280, 96 ) )
end end
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
winSize = RL_GetScreenSize() winSize = RL.GetScreenSize()
RL_SetWindowTitle( "ReiLuaGui examples" ) RL.SetWindowTitle( "ReiLuaGui examples" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
initGui() initGui()
end end
function process( delta ) function RL.process( delta )
Gui.process( Vec2:new( RL_GetMousePosition() ) ) Gui.process( Vec2:new( RL.GetMousePosition() ) )
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
Gui.draw() Gui.draw()
end end

View File

@@ -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" ) util = require( "utillib" )
Vec2 = require( "vector2" ) Vec2 = require( "vector2" )
@@ -7,16 +7,16 @@ Color = require( "color" )
Gui = require( "gui" ) Gui = require( "gui" )
local container = {} local container = {}
-- local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/circle.png" ) -- local circleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/circle.png" )
local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/plain-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 checkTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/check-mark.png" )
local borderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" ) local borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
local textInput local textInput
RL_GenTextureMipmaps( circleTexture ) RL.GenTextureMipmaps( circleTexture )
RL_GenTextureMipmaps( checkTexture ) RL.GenTextureMipmaps( checkTexture )
RL_SetTextureFilter( circleTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( circleTexture, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureFilter( checkTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( checkTexture, RL.TEXTURE_FILTER_TRILINEAR )
function initGui() function initGui()
-- local label = Gui.label:new( { text = "Dog", bounds = { 32, 32, 96, 96 }, drawBounds = true, Haling = Gui.ALING.CENTER, Valing = Gui.ALING.TOP } ) -- 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( { local dog = Gui.element:new( {
bounds = Rect:new( 0, 0, 128, 36 ), bounds = Rect:new( 0, 0, 128, 36 ),
onClicked = function() panel:setPosition( Vec2:new( 290, 120 ) ) end, onClicked = function() panel:setPosition( Vec2:new( 290, 120 ) ) end,
onMouseOver = function( self ) self.items[1].color = RED end, onMouseOver = function( self ) self.items[1].color = RL.RED end,
notMouseOver = function( self ) self.items[1].color = BLACK end, notMouseOver = function( self ) self.items[1].color = RL.BLACK end,
drawBounds = true, drawBounds = true,
} ) } )
@@ -58,7 +58,7 @@ function initGui()
HAling = Gui.ALING.CENTER, HAling = Gui.ALING.CENTER,
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
visible = true, 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 ) } ) ) 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( { local element = Gui.element:new( {
bounds = Rect:new( 0, 0, 120, 30 ), bounds = Rect:new( 0, 0, 120, 30 ),
onClicked = function() panel:setPosition( Vec2:new( 340, 380 ) ) end, onClicked = function() panel:setPosition( Vec2:new( 340, 380 ) ) end,
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end, onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
drawBounds = true, drawBounds = true,
} ) } )
@@ -97,8 +97,8 @@ function initGui()
local element = Gui.element:new( { local element = Gui.element:new( {
bounds = itemBounds:clone(), bounds = itemBounds:clone(),
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end, onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
drawBounds = true, drawBounds = true,
} ) } )
element:add( Gui.text:new( { text = "Dog" } ) ) element:add( Gui.text:new( { text = "Dog" } ) )
@@ -107,8 +107,8 @@ function initGui()
element = Gui.element:new( { element = Gui.element:new( {
bounds = Rect:new( 0, 0, 78, 24 ), bounds = Rect:new( 0, 0, 78, 24 ),
-- bounds = Rect:new( 0, 0, 78, 64 ), -- bounds = Rect:new( 0, 0, 78, 64 ),
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end, onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end, notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
drawBounds = true, drawBounds = true,
} ) } )
element:add( Gui.text:new( { text = "Cat" } ) ) element:add( Gui.text:new( { text = "Cat" } ) )
@@ -123,39 +123,38 @@ function initGui()
textInput = Gui.element:new( { textInput = Gui.element:new( {
bounds = Rect:new( 64, 360, 300, 32 ), bounds = Rect:new( 64, 360, 300, 32 ),
drawBounds = true, drawBounds = true,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
onClicked = function() Gui.setInputFocus( textInput ) end, 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() container:delete() end,
-- inputFocus = function() panel:set2Back() 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 } ) ) textInput:add( Gui.text:new( { text = "", maxTextLen = 16, allowLineBreak = false } ) )
end end
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
winSize = RL_GetScreenSize() winSize = RL.GetScreenSize()
RL_SetWindowTitle( "ReiLuaGui Test" ) RL.SetWindowTitle( "ReiLuaGui Test" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
initGui() initGui()
end end
function process( delta ) function RL.process( delta )
Gui.process( Vec2:new( RL_GetMousePosition() ) ) Gui.process( Vec2:new( RL.GetMousePosition() ) )
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
Gui.draw() Gui.draw()
RL_DrawText( 0, "Work in progress GuiLib test.", { 10, 10 }, 30, 4, BLACK )
end end

View File

@@ -42,23 +42,23 @@ function Bunny:update()
end end
end end
function init() function RL.init()
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( { screenWidth, screenHeight } ) RL.SetWindowSize( { screenWidth, screenHeight } )
RL_SetWindowTitle( "raylib [textures] example - bunnymark" ) RL.SetWindowTitle( "raylib [textures] example - bunnymark" )
-- Load bunny texture -- Load bunny texture
texBunny = RL_LoadTexture( RL_GetBasePath().."../resources/images/wabbit_alpha.png" ) texBunny = RL.LoadTexture( RL.GetBasePath().."../resources/images/wabbit_alpha.png" )
texSize = RL_GetTextureSize( texBunny ) texSize = RL.GetTextureSize( texBunny )
end end
function process( delta ) function RL.process( delta )
if RL_IsMouseButtonDown( 0 ) then if RL.IsMouseButtonDown( 0 ) then
-- Create more bunnies -- Create more bunnies
for i = 1, 100 do for i = 1, 100 do
if #bunnies < MAX_BUNNIES then if #bunnies < MAX_BUNNIES then
local speed = { math.random( -250, 250 ) / 60, math.random( -250, 250 ) / 60 } local speed = { math.random( -250, 250 ) / 60, math.random( -250, 250 ) / 60 }
local color = { math.random( 50, 240 ), math.random( 80, 240 ), math.random( 100, 240 ), 255 } local color = { math.random( 50, 240 ), math.random( 80, 240 ), math.random( 100, 240 ), 255 }
table.insert( bunnies, Bunny:new( RL_GetMousePosition(), speed, color ) ) table.insert( bunnies, Bunny:new( RL.GetMousePosition(), speed, color ) )
end end
end end
end end
@@ -68,8 +68,8 @@ function process( delta )
end end
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
for _, bunny in ipairs( bunnies ) do for _, bunny in ipairs( bunnies ) do
-- NOTE: When internal batch buffer limit is reached (MAX_BATCH_ELEMENTS), -- NOTE: When internal batch buffer limit is reached (MAX_BATCH_ELEMENTS),
@@ -78,11 +78,11 @@ function draw()
-- Process of sending data is costly and it could happen that GPU data has not been completely -- Process of sending data is costly and it could happen that GPU data has not been completely
-- processed for drawing while new data is tried to be sent (updating current in-use buffers) -- processed for drawing while new data is tried to be sent (updating current in-use buffers)
-- it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies -- it could generates a stall and consequently a frame drop, limiting the number of drawn bunnies
RL_DrawTexture( texBunny, { bunny.position[1], bunny.position[2] }, bunny.color ) RL.DrawTexture( texBunny, { bunny.position[1], bunny.position[2] }, bunny.color )
end end
RL_DrawRectangle( { 0, 0, screenWidth, 40 }, BLACK) RL.DrawRectangle( { 0, 0, screenWidth, 40 }, RL.BLACK)
RL_DrawText( 0, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, GREEN ) RL.DrawText( 0, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, RL.GREEN )
RL_DrawText( 0, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RED ) RL.DrawText( 0, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RL.RED )
RL_DrawFPS( { 10, 10 } ) RL.DrawFPS( { 10, 10 } )
end end

View File

@@ -4,12 +4,12 @@ local camera = -1
local texture = -1 local texture = -1
local textureSize = { 256, 96 } local textureSize = { 256, 96 }
local res = { 384, 216 } local res = { 384, 216 }
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
local winScale = 4 local winScale = 4
local framebuffer = -1 local framebuffer = -1
local TILE_SIZE = 32 local TILE_SIZE = 32
local TILE_VERTEX_COLORS = { WHITE, WHITE, WHITE, WHITE } local TILE_VERTEX_COLORS = { RL.WHITE, RL.WHITE, RL.WHITE, RL.WHITE }
local FLOOR = 1 local FLOOR = 1
local CEILING = 2 local CEILING = 2
@@ -51,38 +51,37 @@ local function getTileVer( x, y, type )
return verts return verts
end end
function drawSprites() local function drawSprites()
for _, sprite in ipairs( sprites ) do for _, sprite in ipairs( sprites ) do
sprite.dis = RL_Vector2Distance( { pos[1], pos[3] }, { sprite.pos[1], sprite.pos[2] } ) sprite.dis = RL.Vector2Distance( { pos[1], pos[3] }, { sprite.pos[1], sprite.pos[2] } )
end end
table.sort( sprites, function( a, b ) return a.dis > b.dis end ) table.sort( sprites, function( a, b ) return a.dis > b.dis end )
for _, sprite in ipairs( sprites ) do for _, sprite in ipairs( sprites ) do
RL_DrawBillboardRec( camera, texture, { sprite.tile[1] * TILE_SIZE, sprite.tile[2] * TILE_SIZE, TILE_SIZE, TILE_SIZE }, RL.DrawBillboardRec( camera, texture, { sprite.tile[1] * TILE_SIZE, sprite.tile[2] * TILE_SIZE, TILE_SIZE, TILE_SIZE },
{ sprite.pos[1], 0.5 * sprite.size, sprite.pos[2] }, { sprite.size, sprite.size }, WHITE ) { sprite.pos[1], 0.5 * sprite.size, sprite.pos[2] }, { sprite.size, sprite.size }, RL.WHITE )
end end
end end
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
winSize = { res[1] * winScale, res[2] * winScale } winSize = { res[1] * winScale, res[2] * winScale }
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetExitKey( KEY_ESCAPE ) RL.SetExitKey( RL.KEY_ESCAPE )
-- framebuffer = RL_LoadRenderTexture( res ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" ) texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, pos ) RL.SetCamera3DPosition( camera, pos )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FIRST_PERSON ) RL.SetCameraMode( camera, RL.CAMERA_FIRST_PERSON )
-- for x = 0, 3 do -- for x = 0, 3 do
-- for y = 0, 9 do -- for y = 0, 9 do
@@ -94,41 +93,41 @@ function init()
table.insert( sprites, { pos = { 0.5, 3.5 }, tile = { 3, 0 }, dis = 0, size = 0.7 } ) table.insert( sprites, { pos = { 0.5, 3.5 }, tile = { 3, 0 }, dis = 0, size = 0.7 } )
end end
function draw() function RL.draw()
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
pos = RL_GetCamera3DPosition( camera ) pos = RL.GetCamera3DPosition( camera )
-- RL_BeginTextureMode( framebuffer ) -- RL.BeginTextureMode( framebuffer )
RL_ClearBackground( { 100, 150, 150 } ) RL.ClearBackground( { 100, 150, 150 } )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
-- Floor and ceiling. -- Floor and ceiling.
for x = 0, 3 do for x = 0, 3 do
for y = 0, 10 do for y = 0, 10 do
RL_DrawQuad3DTexture( texture, getTileVer( x, y, FLOOR ), getTexCoords( 1, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( x, y, FLOOR ), getTexCoords( 1, 0 ), TILE_VERTEX_COLORS )
RL_DrawQuad3DTexture( texture, getTileVer( x, y, CEILING ), getTexCoords( 2, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( x, y, CEILING ), getTexCoords( 2, 0 ), TILE_VERTEX_COLORS )
end end
end end
-- Walls. -- Walls.
RL_DrawQuad3DTexture( texture, getTileVer( 0, 0, WALL_N ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 0, 0, WALL_N ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
RL_DrawQuad3DTexture( texture, getTileVer( 1, 0, WALL_N ), getTexCoords( 0, 2 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 1, 0, WALL_N ), getTexCoords( 0, 2 ), TILE_VERTEX_COLORS )
RL_DrawQuad3DTexture( texture, getTileVer( 2, 0, WALL_N ), getTexCoords( 2, 2 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 2, 0, WALL_N ), getTexCoords( 2, 2 ), TILE_VERTEX_COLORS )
RL_DrawQuad3DTexture( texture, getTileVer( 3, 0, WALL_N ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 3, 0, WALL_N ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
for x = 0, 3 do for x = 0, 3 do
RL_DrawQuad3DTexture( texture, getTileVer( x, 10, WALL_S ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( x, 10, WALL_S ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
end end
for y = 0, 10 do for y = 0, 10 do
RL_DrawQuad3DTexture( texture, getTileVer( 0, y, WALL_W ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 0, y, WALL_W ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
RL_DrawQuad3DTexture( texture, getTileVer( 3, y, WALL_E ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS ) RL.DrawQuad3DTexture( texture, getTileVer( 3, y, WALL_E ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
end end
drawSprites() drawSprites()
RL_EndMode3D() RL.EndMode3D()
-- RL_EndTextureMode() -- RL.EndTextureMode()
-- RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE ) -- RL.SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE )
-- RL_DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, WHITE ) -- RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, WHITE )
-- RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) -- RL.SetTextureSource( TEXTURE_SOURCE_TEXTURE )
end end

View File

@@ -20,94 +20,92 @@ local colorPicker = { color = { 255, 255, 255 } }
local colorPanel = { color = { 255, 255, 255 }, alpha = 1.0, hue = 1.0, oldHue = 1.0 } local colorPanel = { color = { 255, 255, 255 }, alpha = 1.0, hue = 1.0, oldHue = 1.0 }
local comboBoxActive = 0 local comboBoxActive = 0
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = { 1920, 1080 } local winSize = { 1920, 1080 }
RL_GuiSetFont( 0 ) RL.GuiSetFont( 0 )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
end end
function process( delta ) function RL.process( delta )
end end
function draw() function RL.draw()
RL_ClearBackground( { 50, 20, 75 } ) RL.ClearBackground( { 50, 20, 75 } )
-- if RL_GuiButton( { 112, 16, 96, 32 }, "Exit" ) then if RL.GuiButton( { 112, 16, 96, 32 }, RL.GuiIconText( 113, "Exit" ) ) then
if RL_GuiButton( { 112, 16, 96, 32 }, RL_GuiIconText( 113, "Exit" ) ) then RL.CloseWindow()
RL_CloseWindow()
end end
if windowOpen and RL_GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then if windowOpen and RL.GuiWindowBox( { 300, 16, 200, 320 }, "Window" ) then
windowOpen = false windowOpen = false
end end
RL_GuiPanel( { 60, 260, 100, 100 }, "Panel" ) RL.GuiPanel( { 60, 260, 100, 100 }, "Panel" )
toggled = RL_GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled ) toggled = RL.GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
index = RL_GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index ) index = RL.GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
checkbox = RL_GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox ) checkbox = RL.GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
local textBoxToggle = false local textBoxToggle = false
textBoxToggle, textBoxText = RL_GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive ) textBoxToggle, textBoxText = RL.GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive )
-- textBoxToggle, textBoxText = RL_GuiTextBoxMulti( { 32, 400, 120, 64 }, textBoxText, 120, textBoxActive ) -- textBoxToggle, textBoxText = RL.GuiTextBoxMulti( { 32, 400, 120, 64 }, textBoxText, 120, textBoxActive )
if textBoxToggle then if textBoxToggle then
textBoxActive = not textBoxActive textBoxActive = not textBoxActive
end end
local spinnerToggle = false local spinnerToggle = false
spinnerToggle, spinnerValue = RL_GuiSpinner( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive ) spinnerToggle, spinnerValue = RL.GuiSpinner( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive )
-- spinnerToggle, spinnerValue = RL_GuiValueBox( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive ) -- spinnerToggle, spinnerValue = RL.GuiValueBox( { 64, 450, 96, 32 }, "Value", spinnerValue, spinnerValueRange[1], spinnerValueRange[2], spinnerActive )
if spinnerToggle then if spinnerToggle then
spinnerActive = not spinnerActive spinnerActive = not spinnerActive
end end
sliderValue = RL_GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] ) sliderValue = RL.GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] )
scrollbarValue = RL_GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 ) scrollbarValue = RL.GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 )
local dropdownToggle = false local dropdownToggle = false
dropdownToggle, dropdownValue = RL_GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive ) dropdownToggle, dropdownValue = RL.GuiDropdownBox( { 2, 2, 96, 16 }, "Cat\nDog\nMonkey", dropdownValue, dropdownActive )
if dropdownToggle then if dropdownToggle then
dropdownActive = not dropdownActive dropdownActive = not dropdownActive
end end
listView.item, listView.scroll = RL_GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item ) listView.item, listView.scroll = RL.GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item )
-- listViewEx.item, listViewEx.scroll, listViewEx.focus = RL_GuiListViewEx( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listViewEx.focus, listViewEx.scroll, listViewEx.item ) messageBox.buttonIndex = RL.GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
messageBox.buttonIndex = RL_GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
if 0 <= messageBox.buttonIndex then if 0 <= messageBox.buttonIndex then
print( "messageBox.buttonIndex", messageBox.buttonIndex ) print( "messageBox.buttonIndex", messageBox.buttonIndex )
end end
textInputBox.buttonIndex, textInputBox.text, textInputBox.secretViewActive textInputBox.buttonIndex, textInputBox.text, textInputBox.secretViewActive
= RL_GuiTextInputBox( { 420, 510, 300, 150 }, "Input Box", "Put text here", "Button",textInputBox.text, 200, textInputBox.secretViewActive ) = RL.GuiTextInputBox( { 420, 510, 300, 150 }, "Input Box", "Put text here", "Button",textInputBox.text, 200, textInputBox.secretViewActive )
if 0 <= textInputBox.buttonIndex then if 0 <= textInputBox.buttonIndex then
print( "textInputBox.buttonIndex", textInputBox.buttonIndex ) print( "textInputBox.buttonIndex", textInputBox.buttonIndex )
end end
colorPicker.color = RL_GuiColorPicker( { 620, 20, 150, 150 }, "Color Picker", colorPicker.color ) colorPicker.color = RL.GuiColorPicker( { 620, 20, 150, 150 }, "Color Picker", colorPicker.color )
colorPanel.color = RL_GuiColorPanel( { 820, 20, 150, 150 }, "Color Panel", colorPanel.color ) colorPanel.color = RL.GuiColorPanel( { 820, 20, 150, 150 }, "Color Panel", colorPanel.color )
colorPanel.alpha = RL_GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha ) colorPanel.alpha = RL.GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha )
colorPanel.hue = RL_GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue ) colorPanel.hue = RL.GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
if colorPanel.hue ~= colorPanel.oldHue then if colorPanel.hue ~= colorPanel.oldHue then
colorPanel.oldHue = colorPanel.hue colorPanel.oldHue = colorPanel.hue
colorPanel.color = RL_ColorFromHSV( colorPanel.hue, 1.0, 1.0 ) colorPanel.color = RL.ColorFromHSV( colorPanel.hue, 1.0, 1.0 )
end end
RL_GuiDrawIcon( 121, { 6, 20 }, 2, WHITE ) RL.GuiDrawIcon( 121, { 6, 20 }, 2, RL.WHITE )
comboBoxActive = RL_GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive ) comboBoxActive = RL.GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
end end

View File

@@ -18,67 +18,67 @@ local dirtBottomRec = { 7 * TILE_SIZE, 0 * TILE_SIZE, TILE_SIZE, TILE_SIZE }
local matrix = {} local matrix = {}
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 8, 16 } ) RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FREE ) RL.SetCameraMode( camera, RL.CAMERA_FREE )
heigthImage = RL_LoadImage( RL_GetBasePath().."../resources/images/heightmap.png" ) heigthImage = RL.LoadImage( RL.GetBasePath().."../resources/images/heightmap.png" )
mesh = RL_GenMeshHeightmap( heigthImage, { 16, 4, 16 } ) mesh = RL.GenMeshHeightmap( heigthImage, { 16, 4, 16 } )
tilesetTex = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" ) tilesetTex = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
groundTexture = RL_LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } ) groundTexture = RL.LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } )
-- Draw to ground texture. -- Draw to ground texture.
RL_BeginTextureMode( groundTexture ) RL.BeginTextureMode( groundTexture )
for x = 1, 16 do for x = 1, 16 do
for y = 1, 16 do for y = 1, 16 do
local pos = { x - 1, y - 1 } local pos = { x - 1, y - 1 }
if 4 < x and x < 14 and 4 < y and y < 8 then if 4 < x and x < 14 and 4 < y and y < 8 then
RL_DrawTextureRec( tilesetTex, dirtRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, dirtRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
elseif 4 == x and 4 < y and y < 8 then elseif 4 == x and 4 < y and y < 8 then
RL_DrawTextureRec( tilesetTex, dirtRightRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, dirtRightRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
elseif 14 == x and 4 < y and y < 8 then elseif 14 == x and 4 < y and y < 8 then
RL_DrawTextureRec( tilesetTex, dirtLeftRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, dirtLeftRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
elseif 4 < x and x < 14 and 4 == y then elseif 4 < x and x < 14 and 4 == y then
RL_DrawTextureRec( tilesetTex, dirtTopRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, dirtTopRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
elseif 4 < x and x < 14 and 8 == y then elseif 4 < x and x < 14 and 8 == y then
RL_DrawTextureRec( tilesetTex, dirtBottomRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, dirtBottomRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
else else
RL_DrawTextureRec( tilesetTex, grassRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tilesetTex, grassRec, { pos[1] * TILE_SIZE, pos[2] * TILE_SIZE }, RL.WHITE )
end end
end end
end end
RL_EndTextureMode() RL.EndTextureMode()
material = RL_LoadMaterialDefault() material = RL.LoadMaterialDefault()
RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
-- RL_GenTextureMipmaps( groundTexture ) -- RL.GenTextureMipmaps( groundTexture )
-- RL_SetTextureFilter( groundTexture, TEXTURE_FILTER_TRILINEAR ) -- RL.SetTextureFilter( groundTexture, TEXTURE_FILTER_TRILINEAR )
RL_SetMaterialTexture( material, MATERIAL_MAP_ALBEDO, groundTexture ) RL.SetMaterialTexture( material, RL.MATERIAL_MAP_ALBEDO, groundTexture )
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
matrix = RL_MatrixMultiply( RL_MatrixIdentity(), RL_MatrixTranslate( { -4, 0, -4 } ) ) matrix = RL.MatrixMultiply( RL.MatrixIdentity(), RL.MatrixTranslate( { -4, 0, -4 } ) )
end end
function draw() function RL.draw()
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawMesh( mesh, material, matrix ) RL.DrawMesh( mesh, material, matrix )
RL_EndMode3D() RL.EndMode3D()
end end

View File

@@ -5,40 +5,40 @@ local catImage = -1
local catCopy = -1 local catCopy = -1
local textImage = -1 local textImage = -1
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
image = RL_GenImageColor( winSize[1], winSize[2], WHITE ) image = RL.GenImageColor( winSize[1], winSize[2], RL.WHITE )
-- Test changing working directory. -- Test changing working directory.
RL_ChangeDirectory( RL_GetBasePath().."../resources" ) RL.ChangeDirectory( RL.GetBasePath().."../resources" )
catImage = RL_LoadImage( RL_GetWorkingDirectory().."/images/cat.png" ) catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" )
RL_ImageClearBackground( image, { 150, 60, 100 } ) RL.ImageClearBackground( image, { 150, 60, 100 } )
RL_ImageDrawPixel( image, { 32, 32 }, WHITE ) RL.ImageDrawPixel( image, { 32, 32 }, RL.WHITE )
RL_ImageDrawLine( image, { 32, 45 }, { 100, 60 }, GREEN ) RL.ImageDrawLine( image, { 32, 45 }, { 100, 60 }, RL.GREEN )
RL_ImageDrawCircle( image, { 64, 32 }, 16, BLUE ) RL.ImageDrawCircle( image, { 64, 32 }, 16, RL.BLUE )
RL_ImageDrawRectangle( image, { 120, 64, 32, 64 }, BLUE ) RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE )
RL_ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, BLUE ) RL.ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, RL.BLUE )
RL_ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, WHITE ) RL.ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, RL.WHITE )
RL_ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, WHITE ) RL.ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, RL.WHITE )
local src = { 80, 70, 96, 96 } local src = { 80, 70, 96, 96 }
catCopy = RL_ImageFromImage( catImage, src ) catCopy = RL.ImageFromImage( catImage, src )
RL_ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, WHITE ) RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE )
textImage = RL_ImageText( 0, "Cat", 10, 4, WHITE ) textImage = RL.ImageText( 0, "Cat", 10, 4, RL.WHITE )
local imageSize = RL_GetImageSize( textImage ) local imageSize = RL.GetImageSize( textImage )
RL_ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, WHITE ) RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE )
texture = RL_LoadTextureFromImage( image ) texture = RL.LoadTextureFromImage( image )
end end
function draw() function RL.draw()
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_DrawTexture( texture, { 0, 0 }, WHITE ) RL.DrawTexture( texture, { 0, 0 }, RL.WHITE )
end end

View File

@@ -18,94 +18,94 @@ local shader
local matInstances local matInstances
local matDefault local matDefault
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Instancing" ) RL.SetWindowTitle( "Instancing" )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
-- Define the camera to look into our 3d world -- Define the camera to look into our 3d world
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { -125.0, 125.0, -125.0 } ) RL.SetCamera3DPosition( camera, { -125.0, 125.0, -125.0 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCamera3DFovy( camera, 45 ) RL.SetCamera3DFovy( camera, 45 )
RL_SetCameraMode( camera, CAMERA_ORBITAL ) RL.SetCameraMode( camera, RL.CAMERA_ORBITAL )
-- Define mesh to be instanced -- Define mesh to be instanced
cube = RL_GenMeshCube( { 1, 1, 1 } ) cube = RL.GenMeshCube( { 1, 1, 1 } )
-- Translate and rotate cubes randomly -- Translate and rotate cubes randomly
for i = 1, MAX_INSTANCES do for i = 1, MAX_INSTANCES do
local translation = RL_MatrixTranslate( { math.random( -50, 50 ), math.random( -50, 50 ), math.random( -50, 50 ) } ) local translation = RL.MatrixTranslate( { math.random( -50, 50 ), math.random( -50, 50 ), math.random( -50, 50 ) } )
local axis = RL_Vector3Normalize( { math.random( 0, 360 ), math.random( 0, 360 ), math.random( 0, 360 ) } ) local axis = RL.Vector3Normalize( { math.random( 0, 360 ), math.random( 0, 360 ), math.random( 0, 360 ) } )
local angle = math.rad( math.random( 0, 10 ) ) local angle = math.rad( math.random( 0, 10 ) )
local rotation = RL_MatrixRotate( axis, angle ) local rotation = RL.MatrixRotate( axis, angle )
table.insert( transforms, RL_MatrixMultiply( rotation, translation ) ) table.insert( transforms, RL.MatrixMultiply( rotation, translation ) )
end end
-- Load lighting shader -- Load lighting shader
shader = RL_LoadShader( RL_GetBasePath().."../resources/shaders/glsl330/lighting_instancing.vs", shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lighting_instancing.vs",
RL_GetBasePath().."../resources/shaders/glsl330/lighting.fs" ) RL.GetBasePath().."../resources/shaders/glsl330/lighting.fs" )
-- Get shader locations -- Get shader locations
local mvpLoc = RL_GetShaderLocation( shader, "mvp" ) local mvpLoc = RL.GetShaderLocation( shader, "mvp" )
local viewPosLoc = RL_GetShaderLocation( shader, "viewPos" ) local viewPosLoc = RL.GetShaderLocation( shader, "viewPos" )
local instanceTransformLoc = RL_GetShaderLocationAttrib( shader, "instanceTransform" ) local instanceTransformLoc = RL.GetShaderLocationAttrib( shader, "instanceTransform" )
RL_SetShaderLocationIndex( shader, SHADER_LOC_MATRIX_MVP, mvpLoc ) RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_MATRIX_MVP, mvpLoc )
RL_SetShaderLocationIndex( shader, SHADER_LOC_VECTOR_VIEW, viewPosLoc ) RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_VECTOR_VIEW, viewPosLoc )
RL_SetShaderLocationIndex( shader, SHADER_LOC_MATRIX_MODEL, instanceTransformLoc ) RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_MATRIX_MODEL, instanceTransformLoc )
-- Set shader value: ambient light level -- Set shader value: ambient light level
local ambientLoc = RL_GetShaderLocation( shader, "ambient" ) local ambientLoc = RL.GetShaderLocation( shader, "ambient" )
RL_SetShaderValue( shader, ambientLoc, { 0.2, 0.2, 0.2, 0.1 }, SHADER_UNIFORM_VEC4 ) RL.SetShaderValue( shader, ambientLoc, { 0.2, 0.2, 0.2, 0.1 }, RL.SHADER_UNIFORM_VEC4 )
-- Create one light -- Create one light
RL_CreateLight( LIGHT_DIRECTIONAL, { 50.0, 50.0, 0.0 }, RL_Vector3Zero(), WHITE, shader ) RL.CreateLight( RL.LIGHT_DIRECTIONAL, { 50.0, 50.0, 0.0 }, RL.Vector3Zero(), RL.WHITE, shader )
-- NOTE: We are assigning the intancing shader to material.shader -- NOTE: We are assigning the intancing shader to material.shader
-- to be used on mesh drawing with DrawMeshInstanced() -- to be used on mesh drawing with DrawMeshInstanced()
matInstances = RL_LoadMaterialDefault() matInstances = RL.LoadMaterialDefault()
RL_SetMaterialShader( matInstances, shader ) RL.SetMaterialShader( matInstances, shader )
RL_SetMaterialColor( matInstances, MATERIAL_MAP_DIFFUSE, RED ) RL.SetMaterialColor( matInstances, RL.MATERIAL_MAP_DIFFUSE, RL.RED )
-- Load default material (using raylib intenral default shader) for non-instanced mesh drawing -- Load default material (using raylib intenral default shader) for non-instanced mesh drawing
-- WARNING: Default shader enables vertex color attribute BUT GenMeshCube() does not generate vertex colors, so, -- WARNING: Default shader enables vertex color attribute BUT GenMeshCube() does not generate vertex colors, so,
-- when drawing the color attribute is disabled and a default color value is provided as input for thevertex attribute -- when drawing the color attribute is disabled and a default color value is provided as input for thevertex attribute
matDefault = RL_LoadMaterialDefault() matDefault = RL.LoadMaterialDefault()
RL_SetMaterialColor( matDefault, MATERIAL_MAP_DIFFUSE, BLUE ) RL.SetMaterialColor( matDefault, RL.MATERIAL_MAP_DIFFUSE, RL.BLUE )
end end
function process( delta ) function RL.process( delta )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
-- Update the light shader with the camera view position -- Update the light shader with the camera view position
local loc = RL_GetShaderLocationIndex( shader, SHADER_LOC_VECTOR_VIEW ) local loc = RL.GetShaderLocationIndex( shader, RL.SHADER_LOC_VECTOR_VIEW )
RL_SetShaderValue( shader, loc, RL_GetCamera3DPosition( camera ), SHADER_UNIFORM_VEC3 ) RL.SetShaderValue( shader, loc, RL.GetCamera3DPosition( camera ), RL.SHADER_UNIFORM_VEC3 )
end end
function draw() function RL.draw()
RL_ClearBackground( DARKBLUE ) RL.ClearBackground( RL.DARKBLUE )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
-- Draw cube mesh with default material (BLUE) -- Draw cube mesh with default material (BLUE)
RL_DrawMesh( cube, matDefault, RL_MatrixTranslate( { -10.0, 0.0, 0.0 } ) ) RL.DrawMesh( cube, matDefault, RL.MatrixTranslate( { -10.0, 0.0, 0.0 } ) )
-- Draw meshes instanced using material containing instancing shader (RED + lighting), -- Draw meshes instanced using material containing instancing shader (RED + lighting),
-- transforms[] for the instances should be provided, they are dynamically -- transforms[] for the instances should be provided, they are dynamically
-- updated in GPU every frame, so we can animate the different mesh instances -- updated in GPU every frame, so we can animate the different mesh instances
RL_DrawMeshInstanced( cube, matInstances, transforms, MAX_INSTANCES ) RL.DrawMeshInstanced( cube, matInstances, transforms, MAX_INSTANCES )
-- Draw cube mesh with default material (BLUE) -- Draw cube mesh with default material (BLUE)
RL_DrawMesh( cube, matDefault, RL_MatrixTranslate( { 10.0, 0.0, 0.0 } ) ) RL.DrawMesh( cube, matDefault, RL.MatrixTranslate( { 10.0, 0.0, 0.0 } ) )
RL_EndMode3D() RL.EndMode3D()
RL_DrawFPS( { 10, 10 } ) RL.DrawFPS( { 10, 10 } )
end end

View File

@@ -2,7 +2,6 @@
local monitor = 0 local monitor = 0
local camera = -1 local camera = -1
local texture = -1
local material = -1 local material = -1
local model = -1 local model = -1
local animations = -1 local animations = -1
@@ -12,41 +11,41 @@ local curAnim = 0
local frameCount = 0 local frameCount = 0
local animSpeed = 60 local animSpeed = 60
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 2, 4 } ) RL.SetCamera3DPosition( camera, { 0, 2, 4 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FREE ) RL.SetCameraMode( camera, RL.CAMERA_FREE )
material = RL_CreateMaterial( { material = RL.CreateMaterial( {
maps = { maps = {
{ {
MATERIAL_MAP_ALBEDO, RL.MATERIAL_MAP_ALBEDO,
{ {
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/monkey_tex.png" ), texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" ),
color = WHITE, color = RL.WHITE,
}, },
}, },
}, },
} ) } )
model = RL_LoadModel( RL_GetBasePath().."../resources/iqm/monkey.iqm" ) model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
RL_SetModelMaterial( model, 0, material ) RL.SetModelMaterial( model, 0, material )
animations, animationCount = RL_LoadModelAnimations( RL_GetBasePath().."../resources/iqm/monkey.iqm" ) animations, animationCount = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
print( "animationCount", animationCount ) print( "animationCount", animationCount )
end end
function process( delta ) function RL.process( delta )
if RL_IsKeyPressed( KEY_ENTER ) then if RL.IsKeyPressed( RL.KEY_ENTER ) then
curAnim = curAnim + 1 curAnim = curAnim + 1
if animationCount <= curAnim then if animationCount <= curAnim then
@@ -54,15 +53,15 @@ function process( delta )
end end
frame = 0.0 frame = 0.0
frameCount = RL_GetModelAnimationFrameCount( animations, curAnim ) frameCount = RL.GetModelAnimationFrameCount( animations, curAnim )
elseif RL_IsKeyPressed( KEY_UP ) then elseif RL.IsKeyPressed( RL.KEY_UP ) then
animSpeed = animSpeed + 5 animSpeed = animSpeed + 5
elseif RL_IsKeyPressed( KEY_DOWN ) then elseif RL.IsKeyPressed( RL.KEY_DOWN ) then
animSpeed = animSpeed - 5 animSpeed = animSpeed - 5
end end
if RL_IsKeyDown( KEY_SPACE ) then if RL.IsKeyDown( RL.KEY_SPACE ) then
RL_UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) ) RL.UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) )
frame = frame + animSpeed * delta frame = frame + animSpeed * delta
if frameCount < frame then if frameCount < frame then
@@ -73,19 +72,19 @@ function process( delta )
end end
end end
function draw() function RL.draw()
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawGrid( 8, 1 ) RL.DrawGrid( 8, 1 )
RL_DrawModelEx( model, { 0, 0, 0 }, { 1.0, 0.0, 0.0 }, -90.0, { 1.0, 1.0, 1.0 }, WHITE ) RL.DrawModelEx( model, { 0, 0, 0 }, { 1.0, 0.0, 0.0 }, -90.0, { 1.0, 1.0, 1.0 }, RL.WHITE )
RL_EndMode3D() RL.EndMode3D()
RL_DrawText( 0, RL.DrawText( 0,
"Enter: Change animation\ "Enter: Change animation\
Space: Play animation\ Space: Play animation\
Up arrow: Inreace animation speed\ Up arrow: Inreace animation speed\
Down arrow: Decreace animation speed", Down arrow: Decreace animation speed",
{ 10, 10 }, 30, 5, WHITE ) { 10, 10 }, 30, 5, RL.WHITE )
end end

View File

@@ -10,20 +10,20 @@ local shader = -1
local matrix = {} local matrix = {}
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 8, 16 } ) RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FREE ) RL.SetCameraMode( camera, RL.CAMERA_FREE )
local ts = PLANE_SIZE local ts = PLANE_SIZE
local meshData = { local meshData = {
@@ -33,61 +33,61 @@ function init()
{ 0, 0 }, { ts, ts }, { ts, 0 } }, { 0, 0 }, { ts, ts }, { ts, 0 } },
texcoords2 = { { 0, 0 }, { 0, 1 }, { 1, 1 }, texcoords2 = { { 0, 0 }, { 0, 1 }, { 1, 1 },
{ 0, 0 }, { 1, 1 }, { 1, 0 } }, { 0, 0 }, { 1, 1 }, { 1, 0 } },
colors = { WHITE, WHITE, WHITE, colors = { RL.WHITE, RL.WHITE, RL.WHITE,
WHITE, WHITE, WHITE }, RL.WHITE, RL.WHITE, RL.WHITE },
normals = { { 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 }, normals = { { 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 },
{ 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 } }, { 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 } },
} }
mesh = RL_GenMeshCustom( meshData, true ) mesh = RL.GenMeshCustom( meshData, true )
-- local meshEdit = { -- local meshEdit = {
-- vertices = { { 0, 1, 0 }, { 0, 0, PLANE_SIZE }, { PLANE_SIZE, 0, PLANE_SIZE }, -- vertices = { { 0, 1, 0 }, { 0, 0, PLANE_SIZE }, { PLANE_SIZE, 0, PLANE_SIZE },
-- { 0, 1, 0 }, { PLANE_SIZE, 0, PLANE_SIZE }, { PLANE_SIZE, 0, 0 } }, -- { 0, 1, 0 }, { PLANE_SIZE, 0, PLANE_SIZE }, { PLANE_SIZE, 0, 0 } },
-- } -- }
-- RL_UpdateMesh( mesh, meshEdit ) -- RL.UpdateMesh( mesh, meshEdit )
tileTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" ) tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tile.png" )
RL_GenTextureMipmaps( tileTexture ) RL.GenTextureMipmaps( tileTexture )
RL_SetTextureFilter( tileTexture, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( tileTexture, RL.TEXTURE_FILTER_TRILINEAR )
lightmap = RL_LoadTexture( RL_GetBasePath().."../resources/images/lightmap.png" ) lightmap = RL.LoadTexture( RL.GetBasePath().."../resources/images/lightmap.png" )
RL_GenTextureMipmaps( lightmap ) RL.GenTextureMipmaps( lightmap )
RL_SetTextureFilter( lightmap, TEXTURE_FILTER_TRILINEAR ) RL.SetTextureFilter( lightmap, RL.TEXTURE_FILTER_TRILINEAR )
RL_SetTextureWrap( lightmap, TEXTURE_WRAP_CLAMP ) RL.SetTextureWrap( lightmap, RL.TEXTURE_WRAP_CLAMP )
shader = RL_LoadShader( RL_GetBasePath().."../resources/shaders/glsl330/lightmap.vs", shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
RL_GetBasePath().."../resources/shaders/glsl330/lightmap.fs" ) RL.GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
local materialData = { local materialData = {
shader = shader, shader = shader,
maps = { maps = {
{ {
MATERIAL_MAP_ALBEDO, RL.MATERIAL_MAP_ALBEDO,
{ {
texture = tileTexture, texture = tileTexture,
color = WHITE, color = RL.WHITE,
value = 1.0, value = 1.0,
}, },
}, },
{ {
MATERIAL_MAP_METALNESS, RL.MATERIAL_MAP_METALNESS,
{ {
texture = lightmap, texture = lightmap,
color = WHITE, color = RL.WHITE,
value = 1.0, value = 1.0,
}, },
}, },
}, },
} }
material = RL_CreateMaterial( materialData ) material = RL.CreateMaterial( materialData )
matrix = RL_MatrixMultiply( RL_MatrixIdentity(), RL_MatrixTranslate( { -4, 0, -4 } ) ) matrix = RL.MatrixMultiply( RL.MatrixIdentity(), RL.MatrixTranslate( { -4, 0, -4 } ) )
end end
function draw() function RL.draw()
RL_ClearBackground( { 25, 50, 50 } ) RL.ClearBackground( { 25, 50, 50 } )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawMesh( mesh, material, matrix ) RL.DrawMesh( mesh, material, matrix )
RL_EndMode3D() RL.EndMode3D()
end end

View File

@@ -2,24 +2,24 @@ local dstRec = { 160.0, 160.0, 8.0, 8.0 };
local origin = { 0.0, 0.0 } local origin = { 0.0, 0.0 }
-- local ninePatchInfo = { { 0.0, 0.0, 24.0, 24.0 }, 8, 8, 8, 8, NPATCH_NINE_PATCH } -- local ninePatchInfo = { { 0.0, 0.0, 24.0, 24.0 }, 8, 8, 8, 8, NPATCH_NINE_PATCH }
local ninePatchInfo = { source = { 0, 0, 24.0, 24.0 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH } local ninePatchInfo = { source = { 0, 0, 24.0, 24.0 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH }
local nPatchTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" ) local nPatchTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
function init() function RL.init()
RL_SetWindowTitle( "N-Patches" ) RL.SetWindowTitle( "N-Patches" )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
end end
function process( delta ) function RL.process( delta )
local mousePosition = RL_GetMousePosition(); local mousePosition = RL.GetMousePosition();
-- Resize the n-patch based on mouse position -- Resize the n-patch based on mouse position
dstRec[3] = mousePosition[1] - dstRec[1]; dstRec[3] = mousePosition[1] - dstRec[1];
dstRec[4] = mousePosition[2] - dstRec[2]; dstRec[4] = mousePosition[2] - dstRec[2];
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL_DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, WHITE ) RL.DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, RL.WHITE )
end end

View File

@@ -1,57 +1,56 @@
local tex = -1 local tex = -1
local pos = { 32, 32 } local pos = { 32, 32 }
local speed = 60.0 local speed = 60.0
local sound = -1
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local framebuffer = -1 local framebuffer = -1
local res = { 320, 180 } local res = { 320, 180 }
local scale = 5 local scale = 5
local winSize = { res[1] * scale, res[2] * scale } local winSize = { res[1] * scale, res[2] * scale }
function init() function RL.init()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
tex = RL_LoadTexture( RL_GetBasePath().."../resources/images/cat.png" ) tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
-- Create framebuffer. -- Create framebuffer.
framebuffer = RL_LoadRenderTexture( res ) framebuffer = RL.LoadRenderTexture( res )
end end
function process( delta ) function RL.process( delta )
if RL_IsKeyDown( KEY_RIGHT ) then if RL.IsKeyDown( RL.KEY_RIGHT ) then
pos[1] = pos[1] + delta * speed pos[1] = pos[1] + delta * speed
elseif RL_IsKeyDown( KEY_LEFT ) then elseif RL.IsKeyDown( RL.KEY_LEFT ) then
pos[1] = pos[1] - delta * speed pos[1] = pos[1] - delta * speed
end end
if RL_IsKeyDown( KEY_UP ) then if RL.IsKeyDown( RL.KEY_UP ) then
pos[2] = pos[2] - delta * speed pos[2] = pos[2] - delta * speed
elseif RL_IsKeyDown( KEY_DOWN ) then elseif RL.IsKeyDown( RL.KEY_DOWN ) then
pos[2] = pos[2] + delta * speed pos[2] = pos[2] + delta * speed
end end
if RL_IsWindowResized() then if RL.IsWindowResized() then
winSize = RL_GetScreenSize() winSize = RL.GetScreenSize()
end end
end end
function draw() function RL.draw()
RL_ClearBackground( { 0, 0, 0 } ) RL.ClearBackground( { 0, 0, 0 } )
RL_BeginTextureMode( framebuffer ) RL.BeginTextureMode( framebuffer )
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_DrawPixel( { 100, 100 }, { 255, 50, 100 } ) RL.DrawPixel( { 100, 100 }, { 255, 50, 100 } )
RL_DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 255 } ) RL.DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 255 } )
RL_DrawRectangle( { 200, 120, 40, 50 }, { 100, 170, 255 } ) RL.DrawRectangle( { 200, 120, 40, 50 }, { 100, 170, 255 } )
RL_DrawTexturePro( tex, { 166, 138, 128, 128 }, { pos[1], pos[2], 128, 128 }, { 16, 16 }, 0.0, WHITE ) RL.DrawTexturePro( tex, { 166, 138, 128, 128 }, { pos[1], pos[2], 128, 128 }, { 16, 16 }, 0.0, RL.WHITE )
RL_DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } ) RL.DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } )
RL_DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RED ) RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED )
RL_EndTextureMode() RL.EndTextureMode()
RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
RL_DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } )
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
end end

View File

@@ -1,8 +1,14 @@
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
util = require( "utillib" ) Util = require( "utillib" )
Vec2 = require( "vector2" ) Vec2 = require( "vector2" )
-- print( "RL", RL, #RL )
-- for i, v in pairs( RL ) do
-- print( i, v )
-- end
local TILE_SIZE = 16 local TILE_SIZE = 16
local PLAYER_MAXSPEED = 1.5 local PLAYER_MAXSPEED = 1.5
local PLAYER_ACCELL = 5 local PLAYER_ACCELL = 5
@@ -11,11 +17,11 @@ local GRAVITY = 6
local JUMP_STR = 3 local JUMP_STR = 3
local WALK_ANIM_SPEED = 12 local WALK_ANIM_SPEED = 12
local tex = RL_LoadTexture( RL_GetBasePath().."../resources/images/arcade_platformerV2.png" ) local tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/arcade_platformerV2.png" )
local res = Vec2:new( 160, 144 ) local res = Vec2:new( 160, 144 )
local winScale = 5 local winScale = 5
local winSize = res:scale( winScale ) local winSize = res:scale( winScale )
local framebuffer = RL_LoadRenderTexture( res ) local framebuffer = RL.LoadRenderTexture( res )
local monitor = 0 local monitor = 0
local tilemap = { local tilemap = {
size = Vec2:new( res.x / TILE_SIZE, res.y / TILE_SIZE ), size = Vec2:new( res.x / TILE_SIZE, res.y / TILE_SIZE ),
@@ -80,21 +86,21 @@ local function createMap()
tilemap.tiles[1][8] = 6 tilemap.tiles[1][8] = 6
end end
function init() function RL.init()
local monitorPos = Vec2:new( RL_GetMonitorPosition( monitor ) ) local monitorPos = Vec2:new( RL.GetMonitorPosition( monitor ) )
local monitorSize = Vec2:new( RL_GetMonitorSize( monitor ) ) local monitorSize = Vec2:new( RL.GetMonitorSize( monitor ) )
RL_SetWindowTitle( "Platformer" ) RL.SetWindowTitle( "Platformer" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } ) RL.SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } )
createMap() createMap()
end end
local function isTileWall( pos ) local function isTileWall( pos )
if RL_CheckCollisionPointRec( { pos.x, pos.y }, { 0, 0, tilemap.size.x - 1, tilemap.size.y - 1 } ) then if RL.CheckCollisionPointRec( { pos.x, pos.y }, { 0, 0, tilemap.size.x - 1, tilemap.size.y - 1 } ) then
return 0 < tilemap.tiles[ pos.x + 1 ][ pos.y + 1 ] return 0 < tilemap.tiles[ pos.x + 1 ][ pos.y + 1 ]
else else
return false return false
@@ -103,7 +109,7 @@ end
local function tileCollision( entity ) local function tileCollision( entity )
local vPos = entity.pos + entity.vel -- Future pos with current vel. local vPos = entity.pos + entity.vel -- Future pos with current vel.
local vRect = util.tableClone( entity.colRect ) local vRect = Util.tableClone( entity.colRect )
local tinyGap = 0.001 -- Tiny gap between collisionRect and tile to prevent getting stuck on all seams. local tinyGap = 0.001 -- Tiny gap between collisionRect and tile to prevent getting stuck on all seams.
-- Move test rect to predicted position. -- Move test rect to predicted position.
@@ -172,14 +178,14 @@ end
local function playerMovement( delta ) local function playerMovement( delta )
local moving = { false, false } local moving = { false, false }
if RL_IsKeyDown( KEY_RIGHT ) then if RL.IsKeyDown( RL.KEY_RIGHT ) then
player.vel.x = player.vel.x + PLAYER_ACCELL * delta player.vel.x = player.vel.x + PLAYER_ACCELL * delta
moving[1] = true moving[1] = true
if 0 < player.vel.x then if 0 < player.vel.x then
player.facing = 1 player.facing = 1
end end
elseif RL_IsKeyDown( KEY_LEFT ) then elseif RL.IsKeyDown( RL.KEY_LEFT ) then
player.vel.x = player.vel.x - PLAYER_ACCELL * delta player.vel.x = player.vel.x - PLAYER_ACCELL * delta
moving[1] = true moving[1] = true
@@ -188,7 +194,7 @@ local function playerMovement( delta )
end end
end end
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then if RL.IsKeyPressed( RL.KEY_SPACE ) and player.onFloor then
player.vel.y = -JUMP_STR player.vel.y = -JUMP_STR
player.onFloor = false player.onFloor = false
end end
@@ -205,7 +211,7 @@ local function playerMovement( delta )
end end
end end
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED ) player.vel.x = Util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
player.vel.y = player.vel.y + GRAVITY * delta player.vel.y = player.vel.y + GRAVITY * delta
@@ -220,16 +226,16 @@ local function playerMovement( delta )
player.colRect[2] = player.pos.y - player.colRect[4] player.colRect[2] = player.pos.y - player.colRect[4]
end end
function process( delta ) function RL.process( delta )
if RL_IsWindowResized() then if RL.IsWindowResized() then
winSize:set( RL_GetScreenSize() ) winSize:set( RL.GetScreenSize() )
end end
playerMovement( delta ) playerMovement( delta )
end end
local function drawMap() local function drawMap()
RL_DrawTextureRec( tex, { 0, 160, res.x, res.y }, { 0, 0 }, WHITE ) RL.DrawTextureRec( tex, { 0, 160, res.x, res.y }, { 0, 0 }, RL.WHITE )
for x = 1, tilemap.size.x do for x = 1, tilemap.size.x do
for y = 1, tilemap.size.y do for y = 1, tilemap.size.y do
@@ -237,7 +243,7 @@ local function drawMap()
local pos = Vec2:new( x - 1, y - 1 ) local pos = Vec2:new( x - 1, y - 1 )
if 0 < tile then if 0 < tile then
RL_DrawTextureRec( tex, tilemap.tileRects[ tile ], { pos.x * TILE_SIZE, pos.y * TILE_SIZE }, WHITE ) RL.DrawTextureRec( tex, tilemap.tileRects[ tile ], { pos.x * TILE_SIZE, pos.y * TILE_SIZE }, RL.WHITE )
end end
end end
end end
@@ -250,7 +256,7 @@ local function drawPlayer()
if math.abs( player.vel.x ) < 0.1 then if math.abs( player.vel.x ) < 0.1 then
player.curFrame = 1 player.curFrame = 1
else else
player.animPos = player.animPos + WALK_ANIM_SPEED * ( math.abs( player.vel.x ) / PLAYER_MAXSPEED ) * RL_GetFrameTime() player.animPos = player.animPos + WALK_ANIM_SPEED * ( math.abs( player.vel.x ) / PLAYER_MAXSPEED ) * RL.GetFrameTime()
local frame = math.ceil( player.animPos ) local frame = math.ceil( player.animPos )
if #player.walkAnimFrames < frame then if #player.walkAnimFrames < frame then
@@ -270,7 +276,7 @@ local function drawPlayer()
-- Draw rect. -- Draw rect.
local src = util.tableClone( player.frames[ player.curFrame ] ) local src = Util.tableClone( player.frames[ player.curFrame ] )
local dst = { local dst = {
player.pos.x - src[3] / 2, player.pos.x - src[3] / 2,
player.pos.y - src[4], player.pos.y - src[4],
@@ -282,19 +288,19 @@ local function drawPlayer()
src[3] = -src[3] src[3] = -src[3]
end end
RL_DrawTexturePro( tex, src, dst, { 0, 0 }, 0.0, WHITE ) RL.DrawTexturePro( tex, src, dst, { 0, 0 }, 0.0, RL.WHITE )
end end
function draw() function RL.draw()
RL_ClearBackground( RED ) RL.ClearBackground( RL.RED )
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
RL_BeginTextureMode( framebuffer ) RL.BeginTextureMode( framebuffer )
drawMap() drawMap()
drawPlayer() drawPlayer()
RL_EndTextureMode() RL.EndTextureMode()
RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
RL_DrawTexturePro( framebuffer, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, WHITE ) RL.DrawTexturePro( framebuffer, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE )
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
end end

View File

@@ -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" util = require "utillib"
Vec2 = require "vector2" Vec2 = require "vector2"
@@ -8,7 +8,6 @@ local MOVE_SPEED = 0.5
local monitor = 0 local monitor = 0
local camera = -1 local camera = -1
local texture = -1
local tri = { local tri = {
a = Vec3:new( 0, 0, 0 ), a = Vec3:new( 0, 0, 0 ),
-- a = Vec3:new( 0, 1, 0 ), -- a = Vec3:new( 0, 1, 0 ),
@@ -26,27 +25,25 @@ local point = {
local debugText = "" local debugText = ""
local function calcNormal( tri ) local function calcNormal( tri )
tri.normal = Vec3:new( RL_Vector3Normalize( RL_Vector3CrossProduct( tri.b - tri.a, tri.c - tri.a ) ) ) tri.normal = Vec3:new( RL.Vector3Normalize( RL.Vector3CrossProduct( tri.b - tri.a, tri.c - tri.a ) ) )
end end
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = { 1920, 1080 } local winSize = { 1920, 1080 }
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 1, 2 } ) RL.SetCamera3DPosition( camera, { 0, 1, 2 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FREE ) RL.SetCameraMode( camera, RL.CAMERA_FREE )
calcNormal( tri ) calcNormal( tri )
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
end end
local function checkCollisionPointTriangle( p, a, b, c, n ) local function checkCollisionPointTriangle( p, a, b, c, n )
@@ -78,48 +75,48 @@ local function checkCollisionPointTriangle( p, a, b, c, n )
return 0.0 < result.x and 0.0 < result.y and 0.0 < result.z and distance < 0.0, distance return 0.0 < result.x and 0.0 < result.y and 0.0 < result.z and distance < 0.0, distance
end end
function process( delta ) function RL.process( delta )
debugText = "" debugText = ""
if RL_IsKeyDown( string.byte( "D" ) ) then if RL.IsKeyDown( string.byte( "D" ) ) then
point.pos.x = point.pos.x + MOVE_SPEED * delta point.pos.x = point.pos.x + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "A" ) ) then elseif RL.IsKeyDown( string.byte( "A" ) ) then
point.pos.x = point.pos.x - MOVE_SPEED * delta point.pos.x = point.pos.x - MOVE_SPEED * delta
end end
if RL_IsKeyDown( string.byte( "S" ) ) then if RL.IsKeyDown( string.byte( "S" ) ) then
point.pos.z = point.pos.z + MOVE_SPEED * delta point.pos.z = point.pos.z + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "W" ) ) then elseif RL.IsKeyDown( string.byte( "W" ) ) then
point.pos.z = point.pos.z - MOVE_SPEED * delta point.pos.z = point.pos.z - MOVE_SPEED * delta
end end
if RL_IsKeyDown( string.byte( "R" ) ) then if RL.IsKeyDown( string.byte( "R" ) ) then
point.pos.y = point.pos.y + MOVE_SPEED * delta point.pos.y = point.pos.y + MOVE_SPEED * delta
elseif RL_IsKeyDown( string.byte( "F" ) ) then elseif RL.IsKeyDown( string.byte( "F" ) ) then
point.pos.y = point.pos.y - MOVE_SPEED * delta point.pos.y = point.pos.y - MOVE_SPEED * delta
end end
if checkCollisionPointTriangle( point.pos, tri.a, tri.b, tri.c, tri.normal ) then if checkCollisionPointTriangle( point.pos, tri.a, tri.b, tri.c, tri.normal ) then
point.color = RED point.color = RL.RED
else else
point.color = GREEN point.color = RL.GREEN
end end
end end
function draw() function RL.draw()
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawGrid( 8, 1 ) RL.DrawGrid( 8, 1 )
RL_DrawTriangle3D( tri.a, tri.b, tri.c, { 200, 100, 100 } ) RL.DrawTriangle3D( tri.a, tri.b, tri.c, { 200, 100, 100 } )
RL_DrawLine3D( { point.pos.x - point.lineLen, point.pos.y, point.pos.z }, RL.DrawLine3D( { point.pos.x - point.lineLen, point.pos.y, point.pos.z },
{ point.pos.x + point.lineLen, point.pos.y, point.pos.z }, BLUE ) { point.pos.x + point.lineLen, point.pos.y, point.pos.z }, RL.BLUE )
RL_DrawLine3D( { point.pos.x, point.pos.y - point.lineLen, point.pos.z }, RL.DrawLine3D( { point.pos.x, point.pos.y - point.lineLen, point.pos.z },
{ point.pos.x, point.pos.y + point.lineLen, point.pos.z }, BLUE ) { point.pos.x, point.pos.y + point.lineLen, point.pos.z }, RL.BLUE )
RL_DrawLine3D( { point.pos.x, point.pos.y, point.pos.z - point.lineLen }, RL.DrawLine3D( { point.pos.x, point.pos.y, point.pos.z - point.lineLen },
{ point.pos.x, point.pos.y, point.pos.z + point.lineLen }, BLUE ) { point.pos.x, point.pos.y, point.pos.z + point.lineLen }, RL.BLUE )
RL_DrawSphereWires( point.pos, point.radius, 3, 8, point.color ) RL.DrawSphereWires( point.pos, point.radius, 3, 8, point.color )
RL_EndMode3D() RL.EndMode3D()
RL_DrawText( 0, debugText, { 10, 10 }, 30, 4, WHITE ) RL.DrawText( 0, debugText, { 10, 10 }, 30, 4, RL.WHITE )
end end

View File

@@ -48,33 +48,33 @@ local function ballHit( padPos, padSize )
ball.vel[2] = BALL_SPEED * relHitPos / padSize[2] * 2 ball.vel[2] = BALL_SPEED * relHitPos / padSize[2] * 2
end end
function init() function RL.init()
-- Set window to center of monitor. -- Set window to center of monitor.
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Pong" ) RL.SetWindowTitle( "Pong" )
-- Initialize ball pos. -- Initialize ball pos.
math.randomseed( os.time() ) math.randomseed( os.time() )
reset() reset()
end end
function process( delta ) function RL.process( delta )
-- Left player controls. -- Left player controls.
if RL_IsKeyDown( string.byte( "W" ) ) and 0 < playerLeft.pos[2] then if RL.IsKeyDown( string.byte( "W" ) ) and 0 < playerLeft.pos[2] then
playerLeft.pos[2] = playerLeft.pos[2] - PLAYER_SPEED * delta playerLeft.pos[2] = playerLeft.pos[2] - PLAYER_SPEED * delta
elseif RL_IsKeyDown( string.byte( "S" ) ) and playerLeft.pos[2] + playerLeft.size[2] < winSize[2] then elseif RL.IsKeyDown( string.byte( "S" ) ) and playerLeft.pos[2] + playerLeft.size[2] < winSize[2] then
playerLeft.pos[2] = playerLeft.pos[2] + PLAYER_SPEED * delta playerLeft.pos[2] = playerLeft.pos[2] + PLAYER_SPEED * delta
end end
-- Right player controls. -- Right player controls.
if RL_IsKeyDown( KEY_UP ) and 0 < playerRight.pos[2] then if RL.IsKeyDown( RL.KEY_UP ) and 0 < playerRight.pos[2] then
playerRight.pos[2] = playerRight.pos[2] - PLAYER_SPEED * delta playerRight.pos[2] = playerRight.pos[2] - PLAYER_SPEED * delta
elseif RL_IsKeyDown( KEY_DOWN ) and playerRight.pos[2] + playerRight.size[2] < winSize[2] then elseif RL.IsKeyDown( RL.KEY_DOWN ) and playerRight.pos[2] + playerRight.size[2] < winSize[2] then
playerRight.pos[2] = playerRight.pos[2] + PLAYER_SPEED * delta playerRight.pos[2] = playerRight.pos[2] + PLAYER_SPEED * delta
end end
@@ -94,9 +94,9 @@ function process( delta )
local playerRightRect = { playerRight.pos[1], playerRight.pos[2], local playerRightRect = { playerRight.pos[1], playerRight.pos[2],
playerRight.size[1], playerRight.size[2] } playerRight.size[1], playerRight.size[2] }
if RL_CheckCollisionCircleRec( ball.pos, ball.radius, playerLeftRect ) and ball.vel[1] < 0 then if RL.CheckCollisionCircleRec( ball.pos, ball.radius, playerLeftRect ) and ball.vel[1] < 0 then
ballHit( playerLeft.pos, playerLeft.size ) ballHit( playerLeft.pos, playerLeft.size )
elseif RL_CheckCollisionCircleRec( ball.pos, ball.radius, playerRightRect ) and 0 < ball.vel[1] then elseif RL.CheckCollisionCircleRec( ball.pos, ball.radius, playerRightRect ) and 0 < ball.vel[1] then
ballHit( playerRight.pos, playerRight.size ) ballHit( playerRight.pos, playerRight.size )
end end
@@ -110,18 +110,18 @@ function process( delta )
end end
end end
function draw() function RL.draw()
RL_ClearBackground( BLACK ) RL.ClearBackground( RL.BLACK )
-- Draw players. -- Draw players.
RL_DrawRectangle( { playerLeft.pos[1], playerLeft.pos[2], playerLeft.size[1], playerLeft.size[2] }, WHITE ) RL.DrawRectangle( { playerLeft.pos[1], playerLeft.pos[2], playerLeft.size[1], playerLeft.size[2] }, RL.WHITE )
RL_DrawRectangle( { playerRight.pos[1], playerRight.pos[2], playerRight.size[1], playerRight.size[2] }, WHITE ) RL.DrawRectangle( { playerRight.pos[1], playerRight.pos[2], playerRight.size[1], playerRight.size[2] }, RL.WHITE )
-- Draw ball. Ball position will be the center in drawCircle. -- Draw ball. Ball position will be the center in drawCircle.
RL_DrawCircle( ball.pos, ball.radius, WHITE ) RL.DrawCircle( ball.pos, ball.radius, RL.WHITE )
-- Draw scire -- Draw scire
RL_DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, WHITE ) RL.DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE )
local rightTextSize = RL_MeasureText( 0, playerRight.score, 40, 2 ) local rightTextSize = RL.MeasureText( 0, playerRight.score, 40, 2 )
RL_DrawText( 0, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, WHITE ) RL.DrawText( 0, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE )
end end

View File

@@ -1,6 +1,6 @@
-- Pong example using Vector2 library. -- Pong example using Vector2 library.
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua" package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
Vec2 = require "vector2" Vec2 = require "vector2"
@@ -54,33 +54,33 @@ local function ballHit( padPos, padSize )
ball.vel.y = BALL_SPEED * relHitPos / padSize.y * 2 ball.vel.y = BALL_SPEED * relHitPos / padSize.y * 2
end end
function init() function RL.init()
-- Set window to center of monitor. -- Set window to center of monitor.
local mPos = Vec2:new( RL_GetMonitorPosition( monitor ) ) local mPos = Vec2:new( RL.GetMonitorPosition( monitor ) )
local mSize = Vec2:new( RL_GetMonitorSize( monitor ) ) local mSize = Vec2:new( RL.GetMonitorSize( monitor ) )
RL_SetConfigFlags( FLAG_VSYNC_HINT ) RL.SetConfigFlags( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } ) RL.SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } )
RL_SetWindowTitle( "Pong" ) RL.SetWindowTitle( "Pong" )
-- Initialize ball pos. -- Initialize ball pos.
math.randomseed( os.time() ) math.randomseed( os.time() )
reset() reset()
end end
function process( delta ) function RL.process( delta )
-- Left player controls. -- Left player controls.
if RL_IsKeyDown( KEY_W ) and 0 < playerLeft.pos.y then if RL.IsKeyDown( RL.KEY_W ) and 0 < playerLeft.pos.y then
playerLeft.pos.y = playerLeft.pos.y - PLAYER_SPEED * delta playerLeft.pos.y = playerLeft.pos.y - PLAYER_SPEED * delta
elseif RL_IsKeyDown( KEY_S ) and playerLeft.pos.y + playerLeft.size.y < winSize.y then elseif RL.IsKeyDown( RL.KEY_S ) and playerLeft.pos.y + playerLeft.size.y < winSize.y then
playerLeft.pos.y = playerLeft.pos.y + PLAYER_SPEED * delta playerLeft.pos.y = playerLeft.pos.y + PLAYER_SPEED * delta
end end
-- Right player controls. -- Right player controls.
if RL_IsKeyDown( KEY_UP ) and 0 < playerRight.pos.y then if RL.IsKeyDown( RL.KEY_UP ) and 0 < playerRight.pos.y then
playerRight.pos.y = playerRight.pos.y - PLAYER_SPEED * delta playerRight.pos.y = playerRight.pos.y - PLAYER_SPEED * delta
elseif RL_IsKeyDown( KEY_DOWN ) and playerRight.pos.y + playerRight.size.y < winSize.y then elseif RL.IsKeyDown( RL.KEY_DOWN ) and playerRight.pos.y + playerRight.size.y < winSize.y then
playerRight.pos.y = playerRight.pos.y + PLAYER_SPEED * delta playerRight.pos.y = playerRight.pos.y + PLAYER_SPEED * delta
end end
@@ -99,9 +99,9 @@ function process( delta )
local playerRightRect = { playerRight.pos.x, playerRight.pos.y, local playerRightRect = { playerRight.pos.x, playerRight.pos.y,
playerRight.size.x, playerRight.size.y } playerRight.size.x, playerRight.size.y }
if RL_CheckCollisionCircleRec( ball.pos, ball.radius, playerLeftRect ) and ball.vel.x < 0 then if RL.CheckCollisionCircleRec( ball.pos, ball.radius, playerLeftRect ) and ball.vel.x < 0 then
ballHit( playerLeft.pos, playerLeft.size ) ballHit( playerLeft.pos, playerLeft.size )
elseif RL_CheckCollisionCircleRec( ball.pos, ball.radius, playerRightRect ) and 0 < ball.vel.x then elseif RL.CheckCollisionCircleRec( ball.pos, ball.radius, playerRightRect ) and 0 < ball.vel.x then
ballHit( playerRight.pos, playerRight.size ) ballHit( playerRight.pos, playerRight.size )
end end
@@ -115,18 +115,18 @@ function process( delta )
end end
end end
function draw() function RL.draw()
RL_ClearBackground( BLACK ) RL.ClearBackground( RL.BLACK )
-- Draw players. -- Draw players.
RL_DrawRectangle( { playerLeft.pos.x, playerLeft.pos.y, playerLeft.size.x, playerLeft.size.y }, WHITE ) RL.DrawRectangle( { playerLeft.pos.x, playerLeft.pos.y, playerLeft.size.x, playerLeft.size.y }, RL.WHITE )
RL_DrawRectangle( { playerRight.pos.x, playerRight.pos.y, playerRight.size.x, playerRight.size.y }, WHITE ) RL.DrawRectangle( { playerRight.pos.x, playerRight.pos.y, playerRight.size.x, playerRight.size.y }, RL.WHITE )
-- Draw ball. Ball position will be the center in drawCircle. -- Draw ball. Ball position will be the center in drawCircle.
RL_DrawCircle( ball.pos, ball.radius, WHITE ) RL.DrawCircle( ball.pos, ball.radius, RL.WHITE )
-- Draw score. -- Draw score.
RL_DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, WHITE ) RL.DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE )
local rightTextSize = Vec2:new( RL_MeasureText( 0, playerRight.score, 40, 2 ) ) local rightTextSize = Vec2:new( RL.MeasureText( 0, playerRight.score, 40, 2 ) )
RL_DrawText( 0, playerRight.score, { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, WHITE ) RL.DrawText( 0, playerRight.score, { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE )
end end

View File

@@ -4,17 +4,17 @@ local ray = { { 0.5, 0, 4 }, { 0.1, 0, -1 } }
local function setupWindow() local function setupWindow()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
end end
function ray_collision() function ray_collision()
local rayCol = RL_GetRayCollisionMesh( ray, sphereMesh, RL_MatrixIdentity() ) local rayCol = RL.GetRayCollisionMesh( ray, sphereMesh, RL.MatrixIdentity() )
if rayCol ~= nil and rayCol.hit then if rayCol ~= nil and rayCol.hit then
print( "hit", rayCol.hit ) print( "hit", rayCol.hit )
@@ -24,35 +24,35 @@ function ray_collision()
end end
end end
function init() function RL.init()
setupWindow() setupWindow()
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 0, 2, 4 } ) RL.SetCamera3DPosition( camera, { 0, 2, 4 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
RL_SetCameraMode( camera, CAMERA_FREE ) RL.SetCameraMode( camera, RL.CAMERA_FREE )
sphereMesh = RL_GenMeshSphere( 1.0, 8, 10 ) sphereMesh = RL.GenMeshSphere( 1.0, 8, 10 )
ray_collision() ray_collision()
end end
function process( delta ) function RL.process( delta )
if RL_IsMouseButtonPressed( 0 ) then if RL.IsMouseButtonPressed( 0 ) then
ray = RL_GetMouseRay( RL_GetMousePosition(), camera ) ray = RL.GetMouseRay( RL.GetMousePosition(), camera )
ray_collision() ray_collision()
end end
end end
function draw() function RL.draw()
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_UpdateCamera3D( camera ) RL.UpdateCamera3D( camera )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawGrid( 8, 1 ) RL.DrawGrid( 8, 1 )
RL_DrawRay( ray, { 255, 100, 100 } ) RL.DrawRay( ray, { 255, 100, 100 } )
RL_DrawMesh( sphereMesh, 0, RL_MatrixIdentity() ) RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() )
RL_EndMode3D() RL.EndMode3D()
end end

View File

@@ -10,7 +10,7 @@ Color = require( "color" )
To To
if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS || action == GLFW_REPEAT)) if ((CORE.Input.Keyboard.keyPressedQueueCount < MAX_KEY_PRESSED_QUEUE) && (action == GLFW_PRESS || action == GLFW_REPEAT))
Now GLFW_REPEAT can be read by "RL_GetKeyPressed". Now GLFW_REPEAT can be read by "RL.GetKeyPressed".
]] ]]
Gui = { Gui = {
@@ -39,7 +39,7 @@ Gui = {
RECTANGLE_ROUNDED_LINES = 8, RECTANGLE_ROUNDED_LINES = 8,
}, },
mouseButton = MOUSE_BUTTON_LEFT, mouseButton = RL.MOUSE_BUTTON_LEFT,
font = 0, font = 0,
fontSize = 20, fontSize = 20,
padding = 2, padding = 2,
@@ -114,12 +114,12 @@ function Gui.set2Back( cell )
end end
function Gui.process( mousePosition ) function Gui.process( mousePosition )
local mouseWheel = RL_GetMouseWheelMove() local mouseWheel = RL.GetMouseWheelMove()
Gui._mousePos = mousePosition Gui._mousePos = mousePosition
if Gui.heldCallback ~= nil then if Gui.heldCallback ~= nil then
if RL_IsMouseButtonDown( Gui.mouseButton ) then if RL.IsMouseButtonDown( Gui.mouseButton ) then
Gui.heldCallback() Gui.heldCallback()
else else
Gui.heldCallback = nil Gui.heldCallback = nil
@@ -137,11 +137,11 @@ function Gui.process( mousePosition )
if cell ~= nil then if cell ~= nil then
if not foundFirst and cell.isMouseOver ~= nil and cell:isMouseOver( mousePosition ) and not cell.disabled then if not foundFirst and cell.isMouseOver ~= nil and cell:isMouseOver( mousePosition ) and not cell.disabled then
-- On clicked. -- On clicked.
if RL_IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then if RL.IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then
cell:onClicked() cell:onClicked()
end end
-- On held. -- On held.
if RL_IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then if RL.IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then
cell:onHeld() cell:onHeld()
end end
-- Mouse wheel scrolling. -- Mouse wheel scrolling.
@@ -154,7 +154,7 @@ function Gui.process( mousePosition )
local pos = Vec2:new( cell._scrollRect.x, cell._scrollRect.y ) local pos = Vec2:new( cell._scrollRect.x, cell._scrollRect.y )
local scrollVec = Vec2:new( 0, cell.scrollAmount * mouseWheel ) local scrollVec = Vec2:new( 0, cell.scrollAmount * mouseWheel )
if RL_IsKeyDown( KEY_LEFT_SHIFT ) then if RL.IsKeyDown( RL.KEY_LEFT_SHIFT ) then
scrollVec = Vec2:new( cell.scrollAmount * mouseWheel, 0 ) scrollVec = Vec2:new( cell.scrollAmount * mouseWheel, 0 )
end end
@@ -172,7 +172,7 @@ function Gui.process( mousePosition )
-- Text input. -- Text input.
if Gui._inputItem ~= nil then if Gui._inputItem ~= nil then
repeat repeat
local char = RL_GetCharPressed() local char = RL.GetCharPressed()
if 0 < char then if 0 < char then
if utf8.len( Gui._inputItem.text ) < Gui._inputItem.maxTextLen then if utf8.len( Gui._inputItem.text ) < Gui._inputItem.maxTextLen then
@@ -183,24 +183,24 @@ function Gui.process( mousePosition )
until char == 0 until char == 0
repeat repeat
local key = RL_GetKeyPressed() local key = RL.GetKeyPressed()
if 0 < key then if 0 < key then
if key == KEY_BACKSPACE then if key == RL.KEY_BACKSPACE then
Gui._inputItem.text = util.utf8Sub( Gui._inputItem.text, 0, utf8.len( Gui._inputItem.text ) - 1 ) Gui._inputItem.text = util.utf8Sub( Gui._inputItem.text, 0, utf8.len( Gui._inputItem.text ) - 1 )
elseif key == KEY_ENTER or key == KEY_KP_ENTER then elseif key == RL.KEY_ENTER or key == RL.KEY_KP_ENTER then
if Gui._inputItem.allowLineBreak then if Gui._inputItem.allowLineBreak then
Gui._inputItem.text = Gui._inputItem.text.."\n" Gui._inputItem.text = Gui._inputItem.text.."\n"
else else
Gui.inputUnfocus() Gui.inputUnfocus()
end end
elseif key == KEY_ESCAPE then elseif key == RL.KEY_ESCAPE then
Gui.inputUnfocus() Gui.inputUnfocus()
end end
end end
until key == 0 until key == 0
if readyToUnfocusInput and RL_IsMouseButtonPressed( Gui.mouseButton ) then if readyToUnfocusInput and RL.IsMouseButtonPressed( Gui.mouseButton ) then
Gui.inputUnfocus() Gui.inputUnfocus()
end end
@@ -234,7 +234,7 @@ function Text:new( set )
object.text = setProperty( set, "text", "" ) object.text = setProperty( set, "text", "" )
object.fontSize = setProperty( set, "fontSize", Gui.fontSize ) object.fontSize = setProperty( set, "fontSize", Gui.fontSize )
object.spacing = setProperty( set, "spacing", Gui.spacing ) object.spacing = setProperty( set, "spacing", Gui.spacing )
object.color = setProperty( set, "color", Color:new( BLACK ) ) object.color = setProperty( set, "color", Color:new( RL.BLACK ) )
object.maxTextLen = setProperty( set, "maxTextLen", nil ) object.maxTextLen = setProperty( set, "maxTextLen", nil )
object.allowLineBreak = setProperty( set, "allowLineBreak", false ) object.allowLineBreak = setProperty( set, "allowLineBreak", false )
@@ -253,7 +253,7 @@ function Text:set( text )
self.text = text self.text = text
end end
local textSize = Vec2:new( RL_MeasureText( self.font, self.text, self.fontSize, self.spacing ) ) local textSize = Vec2:new( RL.MeasureText( self.font, self.text, self.fontSize, self.spacing ) )
self.bounds.width = textSize.x self.bounds.width = textSize.x
self.bounds.height = textSize.y self.bounds.height = textSize.y
@@ -264,7 +264,7 @@ function Text:draw()
return return
end end
RL_DrawText( self.font, self.text, { self._parent.bounds.x + self.bounds.x, self._parent.bounds.y + self.bounds.y }, self.fontSize, self.spacing, self.color ) RL.DrawText( self.font, self.text, { self._parent.bounds.x + self.bounds.x, self._parent.bounds.y + self.bounds.y }, self.fontSize, self.spacing, self.color )
end end
-- Texture. -- Texture.
@@ -283,7 +283,7 @@ function Texture:new( set )
object.source = setProperty( set, "source", Rect:new( 0, 0, 0, 0 ) ) object.source = setProperty( set, "source", Rect:new( 0, 0, 0, 0 ) )
object.origin = setProperty( set, "origin", Vec2:new( 0, 0 ) ) object.origin = setProperty( set, "origin", Vec2:new( 0, 0 ) )
object.rotation = setProperty( set, "rotation", 0 ) object.rotation = setProperty( set, "rotation", 0 )
object.color = setProperty( set, "color", Color:new( WHITE ) ) object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
object.nPatchInfo = setProperty( set, "nPatchInfo", nil ) object.nPatchInfo = setProperty( set, "nPatchInfo", nil )
object.visible = setProperty( set, "visible", true ) object.visible = setProperty( set, "visible", true )
@@ -299,7 +299,7 @@ function Texture:set( texture )
return return
end end
local texSize = Vec2:new( RL_GetTextureSize( texture ) ) local texSize = Vec2:new( RL.GetTextureSize( texture ) )
if self.bounds.width == 0 or self.bounds.height == 0 then if self.bounds.width == 0 or self.bounds.height == 0 then
self.bounds.width = texSize.x self.bounds.width = texSize.x
@@ -326,9 +326,9 @@ function Texture:draw()
} }
if self.nPatchInfo ~= nil then if self.nPatchInfo ~= nil then
RL_DrawTextureNPatch( self.texture, self.nPatchInfo, dst, self.origin, self.rotation, self.color ) RL.DrawTextureNPatch( self.texture, self.nPatchInfo, dst, self.origin, self.rotation, self.color )
else else
RL_DrawTexturePro( self.texture, self.source, dst, self.origin, self.rotation, self.color ) RL.DrawTexturePro( self.texture, self.source, dst, self.origin, self.rotation, self.color )
end end
end end
@@ -359,7 +359,7 @@ function Shape:new( set )
object.roundness = setProperty( set, "roundness", 1 ) object.roundness = setProperty( set, "roundness", 1 )
object.segments = setProperty( set, "segments", 4 ) object.segments = setProperty( set, "segments", 4 )
object.color = setProperty( set, "color", Color:new( WHITE ) ) object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
object.visible = setProperty( set, "visible", true ) object.visible = setProperty( set, "visible", true )
object._parent = nil object._parent = nil
@@ -392,23 +392,23 @@ function Shape:draw()
local pos = Vec2:new( self._parent.bounds.x, self._parent.bounds.y ) local pos = Vec2:new( self._parent.bounds.x, self._parent.bounds.y )
if self.shape == Gui.SHAPE.LINE then if self.shape == Gui.SHAPE.LINE then
RL_DrawLine( self.startPos + pos, self.endPos + pos, self.thickness, self.color ) RL.DrawLine( self.startPos + pos, self.endPos + pos, self.thickness, self.color )
elseif self.shape == Gui.SHAPE.CIRCLE then elseif self.shape == Gui.SHAPE.CIRCLE then
RL_DrawCircle( self.center + pos, self.radius, self.color ) RL.DrawCircle( self.center + pos, self.radius, self.color )
elseif self.shape == Gui.SHAPE.CIRCLE_LINES then elseif self.shape == Gui.SHAPE.CIRCLE_LINES then
RL_DrawCircleLines( self.center + pos, self.radius, self.color ) RL.DrawCircleLines( self.center + pos, self.radius, self.color )
elseif self.shape == Gui.SHAPE.ELLIPSE then elseif self.shape == Gui.SHAPE.ELLIPSE then
RL_DrawEllipse( self.center + pos, self.radiusH, self.radiusV, self.color ) RL.DrawEllipse( self.center + pos, self.radiusH, self.radiusV, self.color )
elseif self.shape == Gui.SHAPE.ELLIPSE_LINES then elseif self.shape == Gui.SHAPE.ELLIPSE_LINES then
RL_DrawEllipseLines( self.center + pos, self.radiusH, self.radiusV, self.color ) RL.DrawEllipseLines( self.center + pos, self.radiusH, self.radiusV, self.color )
elseif self.shape == Gui.SHAPE.RECTANGLE then elseif self.shape == Gui.SHAPE.RECTANGLE then
RL_DrawRectangle( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color ) RL.DrawRectangle( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
elseif self.shape == Gui.SHAPE.RECTANGLE_LINES then elseif self.shape == Gui.SHAPE.RECTANGLE_LINES then
RL_DrawRectangleLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color ) RL.DrawRectangleLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.color )
elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED then elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED then
RL_DrawRectangleRounded( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.color ) RL.DrawRectangleRounded( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.color )
elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED_LINES then elseif self.shape == Gui.SHAPE.RECTANGLE_ROUNDED_LINES then
RL_DrawRectangleRoundedLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.thickness, self.color ) RL.DrawRectangleRoundedLines( { self.bounds.x + pos.x, self.bounds.y + pos.y, self.bounds.width, self.bounds.height }, self.roundness, self.segments, self.thickness, self.color )
end end
end end
@@ -428,7 +428,7 @@ function Element:new( set )
object.visible = setProperty( set, "visible", true ) object.visible = setProperty( set, "visible", true )
object.disabled = setProperty( set, "disabled", false ) object.disabled = setProperty( set, "disabled", false )
object.drawBounds = setProperty( set, "drawBounds", false ) object.drawBounds = setProperty( set, "drawBounds", false )
object.color = setProperty( set, "color", Color:new( GRAY ) ) object.color = setProperty( set, "color", Color:new( RL.GRAY ) )
object.items = {} object.items = {}
@@ -481,10 +481,10 @@ function Element:add( item )
end end
function Element:isMouseOver( mousePosition ) function Element:isMouseOver( mousePosition )
local over = RL_CheckCollisionPointRec( mousePosition, self.bounds ) local over = RL.CheckCollisionPointRec( mousePosition, self.bounds )
if over and self._visibilityBounds ~= nil then if over and self._visibilityBounds ~= nil then
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds ) over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
end end
if over and self.onMouseOver ~= nil then if over and self.onMouseOver ~= nil then
@@ -498,7 +498,7 @@ function Element:draw()
local usedScissor = false local usedScissor = false
if self._visibilityBounds ~= nil then if self._visibilityBounds ~= nil then
local rect = Rect:new( RL_GetCollisionRec( self.bounds, self._visibilityBounds ) ) local rect = Rect:new( RL.GetCollisionRec( self.bounds, self._visibilityBounds ) )
-- Use scissor mode only on partyally visible. -- Use scissor mode only on partyally visible.
if rect.width == 0 and rect.height == 0 then if rect.width == 0 and rect.height == 0 then
@@ -506,12 +506,12 @@ function Element:draw()
elseif math.floor( rect.width ) ~= math.floor( self.bounds.width ) elseif math.floor( rect.width ) ~= math.floor( self.bounds.width )
or math.floor( rect.height ) ~= math.floor( self.bounds.height ) then or math.floor( rect.height ) ~= math.floor( self.bounds.height ) then
usedScissor = true usedScissor = true
RL_BeginScissorMode( self._visibilityBounds ) RL.BeginScissorMode( self._visibilityBounds )
end end
end end
if self.drawBounds then if self.drawBounds then
RL_DrawRectangle( self.bounds, self.color ) RL.DrawRectangle( self.bounds, self.color )
end end
for _, item in ipairs( self.items ) do for _, item in ipairs( self.items ) do
@@ -519,7 +519,7 @@ function Element:draw()
end end
if usedScissor then if usedScissor then
RL_EndScissorMode() RL.EndScissorMode()
end end
end end
@@ -557,7 +557,7 @@ function Container:new( set )
object.showScrollbar = setProperty( set, "showScrollbar", false ) object.showScrollbar = setProperty( set, "showScrollbar", false )
object.scrollbarWidth = setProperty( set, "scrollbarWidth", Gui.scrollbarWidth ) object.scrollbarWidth = setProperty( set, "scrollbarWidth", Gui.scrollbarWidth )
object.scrollAmount = setProperty( set, "scrollAmount", Gui.scrollAmount ) -- When using mouse scroll. object.scrollAmount = setProperty( set, "scrollAmount", Gui.scrollAmount ) -- When using mouse scroll.
object.color = setProperty( set, "color", Color:new( WHITE ) ) object.color = setProperty( set, "color", Color:new( RL.WHITE ) )
object.drawBounds = setProperty( set, "drawBounds", false ) object.drawBounds = setProperty( set, "drawBounds", false )
object.drawScrollRect = setProperty( set, "drawScrollRect", false ) object.drawScrollRect = setProperty( set, "drawScrollRect", false )
-- For grid container. Do not set both. -- For grid container. Do not set both.
@@ -638,10 +638,10 @@ function Container:mouseScroll( v )
end end
function Container:isMouseOver( mousePosition ) function Container:isMouseOver( mousePosition )
local over = RL_CheckCollisionPointRec( mousePosition, self.bounds ) local over = RL.CheckCollisionPointRec( mousePosition, self.bounds )
if over and self._visibilityBounds ~= nil then if over and self._visibilityBounds ~= nil then
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds ) over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
end end
if over and self.onMouseOver ~= nil then if over and self.onMouseOver ~= nil then
@@ -701,7 +701,7 @@ function Container:update()
self._VScrollbar = Element:new( { self._VScrollbar = Element:new( {
padding = 0, padding = 0,
drawBounds = true, drawBounds = true,
color = Color:new( GRAY ), color = Color:new( RL.GRAY ),
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 0, 1 ) ) end end, onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 0, 1 ) ) end end,
} ) } )
@@ -710,7 +710,7 @@ function Container:update()
VAling = Gui.ALING.NONE, VAling = Gui.ALING.NONE,
bounds = Rect:new( 0, 0, 0, 0 ), bounds = Rect:new( 0, 0, 0, 0 ),
shape = Gui.SHAPE.RECTANGLE_ROUNDED, shape = Gui.SHAPE.RECTANGLE_ROUNDED,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
} ) ) } ) )
end end
@@ -718,7 +718,7 @@ function Container:update()
self._HScrollbar = Element:new( { self._HScrollbar = Element:new( {
padding = 0, padding = 0,
drawBounds = true, drawBounds = true,
color = Color:new( GRAY ), color = Color:new( RL.GRAY ),
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 1, 0 ) ) end end, onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 1, 0 ) ) end end,
} ) } )
@@ -727,7 +727,7 @@ function Container:update()
VAling = Gui.ALING.CENTER, VAling = Gui.ALING.CENTER,
bounds = Rect:new( 0, 0, 0, 0 ), bounds = Rect:new( 0, 0, 0, 0 ),
shape = Gui.SHAPE.RECTANGLE_ROUNDED, shape = Gui.SHAPE.RECTANGLE_ROUNDED,
color = Color:new( LIGHTGRAY ), color = Color:new( RL.LIGHTGRAY ),
} ) ) } ) )
end end
end end
@@ -854,17 +854,17 @@ end
function Container:draw() function Container:draw()
if self.drawBounds then if self.drawBounds then
RL_DrawRectangle( self.bounds, self.color ) RL.DrawRectangle( self.bounds, self.color )
end end
if self.drawScrollRect then if self.drawScrollRect then
RL_DrawRectangleLines( { RL.DrawRectangleLines( {
self.bounds.x - self._scrollRect.x, self.bounds.x - self._scrollRect.x,
self.bounds.y - self._scrollRect.y, self.bounds.y - self._scrollRect.y,
self._scrollRect.width, self._scrollRect.width,
self._scrollRect.height, self._scrollRect.height,
}, },
RED ) RL.RED )
end end
end end

View File

@@ -15,7 +15,7 @@ function utillib.deepCopy( orig )
for origKey, origValue in next, orig, nil do for origKey, origValue in next, orig, nil do
-- If object has clone method, use that. -- If object has clone method, use that.
if type( origValue ) == "table" and type( origValue.clone ) == "function" then if type( origValue ) == "table" and type( origValue.clone ) == "function" then
copy[ utillib.deepCopy( origKey ) ] = orig_value:clone() copy[ utillib.deepCopy( origKey ) ] = origValue:clone()
else else
copy[ utillib.deepCopy( origKey ) ] = utillib.deepCopy( origValue ) copy[ utillib.deepCopy( origKey ) ] = utillib.deepCopy( origValue )
end end
@@ -128,9 +128,9 @@ end
function utillib.wrapAngleRad( angle ) function utillib.wrapAngleRad( angle )
if angle < 0 then if angle < 0 then
return math.fmod( angle, PI * 2 ) + PI * 2 return math.fmod( angle, RL.PI * 2 ) + RL.PI * 2
else else
return math.fmod( angle, PI * 2 ) return math.fmod( angle, RL.PI * 2 )
end end
end end

View File

@@ -38,7 +38,7 @@ Vector2.meta = {
return len return len
end, end,
__eq = function( v1, v2 ) __eq = function( v1, v2 )
return RL_Vector2Equals( v1, v2 ) == 1 return RL.Vector2Equals( v1, v2 ) == 1
end, end,
} }
@@ -91,79 +91,79 @@ function Vector2:max( v2 )
end end
function Vector2:addValue( value ) function Vector2:addValue( value )
return Vector2:new( RL_Vector2AddValue( self, value ) ) return Vector2:new( RL.Vector2AddValue( self, value ) )
end end
function Vector2:subValue( value ) function Vector2:subValue( value )
return Vector2:new( RL_Vector2SubtractValue( self, value ) ) return Vector2:new( RL.Vector2SubtractValue( self, value ) )
end end
function Vector2:length() function Vector2:length()
return RL_Vector2Length( self ) return RL.Vector2Length( self )
end end
function Vector2:lengthSqr() function Vector2:lengthSqr()
return RL_Vector2LengthSqr( self ) return RL.Vector2LengthSqr( self )
end end
function Vector2:dot( v2 ) function Vector2:dot( v2 )
return RL_Vector2DotProduct( self, v2 ) return RL.Vector2DotProduct( self, v2 )
end end
function Vector2:distance( v2 ) function Vector2:distance( v2 )
return RL_Vector2Distance( self, v2 ) return RL.Vector2Distance( self, v2 )
end end
function Vector2:distanceSqr( v2 ) function Vector2:distanceSqr( v2 )
return RL_Vector2DistanceSqr( self, v2 ) return RL.Vector2DistanceSqr( self, v2 )
end end
function Vector2:angle( v2 ) function Vector2:angle( v2 )
return RL_Vector2Angle( self, v2 ) return RL.Vector2Angle( self, v2 )
end end
function Vector2:scale( scale ) function Vector2:scale( scale )
return Vector2:new( RL_Vector2Scale( self, scale ) ) return Vector2:new( RL.Vector2Scale( self, scale ) )
end end
function Vector2:normalize() function Vector2:normalize()
return Vector2:new( RL_Vector2Normalize( self ) ) return Vector2:new( RL.Vector2Normalize( self ) )
end end
function Vector2:transform( mat ) function Vector2:transform( mat )
return Vector2:new( RL_Vector2Transform( self, mat ) ) return Vector2:new( RL.Vector2Transform( self, mat ) )
end end
function Vector2:lerp( v2, value ) function Vector2:lerp( v2, value )
return Vector2:new( RL_Vector2Lerp( self, v2, value ) ) return Vector2:new( RL.Vector2Lerp( self, v2, value ) )
end end
function Vector2:reflect( normal ) function Vector2:reflect( normal )
return Vector2:new( RL_Vector2Reflect( self, normal ) ) return Vector2:new( RL.Vector2Reflect( self, normal ) )
end end
function Vector2:rotate( angle ) function Vector2:rotate( angle )
return Vector2:new( RL_Vector2Rotate( self, angle ) ) return Vector2:new( RL.Vector2Rotate( self, angle ) )
end end
function Vector2:moveTowards( target, maxDistance ) function Vector2:moveTowards( target, maxDistance )
return Vector2:new( RL_Vector2MoveTowards( self, target, maxDistance ) ) return Vector2:new( RL.Vector2MoveTowards( self, target, maxDistance ) )
end end
function Vector2:invert() function Vector2:invert()
return Vector2:new( RL_Vector2Invert( self ) ) return Vector2:new( RL.Vector2Invert( self ) )
end end
function Vector2:clamp( min, max ) function Vector2:clamp( min, max )
return Vector2:new( RL_Vector2Clamp( self, min, max ) ) return Vector2:new( RL.Vector2Clamp( self, min, max ) )
end end
function Vector2:clampValue( min, max ) function Vector2:clampValue( min, max )
return Vector2:new( RL_Vector2ClampValue( self, min, max ) ) return Vector2:new( RL.Vector2ClampValue( self, min, max ) )
end end
function Vector2:equals( v2 ) function Vector2:equals( v2 )
return RL_Vector2Equals( self, v2 ) return RL.Vector2Equals( self, v2 )
end end
return Vector2 return Vector2

View File

@@ -38,7 +38,7 @@ Vector3.meta = {
return len return len
end, end,
__eq = function( v1, v2 ) __eq = function( v1, v2 )
return RL_Vector3Equals( v1, v2 ) == 1 return RL.Vector3Equals( v1, v2 ) == 1
end, end,
} }
@@ -85,104 +85,104 @@ function Vector3:abs()
end end
function Vector3:min( v2 ) function Vector3:min( v2 )
return Vector3:new( RL_Vector3Min( self, v2 ) ) return Vector3:new( RL.Vector3Min( self, v2 ) )
end end
function Vector3:max( v2 ) function Vector3:max( v2 )
return Vector3:new( RL_Vector3Max( self, v2 ) ) return Vector3:new( RL.Vector3Max( self, v2 ) )
end end
function Vector3:addValue( value ) function Vector3:addValue( value )
return Vector3:new( RL_Vector3AddValue( self, value ) ) return Vector3:new( RL.Vector3AddValue( self, value ) )
end end
function Vector3:subValue( value ) function Vector3:subValue( value )
return Vector3:new( RL_Vector3SubtractValue( self, value ) ) return Vector3:new( RL.Vector3SubtractValue( self, value ) )
end end
function Vector3:scale( scalar ) function Vector3:scale( scalar )
return Vector3:new( RL_Vector3Scale( self, scalar ) ) return Vector3:new( RL.Vector3Scale( self, scalar ) )
end end
function Vector3:cross( v2 ) function Vector3:cross( v2 )
return Vector3:new( RL_Vector3CrossProduct( self, v2 ) ) return Vector3:new( RL.Vector3CrossProduct( self, v2 ) )
end end
function Vector3:perpendicular() function Vector3:perpendicular()
return Vector3:new( RL_Vector3Perpendicular( self ) ) return Vector3:new( RL.Vector3Perpendicular( self ) )
end end
function Vector3:length() function Vector3:length()
return RL_Vector3Length( self ) return RL.Vector3Length( self )
end end
function Vector3:lengthSqr() function Vector3:lengthSqr()
return RL_Vector3LengthSqr( self ) return RL.Vector3LengthSqr( self )
end end
function Vector3:dot( v2 ) function Vector3:dot( v2 )
return RL_Vector3DotProduct( self, v2 ) return RL.Vector3DotProduct( self, v2 )
end end
function Vector3:distance( v2 ) function Vector3:distance( v2 )
return RL_Vector3Distance( self, v2 ) return RL.Vector3Distance( self, v2 )
end end
function Vector3:distanceSqr( v2 ) function Vector3:distanceSqr( v2 )
return RL_Vector3DistanceSqr( self, v2 ) return RL.Vector3DistanceSqr( self, v2 )
end end
function Vector3:angle( v2 ) function Vector3:angle( v2 )
return RL_Vector3Angle( self, v2 ) return RL.Vector3Angle( self, v2 )
end end
function Vector3:negate() function Vector3:negate()
return Vector3:new( RL_Vector3Negate( self ) ) return Vector3:new( RL.Vector3Negate( self ) )
end end
function Vector3:normalize() function Vector3:normalize()
return Vector3:new( RL_Vector3Normalize( self ) ) return Vector3:new( RL.Vector3Normalize( self ) )
end end
function Vector3:orthoNormalize( v2 ) function Vector3:orthoNormalize( v2 )
local r1, r2 = RL_Vector3OrthoNormalize( self, v2 ) local r1, r2 = RL.Vector3OrthoNormalize( self, v2 )
return Vector3:new( r1[1], r1[2], r1[3] ), Vector3:new( r2[1], r2[2], r2[3] ) return Vector3:new( r1[1], r1[2], r1[3] ), Vector3:new( r2[1], r2[2], r2[3] )
end end
function Vector3:transform( mat ) function Vector3:transform( mat )
return Vector3:new( RL_Vector3Transform( self, mat ) ) return Vector3:new( RL.Vector3Transform( self, mat ) )
end end
function Vector3:rotateByQuaternion( q ) function Vector3:rotateByQuaternion( q )
return Vector3:new( RL_Vector3RotateByQuaternion( self, q ) ) return Vector3:new( RL.Vector3RotateByQuaternion( self, q ) )
end end
function Vector3:rotateByAxisAngle( axis, angle ) function Vector3:rotateByAxisAngle( axis, angle )
return Vector3:new( RL_Vector3RotateByAxisAngle( self, axis, angle ) ) return Vector3:new( RL.Vector3RotateByAxisAngle( self, axis, angle ) )
end end
function Vector3:lerp( v2, value ) function Vector3:lerp( v2, value )
return Vector3:new( RL_Vector3Lerp( self, v2, value ) ) return Vector3:new( RL.Vector3Lerp( self, v2, value ) )
end end
function Vector3:reflect( normal ) function Vector3:reflect( normal )
return Vector3:new( RL_Vector3Reflect( self, normal ) ) return Vector3:new( RL.Vector3Reflect( self, normal ) )
end end
function Vector3:invert() function Vector3:invert()
return Vector3:new( RL_Vector3Invert( self ) ) return Vector3:new( RL.Vector3Invert( self ) )
end end
function Vector3:clamp( min, max ) function Vector3:clamp( min, max )
return Vector3:new( RL_Vector3Clamp( self, min, max ) ) return Vector3:new( RL.Vector3Clamp( self, min, max ) )
end end
function Vector3:clampValue( min, max ) function Vector3:clampValue( min, max )
return Vector3:new( RL_Vector3ClampValue( self, min, max ) ) return Vector3:new( RL.Vector3ClampValue( self, min, max ) )
end end
function Vector3:equals( v2 ) function Vector3:equals( v2 )
return RL_Vector3Equals( self, v2 ) return RL.Vector3Equals( self, v2 )
end end
return Vector3 return Vector3

View File

@@ -8,27 +8,27 @@ local GLSL_VERSION = "330" -- PLATFORM_DESKTOP
local secondsLoc local secondsLoc
function init() function RL.init()
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/cat.png" ) texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
textureSize = RL_GetTextureSize( texture ) textureSize = RL.GetTextureSize( texture )
shader = RL_LoadShader( nil, RL_GetBasePath().."../resources/shaders/glsl"..GLSL_VERSION.."/wave.fs" ) shader = RL.LoadShader( nil, RL.GetBasePath().."../resources/shaders/glsl"..GLSL_VERSION.."/wave.fs" )
secondsLoc = RL_GetShaderLocation( shader, "secondes" ) secondsLoc = RL.GetShaderLocation( shader, "secondes" )
local sizeLoc = RL_GetShaderLocation( shader, "size" ) local sizeLoc = RL.GetShaderLocation( shader, "size" )
local freqXLoc = RL_GetShaderLocation( shader, "freqX" ) local freqXLoc = RL.GetShaderLocation( shader, "freqX" )
local freqYLoc = RL_GetShaderLocation( shader, "freqY" ) local freqYLoc = RL.GetShaderLocation( shader, "freqY" )
local ampXLoc = RL_GetShaderLocation( shader, "ampX" ) local ampXLoc = RL.GetShaderLocation( shader, "ampX" )
local ampYLoc = RL_GetShaderLocation( shader, "ampY" ) local ampYLoc = RL.GetShaderLocation( shader, "ampY" )
local speedXLoc = RL_GetShaderLocation( shader, "speedX" ) local speedXLoc = RL.GetShaderLocation( shader, "speedX" )
local speedYLoc = RL_GetShaderLocation( shader, "speedY" ) local speedYLoc = RL.GetShaderLocation( shader, "speedY" )
local freqX = 25.0 local freqX = 25.0
local freqY = 25.0 local freqY = 25.0
@@ -37,25 +37,25 @@ function init()
local speedX = 8.0 local speedX = 8.0
local speedY = 8.0 local speedY = 8.0
RL_SetShaderValue( shader, sizeLoc, textureSize, SHADER_UNIFORM_VEC2 ) RL.SetShaderValue( shader, sizeLoc, textureSize, RL.SHADER_UNIFORM_VEC2 )
RL_SetShaderValue( shader, freqXLoc, { freqX }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, freqXLoc, { freqX }, RL.SHADER_UNIFORM_FLOAT )
RL_SetShaderValue( shader, freqYLoc, { freqY }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, freqYLoc, { freqY }, RL.SHADER_UNIFORM_FLOAT )
RL_SetShaderValue( shader, ampXLoc, { ampX }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, ampXLoc, { ampX }, RL.SHADER_UNIFORM_FLOAT )
RL_SetShaderValue( shader, ampYLoc, { ampY }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, ampYLoc, { ampY }, RL.SHADER_UNIFORM_FLOAT )
RL_SetShaderValue( shader, speedXLoc, { speedX }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, speedXLoc, { speedX }, RL.SHADER_UNIFORM_FLOAT )
RL_SetShaderValue( shader, speedYLoc, { speedY }, SHADER_UNIFORM_FLOAT ) RL.SetShaderValue( shader, speedYLoc, { speedY }, RL.SHADER_UNIFORM_FLOAT )
end end
local seconds = 0.0 local seconds = 0.0
function draw() function RL.draw()
seconds = seconds + RL_GetFrameTime(); seconds = seconds + RL.GetFrameTime();
RL_SetShaderValue( shader, secondsLoc, { seconds }, SHADER_UNIFORM_FLOAT ); RL.SetShaderValue( shader, secondsLoc, { seconds }, RL.SHADER_UNIFORM_FLOAT );
RL_ClearBackground( { 100, 150, 100 } ) RL.ClearBackground( { 100, 150, 100 } )
RL_BeginShaderMode( shader ) RL.BeginShaderMode( shader )
RL_DrawTexture( texture, { 0, 0 }, WHITE ); RL.DrawTexture( texture, { 0, 0 }, RL.WHITE );
RL_EndShaderMode() RL.EndShaderMode()
end end

View File

@@ -7,8 +7,8 @@ local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum wannabe.
-- Resources -- Resources
local framebuffer = -1 local framebuffer = -1
local monitor = 0 local monitor = 0
local monitorPos = RL_GetMonitorPosition( monitor ) local monitorPos = RL.GetMonitorPosition( monitor )
local monitorSize = RL_GetMonitorSize( monitor ) local monitorSize = RL.GetMonitorSize( monitor )
local winScale = 6 local winScale = 6
local winSize = { RESOLUTION[1] * winScale, RESOLUTION[2] * winScale } local winSize = { RESOLUTION[1] * winScale, RESOLUTION[2] * winScale }
local gameState = STATE.GAME local gameState = STATE.GAME
@@ -64,18 +64,18 @@ end
-- Init. -- Init.
function init() function RL.init()
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowSize( winSize ) RL.SetWindowSize( winSize )
RL_SetWindowPosition( { monitorPos[1] + monitorSize[1] / 2 - winSize[1] / 2, monitorPos[2] + monitorSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { monitorPos[1] + monitorSize[1] / 2 - winSize[1] / 2, monitorPos[2] + monitorSize[2] / 2 - winSize[2] / 2 } )
RL_SetWindowTitle( "Snake" ) RL.SetWindowTitle( "Snake" )
RL_SetWindowIcon( RL_LoadImage( RL_GetBasePath().."../resources/images/apple.png" ) ) RL.SetWindowIcon( RL.LoadImage( RL.GetBasePath().."../resources/images/apple.png" ) )
framebuffer = RL_LoadRenderTexture( RESOLUTION ) framebuffer = RL.LoadRenderTexture( RESOLUTION )
grassTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/grass.png" ) grassTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/grass.png" )
snakeTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/snake.png" ) snakeTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/snake.png" )
appleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/apple.png" ) appleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/apple.png" )
setSnake() setSnake()
setApplePos() setApplePos()
@@ -122,16 +122,16 @@ local function moveSnake()
moveTimer = moveTimer + 1.0 moveTimer = moveTimer + 1.0
end end
function process( delta ) function RL.process( delta )
if gameState == STATE.GAME then -- Run game. if gameState == STATE.GAME then -- Run game.
-- Controls. -- Controls.
if RL_IsKeyPressed( KEY_RIGHT ) and 0 <= snake.heading[1] then if RL.IsKeyPressed( RL.KEY_RIGHT ) and 0 <= snake.heading[1] then
snake.control = { 1, 0 } snake.control = { 1, 0 }
elseif RL_IsKeyPressed( KEY_LEFT ) and snake.heading[1] <= 0 then elseif RL.IsKeyPressed( RL.KEY_LEFT ) and snake.heading[1] <= 0 then
snake.control = { -1, 0 } snake.control = { -1, 0 }
elseif RL_IsKeyPressed( KEY_DOWN ) and 0 <= snake.heading[2] then elseif RL.IsKeyPressed( RL.KEY_DOWN ) and 0 <= snake.heading[2] then
snake.control = { 0, 1 } snake.control = { 0, 1 }
elseif RL_IsKeyPressed( KEY_UP ) and snake.heading[2] <= 0 then elseif RL.IsKeyPressed( RL.KEY_UP ) and snake.heading[2] <= 0 then
snake.control = { 0, -1 } snake.control = { 0, -1 }
end end
@@ -140,7 +140,7 @@ function process( delta )
if moveTimer <= 0.0 then if moveTimer <= 0.0 then
moveSnake() moveSnake()
end end
elseif gameState == STATE.OVER and RL_IsKeyPressed( KEY_ENTER ) then -- Reset game. elseif gameState == STATE.OVER and RL.IsKeyPressed( RL.KEY_ENTER ) then -- Reset game.
setSnake() setSnake()
setApplePos() setApplePos()
gameState = STATE.GAME gameState = STATE.GAME
@@ -152,7 +152,7 @@ end
local function drawGrass() local function drawGrass()
for y = 0, LEVEL_SIZE - 1 do for y = 0, LEVEL_SIZE - 1 do
for x = 0, LEVEL_SIZE - 1 do for x = 0, LEVEL_SIZE - 1 do
RL_DrawTexture( grassTexture, { x * TILE_SIZE, y * TILE_SIZE }, WHITE ) RL.DrawTexture( grassTexture, { x * TILE_SIZE, y * TILE_SIZE }, RL.WHITE )
end end
end end
end end
@@ -168,14 +168,14 @@ end
local function drawSnake() local function drawSnake()
for i, seg in ipairs( snake.segments ) do for i, seg in ipairs( snake.segments ) do
local angle = math.deg( RL_Vector2Angle( { 0, 0 }, seg.heading ) ) local angle = math.deg( RL.Vector2Angle( { 0, 0 }, seg.heading ) )
local source = { 16, 0, 8, 8 } local source = { 16, 0, 8, 8 }
if i == 1 then -- Tail segment. Yes tail is actually the 'first' segment. if i == 1 then -- Tail segment. Yes tail is actually the 'first' segment.
source[1] = 8 source[1] = 8
if 1 < #snake.segments then if 1 < #snake.segments then
angle = math.deg( RL_Vector2Angle( { 0, 0 }, snake.segments[ 2 ].heading ) ) angle = math.deg( RL.Vector2Angle( { 0, 0 }, snake.segments[ 2 ].heading ) )
end end
elseif i < #snake.segments and not vector2IsEqual( seg.heading, snake.segments[ i+1 ].heading ) then -- Turned middle segments. elseif i < #snake.segments and not vector2IsEqual( seg.heading, snake.segments[ i+1 ].heading ) then -- Turned middle segments.
source[1] = 0 source[1] = 0
@@ -191,34 +191,34 @@ local function drawSnake()
end end
end end
-- Notice that we set the origin to center { 4, 4 } that acts as pivot point. We also have to adjust our dest position by 4. -- Notice that we set the origin to center { 4, 4 } that acts as pivot point. We also have to adjust our dest position by 4.
RL_DrawTexturePro( snakeTexture, source, { seg.pos[1] * TILE_SIZE + 4, seg.pos[2] * TILE_SIZE + 4, 8, 8 }, { 4, 4 }, angle, WHITE ) RL.DrawTexturePro( snakeTexture, source, { seg.pos[1] * TILE_SIZE + 4, seg.pos[2] * TILE_SIZE + 4, 8, 8 }, { 4, 4 }, angle, RL.WHITE )
end end
-- Let's draw the head last to keep it on top. -- Let's draw the head last to keep it on top.
local angle = math.deg( RL_Vector2Angle( { 0, 0 }, snake.heading ) ) local angle = math.deg( RL.Vector2Angle( { 0, 0 }, snake.heading ) )
RL_DrawTexturePro( snakeTexture, { 24, 0, 8, 8 }, { snake.headPos[1] * TILE_SIZE + 4, snake.headPos[2] * TILE_SIZE + 4, 8, 8 }, { 4, 4 }, angle, WHITE ) RL.DrawTexturePro( snakeTexture, { 24, 0, 8, 8 }, { snake.headPos[1] * TILE_SIZE + 4, snake.headPos[2] * TILE_SIZE + 4, 8, 8 }, { 4, 4 }, angle, RL.WHITE )
end end
local function drawApple() local function drawApple()
RL_DrawTexture( appleTexture, { applePos[1] * TILE_SIZE, applePos[2] * TILE_SIZE }, WHITE ) RL.DrawTexture( appleTexture, { applePos[1] * TILE_SIZE, applePos[2] * TILE_SIZE }, RL.WHITE )
end end
function draw() function RL.draw()
-- Clear the window to black. -- Clear the window to black.
RL_ClearBackground( BLACK ) RL.ClearBackground( RL.BLACK )
-- Draw to framebuffer. -- Draw to framebuffer.
RL_BeginTextureMode( framebuffer ) RL.BeginTextureMode( framebuffer )
RL_ClearBackground( BLACK ) RL.ClearBackground( RL.BLACK )
drawGrass() drawGrass()
drawSnake() drawSnake()
drawApple() drawApple()
if gameState == STATE.OVER then if gameState == STATE.OVER then
RL_DrawText( 0, "Press Enter to\nrestart", { 10, 10 }, 10, 2, WHITE ) RL.DrawText( 0, "Press Enter to\nrestart", { 10, 10 }, 10, 2, RL.WHITE )
end end
RL_EndTextureMode() RL.EndTextureMode()
-- Draw framebuffer to window. -- Draw framebuffer to window.
RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
RL_DrawTexturePro( framebuffer, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, WHITE ) RL.DrawTexturePro( framebuffer, { 0, 0, RESOLUTION[1], -RESOLUTION[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, RL.WHITE )
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE ) RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
end end

View File

@@ -9,40 +9,40 @@
local camera = -1 local camera = -1
local num_blocks = 15 local num_blocks = 15
function init() function RL.init()
local monitor = 0 local monitor = 0
local mPos = RL_GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
RL_SetWindowTitle( "Waving cubes" ) RL.SetWindowTitle( "Waving cubes" )
RL_SetWindowState( FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
camera = RL_CreateCamera3D() camera = RL.CreateCamera3D()
RL_SetCamera3DPosition( camera, { 30, 20, 30 } ) RL.SetCamera3DPosition( camera, { 30, 20, 30 } )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } ) RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } ) RL.SetCamera3DUp( camera, { 0, 1, 0 } )
end end
function draw() function RL.draw()
local t = RL_GetTime() local t = RL.GetTime()
local cos = math.cos local cos = math.cos
local sin = math.sin local sin = math.sin
local scale = (2.0 + sin(t)) * 0.7 local scale = (2.0 + sin(t)) * 0.7
local camera_time = t * 0.3 local camera_time = t * 0.3
local camera_pos = RL_GetCamera3DPosition( camera ) local camera_pos = RL.GetCamera3DPosition( camera )
camera_pos[1] = cos(camera_time) * 40.0 camera_pos[1] = cos(camera_time) * 40.0
camera_pos[3] = sin(camera_time) * 40.0 camera_pos[3] = sin(camera_time) * 40.0
RL_SetCamera3DPosition( camera, camera_pos ) RL.SetCamera3DPosition( camera, camera_pos )
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL_BeginMode3D( camera ) RL.BeginMode3D( camera )
RL_DrawGrid( 10, 5.0 ) RL.DrawGrid( 10, 5.0 )
for x = 0,num_blocks - 1 do for x = 0,num_blocks - 1 do
for y = 0,num_blocks - 1 do for y = 0,num_blocks - 1 do
@@ -55,14 +55,14 @@ function draw()
(y - num_blocks / 2) * (scale * 2.0) + scatter, (y - num_blocks / 2) * (scale * 2.0) + scatter,
(z - num_blocks / 2) * (scale * 3.0) + scatter (z - num_blocks / 2) * (scale * 3.0) + scatter
} }
local cube_color = RL_ColorFromHSV( (((x + y + z) * 18) % 360), 0.75, 0.9 ) local cube_color = RL.ColorFromHSV( (((x + y + z) * 18) % 360), 0.75, 0.9 )
local cube_size = (2.4 - scale) * block_scale local cube_size = (2.4 - scale) * block_scale
RL_DrawCube( cube_pos, { cube_size, cube_size, cube_size }, cube_color ) RL.DrawCube( cube_pos, { cube_size, cube_size, cube_size }, cube_color )
end end
end end
end end
RL_EndMode3D() RL.EndMode3D()
RL_DrawFPS( { 10, 10 } ) RL.DrawFPS( { 10, 10 } )
end end

View File

@@ -1,29 +1,29 @@
local textColor = BLACK local textColor = RL.BLACK
local textPos = { 192, 200 } local textPos = { 192, 200 }
local imageFont = -1 local imageFont = -1
local text = "Congrats! You created your first window!" local text = "Congrats! You created your first window!"
function init() function RL.init()
RL_SetWindowTitle( "First window" ) RL.SetWindowTitle( "First window" )
RL_SetWindowState( FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
end end
function process( delta ) function RL.process( delta )
if RL_IsKeyPressed( KEY_ENTER ) then if RL.IsKeyPressed( RL.KEY_ENTER ) then
local textSize = RL_MeasureText( 0, text, 20, 2 ) local textSize = RL.MeasureText( 0, text, 20, 2 )
local winSize = RL_GetScreenSize() local winSize = RL.GetScreenSize()
textColor = BLUE textColor = RL.BLUE
textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 } textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 }
end end
if RL_IsKeyPressed( KEY_SPACE ) then if RL.IsKeyPressed( RL.KEY_SPACE ) then
textColor = BLACK textColor = RL.BLACK
textPos = { 192, 200 } textPos = { 192, 200 }
end end
end end
function draw() function RL.draw()
RL_ClearBackground( RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL_DrawText( 0, text, textPos, 20, 2, textColor ) RL.DrawText( 0, text, textPos, 20, 2, textColor )
end end

View File

@@ -3,9 +3,9 @@
#define STRING_LEN 1024 #define STRING_LEN 1024
#define VERSION_MAJOR 0 #define VERSION_MAJOR 0
#define VERSION_MINOR 4 #define VERSION_MINOR 5
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_DEV 0 #define VERSION_DEV 1
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -58,7 +58,7 @@ static void checkWaveRealloc( int i ) {
*/ */
/* /*
> success = RL_SetMasterVolume( float volume ) > success = RL.SetMasterVolume( float volume )
Set master volume ( listener ) Set master volume ( listener )
@@ -67,7 +67,7 @@ Set master volume ( listener )
*/ */
int laudioSetMasterVolume( lua_State *L ) { int laudioSetMasterVolume( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetMasterVolume( float volume )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetMasterVolume( float volume )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -82,7 +82,7 @@ int laudioSetMasterVolume( lua_State *L ) {
*/ */
/* /*
> sound = RL_LoadSound( string fileName ) > sound = RL.LoadSound( string fileName )
Load sound from file Load sound from file
@@ -91,7 +91,7 @@ Load sound from file
*/ */
int laudioLoadSound( lua_State *L ) { int laudioLoadSound( lua_State *L ) {
if ( !lua_isstring( L, -1 ) ) { if ( !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadSound( string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadSound( string fileName )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -117,7 +117,7 @@ int laudioLoadSound( lua_State *L ) {
} }
/* /*
> wave = RL_LoadWave( string fileName ) > wave = RL.LoadWave( string fileName )
Load wave data from file Load wave data from file
@@ -126,7 +126,7 @@ Load wave data from file
*/ */
int laudioLoadWave( lua_State *L ) { int laudioLoadWave( lua_State *L ) {
if ( !lua_isstring( L, -1 ) ) { if ( !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadWave( string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadWave( string fileName )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -151,7 +151,7 @@ int laudioLoadWave( lua_State *L ) {
} }
/* /*
> sound = RL_LoadSoundFromWave( Wave wave ) > sound = RL.LoadSoundFromWave( Wave wave )
Load sound from wave data Load sound from wave data
@@ -160,7 +160,7 @@ Load sound from wave data
*/ */
int laudioLoadSoundFromWave( lua_State *L ) { int laudioLoadSoundFromWave( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadSoundFromWave( Wave wave )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadSoundFromWave( Wave wave )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -186,7 +186,7 @@ int laudioLoadSoundFromWave( lua_State *L ) {
} }
/* /*
> success = RL_UnloadSound( Sound sound ) > success = RL.UnloadSound( Sound sound )
Unload sound Unload sound
@@ -195,7 +195,7 @@ Unload sound
*/ */
int laudioUnloadSound( lua_State *L ) { int laudioUnloadSound( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UnloadSound( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UnloadSound( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -213,7 +213,7 @@ int laudioUnloadSound( lua_State *L ) {
} }
/* /*
> success = RL_UnloadWave( Wave wave ) > success = RL.UnloadWave( Wave wave )
Unload wave data Unload wave data
@@ -222,7 +222,7 @@ Unload wave data
*/ */
int laudioUnloadWave( lua_State *L ) { int laudioUnloadWave( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UnloadWave( Wave wave )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UnloadWave( Wave wave )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -240,7 +240,7 @@ int laudioUnloadWave( lua_State *L ) {
} }
/* /*
> success = RL_ExportWave( Wave wave, string fileName ) > success = RL.ExportWave( Wave wave, string fileName )
Export wave data to file, returns true on success Export wave data to file, returns true on success
@@ -249,7 +249,7 @@ Export wave data to file, returns true on success
*/ */
int laudioExportWave( lua_State *L ) { int laudioExportWave( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_ExportWave( Wave wave, string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ExportWave( Wave wave, string fileName )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -265,7 +265,7 @@ int laudioExportWave( lua_State *L ) {
} }
/* /*
> success = RL_ExportWaveAsCode( Wave wave, string fileName ) > success = RL.ExportWaveAsCode( Wave wave, string fileName )
Export wave sample data to code (.h), returns true on success Export wave sample data to code (.h), returns true on success
@@ -274,7 +274,7 @@ Export wave sample data to code (.h), returns true on success
*/ */
int laudioExportWaveAsCode( lua_State *L ) { int laudioExportWaveAsCode( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_ExportWaveAsCode( Wave wave, string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ExportWaveAsCode( Wave wave, string fileName )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -294,7 +294,7 @@ int laudioExportWaveAsCode( lua_State *L ) {
*/ */
/* /*
> success = RL_PlaySound( Sound sound ) > success = RL.PlaySound( Sound sound )
Play a sound Play a sound
@@ -303,7 +303,7 @@ Play a sound
*/ */
int laudioPlaySound( lua_State *L ) { int laudioPlaySound( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_PlaySound( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.PlaySound( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -320,7 +320,7 @@ int laudioPlaySound( lua_State *L ) {
} }
/* /*
> success = RL_StopSound( Sound sound ) > success = RL.StopSound( Sound sound )
Stop playing a sound Stop playing a sound
@@ -329,7 +329,7 @@ Stop playing a sound
*/ */
int laudioStopSound( lua_State *L ) { int laudioStopSound( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_StopSound( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.StopSound( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -346,7 +346,7 @@ int laudioStopSound( lua_State *L ) {
} }
/* /*
> success = RL_PauseSound( Sound sound ) > success = RL.PauseSound( Sound sound )
Pause a sound Pause a sound
@@ -355,7 +355,7 @@ Pause a sound
*/ */
int laudioPauseSound( lua_State *L ) { int laudioPauseSound( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_PauseSound( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.PauseSound( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -372,7 +372,7 @@ int laudioPauseSound( lua_State *L ) {
} }
/* /*
> success = RL_ResumeSound( Sound sound ) > success = RL.ResumeSound( Sound sound )
Resume a paused sound Resume a paused sound
@@ -381,7 +381,7 @@ Resume a paused sound
*/ */
int laudioResumeSound( lua_State *L ) { int laudioResumeSound( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_ResumeSound( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.ResumeSound( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -398,7 +398,7 @@ int laudioResumeSound( lua_State *L ) {
} }
/* /*
> success = RL_PlaySoundMulti( Sound sound ) > success = RL.PlaySoundMulti( Sound sound )
Play a sound ( Using multichannel buffer pool ) Play a sound ( Using multichannel buffer pool )
@@ -407,7 +407,7 @@ Play a sound ( Using multichannel buffer pool )
*/ */
int laudioPlaySoundMulti( lua_State *L ) { int laudioPlaySoundMulti( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_PlaySoundMulti( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.PlaySoundMulti( Sound sound )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -424,7 +424,7 @@ int laudioPlaySoundMulti( lua_State *L ) {
} }
/* /*
> RL_StopSoundMulti() > RL.StopSoundMulti()
Stop any sound playing ( using multichannel buffer pool ) Stop any sound playing ( using multichannel buffer pool )
*/ */
@@ -435,7 +435,7 @@ int laudioStopSoundMulti( lua_State *L ) {
} }
/* /*
> count = RL_GetSoundsPlaying() > count = RL.GetSoundsPlaying()
Get number of sounds playing in the multichannel Get number of sounds playing in the multichannel
@@ -448,7 +448,7 @@ int laudioGetSoundsPlaying( lua_State *L ) {
} }
/* /*
> playing = RL_IsSoundPlaying( Sound sound ) > playing = RL.IsSoundPlaying( Sound sound )
Check if a sound is currently playing Check if a sound is currently playing
@@ -457,7 +457,7 @@ Check if a sound is currently playing
*/ */
int laudioIsSoundPlaying( lua_State *L ) { int laudioIsSoundPlaying( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_IsSoundPlaying( Sound sound )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.IsSoundPlaying( Sound sound )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -473,7 +473,7 @@ int laudioIsSoundPlaying( lua_State *L ) {
} }
/* /*
> success = RL_SetSoundVolume( Sound sound, float volume ) > success = RL.SetSoundVolume( Sound sound, float volume )
Set volume for a sound ( 1.0 is max level ) Set volume for a sound ( 1.0 is max level )
@@ -482,7 +482,7 @@ Set volume for a sound ( 1.0 is max level )
*/ */
int laudioSetSoundVolume( lua_State *L ) { int laudioSetSoundVolume( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetSoundVolume( Sound sound, float volume )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetSoundVolume( Sound sound, float volume )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -497,7 +497,7 @@ int laudioSetSoundVolume( lua_State *L ) {
} }
/* /*
> success = RL_SetSoundPitch( Sound sound, float pitch ) > success = RL.SetSoundPitch( Sound sound, float pitch )
Set pitch for a sound ( 1.0 is base level ) Set pitch for a sound ( 1.0 is base level )
@@ -506,7 +506,7 @@ Set pitch for a sound ( 1.0 is base level )
*/ */
int laudioSetSoundPitch( lua_State *L ) { int laudioSetSoundPitch( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetSoundPitch( Sound sound, float pitch )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetSoundPitch( Sound sound, float pitch )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -521,7 +521,7 @@ int laudioSetSoundPitch( lua_State *L ) {
} }
/* /*
> success = RL_SetSoundPan( Sound sound, float pan ) > success = RL.SetSoundPan( Sound sound, float pan )
Set pan for a sound ( 0.5 is center ) Set pan for a sound ( 0.5 is center )
@@ -530,7 +530,7 @@ Set pan for a sound ( 0.5 is center )
*/ */
int laudioSetSoundPan( lua_State *L ) { int laudioSetSoundPan( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetSoundPan( Sound sound, float pitch )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetSoundPan( Sound sound, float pitch )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -545,7 +545,7 @@ int laudioSetSoundPan( lua_State *L ) {
} }
/* /*
> success = RL_WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels ) > success = RL.WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels )
Convert wave data to desired format Convert wave data to desired format
@@ -554,7 +554,7 @@ Convert wave data to desired format
*/ */
int laudioWaveFormat( lua_State *L ) { int laudioWaveFormat( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.WaveFormat( Wave wave, int sampleRate, int sampleSize, int channels )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -574,7 +574,7 @@ int laudioWaveFormat( lua_State *L ) {
} }
/* /*
> wave = RL_WaveCopy( Wave wave ) > wave = RL.WaveCopy( Wave wave )
Copy a wave to a new wave Copy a wave to a new wave
@@ -583,7 +583,7 @@ Copy a wave to a new wave
*/ */
int laudioWaveCopy( lua_State *L ) { int laudioWaveCopy( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_WaveCopy( Wave wave )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.WaveCopy( Wave wave )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -609,7 +609,7 @@ int laudioWaveCopy( lua_State *L ) {
} }
/* /*
> success = RL_WaveCrop( Wave wave, int initSample, int finalSample ) > success = RL.WaveCrop( Wave wave, int initSample, int finalSample )
Crop a wave to defined samples range Crop a wave to defined samples range
@@ -618,7 +618,7 @@ Crop a wave to defined samples range
*/ */
int laudioWaveCrop( lua_State *L ) { int laudioWaveCrop( lua_State *L ) {
if ( !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_WaveCrop( Wave wave, int initSample, int finalSample )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.WaveCrop( Wave wave, int initSample, int finalSample )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -641,7 +641,7 @@ int laudioWaveCrop( lua_State *L ) {
*/ */
/* /*
> success = RL_LoadMusicStream( string fileName ) > success = RL.LoadMusicStream( string fileName )
Load music stream from file Load music stream from file
@@ -650,7 +650,7 @@ Load music stream from file
*/ */
int laudioLoadMusicStream( lua_State *L ) { int laudioLoadMusicStream( lua_State *L ) {
if ( !lua_isstring( L, -1 ) ) { if ( !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadMusicStream( string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadMusicStream( string fileName )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -668,7 +668,7 @@ int laudioLoadMusicStream( lua_State *L ) {
} }
/* /*
> RL_PlayMusicStream() > RL.PlayMusicStream()
Start music playing Start music playing
*/ */
@@ -679,7 +679,7 @@ int laudioPlayMusicStream( lua_State *L ) {
} }
/* /*
> playing = RL_PlayMusicStream() > playing = RL.IsMusicStreamPlaying()
Check if music is playing Check if music is playing
@@ -692,7 +692,7 @@ int laudioIsMusicStreamPlaying( lua_State *L ) {
} }
/* /*
> RL_StopMusicStream() > RL.StopMusicStream()
Stop music playing Stop music playing
*/ */
@@ -703,7 +703,7 @@ int laudioStopMusicStream( lua_State *L ) {
} }
/* /*
> RL_PauseMusicStream() > RL.PauseMusicStream()
Pause music playing Pause music playing
*/ */
@@ -714,7 +714,7 @@ int laudioPauseMusicStream( lua_State *L ) {
} }
/* /*
> RL_ResumeMusicStream() > RL.ResumeMusicStream()
Resume playing paused music Resume playing paused music
*/ */
@@ -725,7 +725,7 @@ int laudioResumeMusicStream( lua_State *L ) {
} }
/* /*
> success = RL_SeekMusicStream( float position ) > success = RL.SeekMusicStream( float position )
Seek music to a position ( in seconds ) Seek music to a position ( in seconds )
@@ -734,7 +734,7 @@ Seek music to a position ( in seconds )
*/ */
int laudioSeekMusicStream( lua_State *L ) { int laudioSeekMusicStream( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SeekMusicStream( float position )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SeekMusicStream( float position )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -745,7 +745,7 @@ int laudioSeekMusicStream( lua_State *L ) {
} }
/* /*
> success = RL_SetMusicVolume( float volume ) > success = RL.SetMusicVolume( float volume )
Set volume for music ( 1.0 is max level ) Set volume for music ( 1.0 is max level )
@@ -754,7 +754,7 @@ Set volume for music ( 1.0 is max level )
*/ */
int laudioSetMusicVolume( lua_State *L ) { int laudioSetMusicVolume( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetMusicVolume( float volume )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetMusicVolume( float volume )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -765,7 +765,7 @@ int laudioSetMusicVolume( lua_State *L ) {
} }
/* /*
> success = RL_SetMusicPitch( float pitch ) > success = RL.SetMusicPitch( float pitch )
Set pitch for a music ( 1.0 is base level ) Set pitch for a music ( 1.0 is base level )
@@ -774,7 +774,7 @@ Set pitch for a music ( 1.0 is base level )
*/ */
int laudioSetMusicPitch( lua_State *L ) { int laudioSetMusicPitch( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetMusicPitch( float pitch )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetMusicPitch( float pitch )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -785,7 +785,7 @@ int laudioSetMusicPitch( lua_State *L ) {
} }
/* /*
> success = RL_SetMusicPan( float pan ) > success = RL.SetMusicPan( float pan )
Set pan for a music ( 0.5 is center ) Set pan for a music ( 0.5 is center )
@@ -794,7 +794,7 @@ Set pan for a music ( 0.5 is center )
*/ */
int laudioSetMusicPan( lua_State *L ) { int laudioSetMusicPan( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetMusicPan( float pan )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetMusicPan( float pan )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -805,7 +805,7 @@ int laudioSetMusicPan( lua_State *L ) {
} }
/* /*
> length = RL_GetMusicTimeLength() > length = RL.GetMusicTimeLength()
Get music time length ( in seconds ) Get music time length ( in seconds )
@@ -818,7 +818,7 @@ int laudioGetMusicTimeLength( lua_State *L ) {
} }
/* /*
> played = RL_GetMusicTimePlayed() > played = RL.GetMusicTimePlayed()
Get current music time played ( in seconds ) Get current music time played ( in seconds )

File diff suppressed because it is too large Load Diff

View File

@@ -9,7 +9,7 @@
*/ */
/* /*
> value = RL_EaseLinear( float t, float b, float c, float d ) > value = RL.EaseLinear( float t, float b, float c, float d )
Ease linear Ease linear
@@ -18,7 +18,7 @@ Ease linear
*/ */
int leasingsEaseLinear( lua_State *L ) { int leasingsEaseLinear( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseLinear( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseLinear( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -32,7 +32,7 @@ int leasingsEaseLinear( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseSineIn( float t, float b, float c, float d ) > value = RL.EaseSineIn( float t, float b, float c, float d )
Ease sine in Ease sine in
@@ -41,7 +41,7 @@ Ease sine in
*/ */
int leasingsEaseSineIn( lua_State *L ) { int leasingsEaseSineIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseSineIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseSineIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -51,7 +51,7 @@ int leasingsEaseSineIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseSineOut( float t, float b, float c, float d ) > value = RL.EaseSineOut( float t, float b, float c, float d )
Ease sine out Ease sine out
@@ -60,7 +60,7 @@ Ease sine out
*/ */
int leasingsEaseSineOut( lua_State *L ) { int leasingsEaseSineOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseSineOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseSineOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -70,7 +70,7 @@ int leasingsEaseSineOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseSineInOut( float t, float b, float c, float d ) > value = RL.EaseSineInOut( float t, float b, float c, float d )
Ease sine in out Ease sine in out
@@ -79,7 +79,7 @@ Ease sine in out
*/ */
int leasingsEaseSineInOut( lua_State *L ) { int leasingsEaseSineInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseSineInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseSineInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -93,7 +93,7 @@ int leasingsEaseSineInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseCircIn( float t, float b, float c, float d ) > value = RL.EaseCircIn( float t, float b, float c, float d )
Ease circle in Ease circle in
@@ -102,7 +102,7 @@ Ease circle in
*/ */
int leasingsEaseCircIn( lua_State *L ) { int leasingsEaseCircIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCircIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCircIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -112,7 +112,7 @@ int leasingsEaseCircIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseCircOut( float t, float b, float c, float d ) > value = RL.EaseCircOut( float t, float b, float c, float d )
Ease circle out Ease circle out
@@ -121,7 +121,7 @@ Ease circle out
*/ */
int leasingsEaseCircOut( lua_State *L ) { int leasingsEaseCircOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCircOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCircOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -131,7 +131,7 @@ int leasingsEaseCircOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseCircInOut( float t, float b, float c, float d ) > value = RL.EaseCircInOut( float t, float b, float c, float d )
Ease circle in out Ease circle in out
@@ -140,7 +140,7 @@ Ease circle in out
*/ */
int leasingsEaseCircInOut( lua_State *L ) { int leasingsEaseCircInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCircInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCircInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -154,7 +154,7 @@ int leasingsEaseCircInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseCubicIn( float t, float b, float c, float d ) > value = RL.EaseCubicIn( float t, float b, float c, float d )
Ease cubic in Ease cubic in
@@ -163,7 +163,7 @@ Ease cubic in
*/ */
int leasingsEaseCubicIn( lua_State *L ) { int leasingsEaseCubicIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCubicIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCubicIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -173,7 +173,7 @@ int leasingsEaseCubicIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseCubicOut( float t, float b, float c, float d ) > value = RL.EaseCubicOut( float t, float b, float c, float d )
Ease cubic out Ease cubic out
@@ -182,7 +182,7 @@ Ease cubic out
*/ */
int leasingsEaseCubicOut( lua_State *L ) { int leasingsEaseCubicOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCubicOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCubicOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -192,7 +192,7 @@ int leasingsEaseCubicOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseCubicInOut( float t, float b, float c, float d ) > value = RL.EaseCubicInOut( float t, float b, float c, float d )
Ease cubic in out Ease cubic in out
@@ -201,7 +201,7 @@ Ease cubic in out
*/ */
int leasingsEaseCubicInOut( lua_State *L ) { int leasingsEaseCubicInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseCubicInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseCubicInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -215,7 +215,7 @@ int leasingsEaseCubicInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseQuadIn( float t, float b, float c, float d ) > value = RL.EaseQuadIn( float t, float b, float c, float d )
Ease quadratic in Ease quadratic in
@@ -224,7 +224,7 @@ Ease quadratic in
*/ */
int leasingsEaseQuadIn( lua_State *L ) { int leasingsEaseQuadIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseQuadIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseQuadIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -234,7 +234,7 @@ int leasingsEaseQuadIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseQuadOut( float t, float b, float c, float d ) > value = RL.EaseQuadOut( float t, float b, float c, float d )
Ease quadratic out Ease quadratic out
@@ -243,7 +243,7 @@ Ease quadratic out
*/ */
int leasingsEaseQuadOut( lua_State *L ) { int leasingsEaseQuadOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseQuadOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseQuadOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -253,7 +253,7 @@ int leasingsEaseQuadOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseQuadInOut( float t, float b, float c, float d ) > value = RL.EaseQuadInOut( float t, float b, float c, float d )
Ease quadratic in out Ease quadratic in out
@@ -262,7 +262,7 @@ Ease quadratic in out
*/ */
int leasingsEaseQuadInOut( lua_State *L ) { int leasingsEaseQuadInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseQuadInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseQuadInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -276,7 +276,7 @@ int leasingsEaseQuadInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseExpoIn( float t, float b, float c, float d ) > value = RL.EaseExpoIn( float t, float b, float c, float d )
Ease exponential in Ease exponential in
@@ -285,7 +285,7 @@ Ease exponential in
*/ */
int leasingsEaseExpoIn( lua_State *L ) { int leasingsEaseExpoIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseExpoIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseExpoIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -295,7 +295,7 @@ int leasingsEaseExpoIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseExpoOut( float t, float b, float c, float d ) > value = RL.EaseExpoOut( float t, float b, float c, float d )
Ease exponential out Ease exponential out
@@ -304,7 +304,7 @@ Ease exponential out
*/ */
int leasingsEaseExpoOut( lua_State *L ) { int leasingsEaseExpoOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseExpoOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseExpoOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -314,7 +314,7 @@ int leasingsEaseExpoOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseExpoInOut( float t, float b, float c, float d ) > value = RL.EaseExpoInOut( float t, float b, float c, float d )
Ease exponential in out Ease exponential in out
@@ -323,7 +323,7 @@ Ease exponential in out
*/ */
int leasingsEaseExpoInOut( lua_State *L ) { int leasingsEaseExpoInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseExpoInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseExpoInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -337,7 +337,7 @@ int leasingsEaseExpoInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseBackIn( float t, float b, float c, float d ) > value = RL.EaseBackIn( float t, float b, float c, float d )
Ease back in Ease back in
@@ -346,7 +346,7 @@ Ease back in
*/ */
int leasingsEaseBackIn( lua_State *L ) { int leasingsEaseBackIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBackIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBackIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -356,7 +356,7 @@ int leasingsEaseBackIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseBackOut( float t, float b, float c, float d ) > value = RL.EaseBackOut( float t, float b, float c, float d )
Ease back out Ease back out
@@ -365,7 +365,7 @@ Ease back out
*/ */
int leasingsEaseBackOut( lua_State *L ) { int leasingsEaseBackOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBackOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBackOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -375,7 +375,7 @@ int leasingsEaseBackOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseBackInOut( float t, float b, float c, float d ) > value = RL.EaseBackInOut( float t, float b, float c, float d )
Ease back in out Ease back in out
@@ -384,7 +384,7 @@ Ease back in out
*/ */
int leasingsEaseBackInOut( lua_State *L ) { int leasingsEaseBackInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBackInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBackInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -398,7 +398,7 @@ int leasingsEaseBackInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseBounceIn( float t, float b, float c, float d ) > value = RL.EaseBounceIn( float t, float b, float c, float d )
Ease bounce in Ease bounce in
@@ -407,7 +407,7 @@ Ease bounce in
*/ */
int leasingsEaseBounceIn( lua_State *L ) { int leasingsEaseBounceIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBounceIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBounceIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -417,7 +417,7 @@ int leasingsEaseBounceIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseBounceOut( float t, float b, float c, float d ) > value = RL.EaseBounceOut( float t, float b, float c, float d )
Ease bounce out Ease bounce out
@@ -426,7 +426,7 @@ Ease bounce out
*/ */
int leasingsEaseBounceOut( lua_State *L ) { int leasingsEaseBounceOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBounceOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBounceOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -436,7 +436,7 @@ int leasingsEaseBounceOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseBounceInOut( float t, float b, float c, float d ) > value = RL.EaseBounceInOut( float t, float b, float c, float d )
Ease bounce in out Ease bounce in out
@@ -445,7 +445,7 @@ Ease bounce in out
*/ */
int leasingsEaseBounceInOut( lua_State *L ) { int leasingsEaseBounceInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseBounceInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseBounceInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -459,7 +459,7 @@ int leasingsEaseBounceInOut( lua_State *L ) {
*/ */
/* /*
> value = RL_EaseElasticIn( float t, float b, float c, float d ) > value = RL.EaseElasticIn( float t, float b, float c, float d )
Ease elastic in Ease elastic in
@@ -468,7 +468,7 @@ Ease elastic in
*/ */
int leasingsEaseElasticIn( lua_State *L ) { int leasingsEaseElasticIn( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseElasticIn( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseElasticIn( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -478,7 +478,7 @@ int leasingsEaseElasticIn( lua_State *L ) {
} }
/* /*
> value = RL_EaseElasticOut( float t, float b, float c, float d ) > value = RL.EaseElasticOut( float t, float b, float c, float d )
Ease elastic out Ease elastic out
@@ -487,7 +487,7 @@ Ease elastic out
*/ */
int leasingsEaseElasticOut( lua_State *L ) { int leasingsEaseElasticOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseElasticOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseElasticOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -497,7 +497,7 @@ int leasingsEaseElasticOut( lua_State *L ) {
} }
/* /*
> value = RL_EaseElasticInOut( float t, float b, float c, float d ) > value = RL.EaseElasticInOut( float t, float b, float c, float d )
Ease elastic in out Ease elastic in out
@@ -506,7 +506,7 @@ Ease elastic in out
*/ */
int leasingsEaseElasticInOut( lua_State *L ) { int leasingsEaseElasticInOut( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_EaseElasticInOut( float t, float b, float c, float d )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.EaseElasticInOut( float t, float b, float c, float d )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }

View File

@@ -37,7 +37,7 @@ bool validLight( size_t id ) {
*/ */
/* /*
> light = RL_CreateLight( int type, Vector3 position, Vector3 target, Color color, Shader shader ) > light = RL.CreateLight( int type, Vector3 position, Vector3 target, Color color, Shader shader )
Create a light and get shader locations Create a light and get shader locations
@@ -46,7 +46,7 @@ Create a light and get shader locations
*/ */
int llightsCreateLight( lua_State *L ) { int llightsCreateLight( lua_State *L ) {
if ( !lua_isnumber( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CreateLight( int type, Vector3 position, Vector3 target, Color color, Shader shader )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CreateLight( int type, Vector3 position, Vector3 target, Color color, Shader shader )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -76,7 +76,7 @@ int llightsCreateLight( lua_State *L ) {
} }
/* /*
> success = RL_UpdateLightValues( Shader shader, Light light ) > success = RL.UpdateLightValues( Shader shader, Light light )
Send light properties to shader Send light properties to shader
@@ -85,7 +85,7 @@ Send light properties to shader
*/ */
int llightsUpdateLightValues( lua_State *L ) { int llightsUpdateLightValues( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UpdateLightValues( Shader shader, Light light )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UpdateLightValues( Shader shader, Light light )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -11,7 +11,7 @@
*/ */
/* /*
> RL_GuiEnable() > RL.GuiEnable()
Enable gui controls ( global state ) Enable gui controls ( global state )
*/ */
@@ -22,7 +22,7 @@ int lguiGuiEnable( lua_State *L ) {
} }
/* /*
> RL_GuiDisable() > RL.GuiDisable()
Disable gui controls ( global state ) Disable gui controls ( global state )
*/ */
@@ -33,7 +33,7 @@ int lguiGuiDisable( lua_State *L ) {
} }
/* /*
> RL_GuiLock() > RL.GuiLock()
Lock gui controls ( global state ) Lock gui controls ( global state )
*/ */
@@ -44,7 +44,7 @@ int lguiGuiLock( lua_State *L ) {
} }
/* /*
> RL_GuiUnlock() > RL.GuiUnlock()
Unlock gui controls ( global state ) Unlock gui controls ( global state )
*/ */
@@ -55,7 +55,7 @@ int lguiGuiUnlock( lua_State *L ) {
} }
/* /*
> locked = RL_GuiIsLocked() > locked = RL.GuiIsLocked()
Check if gui is locked ( global state ) Check if gui is locked ( global state )
@@ -68,7 +68,7 @@ int lguiGuiIsLocked( lua_State *L ) {
} }
/* /*
> success = RL_GuiFade( float alpha ) > success = RL.GuiFade( float alpha )
Set gui controls alpha ( global state ), alpha goes from 0.0f to 1.0f Set gui controls alpha ( global state ), alpha goes from 0.0f to 1.0f
@@ -77,7 +77,7 @@ Set gui controls alpha ( global state ), alpha goes from 0.0f to 1.0f
*/ */
int lguiGuiFade( lua_State *L ) { int lguiGuiFade( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiFade( float alpha )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiFade( float alpha )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -88,7 +88,7 @@ int lguiGuiFade( lua_State *L ) {
} }
/* /*
> success = RL_GuiSetState( int state ) > success = RL.GuiSetState( int state )
Set gui state ( global state ) Set gui state ( global state )
@@ -97,7 +97,7 @@ Set gui state ( global state )
*/ */
int lguiGuiSetState( lua_State *L ) { int lguiGuiSetState( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetState( int state )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSetState( int state )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -108,7 +108,7 @@ int lguiGuiSetState( lua_State *L ) {
} }
/* /*
> state = RL_GuiGetState() > state = RL.GuiGetState()
Get gui state ( global state ) Get gui state ( global state )
@@ -125,7 +125,7 @@ int lguiGuiGetState( lua_State *L ) {
*/ */
/* /*
> success = RL_GuiSetFont( Font font ) > success = RL.GuiSetFont( Font font )
Set gui custom font ( Global state ) Set gui custom font ( Global state )
@@ -134,7 +134,7 @@ Set gui custom font ( Global state )
*/ */
int lguiGuiSetFont( lua_State *L ) { int lguiGuiSetFont( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetFont( Font font )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSetFont( Font font )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -149,7 +149,7 @@ int lguiGuiSetFont( lua_State *L ) {
*/ */
/* /*
> success = RL_GuiSetStyle( int control, int property, int value ) > success = RL.GuiSetStyle( int control, int property, int value )
Set one style property Set one style property
@@ -158,7 +158,7 @@ Set one style property
*/ */
int lguiGuiSetStyle( lua_State *L ) { int lguiGuiSetStyle( lua_State *L ) {
if ( !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetStyle( int control, int property, int value )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSetStyle( int control, int property, int value )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -169,7 +169,7 @@ int lguiGuiSetStyle( lua_State *L ) {
} }
/* /*
> value = RL_GuiGetStyle( int control, int property ) > value = RL.GuiGetStyle( int control, int property )
Get one style property Get one style property
@@ -178,7 +178,7 @@ Get one style property
*/ */
int lguiGuiGetStyle( lua_State *L ) { int lguiGuiGetStyle( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiGetStyle( int control, int property )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiGetStyle( int control, int property )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -188,7 +188,7 @@ int lguiGuiGetStyle( lua_State *L ) {
} }
/* /*
> success = RL_GuiLoadStyle( int control, int property ) > success = RL.GuiLoadStyle( int control, int property )
Load style file over global style variable ( .rgs ) Load style file over global style variable ( .rgs )
@@ -197,7 +197,7 @@ Load style file over global style variable ( .rgs )
*/ */
int lguiGuiLoadStyle( lua_State *L ) { int lguiGuiLoadStyle( lua_State *L ) {
if ( !lua_isstring( L, -1 ) ) { if ( !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLoadStyle( string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiLoadStyle( string fileName )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -208,7 +208,7 @@ int lguiGuiLoadStyle( lua_State *L ) {
} }
/* /*
> RL_GuiLoadStyleDefault() > RL.GuiLoadStyleDefault()
Load style default over global style Load style default over global style
*/ */
@@ -223,7 +223,7 @@ int lguiGuiLoadStyleDefault( lua_State *L ) {
*/ */
/* /*
> state = RL_GuiWindowBox( Rectangle bounds, string title ) > state = RL.GuiWindowBox( Rectangle bounds, string title )
Window Box control, shows a window that can be closed Window Box control, shows a window that can be closed
@@ -232,7 +232,7 @@ Window Box control, shows a window that can be closed
*/ */
int lguiGuiWindowBox( lua_State *L ) { int lguiGuiWindowBox( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiWindowBox( Rectangle bounds, string title )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiWindowBox( Rectangle bounds, string title )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -247,7 +247,7 @@ int lguiGuiWindowBox( lua_State *L ) {
} }
/* /*
> success = RL_GuiGroupBox( Rectangle bounds, string text ) > success = RL.GuiGroupBox( Rectangle bounds, string text )
Group Box control with text name Group Box control with text name
@@ -256,7 +256,7 @@ Group Box control with text name
*/ */
int lguiGuiGroupBox( lua_State *L ) { int lguiGuiGroupBox( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiGroupBox( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiGroupBox( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -272,7 +272,7 @@ int lguiGuiGroupBox( lua_State *L ) {
} }
/* /*
> success = RL_GuiLine( Rectangle bounds, string text ) > success = RL.GuiLine( Rectangle bounds, string text )
Line separator control, could contain text Line separator control, could contain text
@@ -281,7 +281,7 @@ Line separator control, could contain text
*/ */
int lguiGuiLine( lua_State *L ) { int lguiGuiLine( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLine( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiLine( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -297,7 +297,7 @@ int lguiGuiLine( lua_State *L ) {
} }
/* /*
> success = RL_GuiPanel( Rectangle bounds, string text ) > success = RL.GuiPanel( Rectangle bounds, string text )
Panel control, useful to group controls Panel control, useful to group controls
@@ -306,7 +306,7 @@ Panel control, useful to group controls
*/ */
int lguiGuiPanel( lua_State *L ) { int lguiGuiPanel( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiPanel( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiPanel( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -322,7 +322,7 @@ int lguiGuiPanel( lua_State *L ) {
} }
/* /*
> view, scroll = RL_GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll ) > view, scroll = RL.GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )
Scroll Panel control Scroll Panel control
@@ -331,7 +331,7 @@ Scroll Panel control
*/ */
int lguiGuiScrollPanel( lua_State *L ) { int lguiGuiScrollPanel( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiScrollPanel( Rectangle bounds, string text, Rectangle content, Vector2 scroll )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -355,7 +355,7 @@ int lguiGuiScrollPanel( lua_State *L ) {
*/ */
/* /*
> success = RL_GuiLabel( Rectangle bounds, string text ) > success = RL.GuiLabel( Rectangle bounds, string text )
Label control, shows text Label control, shows text
@@ -364,7 +364,7 @@ Label control, shows text
*/ */
int lguiGuiLabel( lua_State *L ) { int lguiGuiLabel( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLabel( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiLabel( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -380,7 +380,7 @@ int lguiGuiLabel( lua_State *L ) {
} }
/* /*
> clicked = RL_GuiButton( Rectangle bounds, string text ) > clicked = RL.GuiButton( Rectangle bounds, string text )
Button control, returns true when clicked Button control, returns true when clicked
@@ -389,7 +389,7 @@ Button control, returns true when clicked
*/ */
int lguiGuiButton( lua_State *L ) { int lguiGuiButton( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiButton( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiButton( Rectangle bounds, string text )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -404,7 +404,7 @@ int lguiGuiButton( lua_State *L ) {
} }
/* /*
> clicked = RL_GuiLabelButton( Rectangle bounds, string text ) > clicked = RL.GuiLabelButton( Rectangle bounds, string text )
Label button control, show true when clicked Label button control, show true when clicked
@@ -413,7 +413,7 @@ Label button control, show true when clicked
*/ */
int lguiGuiLabelButton( lua_State *L ) { int lguiGuiLabelButton( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiLabelButton( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiLabelButton( Rectangle bounds, string text )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -428,7 +428,7 @@ int lguiGuiLabelButton( lua_State *L ) {
} }
/* /*
> active = RL_GuiToggle( Rectangle bounds, string text, bool active ) > active = RL.GuiToggle( Rectangle bounds, string text, bool active )
Toggle Button control, returns true when active Toggle Button control, returns true when active
@@ -437,7 +437,7 @@ Toggle Button control, returns true when active
*/ */
int lguiGuiToggle( lua_State *L ) { int lguiGuiToggle( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isboolean( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiToggle( Rectangle bounds, string text, bool active )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiToggle( Rectangle bounds, string text, bool active )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -454,7 +454,7 @@ int lguiGuiToggle( lua_State *L ) {
} }
/* /*
> index = RL_GuiToggleGroup( Rectangle bounds, string text, int active ) > index = RL.GuiToggleGroup( Rectangle bounds, string text, int active )
Toggle Group control, returns active toggle index Toggle Group control, returns active toggle index
@@ -463,7 +463,7 @@ Toggle Group control, returns active toggle index
*/ */
int lguiGuiToggleGroup( lua_State *L ) { int lguiGuiToggleGroup( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiToggleGroup( Rectangle bounds, string text, bool active )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiToggleGroup( Rectangle bounds, string text, bool active )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -480,7 +480,7 @@ int lguiGuiToggleGroup( lua_State *L ) {
} }
/* /*
> active = RL_GuiCheckBox( Rectangle bounds, string text, bool checked ) > active = RL.GuiCheckBox( Rectangle bounds, string text, bool checked )
Check Box control, returns true when active Check Box control, returns true when active
@@ -489,7 +489,7 @@ Check Box control, returns true when active
*/ */
int lguiGuiCheckBox( lua_State *L ) { int lguiGuiCheckBox( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isboolean( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiCheckBox( Rectangle bounds, string text, bool checked )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiCheckBox( Rectangle bounds, string text, bool checked )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -506,7 +506,7 @@ int lguiGuiCheckBox( lua_State *L ) {
} }
/* /*
> active = RL_GuiComboBox( Rectangle bounds, string text, int active ) > active = RL.GuiComboBox( Rectangle bounds, string text, int active )
Combo Box control, returns selected item index Combo Box control, returns selected item index
@@ -515,7 +515,7 @@ Combo Box control, returns selected item index
*/ */
int lguiGuiComboBox( lua_State *L ) { int lguiGuiComboBox( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiComboBox( Rectangle bounds, string text, int active )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiComboBox( Rectangle bounds, string text, int active )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -532,7 +532,7 @@ int lguiGuiComboBox( lua_State *L ) {
} }
/* /*
> pressed, text = RL_GuiTextBox( Rectangle bounds, string text, int textSize, bool editMode ) > pressed, text = RL.GuiTextBox( Rectangle bounds, string text, int textSize, bool editMode )
Text Box control, updates input text Text Box control, updates input text
@@ -541,7 +541,7 @@ Text Box control, updates input text
*/ */
int lguiGuiTextBox( lua_State *L ) { int lguiGuiTextBox( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiTextBox( Rectangle bounds, string text, int textSize, bool editMode )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiTextBox( Rectangle bounds, string text, int textSize, bool editMode )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -561,7 +561,7 @@ int lguiGuiTextBox( lua_State *L ) {
} }
/* /*
> pressed, text = RL_GuiTextBoxMulti( Rectangle bounds, string text, int textSize, bool editMode ) > pressed, text = RL.GuiTextBoxMulti( Rectangle bounds, string text, int textSize, bool editMode )
Text Box control with multiple lines Text Box control with multiple lines
@@ -570,7 +570,7 @@ Text Box control with multiple lines
*/ */
int lguiGuiTextBoxMulti( lua_State *L ) { int lguiGuiTextBoxMulti( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiTextBoxMulti( Rectangle bounds, string text, int textSize, bool editMode )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiTextBoxMulti( Rectangle bounds, string text, int textSize, bool editMode )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -590,7 +590,7 @@ int lguiGuiTextBoxMulti( lua_State *L ) {
} }
/* /*
> pressed, value = RL_GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode ) > pressed, value = RL.GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
Spinner control, returns selected value Spinner control, returns selected value
@@ -600,7 +600,7 @@ Spinner control, returns selected value
int lguiGuiSpinner( lua_State *L ) { int lguiGuiSpinner( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isnumber( L, -4 ) if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isnumber( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSpinner( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -624,7 +624,7 @@ int lguiGuiSpinner( lua_State *L ) {
} }
/* /*
> pressed, value = RL_GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode ) > pressed, value = RL.GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )
Value Box control, updates input text with numbers Value Box control, updates input text with numbers
@@ -634,7 +634,7 @@ Value Box control, updates input text with numbers
int lguiGuiValueBox( lua_State *L ) { int lguiGuiValueBox( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isnumber( L, -4 ) if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isnumber( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiValueBox( Rectangle bounds, string text, int value, int minValue, int maxValue, bool editMode )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -658,7 +658,7 @@ int lguiGuiValueBox( lua_State *L ) {
} }
/* /*
> value = RL_GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue ) > value = RL.GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
Slider control, returns selected value Slider control, returns selected value
@@ -668,7 +668,7 @@ Slider control, returns selected value
int lguiGuiSlider( lua_State *L ) { int lguiGuiSlider( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSlider( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -692,7 +692,7 @@ int lguiGuiSlider( lua_State *L ) {
} }
/* /*
> value = RL_GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue ) > value = RL.GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
Slider Bar control, returns selected value Slider Bar control, returns selected value
@@ -702,7 +702,7 @@ Slider Bar control, returns selected value
int lguiGuiSliderBar( lua_State *L ) { int lguiGuiSliderBar( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSliderBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -726,7 +726,7 @@ int lguiGuiSliderBar( lua_State *L ) {
} }
/* /*
> value = RL_GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue ) > value = RL.GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )
Progress Bar control, shows current progress value Progress Bar control, shows current progress value
@@ -736,7 +736,7 @@ Progress Bar control, shows current progress value
int lguiGuiProgressBar( lua_State *L ) { int lguiGuiProgressBar( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) if ( !lua_istable( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiProgressBar( Rectangle bounds, string textLeft, string textRight, float value, float minValue, float maxValue )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -760,7 +760,7 @@ int lguiGuiProgressBar( lua_State *L ) {
} }
/* /*
> value = RL_GuiScrollBar( Rectangle bounds, int value, int minValue, int maxValue ) > value = RL.GuiScrollBar( Rectangle bounds, int value, int minValue, int maxValue )
Scroll Bar control Scroll Bar control
@@ -769,7 +769,7 @@ Scroll Bar control
*/ */
int lguiGuiScrollBar( lua_State *L ) { int lguiGuiScrollBar( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiScrollBar( Rectangle bounds, int value, int minValue, int maxValue )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiScrollBar( Rectangle bounds, int value, int minValue, int maxValue )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -787,7 +787,7 @@ int lguiGuiScrollBar( lua_State *L ) {
} }
/* /*
> pressed, item = RL_GuiDropdownBox( Rectangle bounds, string text, int active, bool editMode ) > pressed, item = RL.GuiDropdownBox( Rectangle bounds, string text, int active, bool editMode )
Dropdown Box control, returns selected item Dropdown Box control, returns selected item
@@ -796,7 +796,7 @@ Dropdown Box control, returns selected item
*/ */
int lguiGuiDropdownBox( lua_State *L ) { int lguiGuiDropdownBox( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isboolean( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiDropdownBox( Rectangle bounds, string text, int active, bool editMode )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiDropdownBox( Rectangle bounds, string text, int active, bool editMode )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -816,7 +816,7 @@ int lguiGuiDropdownBox( lua_State *L ) {
} }
/* /*
> success = RL_GuiStatusBar( Rectangle bounds, string text ) > success = RL.GuiStatusBar( Rectangle bounds, string text )
Status Bar control, shows info text Status Bar control, shows info text
@@ -825,7 +825,7 @@ Status Bar control, shows info text
*/ */
int lguiGuiStatusBar( lua_State *L ) { int lguiGuiStatusBar( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiStatusBar( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiStatusBar( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -841,7 +841,7 @@ int lguiGuiStatusBar( lua_State *L ) {
} }
/* /*
> success = RL_GuiDummyRec( Rectangle bounds, string text ) > success = RL.GuiDummyRec( Rectangle bounds, string text )
Dummy control for placeholders Dummy control for placeholders
@@ -850,7 +850,7 @@ Dummy control for placeholders
*/ */
int lguiGuiDummyRec( lua_State *L ) { int lguiGuiDummyRec( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiDummyRec( Rectangle bounds, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiDummyRec( Rectangle bounds, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -866,7 +866,7 @@ int lguiGuiDummyRec( lua_State *L ) {
} }
/* /*
> cell = RL_GuiGrid( Rectangle bounds, string text, float spacing, int subdivs ) > cell = RL.GuiGrid( Rectangle bounds, string text, float spacing, int subdivs )
Grid control, returns mouse cell position Grid control, returns mouse cell position
@@ -875,7 +875,7 @@ Grid control, returns mouse cell position
*/ */
int lguiGuiGrid( lua_State *L ) { int lguiGuiGrid( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiGrid( Rectangle bounds, string text, float spacing, int subdivs )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiGrid( Rectangle bounds, string text, float spacing, int subdivs )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -898,7 +898,7 @@ int lguiGuiGrid( lua_State *L ) {
*/ */
/* /*
> itemIndex, scrollIndex = RL_GuiListView( Rectangle bounds, string text, int scrollIndex, int active ) > itemIndex, scrollIndex = RL.GuiListView( Rectangle bounds, string text, int scrollIndex, int active )
List View control, returns selected list item index and scroll index List View control, returns selected list item index and scroll index
@@ -907,7 +907,7 @@ List View control, returns selected list item index and scroll index
*/ */
int lguiGuiListView( lua_State *L ) { int lguiGuiListView( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiListView( Rectangle bounds, string text, int scrollIndex, int active )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiListView( Rectangle bounds, string text, int scrollIndex, int active )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -927,7 +927,7 @@ int lguiGuiListView( lua_State *L ) {
} }
/* /*
> itemIndex, scrollIndex, focus = RL_GuiListViewEx( Rectangle bounds, string text, int focus, int scrollIndex, int active ) > itemIndex, scrollIndex, focus = RL.GuiListViewEx( Rectangle bounds, string text, int focus, int scrollIndex, int active )
List View with extended parameters, returns selected list item index, scroll index and focus List View with extended parameters, returns selected list item index, scroll index and focus
@@ -937,7 +937,7 @@ List View with extended parameters, returns selected list item index, scroll ind
int lguiGuiListViewEx( lua_State *L ) { int lguiGuiListViewEx( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isnumber( L, -3 ) if ( !lua_istable( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isnumber( L, -3 )
|| !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiListViewEx( Rectangle bounds, string text, int focus, int scrollIndex, int active )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiListViewEx( Rectangle bounds, string text, int focus, int scrollIndex, int active )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -960,7 +960,7 @@ int lguiGuiListViewEx( lua_State *L ) {
} }
/* /*
> buttonIndex = RL_GuiMessageBox( Rectangle bounds, string title, string message, string buttons ) > buttonIndex = RL.GuiMessageBox( Rectangle bounds, string title, string message, string buttons )
Message Box control, displays a message, returns button index ( 0 is x button ) Message Box control, displays a message, returns button index ( 0 is x button )
@@ -969,7 +969,7 @@ Message Box control, displays a message, returns button index ( 0 is x button )
*/ */
int lguiGuiMessageBox( lua_State *L ) { int lguiGuiMessageBox( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiMessageBox( Rectangle bounds, string title, string message, string buttons )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiMessageBox( Rectangle bounds, string title, string message, string buttons )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -990,7 +990,7 @@ int lguiGuiMessageBox( lua_State *L ) {
} }
/* /*
> buttonIndex, text, secretViewActive = RL_GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive ) > buttonIndex, text, secretViewActive = RL.GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )
Text Input Box control, ask for text, supports secret Text Input Box control, ask for text, supports secret
@@ -999,7 +999,7 @@ Text Input Box control, ask for text, supports secret
*/ */
int lguiGuiTextInputBox( lua_State *L ) { int lguiGuiTextInputBox( lua_State *L ) {
if ( !lua_istable( L, -7 ) || !lua_isstring( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -7 ) || !lua_isstring( L, -6 ) || !lua_isstring( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiTextInputBox( Rectangle bounds, string title, string message, string buttons, string text, int textMaxSize, int secretViewActive )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1029,7 +1029,7 @@ int lguiGuiTextInputBox( lua_State *L ) {
} }
/* /*
> color = RL_GuiColorPicker( Rectangle bounds, string text, Color color ) > color = RL.GuiColorPicker( Rectangle bounds, string text, Color color )
Color Picker control ( multiple color controls ) Color Picker control ( multiple color controls )
@@ -1038,7 +1038,7 @@ Color Picker control ( multiple color controls )
*/ */
int lguiGuiColorPicker( lua_State *L ) { int lguiGuiColorPicker( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorPicker( Rectangle bounds, string text, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiColorPicker( Rectangle bounds, string text, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1055,7 +1055,7 @@ int lguiGuiColorPicker( lua_State *L ) {
} }
/* /*
> color = RL_GuiColorPanel( Rectangle bounds, string text, Color color ) > color = RL.GuiColorPanel( Rectangle bounds, string text, Color color )
Color Panel control Color Panel control
@@ -1064,7 +1064,7 @@ Color Panel control
*/ */
int lguiGuiColorPanel( lua_State *L ) { int lguiGuiColorPanel( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorPanel( Rectangle bounds, string text, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiColorPanel( Rectangle bounds, string text, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1081,7 +1081,7 @@ int lguiGuiColorPanel( lua_State *L ) {
} }
/* /*
> alpha = RL_GuiColorBarAlpha( Rectangle bounds, string text, float alpha ) > alpha = RL.GuiColorBarAlpha( Rectangle bounds, string text, float alpha )
Color Bar Alpha control Color Bar Alpha control
@@ -1090,7 +1090,7 @@ Color Bar Alpha control
*/ */
int lguiGuiColorBarAlpha( lua_State *L ) { int lguiGuiColorBarAlpha( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorBarAlpha( Rectangle bounds, string text, float alpha )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiColorBarAlpha( Rectangle bounds, string text, float alpha )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1107,7 +1107,7 @@ int lguiGuiColorBarAlpha( lua_State *L ) {
} }
/* /*
> hue = RL_GuiColorBarHue( Rectangle bounds, string text, float value ) > hue = RL.GuiColorBarHue( Rectangle bounds, string text, float value )
Color Bar Hue control Color Bar Hue control
@@ -1116,7 +1116,7 @@ Color Bar Hue control
*/ */
int lguiGuiColorBarHue( lua_State *L ) { int lguiGuiColorBarHue( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiColorBarHue( Rectangle bounds, string text, float value )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiColorBarHue( Rectangle bounds, string text, float value )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1137,7 +1137,7 @@ int lguiGuiColorBarHue( lua_State *L ) {
*/ */
/* /*
> text = RL_GuiIconText( int iconId, string text ) > text = RL.GuiIconText( int iconId, string text )
Get text with icon id prepended ( if supported ) Get text with icon id prepended ( if supported )
@@ -1146,7 +1146,7 @@ Get text with icon id prepended ( if supported )
*/ */
int lguiGuiIconText( lua_State *L ) { int lguiGuiIconText( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiIconText( int iconId, string text )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiIconText( int iconId, string text )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1166,7 +1166,7 @@ int lguiGuiIconText( lua_State *L ) {
} }
/* /*
> success = RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color ) > success = RL.GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )
Draw icon Draw icon
@@ -1175,7 +1175,7 @@ Draw icon
*/ */
int lguiGuiDrawIcon( lua_State *L ) { int lguiGuiDrawIcon( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiDrawIcon( int iconId, Vector2 pos, int pixelSize, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1194,7 +1194,7 @@ int lguiGuiDrawIcon( lua_State *L ) {
} }
/* /*
> success = RL_GuiSetIconScale( int scale ) > success = RL.GuiSetIconScale( int scale )
Set icon scale ( 1 by default ) Set icon scale ( 1 by default )
@@ -1203,7 +1203,7 @@ Set icon scale ( 1 by default )
*/ */
int lguiGuiSetIconScale( lua_State *L ) { int lguiGuiSetIconScale( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetIconScale( int scale )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSetIconScale( int scale )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1214,7 +1214,7 @@ int lguiGuiSetIconScale( lua_State *L ) {
} }
/* /*
> success = RL_GuiSetIconPixel( int iconId, Vector2 pos ) > success = RL.GuiSetIconPixel( int iconId, Vector2 pos )
Set icon pixel value Set icon pixel value
@@ -1223,7 +1223,7 @@ Set icon pixel value
*/ */
int lguiGuiSetIconPixel( lua_State *L ) { int lguiGuiSetIconPixel( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiSetIconPixel( int iconId, Vector2 pos )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiSetIconPixel( int iconId, Vector2 pos )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1238,7 +1238,7 @@ int lguiGuiSetIconPixel( lua_State *L ) {
} }
/* /*
> success = RL_GuiClearIconPixel( int iconId, Vector2 pos ) > success = RL.GuiClearIconPixel( int iconId, Vector2 pos )
Clear icon pixel value Clear icon pixel value
@@ -1247,7 +1247,7 @@ Clear icon pixel value
*/ */
int lguiGuiClearIconPixel( lua_State *L ) { int lguiGuiClearIconPixel( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiClearIconPixel( int iconId, Vector2 pos )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiClearIconPixel( int iconId, Vector2 pos )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -1262,7 +1262,7 @@ int lguiGuiClearIconPixel( lua_State *L ) {
} }
/* /*
> value = RL_GuiCheckIconPixel( int iconId, Vector2 pos ) > value = RL.GuiCheckIconPixel( int iconId, Vector2 pos )
Check icon pixel value Check icon pixel value
@@ -1271,7 +1271,7 @@ Check icon pixel value
*/ */
int lguiGuiCheckIconPixel( lua_State *L ) { int lguiGuiCheckIconPixel( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GuiCheckIconPixel( int iconId, Vector2 pos )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GuiCheckIconPixel( int iconId, Vector2 pos )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }

View File

@@ -8,7 +8,7 @@
*/ */
/* /*
> success = RL_rlSetLineWidth( float width ) > success = RL.rlSetLineWidth( float width )
Set the line drawing width Set the line drawing width
@@ -17,7 +17,7 @@ Set the line drawing width
*/ */
int lrlglSetLineWidth( lua_State *L ) { int lrlglSetLineWidth( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_rlSetLineWidth( float width )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.rlSetLineWidth( float width )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -28,7 +28,7 @@ int lrlglSetLineWidth( lua_State *L ) {
} }
/* /*
> width = RL_rlGetLineWidth() > width = RL.rlGetLineWidth()
Get the line drawing width Get the line drawing width

File diff suppressed because it is too large Load Diff

View File

@@ -8,7 +8,7 @@
*/ */
/* /*
> success = RL_SetShapesTexture( Texture2D texture, Rectangle source ) > success = RL.SetShapesTexture( Texture2D texture, Rectangle source )
Set texture and rectangle to be used on shapes drawing Set texture and rectangle to be used on shapes drawing
NOTE: It can be useful when using basic shapes and one single font, NOTE: It can be useful when using basic shapes and one single font,
@@ -19,7 +19,7 @@ defining a font char white rectangle would allow drawing everything in a single
*/ */
int lshapesSetShapesTexture( lua_State *L ) { int lshapesSetShapesTexture( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_SetShapesTexture( Texture2D texture, Rectangle source )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetShapesTexture( Texture2D texture, Rectangle source )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -38,7 +38,7 @@ int lshapesSetShapesTexture( lua_State *L ) {
} }
/* /*
> success = RL_DrawPixel( Vector2 pos, Color color ) > success = RL.DrawPixel( Vector2 pos, Color color )
Draw a pixel Draw a pixel
@@ -47,7 +47,7 @@ Draw a pixel
*/ */
int lshapesDrawPixel( lua_State *L ) { int lshapesDrawPixel( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPixel( Vector2 pos, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawPixel( Vector2 pos, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -62,7 +62,7 @@ int lshapesDrawPixel( lua_State *L ) {
} }
/* /*
> success = RL_DrawLine( Vector2 startPos, Vector2 endPos, float thickness, Color color ) > success = RL.DrawLine( Vector2 startPos, Vector2 endPos, float thickness, Color color )
Draw a line defining thickness Draw a line defining thickness
@@ -71,7 +71,7 @@ Draw a line defining thickness
*/ */
int lshapesDrawLine( lua_State *L ) { int lshapesDrawLine( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLine( Vector2 startPos, Vector2 endPos, float thickness, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawLine( Vector2 startPos, Vector2 endPos, float thickness, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -90,7 +90,7 @@ int lshapesDrawLine( lua_State *L ) {
} }
/* /*
> success = RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color ) > success = RL.DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )
Draw a line using cubic-bezier curves in-out Draw a line using cubic-bezier curves in-out
@@ -99,7 +99,7 @@ Draw a line using cubic-bezier curves in-out
*/ */
int lshapesDrawLineBezier( lua_State *L ) { int lshapesDrawLineBezier( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawLineBezier( Vector2 startPos, Vector2 endPos, float thickness, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -118,7 +118,7 @@ int lshapesDrawLineBezier( lua_State *L ) {
} }
/* /*
> success = RL_DrawLineBezierQuad( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color ) > success = RL.DrawLineBezierQuad( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )
Draw line using quadratic bezier curves with a control point Draw line using quadratic bezier curves with a control point
@@ -127,7 +127,7 @@ Draw line using quadratic bezier curves with a control point
*/ */
int lshapesDrawLineBezierQuad( lua_State *L ) { int lshapesDrawLineBezierQuad( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezier( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawLineBezier( Vector2 startPos, Vector2 endPos, Vector2 controlPos, float thickness, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -148,7 +148,7 @@ int lshapesDrawLineBezierQuad( lua_State *L ) {
} }
/* /*
> success = RL_DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color ) > success = RL.DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )
Draw line using quadratic bezier curves with a control point Draw line using quadratic bezier curves with a control point
@@ -158,7 +158,7 @@ Draw line using quadratic bezier curves with a control point
int lshapesDrawLineBezierCubic( lua_State *L ) { int lshapesDrawLineBezierCubic( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || if ( !lua_istable( L, -6 ) || !lua_istable( L, -5 ) || !lua_istable( L, -4 ) ||
!lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawLineBezierCubic( Vector2 startPos, Vector2 endPos, Vector2 startControlPos, Vector2 endControlPos, float thickness, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -181,7 +181,7 @@ int lshapesDrawLineBezierCubic( lua_State *L ) {
} }
/* /*
> success = RL_DrawLineStrip( Vector2 points{}, int pointsCount, Color color ) > success = RL.DrawLineStrip( Vector2{} points, int pointsCount, Color color )
Draw lines sequence Draw lines sequence
@@ -190,7 +190,7 @@ Draw lines sequence
*/ */
int lshapesDrawLineStrip( lua_State *L ) { int lshapesDrawLineStrip( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawLineStrip( Vector2 points{}, int pointsCount, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawLineStrip( Vector2{} points, int pointsCount, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -217,7 +217,7 @@ int lshapesDrawLineStrip( lua_State *L ) {
} }
/* /*
> success = RL_DrawCircle( Vector2 center, float radius, Color color ) > success = RL.DrawCircle( Vector2 center, float radius, Color color )
Draw a color-filled circle Draw a color-filled circle
@@ -226,7 +226,7 @@ Draw a color-filled circle
*/ */
int lshapesDrawCircle( lua_State *L ) { int lshapesDrawCircle( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircle( Vector2 center, float radius, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCircle( Vector2 center, float radius, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -243,7 +243,7 @@ int lshapesDrawCircle( lua_State *L ) {
} }
/* /*
> success = RL_DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color ) > success = RL.DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
Draw a piece of a circle Draw a piece of a circle
@@ -253,7 +253,7 @@ Draw a piece of a circle
int lshapesDrawCircleSector( lua_State *L ) { int lshapesDrawCircleSector( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) || if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCircleSector( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -276,7 +276,7 @@ int lshapesDrawCircleSector( lua_State *L ) {
} }
/* /*
> success = RL_DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color ) > success = RL.DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )
Draw circle sector outline Draw circle sector outline
@@ -286,7 +286,7 @@ Draw circle sector outline
int lshapesDrawCircleSectorLines( lua_State *L ) { int lshapesDrawCircleSectorLines( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) || if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCircleSectorLines( Vector2 center, float radius, float startAngle, float endAngle, int segments, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -309,7 +309,7 @@ int lshapesDrawCircleSectorLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 ) > success = RL.DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )
Draw a gradient-filled circle Draw a gradient-filled circle
@@ -318,7 +318,7 @@ Draw a gradient-filled circle
*/ */
int lshapesDrawCircleGradient( lua_State *L ) { int lshapesDrawCircleGradient( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCircleGradient( Vector2 center, float radius, Color color1, Color color2 )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -337,7 +337,7 @@ int lshapesDrawCircleGradient( lua_State *L ) {
} }
/* /*
> success = RL_DrawCircleLines( Vector2 center, float radius, Color color ) > success = RL.DrawCircleLines( Vector2 center, float radius, Color color )
Draw circle outline Draw circle outline
@@ -346,7 +346,7 @@ Draw circle outline
*/ */
int lshapesDrawCircleLines( lua_State *L ) { int lshapesDrawCircleLines( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawCircleLines( Vector2 center, float radius, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawCircleLines( Vector2 center, float radius, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -363,7 +363,7 @@ int lshapesDrawCircleLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color ) > success = RL.DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )
Draw ellipse Draw ellipse
@@ -372,7 +372,7 @@ Draw ellipse
*/ */
int lshapesDrawEllipse( lua_State *L ) { int lshapesDrawEllipse( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawEllipse( Vector2 center, float radiusH, float radiusV, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -391,7 +391,7 @@ int lshapesDrawEllipse( lua_State *L ) {
} }
/* /*
> success = RL_DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color ) > success = RL.DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )
Draw ellipse outline Draw ellipse outline
@@ -400,7 +400,7 @@ Draw ellipse outline
*/ */
int lshapesDrawEllipseLines( lua_State *L ) { int lshapesDrawEllipseLines( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawEllipseLines( Vector2 center, float radiusH, float radiusV, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -419,7 +419,7 @@ int lshapesDrawEllipseLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color ) > success = RL.DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
Draw ring Draw ring
@@ -429,7 +429,7 @@ Draw ring
int lshapesDrawRing( lua_State *L ) { int lshapesDrawRing( lua_State *L ) {
if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) || if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRing( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -454,7 +454,7 @@ int lshapesDrawRing( lua_State *L ) {
} }
/* /*
> success = RL_DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color ) > success = RL.DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )
Draw ring outline Draw ring outline
@@ -464,7 +464,7 @@ Draw ring outline
int lshapesDrawRingLines( lua_State *L ) { int lshapesDrawRingLines( lua_State *L ) {
if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) || if ( !lua_istable( L, -7 ) || !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRingLines( Vector2 center, float innerRadius, float outerRadius, float startAngle, float endAngle, int segments, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -489,7 +489,7 @@ int lshapesDrawRingLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangle( Rectangle rec, Color color ) > success = RL.DrawRectangle( Rectangle rec, Color color )
Draw a color-filled rectangle Draw a color-filled rectangle
@@ -498,7 +498,7 @@ Draw a color-filled rectangle
*/ */
int lshapesDrawRectangle( lua_State *L ) { int lshapesDrawRectangle( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangle( Rectangle rec, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangle( Rectangle rec, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -513,7 +513,7 @@ int lshapesDrawRectangle( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectanglePro( Rectangle rec, Vector2 origin, float rotation, Color color ) > success = RL.DrawRectanglePro( Rectangle rec, Vector2 origin, float rotation, Color color )
Draw a color-filled rectangle with pro parameters Draw a color-filled rectangle with pro parameters
@@ -522,7 +522,7 @@ Draw a color-filled rectangle with pro parameters
*/ */
int lshapesDrawRectanglePro( lua_State *L ) { int lshapesDrawRectanglePro( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectanglePro( Rectangle rec, Vector2 origin, float rotation, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectanglePro( Rectangle rec, Vector2 origin, float rotation, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -541,7 +541,7 @@ int lshapesDrawRectanglePro( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 ) > success = RL.DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )
Draw a vertical-gradient-filled rectangle Draw a vertical-gradient-filled rectangle
@@ -550,7 +550,7 @@ Draw a vertical-gradient-filled rectangle
*/ */
int lshapesDrawRectangleGradientV( lua_State *L ) { int lshapesDrawRectangleGradientV( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleGradientV( Rectangle rectangle, Color color1, Color color2 )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -567,7 +567,7 @@ int lshapesDrawRectangleGradientV( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 ) > success = RL.DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )
Draw a horizontal-gradient-filled rectangle Draw a horizontal-gradient-filled rectangle
@@ -576,7 +576,7 @@ Draw a horizontal-gradient-filled rectangle
*/ */
int lshapesDrawRectangleGradientH( lua_State *L ) { int lshapesDrawRectangleGradientH( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleGradientH( Rectangle rectangle, Color color1, Color color2 )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -593,7 +593,7 @@ int lshapesDrawRectangleGradientH( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 ) > success = RL.DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )
Draw a gradient-filled rectangle with custom vertex colors Draw a gradient-filled rectangle with custom vertex colors
@@ -602,7 +602,7 @@ Draw a gradient-filled rectangle with custom vertex colors
*/ */
int lshapesDrawRectangleGradientEx( lua_State *L ) { int lshapesDrawRectangleGradientEx( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -5 ) || !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleGradientEx( Rectangle rectangle, Color col1, Color col2, Color col3, Color col4 )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -623,7 +623,7 @@ int lshapesDrawRectangleGradientEx( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleLines( Rectangle rec, Color color ) > success = RL.DrawRectangleLines( Rectangle rec, Color color )
Draw rectangle outline Draw rectangle outline
@@ -632,7 +632,7 @@ Draw rectangle outline
*/ */
int lshapesDrawRectangleLines( lua_State *L ) { int lshapesDrawRectangleLines( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangle( Rectangle rec, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleLines( Rectangle rec, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -647,7 +647,7 @@ int lshapesDrawRectangleLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color ) > success = RL.DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )
Draw rectangle outline with extended parameters Draw rectangle outline with extended parameters
@@ -656,7 +656,7 @@ Draw rectangle outline with extended parameters
*/ */
int lshapesDrawRectangleLinesEx( lua_State *L ) { int lshapesDrawRectangleLinesEx( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleLinesEx( Rectangle rec, int lineThick, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -673,7 +673,7 @@ int lshapesDrawRectangleLinesEx( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color ) > success = RL.DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )
Draw rectangle with rounded edges Draw rectangle with rounded edges
@@ -682,7 +682,7 @@ Draw rectangle with rounded edges
*/ */
int lshapesDrawRectangleRounded( lua_State *L ) { int lshapesDrawRectangleRounded( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleRounded( Rectangle rec, float roundness, int segments, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -701,7 +701,7 @@ int lshapesDrawRectangleRounded( lua_State *L ) {
} }
/* /*
> success = RL_DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color ) > success = RL.DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )
Draw rectangle with rounded edges outline Draw rectangle with rounded edges outline
@@ -710,7 +710,7 @@ Draw rectangle with rounded edges outline
*/ */
int lshapesDrawRectangleRoundedLines( lua_State *L ) { int lshapesDrawRectangleRoundedLines( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawRectangleRoundedLines( Rectangle rec, float roundness, int segments, int lineThick, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -731,7 +731,7 @@ int lshapesDrawRectangleRoundedLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color ) > success = RL.DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw a color-filled triangle ( Vertex in counter-clockwise order! ) Draw a color-filled triangle ( Vertex in counter-clockwise order! )
@@ -740,7 +740,7 @@ Draw a color-filled triangle ( Vertex in counter-clockwise order! )
*/ */
int lshapesDrawTriangle( lua_State *L ) { int lshapesDrawTriangle( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTriangle( Vector2 v1, Vector2 v2, Vector2 v3, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -759,7 +759,7 @@ int lshapesDrawTriangle( lua_State *L ) {
} }
/* /*
> success = RL_DrawTriangleLines( Vector2 v1, Vector2 v2, Vector2 v3, Color color ) > success = RL.DrawTriangleLines( Vector2 v1, Vector2 v2, Vector2 v3, Color color )
Draw triangle outline ( Vertex in counter-clockwise order! ) Draw triangle outline ( Vertex in counter-clockwise order! )
@@ -768,7 +768,7 @@ Draw triangle outline ( Vertex in counter-clockwise order! )
*/ */
int lshapesDrawTriangleLines( lua_State *L ) { int lshapesDrawTriangleLines( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangleLines( Vector2 v1, Vector2 v2, Vector2 v3, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTriangleLines( Vector2 v1, Vector2 v2, Vector2 v3, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -787,7 +787,7 @@ int lshapesDrawTriangleLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawTriangleFan( Vector2 points{}, int pointsCount, Color color ) > success = RL.DrawTriangleFan( Vector2{} points, int pointsCount, Color color )
Draw a triangle fan defined by points ( first vertex is the center ) Draw a triangle fan defined by points ( first vertex is the center )
@@ -796,7 +796,7 @@ Draw a triangle fan defined by points ( first vertex is the center )
*/ */
int lshapesDrawTriangleFan( lua_State *L ) { int lshapesDrawTriangleFan( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangleFan( Vector2 points{}, int pointsCount, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTriangleFan( Vector2{} points, int pointsCount, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -823,7 +823,7 @@ int lshapesDrawTriangleFan( lua_State *L ) {
} }
/* /*
> success = RL_DrawTriangleStrip( Vector2 points{}, int pointsCount, Color color ) > success = RL.DrawTriangleStrip( Vector2{} points, int pointsCount, Color color )
Draw a triangle strip defined by points Draw a triangle strip defined by points
@@ -832,7 +832,7 @@ Draw a triangle strip defined by points
*/ */
int lshapesDrawTriangleStrip( lua_State *L ) { int lshapesDrawTriangleStrip( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTriangleStrip( Vector2 points{}, int pointsCount, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTriangleStrip( Vector2{} points, int pointsCount, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -859,7 +859,7 @@ int lshapesDrawTriangleStrip( lua_State *L ) {
} }
/* /*
> success = RL_DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color ) > success = RL.DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )
Draw a regular polygon ( Vector version ) Draw a regular polygon ( Vector version )
@@ -868,7 +868,7 @@ Draw a regular polygon ( Vector version )
*/ */
int lshapesDrawPoly( lua_State *L ) { int lshapesDrawPoly( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawPoly( Vector2 center, int sides, float radius, float rotation, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -889,7 +889,7 @@ int lshapesDrawPoly( lua_State *L ) {
} }
/* /*
> success = RL_DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color ) > success = RL.DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )
Draw a polygon outline of n sides Draw a polygon outline of n sides
@@ -898,7 +898,7 @@ Draw a polygon outline of n sides
*/ */
int lshapesDrawPolyLines( lua_State *L ) { int lshapesDrawPolyLines( lua_State *L ) {
if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -5 ) || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawPolyLines( Vector2 center, int sides, float radius, float rotation, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -919,7 +919,7 @@ int lshapesDrawPolyLines( lua_State *L ) {
} }
/* /*
> success = RL_DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color ) > success = RL.DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )
Draw a polygon outline of n sides with extended parameters Draw a polygon outline of n sides with extended parameters
@@ -929,7 +929,7 @@ Draw a polygon outline of n sides with extended parameters
int lshapesDrawPolyLinesEx( lua_State *L ) { int lshapesDrawPolyLinesEx( lua_State *L ) {
if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) || if ( !lua_istable( L, -6 ) || !lua_isnumber( L, -5 ) || !lua_isnumber( L, -4 ) ||
!lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawPolyLinesEx( Vector2 center, int sides, float radius, float rotation, float lineThick, Color color )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -956,7 +956,7 @@ int lshapesDrawPolyLinesEx( lua_State *L ) {
*/ */
/* /*
> collision = RL_CheckCollisionRecs( Rectangle rec1, Rectangle rec2 ) > collision = RL.CheckCollisionRecs( Rectangle rec1, Rectangle rec2 )
Check collision between two rectangles Check collision between two rectangles
@@ -965,7 +965,7 @@ Check collision between two rectangles
*/ */
int lshapesCheckCollisionRecs( lua_State *L ) { int lshapesCheckCollisionRecs( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionRecs( Rectangle rec1, Rectangle rec2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionRecs( Rectangle rec1, Rectangle rec2 )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -979,7 +979,7 @@ int lshapesCheckCollisionRecs( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionCircles( Vector2 center1, float radius1, Vector2 center2, float radius2 ) > collision = RL.CheckCollisionCircles( Vector2 center1, float radius1, Vector2 center2, float radius2 )
Check collision between two circles Check collision between two circles
@@ -988,7 +988,7 @@ Check collision between two circles
*/ */
int lshapesCheckCollisionCircles( lua_State *L ) { int lshapesCheckCollisionCircles( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionCircles( Vector2 center1, float radius1, Vector2 center2, float radius2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionCircles( Vector2 center1, float radius1, Vector2 center2, float radius2 )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1006,7 +1006,7 @@ int lshapesCheckCollisionCircles( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionCircleRec( Vector2 center, float radius, Rectangle rec ) > collision = RL.CheckCollisionCircleRec( Vector2 center, float radius, Rectangle rec )
Check collision between circle and rectangle Check collision between circle and rectangle
@@ -1015,7 +1015,7 @@ Check collision between circle and rectangle
*/ */
int lshapesCheckCollisionCircleRec( lua_State *L ) { int lshapesCheckCollisionCircleRec( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionCircleRec( Vector2 center, float radius, Rectangle rec )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionCircleRec( Vector2 center, float radius, Rectangle rec )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1031,7 +1031,7 @@ int lshapesCheckCollisionCircleRec( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionPointRec( Vector2 point, Rectangle rec ) > collision = RL.CheckCollisionPointRec( Vector2 point, Rectangle rec )
Check if point is inside rectangle Check if point is inside rectangle
@@ -1040,7 +1040,7 @@ Check if point is inside rectangle
*/ */
int lshapesCheckCollisionPointRec( lua_State *L ) { int lshapesCheckCollisionPointRec( lua_State *L ) {
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionPointRec( Vector2 point, Rectangle rec )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionPointRec( Vector2 point, Rectangle rec )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1054,7 +1054,7 @@ int lshapesCheckCollisionPointRec( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionPointCircle( Vector2 point, Vector2 center, float radius ) > collision = RL.CheckCollisionPointCircle( Vector2 point, Vector2 center, float radius )
Check if point is inside circle Check if point is inside circle
@@ -1063,7 +1063,7 @@ Check if point is inside circle
*/ */
int lshapesCheckCollisionPointCircle( lua_State *L ) { int lshapesCheckCollisionPointCircle( lua_State *L ) {
if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionPointCircle( Vector2 point, Vector2 center, float radius )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionPointCircle( Vector2 point, Vector2 center, float radius )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1079,7 +1079,7 @@ int lshapesCheckCollisionPointCircle( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionPointTriangle( Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3 ) > collision = RL.CheckCollisionPointTriangle( Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3 )
Check if point is inside a triangle Check if point is inside a triangle
@@ -1088,7 +1088,7 @@ Check if point is inside a triangle
*/ */
int lshapesCheckCollisionPointTriangle( lua_State *L ) { int lshapesCheckCollisionPointTriangle( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionPointTriangle( Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionPointTriangle( Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3 )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1106,7 +1106,7 @@ int lshapesCheckCollisionPointTriangle( lua_State *L ) {
} }
/* /*
> collision, position = RL_CheckCollisionLines( Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2 ) > collision, position = RL.CheckCollisionLines( Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2 )
Check the collision between two lines defined by two points each, returns collision point by reference Check the collision between two lines defined by two points each, returns collision point by reference
@@ -1115,7 +1115,7 @@ Check the collision between two lines defined by two points each, returns collis
*/ */
int lshapesCheckCollisionLines( lua_State *L ) { int lshapesCheckCollisionLines( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionLines( Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionLines( Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2 )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1136,7 +1136,7 @@ int lshapesCheckCollisionLines( lua_State *L ) {
} }
/* /*
> collision = RL_CheckCollisionPointLine( Vector2 point, Vector2 p1, Vector2 p2, int threshold ) > collision = RL.CheckCollisionPointLine( Vector2 point, Vector2 p1, Vector2 p2, int threshold )
Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold] Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]
@@ -1145,7 +1145,7 @@ Check if point belongs to line created between two points [p1] and [p2] with def
*/ */
int lshapesCheckCollisionPointLine( lua_State *L ) { int lshapesCheckCollisionPointLine( lua_State *L ) {
if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_istable( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_CheckCollisionPointLine( Vector2 point, Vector2 p1, Vector2 p2, int threshold )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.CheckCollisionPointLine( Vector2 point, Vector2 p1, Vector2 p2, int threshold )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }
@@ -1163,7 +1163,7 @@ int lshapesCheckCollisionPointLine( lua_State *L ) {
} }
/* /*
> rectangle = RL_GetCollisionRec( Rectangle rec1, Rectangle rec2 ) > rectangle = RL.GetCollisionRec( Rectangle rec1, Rectangle rec2 )
Get collision rectangle for two rectangles collision Get collision rectangle for two rectangles collision
@@ -1173,7 +1173,7 @@ Get collision rectangle for two rectangles collision
int lshapesGetCollisionRec( lua_State *L ) { int lshapesGetCollisionRec( lua_State *L ) {
/* Rectangle rec1, Rectangle rec2 */ /* Rectangle rec1, Rectangle rec2 */
if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetCollisionRec( Rectangle rec1, Rectangle rec2 )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GetCollisionRec( Rectangle rec1, Rectangle rec2 )" );
lua_pushnil( L ); lua_pushnil( L );
return 1; return 1;
} }

View File

@@ -34,7 +34,7 @@ bool validFont( size_t id ) {
*/ */
/* /*
> font = RL_LoadFont( string fileName ) > font = RL.LoadFont( string fileName )
Load font from file into GPU memory ( VRAM ) Load font from file into GPU memory ( VRAM )
@@ -43,7 +43,7 @@ Load font from file into GPU memory ( VRAM )
*/ */
int ltextLoadFont( lua_State *L ) { int ltextLoadFont( lua_State *L ) {
if ( !lua_isstring( L, -1 ) ) { if ( !lua_isstring( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadFont( string fileName )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadFont( string fileName )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -63,7 +63,7 @@ int ltextLoadFont( lua_State *L ) {
} }
/* /*
> font = RL_LoadFontEx( string fileName, int fontSize ) > font = RL.LoadFontEx( string fileName, int fontSize )
Load font from file with extended parameters. Loading the default character set Load font from file with extended parameters. Loading the default character set
@@ -72,7 +72,7 @@ Load font from file with extended parameters. Loading the default character set
*/ */
int ltextLoadFontEx( lua_State *L ) { int ltextLoadFontEx( lua_State *L ) {
if ( !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isstring( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadFontEx( string fileName, int fontSize )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadFontEx( string fileName, int fontSize )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -92,7 +92,7 @@ int ltextLoadFontEx( lua_State *L ) {
} }
/* /*
> font = RL_LoadFontFromImage( Image image, Color key, int firstChar ) > font = RL.LoadFontFromImage( Image image, Color key, int firstChar )
Load font from Image ( XNA style ) Load font from Image ( XNA style )
@@ -101,7 +101,7 @@ Load font from Image ( XNA style )
*/ */
int ltextLoadFontFromImage( lua_State *L ) { int ltextLoadFontFromImage( lua_State *L ) {
if ( !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -3 ) || !lua_istable( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_LoadFontFromImage( Image image, Color key, int firstChar )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.LoadFontFromImage( Image image, Color key, int firstChar )" );
lua_pushinteger( L, -1 ); lua_pushinteger( L, -1 );
return 1; return 1;
} }
@@ -133,7 +133,7 @@ int ltextLoadFontFromImage( lua_State *L ) {
} }
/* /*
> success = RL_UnloadFont( Font font ) > success = RL.UnloadFont( Font font )
Unload Font from GPU memory ( VRAM ) Unload Font from GPU memory ( VRAM )
@@ -142,7 +142,7 @@ Unload Font from GPU memory ( VRAM )
*/ */
int ltextUnloadFont( lua_State *L ) { int ltextUnloadFont( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_UnloadFont( Font font )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.UnloadFont( Font font )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -164,7 +164,7 @@ int ltextUnloadFont( lua_State *L ) {
*/ */
/* /*
> success = RL_DrawFPS( Vector2 pos ) > success = RL.DrawFPS( Vector2 pos )
Draw current FPS Draw current FPS
@@ -173,7 +173,7 @@ Draw current FPS
*/ */
int ltextDrawFPS( lua_State *L ) { int ltextDrawFPS( lua_State *L ) {
if ( !lua_istable( L, -1 ) ) { if ( !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawFPS( Vector2 pos )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawFPS( Vector2 pos )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -186,7 +186,7 @@ int ltextDrawFPS( lua_State *L ) {
} }
/* /*
> success = RL_DrawText( Font font, string text, Vector2 position, float fontSize, float spacing, Color tint ) > success = RL.DrawText( Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )
Draw text using font and additional parameters Draw text using font and additional parameters
@@ -196,7 +196,7 @@ Draw text using font and additional parameters
int ltextDrawText( lua_State *L ) { int ltextDrawText( lua_State *L ) {
if ( !lua_isnumber( L, -6 ) || !lua_isstring( L, -5 ) || !lua_istable( L, -4 ) if ( !lua_isnumber( L, -6 ) || !lua_isstring( L, -5 ) || !lua_istable( L, -4 )
|| !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawText( Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawText( Font font, string text, Vector2 position, float fontSize, float spacing, Color tint )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -221,7 +221,7 @@ int ltextDrawText( lua_State *L ) {
} }
/* /*
> success = RL_DrawTextPro( Font font, string text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint ) > success = RL.DrawTextPro( Font font, string text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint )
Draw text using Font and pro parameters ( rotation ) Draw text using Font and pro parameters ( rotation )
@@ -231,7 +231,7 @@ Draw text using Font and pro parameters ( rotation )
int ltextDrawTextPro( lua_State *L ) { int ltextDrawTextPro( lua_State *L ) {
if ( !lua_isnumber( L, -8 ) || !lua_isstring( L, -7 ) || !lua_istable( L, -6 ) || !lua_istable( L, -5 ) if ( !lua_isnumber( L, -8 ) || !lua_isstring( L, -7 ) || !lua_istable( L, -6 ) || !lua_istable( L, -5 )
|| !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) { || !lua_isnumber( L, -4 ) || !lua_isnumber( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawTextPro( Font font, string text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawTextPro( Font font, string text, Vector2 position, Vector2 origin, float rotation, float fontSize, float spacing, Color tint )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -264,7 +264,7 @@ int ltextDrawTextPro( lua_State *L ) {
*/ */
/* /*
> size = RL_MeasureText( Font font, string text, float fontSize, float spacing ) > size = RL.MeasureText( Font font, string text, float fontSize, float spacing )
Measure string size for Font Measure string size for Font
@@ -273,7 +273,7 @@ Measure string size for Font
*/ */
int ltextMeasureText( lua_State *L ) { int ltextMeasureText( lua_State *L ) {
if ( !lua_isnumber( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -4 ) || !lua_isstring( L, -3 ) || !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_MeasureText( Font font, string text, float fontSize, float spacing )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.MeasureText( Font font, string text, float fontSize, float spacing )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -293,7 +293,7 @@ int ltextMeasureText( lua_State *L ) {
} }
/* /*
> baseSize = RL_GetFontBaseSize( Font font ) > baseSize = RL.GetFontBaseSize( Font font )
Get font baseSize Get font baseSize
@@ -302,7 +302,7 @@ Get font baseSize
*/ */
int ltextGetFontBaseSize( lua_State *L ) { int ltextGetFontBaseSize( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontBaseSize( Font font )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GetFontBaseSize( Font font )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -318,7 +318,7 @@ int ltextGetFontBaseSize( lua_State *L ) {
} }
/* /*
> glyphCount = RL_GetFontGlyphCount( Font font ) > glyphCount = RL.GetFontGlyphCount( Font font )
Get font glyphCount Get font glyphCount
@@ -327,7 +327,7 @@ Get font glyphCount
*/ */
int ltextGetFontGlyphCount( lua_State *L ) { int ltextGetFontGlyphCount( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphCount( Font font )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GetFontGlyphCount( Font font )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }
@@ -343,7 +343,7 @@ int ltextGetFontGlyphCount( lua_State *L ) {
} }
/* /*
> glyphPadding = RL_GetFontGlyphPadding( Font font ) > glyphPadding = RL.GetFontGlyphPadding( Font font )
Get font glyphPadding Get font glyphPadding
@@ -352,7 +352,7 @@ Get font glyphPadding
*/ */
int ltextGetFontGlyphPadding( lua_State *L ) { int ltextGetFontGlyphPadding( lua_State *L ) {
if ( !lua_isnumber( L, -1 ) ) { if ( !lua_isnumber( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetFontGlyphPadding( Font font )" ); TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.GetFontGlyphPadding( Font font )" );
lua_pushboolean( L, false ); lua_pushboolean( L, false );
return 1; return 1;
} }

File diff suppressed because it is too large Load Diff