All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
This commit is contained in:
35
README.md
35
README.md
@@ -1,8 +1,8 @@
|
||||
## 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.
|
||||
|
||||
@@ -35,33 +35,33 @@ List of some MISSING features that are planned to be included. For specific func
|
||||
|
||||
## 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.
|
||||
|
||||
```
|
||||
local textColor = BLACK
|
||||
local textColor = RL.BLACK
|
||||
local textPos = { 192, 200 }
|
||||
|
||||
function init()
|
||||
RL_SetWindowTitle( "First window" )
|
||||
function RL.init()
|
||||
RL.SetWindowTitle( "First window" )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsKeyPressed( KEY_ENTER ) then
|
||||
function RL.process( delta )
|
||||
if RL.IsKeyPressed( RL.KEY_ENTER ) then
|
||||
textColor = BLUE
|
||||
textPos = { 230, 230 }
|
||||
end
|
||||
|
||||
if RL_IsKeyPressed( KEY_SPACE ) then
|
||||
textColor = BLACK
|
||||
if RL.IsKeyPressed( RL.KEY_SPACE ) then
|
||||
textColor = RL.BLACK
|
||||
textPos = { 192, 200 }
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
RL_DrawText( 0, "Congrats! You created your first window!", textPos, 20, 2, textColor )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
RL.DrawText( 0, "Congrats! You created your first window!", textPos, 20, 2, textColor )
|
||||
end
|
||||
```
|
||||
|
||||
@@ -74,6 +74,7 @@ GameFolder
|
||||
```
|
||||
|
||||
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
|
||||
|
||||
@@ -83,6 +84,14 @@ ReiLua can also be used to run single lua file using interpreter mode with argum
|
||||
./Reilua -i hello.lua
|
||||
```
|
||||
|
||||
## Generate API
|
||||
|
||||
Generate API.md and ReiLua_API.lua from build folder with command.
|
||||
|
||||
```
|
||||
./Reilua -i ../doc_parser.lua
|
||||
```
|
||||
|
||||
## 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.
|
||||
|
||||
5385
ReiLua_API.lua
Normal file
5385
ReiLua_API.lua
Normal file
File diff suppressed because it is too large
Load Diff
45
changelog
45
changelog
@@ -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
|
||||
------------------------------------------------------------------------
|
||||
@@ -14,20 +25,20 @@ KEY CHANGES:
|
||||
- CHANGED: RL_DrawQuad3DTexture now takes vertex colors instead of just single color.
|
||||
|
||||
Detailed changes:
|
||||
ADDED: Help argument.
|
||||
CHANGED: RL_rlSetLineWidth renamed to RL_rlglSetLineWidth.
|
||||
CHANGED: RL_rlGetLineWidth renamed to RL_rlglGetLineWidth.
|
||||
FIXED: DrawRectangleGradient V and H expecting wrong arguments.
|
||||
ADDED: RL_LoadDirectoryFilesEx.
|
||||
FIXED: RL_DrawLineBezierQuad was called RL_DrawLineBezier in API.
|
||||
ADDED: Color lib.
|
||||
FIXED: RL_DrawEllipse and RL_DrawEllipseLines expecting wrong arguments.
|
||||
ADDED: RL_IsPathFile.
|
||||
ADDED: RL_SetMaterialShader.
|
||||
ADDED: RL_GetFileLength.
|
||||
ADDED: RL_LoadFontEx.
|
||||
FIXED: RL_ImageAlphaClear expecting wrong arguments.
|
||||
ADDED: BLEND_ALPHA_PREMULTIPLY.
|
||||
CHANGED: RL_GetWindowSize renamed to RL_GetScreenSize.
|
||||
ADDED: RL_GetKeyName and RL_GetKeyScancode. GLFW Functions.
|
||||
ADDED: KEY_UNKNOWN.
|
||||
- ADDED: Help argument.
|
||||
- CHANGED: RL_rlSetLineWidth renamed to RL_rlglSetLineWidth.
|
||||
- CHANGED: RL_rlGetLineWidth renamed to RL_rlglGetLineWidth.
|
||||
- FIXED: DrawRectangleGradient V and H expecting wrong arguments.
|
||||
- ADDED: RL_LoadDirectoryFilesEx.
|
||||
- FIXED: RL_DrawLineBezierQuad was called RL_DrawLineBezier in API.
|
||||
- ADDED: Color lib.
|
||||
- FIXED: RL_DrawEllipse and RL_DrawEllipseLines expecting wrong arguments.
|
||||
- ADDED: RL_IsPathFile.
|
||||
- ADDED: RL_SetMaterialShader.
|
||||
- ADDED: RL_GetFileLength.
|
||||
- ADDED: RL_LoadFontEx.
|
||||
- FIXED: RL_ImageAlphaClear expecting wrong arguments.
|
||||
- ADDED: BLEND_ALPHA_PREMULTIPLY.
|
||||
- CHANGED: RL_GetWindowSize renamed to RL_GetScreenSize.
|
||||
- ADDED: RL_GetKeyName and RL_GetKeyScancode. GLFW Functions.
|
||||
- ADDED: KEY_UNKNOWN.
|
||||
|
||||
142
doc_parser.lua
142
doc_parser.lua
@@ -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.
|
||||
local separate = false
|
||||
@@ -21,7 +21,65 @@ local function split( str, sep )
|
||||
return t
|
||||
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
|
||||
apiFile:write( "# ReiLua API\n" )
|
||||
@@ -29,24 +87,40 @@ apiFile:write( "# ReiLua API\n" )
|
||||
-- Usage.
|
||||
|
||||
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\
|
||||
This function will be called first when 'main.lua' is found\n\n---\n" )
|
||||
apiFile:write( "\n> function process( delta )\n\
|
||||
This function will be called every frame during execution. It will get time duration from last frame on argument 'delta'\n\n---\n" )
|
||||
apiFile:write( "\n> function draw()\n\
|
||||
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.\n\n---\n" )
|
||||
apiFile:write( "\n> function log( logLevel, message )\n\
|
||||
This function can be used for custom log message handling.\n\n---\n" )
|
||||
apiFile:write( "\n> function exit()\n\
|
||||
This function will be called on program close. Cleanup could be done here.\n\n---\n" )
|
||||
local FUNC_DESC = {
|
||||
init = "This function will be called first when 'main.lua' is found",
|
||||
process = "This function will be called every frame during execution. It will get time duration from last frame on argument 'delta'",
|
||||
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.",
|
||||
log = "This function can be used for custom log message handling.",
|
||||
exit = "This function will be called on program close. Cleanup could be done here.",
|
||||
}
|
||||
|
||||
apiFile:write( "\n---\n> function RL.init()\n\n"..FUNC_DESC.init.."\n\n---\n" )
|
||||
apiFile:write( "\n> function RL.process( delta )\n\n"..FUNC_DESC.process.."\n\n---\n" )
|
||||
apiFile:write( "\n> function RL.draw()\n\n"..FUNC_DESC.draw.."\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.
|
||||
|
||||
local srcFile = io.open( "src/lua_core.c", "r" )
|
||||
local srcFile = io.open( "../src/lua_core.c", "r" )
|
||||
local writing = false
|
||||
|
||||
repeat
|
||||
@@ -61,9 +135,26 @@ repeat
|
||||
if writing then
|
||||
if lineSplit[1] == "\t/*" then
|
||||
apiFile:write( "\n## Globals - "..lineSplit[2].."\n" )
|
||||
luaApiFile:write( "\n-- Globals - "..lineSplit[2].."\n\n" )
|
||||
else
|
||||
-- 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
|
||||
|
||||
@@ -172,8 +263,9 @@ local sourceFiles = {
|
||||
}
|
||||
|
||||
for _, src in ipairs( sourceFiles ) do
|
||||
srcFile = io.open( "src/"..src..".c", "r" )
|
||||
srcFile = io.open( "../src/"..src..".c", "r" )
|
||||
local line = ""
|
||||
local funcStr = ""
|
||||
local p = false
|
||||
|
||||
if separate then
|
||||
@@ -186,12 +278,22 @@ for _, src in ipairs( sourceFiles ) do
|
||||
if line == "*/" then
|
||||
p = false
|
||||
apiFile:write( "\n---\n" )
|
||||
luaApiFile:write( funcStr.."\n" )
|
||||
funcStr = ""
|
||||
end
|
||||
|
||||
|
||||
if p then
|
||||
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
|
||||
|
||||
|
||||
if line == "/*" then
|
||||
p = true
|
||||
apiFile:write( "\n" )
|
||||
|
||||
@@ -7,62 +7,62 @@ local cameraSpeed = 100.0
|
||||
local cameraRotSpeed = 100.0
|
||||
local cameraZoomSpeed = 10.0
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowTitle( "Camera 2D" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
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.SetWindowTitle( "Camera 2D" )
|
||||
|
||||
tileTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
|
||||
camera = RL_CreateCamera2D()
|
||||
RL_SetCamera2DOffset( camera, { winSize[1] / 2, winSize[2] / 2 } )
|
||||
tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
|
||||
camera = RL.CreateCamera2D()
|
||||
RL.SetCamera2DOffset( camera, { winSize[1] / 2, winSize[2] / 2 } )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
-- Move.
|
||||
if RL_IsKeyDown( KEY_RIGHT ) then
|
||||
if RL.IsKeyDown( RL.KEY_RIGHT ) then
|
||||
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
|
||||
end
|
||||
if RL_IsKeyDown( KEY_DOWN ) then
|
||||
if RL.IsKeyDown( RL.KEY_DOWN ) then
|
||||
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
|
||||
end
|
||||
-- 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
|
||||
elseif RL_IsKeyDown( string.byte( "Q" ) ) then
|
||||
elseif RL.IsKeyDown( string.byte( "Q" ) ) then
|
||||
cameraRot = cameraRot - cameraRotSpeed * delta
|
||||
end
|
||||
-- Zoom.
|
||||
if RL_IsKeyDown( string.byte( "R" ) ) then
|
||||
if RL.IsKeyDown( string.byte( "R" ) ) then
|
||||
cameraZoom = cameraZoom + cameraZoomSpeed * delta
|
||||
elseif RL_IsKeyDown( string.byte( "F" ) ) then
|
||||
elseif RL.IsKeyDown( string.byte( "F" ) ) then
|
||||
cameraZoom = cameraZoom - cameraZoomSpeed * delta
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
RL_SetCamera2DTarget( camera, cameraPos )
|
||||
RL_SetCamera2DRotation( camera, cameraRot )
|
||||
RL_SetCamera2DZoom( camera, cameraZoom )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
RL.SetCamera2DTarget( camera, cameraPos )
|
||||
RL.SetCamera2DRotation( camera, cameraRot )
|
||||
RL.SetCamera2DZoom( camera, cameraZoom )
|
||||
|
||||
RL_BeginMode2D( camera )
|
||||
RL.BeginMode2D( camera )
|
||||
-- Draw wall.
|
||||
for y = 0, 4 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
|
||||
-- Draw hero.
|
||||
RL_DrawTextureRec( tileTexture, { 3 * 32, 0, 32, 32 }, { cameraPos[1] - 16, cameraPos[2] - 16 }, WHITE )
|
||||
RL_EndMode2D()
|
||||
RL.DrawTextureRec( tileTexture, { 3 * 32, 0, 32, 32 }, { cameraPos[1] - 16, cameraPos[2] - 16 }, RL.WHITE )
|
||||
RL.EndMode2D()
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ function Calculator:new( pos )
|
||||
padding = 10,
|
||||
onClicked = function()
|
||||
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
|
||||
end,
|
||||
} )
|
||||
@@ -30,7 +30,7 @@ function Calculator:new( pos )
|
||||
texture = bgrTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
|
||||
object.handle:add( Gui.texture:new( {
|
||||
@@ -38,8 +38,8 @@ function Calculator:new( pos )
|
||||
texture = borderTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
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 } ) )
|
||||
@@ -51,8 +51,8 @@ function Calculator:new( pos )
|
||||
onClicked = function()
|
||||
object:setVisible( false )
|
||||
end,
|
||||
onMouseOver = function( self ) self.items[1].color = Color:new( WHITE ) end,
|
||||
notMouseOver = function( self ) self.items[1].color = Color:new( BLACK ) end,
|
||||
onMouseOver = function( self ) self.items[1].color = Color:new( RL.WHITE ) end,
|
||||
notMouseOver = function( self ) self.items[1].color = Color:new( RL.BLACK ) end,
|
||||
} )
|
||||
|
||||
object.closeButton:add( Gui.texture:new( {
|
||||
@@ -73,7 +73,7 @@ function Calculator:new( pos )
|
||||
texture = bgrTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
} ) )
|
||||
|
||||
object.panel:add( Gui.texture:new( {
|
||||
@@ -81,8 +81,8 @@ function Calculator:new( pos )
|
||||
texture = borderTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH },
|
||||
} ) )
|
||||
|
||||
-- Display.
|
||||
@@ -91,13 +91,13 @@ function Calculator:new( pos )
|
||||
bounds = Rect:new( 0, 0, object.windowRect.width - 16, object.DISPLAY_HIGHT ),
|
||||
padding = 10,
|
||||
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 } ) )
|
||||
|
||||
-- Buttons.
|
||||
|
||||
|
||||
local buttonStrings = { "7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3", "-", "0", "C", "=", "+" }
|
||||
object.buttons = {}
|
||||
|
||||
@@ -108,8 +108,8 @@ function Calculator:new( pos )
|
||||
table.insert( object.buttons, Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 40, 32 ),
|
||||
drawBounds = true,
|
||||
onMouseOver = function( self ) self.color = Color:new( WHITE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) 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 )
|
||||
@@ -161,7 +161,7 @@ function Calculator:setPosition( pos )
|
||||
end
|
||||
|
||||
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 )
|
||||
|
||||
self:setPosition( mousePos - self.dragPos )
|
||||
@@ -173,13 +173,13 @@ function Calculator:setVisible( visible )
|
||||
|
||||
self.closeButton.visible = visible
|
||||
self.closeButton.disabled = not visible
|
||||
|
||||
|
||||
self.panel.visible = visible
|
||||
self.panel.disabled = not visible
|
||||
|
||||
self.display.visible = visible
|
||||
self.display.disabled = not visible
|
||||
|
||||
|
||||
for _, button in ipairs( self.buttons ) do
|
||||
button.visible = visible
|
||||
button.disabled = not visible
|
||||
@@ -188,7 +188,7 @@ end
|
||||
|
||||
function Calculator:set2Top()
|
||||
self.panel:set2Top()
|
||||
|
||||
|
||||
for _, button in ipairs( self.buttons ) do
|
||||
button:set2Top()
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ function FileExplorer:new( pos )
|
||||
padding = 10,
|
||||
onClicked = function()
|
||||
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
|
||||
end,
|
||||
} )
|
||||
@@ -30,16 +30,16 @@ function FileExplorer:new( pos )
|
||||
texture = bgrTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
|
||||
|
||||
object.handle:add( Gui.texture:new( {
|
||||
bounds = object.handle.bounds:clone(),
|
||||
texture = borderTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
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 } ) )
|
||||
@@ -51,8 +51,8 @@ function FileExplorer:new( pos )
|
||||
onClicked = function()
|
||||
object:setVisible( false )
|
||||
end,
|
||||
onMouseOver = function( self ) self.items[1].color = Color:new( WHITE ) end,
|
||||
notMouseOver = function( self ) self.items[1].color = Color:new( BLACK ) end,
|
||||
onMouseOver = function( self ) self.items[1].color = Color:new( RL.WHITE ) end,
|
||||
notMouseOver = function( self ) self.items[1].color = Color:new( RL.BLACK ) end,
|
||||
} )
|
||||
|
||||
object.closeButton:add( Gui.texture:new( {
|
||||
@@ -73,7 +73,7 @@ function FileExplorer:new( pos )
|
||||
texture = bgrTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
} ) )
|
||||
|
||||
object.panel:add( Gui.texture:new( {
|
||||
@@ -81,8 +81,8 @@ function FileExplorer:new( pos )
|
||||
texture = borderTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH },
|
||||
} ) )
|
||||
|
||||
-- Path.
|
||||
@@ -90,7 +90,7 @@ function FileExplorer:new( pos )
|
||||
object.pathBox = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 64, object.HANDLE_HIGHT ),
|
||||
drawBounds = true,
|
||||
color = Color:new( WHITE ),
|
||||
color = Color:new( RL.WHITE ),
|
||||
-- onClicked = function() Gui.setInputFocus( object.pathBox ) end,
|
||||
-- inputFocus = function() object.pathBox.color = Color:new( BLUE ) end,
|
||||
-- inputUnfocus = function() object.pathBox.color = Color:new( WHITE ) end,
|
||||
@@ -103,8 +103,8 @@ function FileExplorer:new( pos )
|
||||
object.backButton = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 56, object.HANDLE_HIGHT ),
|
||||
drawBounds = true,
|
||||
onMouseOver = function( self ) self.color = Color:new( WHITE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) 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 ),
|
||||
texture = backTexture,
|
||||
HAling = Gui.ALING.CENTER,
|
||||
color = Color:new( BLACK )
|
||||
color = Color:new( RL.BLACK )
|
||||
} ) )
|
||||
|
||||
-- Files.
|
||||
@@ -130,7 +130,7 @@ function FileExplorer:new( pos )
|
||||
object.fileName = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, object.windowRect.width - 16 - 70, object.HANDLE_HIGHT ),
|
||||
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 } ) )
|
||||
@@ -140,18 +140,18 @@ function FileExplorer:new( pos )
|
||||
object.openButton = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 64, object.HANDLE_HIGHT ),
|
||||
drawBounds = true,
|
||||
color = Color:new( WHITE ),
|
||||
color = Color:new( RL.WHITE ),
|
||||
onClicked = function() object:openFile() end,
|
||||
onMouseOver = function( self ) self.color = Color:new( WHITE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.WHITE ) 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 } ) )
|
||||
|
||||
-- Variables.
|
||||
|
||||
object.path = RL_GetBasePath()
|
||||
|
||||
object.path = RL.GetBasePath()
|
||||
|
||||
-- Take last '/' away.
|
||||
if util.utf8Sub( object.path, utf8.len( object.path ), utf8.len( object.path ) ) == "/" then
|
||||
object.path = util.utf8Sub( object.path, 1, utf8.len( object.path ) - 1 )
|
||||
@@ -189,7 +189,7 @@ function FileExplorer:changeDir( path )
|
||||
end
|
||||
|
||||
function FileExplorer:backDir()
|
||||
self.path = RL_GetPrevDirectoryPath( self.path )
|
||||
self.path = RL.GetPrevDirectoryPath( self.path )
|
||||
|
||||
self:updatePath()
|
||||
end
|
||||
@@ -197,11 +197,11 @@ end
|
||||
function FileExplorer:fileSelect( file )
|
||||
self.file = file
|
||||
|
||||
self.fileName.items[1]:set( RL_GetFileName( file ) )
|
||||
self.fileName.items[1]:set( RL.GetFileName( file ) )
|
||||
end
|
||||
|
||||
function FileExplorer:openFile()
|
||||
print( self.file, RL_GetFileLength( self.file ) )
|
||||
print( self.file, RL.GetFileLength( self.file ) )
|
||||
end
|
||||
|
||||
function FileExplorer:updateFiles()
|
||||
@@ -216,8 +216,8 @@ function FileExplorer:updateFiles()
|
||||
local files = {}
|
||||
local folders = {}
|
||||
|
||||
for _, file in ipairs( RL_LoadDirectoryFiles( self.path ) ) do
|
||||
if RL_IsPathFile( file ) then
|
||||
for _, file in ipairs( RL.LoadDirectoryFiles( self.path ) ) do
|
||||
if RL.IsPathFile( file ) then
|
||||
table.insert( files, file )
|
||||
else
|
||||
table.insert( folders, file )
|
||||
@@ -232,7 +232,7 @@ function FileExplorer:updateFiles()
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
@@ -247,7 +247,7 @@ function FileExplorer:addFileToList( file, texture, color, func )
|
||||
|
||||
element:add( Gui.text:new( {
|
||||
bounds = Rect:new( 28, 0, 20, 20 ),
|
||||
text = RL_GetFileName( file ),
|
||||
text = RL.GetFileName( file ),
|
||||
fontSize = 20,
|
||||
HAling = Gui.ALING.NONE,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
@@ -264,7 +264,7 @@ function FileExplorer:addFileToList( file, texture, color, func )
|
||||
end
|
||||
|
||||
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 )
|
||||
|
||||
self:setPosition( mousePos - self.dragPos )
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
package.path = package.path..";"..RL_GetBasePath().."?.lua"
|
||||
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua"
|
||||
package.path = package.path..";"..RL.GetBasePath().."?.lua"
|
||||
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||
|
||||
util = require( "utillib" )
|
||||
Vec2 = require( "vector2" )
|
||||
@@ -13,29 +13,29 @@ FileExplorer = require( "file_explorer" )
|
||||
-- Textures.
|
||||
|
||||
-- Note that textures are global.
|
||||
cancelTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/cancel.png" )
|
||||
backTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/previous-button.png" )
|
||||
folderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/open-folder.png" )
|
||||
filesTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/files.png" )
|
||||
borderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" )
|
||||
bgrTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_bgr.png" )
|
||||
cancelTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cancel.png" )
|
||||
backTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/previous-button.png" )
|
||||
folderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/open-folder.png" )
|
||||
filesTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/files.png" )
|
||||
borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
|
||||
bgrTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_bgr.png" )
|
||||
|
||||
RL_GenTextureMipmaps( cancelTexture )
|
||||
RL_GenTextureMipmaps( backTexture )
|
||||
RL_GenTextureMipmaps( folderTexture )
|
||||
RL_GenTextureMipmaps( filesTexture )
|
||||
RL_GenTextureMipmaps( borderTexture )
|
||||
RL_GenTextureMipmaps( bgrTexture )
|
||||
RL.GenTextureMipmaps( cancelTexture )
|
||||
RL.GenTextureMipmaps( backTexture )
|
||||
RL.GenTextureMipmaps( folderTexture )
|
||||
RL.GenTextureMipmaps( filesTexture )
|
||||
RL.GenTextureMipmaps( borderTexture )
|
||||
RL.GenTextureMipmaps( bgrTexture )
|
||||
|
||||
RL_SetTextureFilter( cancelTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( backTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( folderTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( filesTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( borderTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( bgrTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( cancelTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( backTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( folderTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( filesTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( borderTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( bgrTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
|
||||
RL_SetTextureWrap( borderTexture, TEXTURE_WRAP_REPEAT )
|
||||
RL_SetTextureWrap( bgrTexture, TEXTURE_WRAP_REPEAT )
|
||||
RL.SetTextureWrap( borderTexture, RL.TEXTURE_WRAP_REPEAT )
|
||||
RL.SetTextureWrap( bgrTexture, RL.TEXTURE_WRAP_REPEAT )
|
||||
|
||||
-- End of calculator definition.
|
||||
|
||||
@@ -51,8 +51,8 @@ function initGui()
|
||||
calculator:setVisible( true )
|
||||
fileExplorer:setVisible( true )
|
||||
end,
|
||||
onMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( GRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) 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 } ) )
|
||||
@@ -61,27 +61,27 @@ function initGui()
|
||||
fileExplorer = FileExplorer:new( Vec2:new( 280, 96 ) )
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowTitle( "ReiLuaGui examples" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "ReiLuaGui examples" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
initGui()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
Gui.process( Vec2:new( RL_GetMousePosition() ) )
|
||||
function RL.process( delta )
|
||||
Gui.process( Vec2:new( RL.GetMousePosition() ) )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
|
||||
Gui.draw()
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua"
|
||||
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||
|
||||
util = require( "utillib" )
|
||||
Vec2 = require( "vector2" )
|
||||
@@ -7,16 +7,16 @@ Color = require( "color" )
|
||||
Gui = require( "gui" )
|
||||
|
||||
local container = {}
|
||||
-- local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/circle.png" )
|
||||
local circleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/plain-circle.png" )
|
||||
local checkTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/check-mark.png" )
|
||||
local borderTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/ui_border.png" )
|
||||
-- local circleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/circle.png" )
|
||||
local circleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/plain-circle.png" )
|
||||
local checkTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/check-mark.png" )
|
||||
local borderTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/ui_border.png" )
|
||||
local textInput
|
||||
|
||||
RL_GenTextureMipmaps( circleTexture )
|
||||
RL_GenTextureMipmaps( checkTexture )
|
||||
RL_SetTextureFilter( circleTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureFilter( checkTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL.GenTextureMipmaps( circleTexture )
|
||||
RL.GenTextureMipmaps( checkTexture )
|
||||
RL.SetTextureFilter( circleTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureFilter( checkTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
|
||||
function initGui()
|
||||
-- local label = Gui.label:new( { text = "Dog", bounds = { 32, 32, 96, 96 }, drawBounds = true, Haling = Gui.ALING.CENTER, Valing = Gui.ALING.TOP } )
|
||||
@@ -45,8 +45,8 @@ function initGui()
|
||||
local dog = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 128, 36 ),
|
||||
onClicked = function() panel:setPosition( Vec2:new( 290, 120 ) ) end,
|
||||
onMouseOver = function( self ) self.items[1].color = RED end,
|
||||
notMouseOver = function( self ) self.items[1].color = BLACK end,
|
||||
onMouseOver = function( self ) self.items[1].color = RL.RED end,
|
||||
notMouseOver = function( self ) self.items[1].color = RL.BLACK end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
|
||||
@@ -58,7 +58,7 @@ function initGui()
|
||||
HAling = Gui.ALING.CENTER,
|
||||
VAling = Gui.ALING.CENTER,
|
||||
visible = true,
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = NPATCH_NINE_PATCH },
|
||||
nPatchInfo = { source = { 0, 0, 24, 24 }, left = 8, top = 8, right = 8, bottom = 8, layout = RL.NPATCH_NINE_PATCH },
|
||||
} ) )
|
||||
|
||||
dog:add( Gui.texture:new( { bounds = Rect:new( 0, 0, 24, 24 ), texture = circleTexture, HAling = Gui.ALING.RIGHT, color = Color:new( 150, 150, 255 ) } ) )
|
||||
@@ -81,8 +81,8 @@ function initGui()
|
||||
local element = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 120, 30 ),
|
||||
onClicked = function() panel:setPosition( Vec2:new( 340, 380 ) ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
|
||||
@@ -97,18 +97,18 @@ function initGui()
|
||||
|
||||
local element = Gui.element:new( {
|
||||
bounds = itemBounds:clone(),
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
element:add( Gui.text:new( { text = "Dog" } ) )
|
||||
container2:add( element )
|
||||
|
||||
|
||||
element = Gui.element:new( {
|
||||
bounds = Rect:new( 0, 0, 78, 24 ),
|
||||
-- bounds = Rect:new( 0, 0, 78, 64 ),
|
||||
onMouseOver = function( self ) self.color = Color:new( DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( LIGHTGRAY ) end,
|
||||
onMouseOver = function( self ) self.color = Color:new( RL.DARKBLUE ) end,
|
||||
notMouseOver = function( self ) self.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
drawBounds = true,
|
||||
} )
|
||||
element:add( Gui.text:new( { text = "Cat" } ) )
|
||||
@@ -123,39 +123,38 @@ function initGui()
|
||||
textInput = Gui.element:new( {
|
||||
bounds = Rect:new( 64, 360, 300, 32 ),
|
||||
drawBounds = true,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
onClicked = function() Gui.setInputFocus( textInput ) end,
|
||||
inputFocus = function() textInput.color = Color:new( BLUE ) end,
|
||||
inputFocus = function() textInput.color = Color:new( RL.BLUE ) end,
|
||||
-- inputFocus = function() container:delete() end,
|
||||
-- inputFocus = function() panel:set2Back() end,
|
||||
inputUnfocus = function() textInput.color = Color:new( LIGHTGRAY ) end,
|
||||
inputUnfocus = function() textInput.color = Color:new( RL.LIGHTGRAY ) end,
|
||||
} )
|
||||
|
||||
textInput:add( Gui.text:new( { text = "", maxTextLen = 16, allowLineBreak = false } ) )
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowTitle( "ReiLuaGui Test" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "ReiLuaGui Test" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
initGui()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
Gui.process( Vec2:new( RL_GetMousePosition() ) )
|
||||
function RL.process( delta )
|
||||
Gui.process( Vec2:new( RL.GetMousePosition() ) )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
|
||||
Gui.draw()
|
||||
RL_DrawText( 0, "Work in progress GuiLib test.", { 10, 10 }, 30, 4, BLACK )
|
||||
end
|
||||
|
||||
@@ -42,23 +42,23 @@ function Bunny:update()
|
||||
end
|
||||
end
|
||||
|
||||
function init()
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( { screenWidth, screenHeight } )
|
||||
RL_SetWindowTitle( "raylib [textures] example - bunnymark" )
|
||||
function RL.init()
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( { screenWidth, screenHeight } )
|
||||
RL.SetWindowTitle( "raylib [textures] example - bunnymark" )
|
||||
-- Load bunny texture
|
||||
texBunny = RL_LoadTexture( RL_GetBasePath().."../resources/images/wabbit_alpha.png" )
|
||||
texSize = RL_GetTextureSize( texBunny )
|
||||
texBunny = RL.LoadTexture( RL.GetBasePath().."../resources/images/wabbit_alpha.png" )
|
||||
texSize = RL.GetTextureSize( texBunny )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsMouseButtonDown( 0 ) then
|
||||
function RL.process( delta )
|
||||
if RL.IsMouseButtonDown( 0 ) then
|
||||
-- Create more bunnies
|
||||
for i = 1, 100 do
|
||||
if #bunnies < MAX_BUNNIES then
|
||||
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 }
|
||||
table.insert( bunnies, Bunny:new( RL_GetMousePosition(), speed, color ) )
|
||||
table.insert( bunnies, Bunny:new( RL.GetMousePosition(), speed, color ) )
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -68,8 +68,8 @@ function process( delta )
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
|
||||
for _, bunny in ipairs( bunnies ) do
|
||||
-- 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
|
||||
-- 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
|
||||
RL_DrawTexture( texBunny, { bunny.position[1], bunny.position[2] }, bunny.color )
|
||||
RL.DrawTexture( texBunny, { bunny.position[1], bunny.position[2] }, bunny.color )
|
||||
end
|
||||
|
||||
RL_DrawRectangle( { 0, 0, screenWidth, 40 }, BLACK)
|
||||
RL_DrawText( 0, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, GREEN )
|
||||
RL_DrawText( 0, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RED )
|
||||
RL_DrawFPS( { 10, 10 } )
|
||||
RL.DrawRectangle( { 0, 0, screenWidth, 40 }, RL.BLACK)
|
||||
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, RL.RED )
|
||||
RL.DrawFPS( { 10, 10 } )
|
||||
end
|
||||
|
||||
@@ -4,12 +4,12 @@ local camera = -1
|
||||
local texture = -1
|
||||
local textureSize = { 256, 96 }
|
||||
local res = { 384, 216 }
|
||||
local winSize = RL_GetScreenSize()
|
||||
local winSize = RL.GetScreenSize()
|
||||
local winScale = 4
|
||||
local framebuffer = -1
|
||||
|
||||
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 CEILING = 2
|
||||
@@ -51,38 +51,37 @@ local function getTileVer( x, y, type )
|
||||
return verts
|
||||
end
|
||||
|
||||
function drawSprites()
|
||||
local function drawSprites()
|
||||
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
|
||||
|
||||
|
||||
table.sort( sprites, function( a, b ) return a.dis > b.dis end )
|
||||
|
||||
for _, sprite in ipairs( sprites ) do
|
||||
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 )
|
||||
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 }, RL.WHITE )
|
||||
end
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
|
||||
winSize = { res[1] * winScale, res[2] * winScale }
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetExitKey( KEY_ESCAPE )
|
||||
-- framebuffer = RL_LoadRenderTexture( res )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetExitKey( RL.KEY_ESCAPE )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
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" )
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, pos )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FIRST_PERSON )
|
||||
texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, pos )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_FIRST_PERSON )
|
||||
|
||||
-- for x = 0, 3 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 } )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_UpdateCamera3D( camera )
|
||||
pos = RL_GetCamera3DPosition( camera )
|
||||
function RL.draw()
|
||||
RL.UpdateCamera3D( camera )
|
||||
pos = RL.GetCamera3DPosition( camera )
|
||||
|
||||
-- RL_BeginTextureMode( framebuffer )
|
||||
RL_ClearBackground( { 100, 150, 150 } )
|
||||
-- RL.BeginTextureMode( framebuffer )
|
||||
RL.ClearBackground( { 100, 150, 150 } )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL.BeginMode3D( camera )
|
||||
|
||||
-- Floor and ceiling.
|
||||
for x = 0, 3 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, CEILING ), getTexCoords( 2, 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 )
|
||||
end
|
||||
end
|
||||
-- Walls.
|
||||
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( 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( 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( 2, 0, WALL_N ), getTexCoords( 2, 2 ), TILE_VERTEX_COLORS )
|
||||
RL.DrawQuad3DTexture( texture, getTileVer( 3, 0, WALL_N ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
|
||||
|
||||
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
|
||||
for y = 0, 10 do
|
||||
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( 0, y, WALL_W ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
|
||||
RL.DrawQuad3DTexture( texture, getTileVer( 3, y, WALL_E ), getTexCoords( 0, 0 ), TILE_VERTEX_COLORS )
|
||||
end
|
||||
|
||||
drawSprites()
|
||||
RL_EndMode3D()
|
||||
-- RL_EndTextureMode()
|
||||
RL.EndMode3D()
|
||||
-- RL.EndTextureMode()
|
||||
|
||||
-- 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_SetTextureSource( TEXTURE_SOURCE_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.SetTextureSource( TEXTURE_SOURCE_TEXTURE )
|
||||
end
|
||||
|
||||
@@ -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 comboBoxActive = 0
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = { 1920, 1080 }
|
||||
|
||||
RL_GuiSetFont( 0 )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.GuiSetFont( 0 )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 50, 20, 75 } )
|
||||
function RL.draw()
|
||||
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
|
||||
RL_CloseWindow()
|
||||
if RL.GuiButton( { 112, 16, 96, 32 }, RL.GuiIconText( 113, "Exit" ) ) then
|
||||
RL.CloseWindow()
|
||||
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
|
||||
end
|
||||
|
||||
RL_GuiPanel( { 60, 260, 100, 100 }, "Panel" )
|
||||
RL.GuiPanel( { 60, 260, 100, 100 }, "Panel" )
|
||||
|
||||
toggled = RL_GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
|
||||
index = RL_GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
|
||||
checkbox = RL_GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
|
||||
toggled = RL.GuiToggle( { 200, 260, 64, 32 }, "Toggle", toggled )
|
||||
index = RL.GuiToggleGroup( { 520, 30, 64, 32 }, "Cat\nDog\nMonkey", index )
|
||||
checkbox = RL.GuiCheckBox( { 200, 300, 16, 16 }, "CheckBox", checkbox )
|
||||
|
||||
local textBoxToggle = false
|
||||
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.GuiTextBox( { 32, 400, 120, 32 }, textBoxText, 32, textBoxActive )
|
||||
-- textBoxToggle, textBoxText = RL.GuiTextBoxMulti( { 32, 400, 120, 64 }, textBoxText, 120, textBoxActive )
|
||||
|
||||
if textBoxToggle then
|
||||
textBoxActive = not textBoxActive
|
||||
end
|
||||
|
||||
local spinnerToggle = false
|
||||
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.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 )
|
||||
|
||||
if spinnerToggle then
|
||||
spinnerActive = not spinnerActive
|
||||
end
|
||||
|
||||
sliderValue = RL_GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] )
|
||||
scrollbarValue = RL_GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 )
|
||||
sliderValue = RL.GuiSliderBar( { 64, 510, 96, 32 }, "min", "max", sliderValue, sliderValueRange[1], sliderValueRange[2] )
|
||||
scrollbarValue = RL.GuiScrollBar( { 64, 550, 130, 32 }, scrollbarValue, 0, 10 )
|
||||
|
||||
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
|
||||
dropdownActive = not dropdownActive
|
||||
end
|
||||
|
||||
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" )
|
||||
listView.item, listView.scroll = RL.GuiListView( { 200, 400, 200, 200 }, "Cat\nElefant\nSquirrel", listView.scroll, listView.item )
|
||||
messageBox.buttonIndex = RL.GuiMessageBox( { 420, 400, 200, 100 }, "Message", "Are you sure about this?", "Yes\nNo" )
|
||||
|
||||
if 0 <= messageBox.buttonIndex then
|
||||
print( "messageBox.buttonIndex", messageBox.buttonIndex )
|
||||
end
|
||||
|
||||
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
|
||||
print( "textInputBox.buttonIndex", textInputBox.buttonIndex )
|
||||
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.alpha = RL_GuiColorBarAlpha( { 820, 180, 150, 20 }, "Color alpha", colorPanel.alpha )
|
||||
colorPanel.hue = RL_GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
|
||||
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.hue = RL.GuiColorBarHue( { 980, 20, 20, 150 }, "Color hue", colorPanel.hue )
|
||||
|
||||
if colorPanel.hue ~= colorPanel.oldHue then
|
||||
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
|
||||
|
||||
RL_GuiDrawIcon( 121, { 6, 20 }, 2, WHITE )
|
||||
|
||||
comboBoxActive = RL_GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
|
||||
RL.GuiDrawIcon( 121, { 6, 20 }, 2, RL.WHITE )
|
||||
|
||||
comboBoxActive = RL.GuiComboBox( { 5, 50, 80, 20 }, "One\nTwo\nThree", comboBoxActive )
|
||||
end
|
||||
|
||||
@@ -18,67 +18,67 @@ local dirtBottomRec = { 7 * TILE_SIZE, 0 * TILE_SIZE, TILE_SIZE, TILE_SIZE }
|
||||
|
||||
local matrix = {}
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
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 } )
|
||||
tilesetTex = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
|
||||
groundTexture = RL_LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } )
|
||||
mesh = RL.GenMeshHeightmap( heigthImage, { 16, 4, 16 } )
|
||||
tilesetTex = RL.LoadTexture( RL.GetBasePath().."../resources/images/tiles.png" )
|
||||
groundTexture = RL.LoadRenderTexture( { TILE_SIZE * 16, TILE_SIZE * 16 } )
|
||||
|
||||
-- Draw to ground texture.
|
||||
RL_BeginTextureMode( groundTexture )
|
||||
RL.BeginTextureMode( groundTexture )
|
||||
|
||||
for x = 1, 16 do
|
||||
for y = 1, 16 do
|
||||
local pos = { x - 1, y - 1 }
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
RL_EndTextureMode()
|
||||
RL.EndTextureMode()
|
||||
|
||||
material = RL_LoadMaterialDefault()
|
||||
RL_SetTextureSource( TEXTURE_SOURCE_RENDER_TEXTURE )
|
||||
-- RL_GenTextureMipmaps( groundTexture )
|
||||
-- RL_SetTextureFilter( groundTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetMaterialTexture( material, MATERIAL_MAP_ALBEDO, groundTexture )
|
||||
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE )
|
||||
material = RL.LoadMaterialDefault()
|
||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
|
||||
-- RL.GenTextureMipmaps( groundTexture )
|
||||
-- RL.SetTextureFilter( groundTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetMaterialTexture( material, RL.MATERIAL_MAP_ALBEDO, groundTexture )
|
||||
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
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_UpdateCamera3D( camera )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL_DrawMesh( mesh, material, matrix )
|
||||
RL_EndMode3D()
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawMesh( mesh, material, matrix )
|
||||
RL.EndMode3D()
|
||||
end
|
||||
|
||||
@@ -5,40 +5,40 @@ local catImage = -1
|
||||
local catCopy = -1
|
||||
local textImage = -1
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
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 )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
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], RL.WHITE )
|
||||
-- Test changing working directory.
|
||||
RL_ChangeDirectory( RL_GetBasePath().."../resources" )
|
||||
catImage = RL_LoadImage( RL_GetWorkingDirectory().."/images/cat.png" )
|
||||
RL_ImageClearBackground( image, { 150, 60, 100 } )
|
||||
RL_ImageDrawPixel( image, { 32, 32 }, WHITE )
|
||||
RL_ImageDrawLine( image, { 32, 45 }, { 100, 60 }, GREEN )
|
||||
RL_ImageDrawCircle( image, { 64, 32 }, 16, BLUE )
|
||||
RL_ImageDrawRectangle( image, { 120, 64, 32, 64 }, BLUE )
|
||||
RL_ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, BLUE )
|
||||
RL_ImageDraw( image, catImage, { 143, 25, 230, 250 }, { 200, 200, 230, 250 }, WHITE )
|
||||
RL_ImageDrawTextEx( image, 0, "Hello", { 300, 32 }, 48.0, 1.0, WHITE )
|
||||
RL.ChangeDirectory( RL.GetBasePath().."../resources" )
|
||||
catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" )
|
||||
RL.ImageClearBackground( image, { 150, 60, 100 } )
|
||||
RL.ImageDrawPixel( image, { 32, 32 }, RL.WHITE )
|
||||
RL.ImageDrawLine( image, { 32, 45 }, { 100, 60 }, RL.GREEN )
|
||||
RL.ImageDrawCircle( image, { 64, 32 }, 16, RL.BLUE )
|
||||
RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE )
|
||||
RL.ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, RL.BLUE )
|
||||
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, RL.WHITE )
|
||||
|
||||
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 )
|
||||
local imageSize = RL_GetImageSize( textImage )
|
||||
RL_ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, WHITE )
|
||||
|
||||
texture = RL_LoadTextureFromImage( image )
|
||||
textImage = RL.ImageText( 0, "Cat", 10, 4, RL.WHITE )
|
||||
local imageSize = RL.GetImageSize( textImage )
|
||||
RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE )
|
||||
|
||||
texture = RL.LoadTextureFromImage( image )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_DrawTexture( texture, { 0, 0 }, WHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.DrawTexture( texture, { 0, 0 }, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -18,94 +18,94 @@ local shader
|
||||
local matInstances
|
||||
local matDefault
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowTitle( "Instancing" )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "Instancing" )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
|
||||
-- Define the camera to look into our 3d world
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { -125.0, 125.0, -125.0 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCamera3DFovy( camera, 45 )
|
||||
RL_SetCameraMode( camera, CAMERA_ORBITAL )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { -125.0, 125.0, -125.0 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCamera3DFovy( camera, 45 )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_ORBITAL )
|
||||
|
||||
-- Define mesh to be instanced
|
||||
cube = RL_GenMeshCube( { 1, 1, 1 } )
|
||||
cube = RL.GenMeshCube( { 1, 1, 1 } )
|
||||
|
||||
-- Translate and rotate cubes randomly
|
||||
for i = 1, MAX_INSTANCES do
|
||||
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 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 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
|
||||
|
||||
-- Load lighting shader
|
||||
shader = RL_LoadShader( RL_GetBasePath().."../resources/shaders/glsl330/lighting_instancing.vs",
|
||||
RL_GetBasePath().."../resources/shaders/glsl330/lighting.fs" )
|
||||
shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lighting_instancing.vs",
|
||||
RL.GetBasePath().."../resources/shaders/glsl330/lighting.fs" )
|
||||
|
||||
-- Get shader locations
|
||||
local mvpLoc = RL_GetShaderLocation( shader, "mvp" )
|
||||
local viewPosLoc = RL_GetShaderLocation( shader, "viewPos" )
|
||||
local instanceTransformLoc = RL_GetShaderLocationAttrib( shader, "instanceTransform" )
|
||||
RL_SetShaderLocationIndex( shader, SHADER_LOC_MATRIX_MVP, mvpLoc )
|
||||
RL_SetShaderLocationIndex( shader, SHADER_LOC_VECTOR_VIEW, viewPosLoc )
|
||||
RL_SetShaderLocationIndex( shader, SHADER_LOC_MATRIX_MODEL, instanceTransformLoc )
|
||||
local mvpLoc = RL.GetShaderLocation( shader, "mvp" )
|
||||
local viewPosLoc = RL.GetShaderLocation( shader, "viewPos" )
|
||||
local instanceTransformLoc = RL.GetShaderLocationAttrib( shader, "instanceTransform" )
|
||||
RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_MATRIX_MVP, mvpLoc )
|
||||
RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_VECTOR_VIEW, viewPosLoc )
|
||||
RL.SetShaderLocationIndex( shader, RL.SHADER_LOC_MATRIX_MODEL, instanceTransformLoc )
|
||||
|
||||
-- Set shader value: ambient light level
|
||||
local ambientLoc = RL_GetShaderLocation( shader, "ambient" )
|
||||
RL_SetShaderValue( shader, ambientLoc, { 0.2, 0.2, 0.2, 0.1 }, SHADER_UNIFORM_VEC4 )
|
||||
local ambientLoc = RL.GetShaderLocation( shader, "ambient" )
|
||||
RL.SetShaderValue( shader, ambientLoc, { 0.2, 0.2, 0.2, 0.1 }, RL.SHADER_UNIFORM_VEC4 )
|
||||
|
||||
-- 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
|
||||
-- to be used on mesh drawing with DrawMeshInstanced()
|
||||
matInstances = RL_LoadMaterialDefault()
|
||||
RL_SetMaterialShader( matInstances, shader )
|
||||
RL_SetMaterialColor( matInstances, MATERIAL_MAP_DIFFUSE, RED )
|
||||
matInstances = RL.LoadMaterialDefault()
|
||||
RL.SetMaterialShader( matInstances, shader )
|
||||
RL.SetMaterialColor( matInstances, RL.MATERIAL_MAP_DIFFUSE, RL.RED )
|
||||
|
||||
-- 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,
|
||||
-- when drawing the color attribute is disabled and a default color value is provided as input for thevertex attribute
|
||||
matDefault = RL_LoadMaterialDefault()
|
||||
RL_SetMaterialColor( matDefault, MATERIAL_MAP_DIFFUSE, BLUE )
|
||||
matDefault = RL.LoadMaterialDefault()
|
||||
RL.SetMaterialColor( matDefault, RL.MATERIAL_MAP_DIFFUSE, RL.BLUE )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
RL_UpdateCamera3D( camera )
|
||||
function RL.process( delta )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
-- Update the light shader with the camera view position
|
||||
local loc = RL_GetShaderLocationIndex( shader, SHADER_LOC_VECTOR_VIEW )
|
||||
RL_SetShaderValue( shader, loc, RL_GetCamera3DPosition( camera ), SHADER_UNIFORM_VEC3 )
|
||||
local loc = RL.GetShaderLocationIndex( shader, RL.SHADER_LOC_VECTOR_VIEW )
|
||||
RL.SetShaderValue( shader, loc, RL.GetCamera3DPosition( camera ), RL.SHADER_UNIFORM_VEC3 )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( DARKBLUE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.DARKBLUE )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL.BeginMode3D( camera )
|
||||
-- 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),
|
||||
-- transforms[] for the instances should be provided, they are dynamically
|
||||
-- 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)
|
||||
RL_DrawMesh( cube, matDefault, RL_MatrixTranslate( { 10.0, 0.0, 0.0 } ) )
|
||||
RL_EndMode3D()
|
||||
RL.DrawMesh( cube, matDefault, RL.MatrixTranslate( { 10.0, 0.0, 0.0 } ) )
|
||||
RL.EndMode3D()
|
||||
|
||||
RL_DrawFPS( { 10, 10 } )
|
||||
RL.DrawFPS( { 10, 10 } )
|
||||
end
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
local monitor = 0
|
||||
local camera = -1
|
||||
local texture = -1
|
||||
local material = -1
|
||||
local model = -1
|
||||
local animations = -1
|
||||
@@ -12,41 +11,41 @@ local curAnim = 0
|
||||
local frameCount = 0
|
||||
local animSpeed = 60
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_FREE )
|
||||
|
||||
material = RL_CreateMaterial( {
|
||||
material = RL.CreateMaterial( {
|
||||
maps = {
|
||||
{
|
||||
MATERIAL_MAP_ALBEDO,
|
||||
RL.MATERIAL_MAP_ALBEDO,
|
||||
{
|
||||
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/monkey_tex.png" ),
|
||||
color = WHITE,
|
||||
texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/monkey_tex.png" ),
|
||||
color = RL.WHITE,
|
||||
},
|
||||
},
|
||||
},
|
||||
} )
|
||||
|
||||
model = RL_LoadModel( RL_GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
RL_SetModelMaterial( model, 0, material )
|
||||
animations, animationCount = RL_LoadModelAnimations( RL_GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
|
||||
model = RL.LoadModel( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
RL.SetModelMaterial( model, 0, material )
|
||||
animations, animationCount = RL.LoadModelAnimations( RL.GetBasePath().."../resources/iqm/monkey.iqm" )
|
||||
|
||||
print( "animationCount", animationCount )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsKeyPressed( KEY_ENTER ) then
|
||||
function RL.process( delta )
|
||||
if RL.IsKeyPressed( RL.KEY_ENTER ) then
|
||||
curAnim = curAnim + 1
|
||||
|
||||
if animationCount <= curAnim then
|
||||
@@ -54,15 +53,15 @@ function process( delta )
|
||||
end
|
||||
|
||||
frame = 0.0
|
||||
frameCount = RL_GetModelAnimationFrameCount( animations, curAnim )
|
||||
elseif RL_IsKeyPressed( KEY_UP ) then
|
||||
frameCount = RL.GetModelAnimationFrameCount( animations, curAnim )
|
||||
elseif RL.IsKeyPressed( RL.KEY_UP ) then
|
||||
animSpeed = animSpeed + 5
|
||||
elseif RL_IsKeyPressed( KEY_DOWN ) then
|
||||
elseif RL.IsKeyPressed( RL.KEY_DOWN ) then
|
||||
animSpeed = animSpeed - 5
|
||||
end
|
||||
|
||||
if RL_IsKeyDown( KEY_SPACE ) then
|
||||
RL_UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) )
|
||||
if RL.IsKeyDown( RL.KEY_SPACE ) then
|
||||
RL.UpdateModelAnimation( model, animations, curAnim, math.floor( frame ) )
|
||||
frame = frame + animSpeed * delta
|
||||
|
||||
if frameCount < frame then
|
||||
@@ -73,19 +72,19 @@ function process( delta )
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_UpdateCamera3D( camera )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
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_EndMode3D()
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
RL_DrawText( 0,
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawGrid( 8, 1 )
|
||||
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.DrawText( 0,
|
||||
"Enter: Change animation\
|
||||
Space: Play animation\
|
||||
Up arrow: Inreace animation speed\
|
||||
Down arrow: Decreace animation speed",
|
||||
{ 10, 10 }, 30, 5, WHITE )
|
||||
{ 10, 10 }, 30, 5, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -10,20 +10,20 @@ local shader = -1
|
||||
|
||||
local matrix = {}
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_FREE )
|
||||
|
||||
local ts = PLANE_SIZE
|
||||
local meshData = {
|
||||
@@ -33,61 +33,61 @@ function init()
|
||||
{ 0, 0 }, { ts, ts }, { ts, 0 } },
|
||||
texcoords2 = { { 0, 0 }, { 0, 1 }, { 1, 1 },
|
||||
{ 0, 0 }, { 1, 1 }, { 1, 0 } },
|
||||
colors = { WHITE, WHITE, WHITE,
|
||||
WHITE, WHITE, WHITE },
|
||||
colors = { RL.WHITE, RL.WHITE, RL.WHITE,
|
||||
RL.WHITE, RL.WHITE, RL.WHITE },
|
||||
normals = { { 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 = {
|
||||
-- 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 } },
|
||||
-- }
|
||||
-- RL_UpdateMesh( mesh, meshEdit )
|
||||
|
||||
tileTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
|
||||
RL_GenTextureMipmaps( tileTexture )
|
||||
RL_SetTextureFilter( tileTexture, TEXTURE_FILTER_TRILINEAR )
|
||||
lightmap = RL_LoadTexture( RL_GetBasePath().."../resources/images/lightmap.png" )
|
||||
RL_GenTextureMipmaps( lightmap )
|
||||
RL_SetTextureFilter( lightmap, TEXTURE_FILTER_TRILINEAR )
|
||||
RL_SetTextureWrap( lightmap, TEXTURE_WRAP_CLAMP )
|
||||
-- RL.UpdateMesh( mesh, meshEdit )
|
||||
|
||||
shader = RL_LoadShader( RL_GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
|
||||
RL_GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
|
||||
tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tile.png" )
|
||||
RL.GenTextureMipmaps( tileTexture )
|
||||
RL.SetTextureFilter( tileTexture, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
lightmap = RL.LoadTexture( RL.GetBasePath().."../resources/images/lightmap.png" )
|
||||
RL.GenTextureMipmaps( lightmap )
|
||||
RL.SetTextureFilter( lightmap, RL.TEXTURE_FILTER_TRILINEAR )
|
||||
RL.SetTextureWrap( lightmap, RL.TEXTURE_WRAP_CLAMP )
|
||||
|
||||
shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
|
||||
RL.GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
|
||||
|
||||
local materialData = {
|
||||
shader = shader,
|
||||
maps = {
|
||||
{
|
||||
MATERIAL_MAP_ALBEDO,
|
||||
RL.MATERIAL_MAP_ALBEDO,
|
||||
{
|
||||
texture = tileTexture,
|
||||
color = WHITE,
|
||||
color = RL.WHITE,
|
||||
value = 1.0,
|
||||
},
|
||||
},
|
||||
{
|
||||
MATERIAL_MAP_METALNESS,
|
||||
RL.MATERIAL_MAP_METALNESS,
|
||||
{
|
||||
texture = lightmap,
|
||||
color = WHITE,
|
||||
color = RL.WHITE,
|
||||
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
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 25, 50, 50 } )
|
||||
RL_UpdateCamera3D( camera )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 25, 50, 50 } )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL_DrawMesh( mesh, material, matrix )
|
||||
RL_EndMode3D()
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawMesh( mesh, material, matrix )
|
||||
RL.EndMode3D()
|
||||
end
|
||||
|
||||
@@ -2,24 +2,24 @@ local dstRec = { 160.0, 160.0, 8.0, 8.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 = { 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()
|
||||
RL_SetWindowTitle( "N-Patches" )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
function RL.init()
|
||||
RL.SetWindowTitle( "N-Patches" )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
local mousePosition = RL_GetMousePosition();
|
||||
function RL.process( delta )
|
||||
local mousePosition = RL.GetMousePosition();
|
||||
|
||||
-- Resize the n-patch based on mouse position
|
||||
dstRec[3] = mousePosition[1] - dstRec[1];
|
||||
dstRec[4] = mousePosition[2] - dstRec[2];
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
RL_DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, WHITE )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
RL.DrawTextureNPatch( nPatchTexture, ninePatchInfo, dstRec, origin, 0.0, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -1,57 +1,56 @@
|
||||
local tex = -1
|
||||
local pos = { 32, 32 }
|
||||
local speed = 60.0
|
||||
local sound = -1
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local framebuffer = -1
|
||||
local res = { 320, 180 }
|
||||
local scale = 5
|
||||
local winSize = { res[1] * scale, res[2] * scale }
|
||||
|
||||
function init()
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowSize( winSize )
|
||||
tex = RL_LoadTexture( RL_GetBasePath().."../resources/images/cat.png" )
|
||||
function RL.init()
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
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.SetWindowSize( winSize )
|
||||
tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
|
||||
-- Create framebuffer.
|
||||
framebuffer = RL_LoadRenderTexture( res )
|
||||
framebuffer = RL.LoadRenderTexture( res )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsKeyDown( KEY_RIGHT ) then
|
||||
function RL.process( delta )
|
||||
if RL.IsKeyDown( RL.KEY_RIGHT ) then
|
||||
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
|
||||
end
|
||||
|
||||
if RL_IsKeyDown( KEY_UP ) then
|
||||
if RL.IsKeyDown( RL.KEY_UP ) then
|
||||
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
|
||||
end
|
||||
|
||||
if RL_IsWindowResized() then
|
||||
winSize = RL_GetScreenSize()
|
||||
if RL.IsWindowResized() then
|
||||
winSize = RL.GetScreenSize()
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 0, 0, 0 } )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 0, 0, 0 } )
|
||||
|
||||
RL_BeginTextureMode( framebuffer )
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_DrawPixel( { 100, 100 }, { 255, 50, 100 } )
|
||||
RL_DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 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_DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } )
|
||||
RL_DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RED )
|
||||
RL_EndTextureMode()
|
||||
RL.BeginTextureMode( framebuffer )
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.DrawPixel( { 100, 100 }, { 255, 50, 100 } )
|
||||
RL.DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 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, RL.WHITE )
|
||||
RL.DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } )
|
||||
RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED )
|
||||
RL.EndTextureMode()
|
||||
|
||||
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, { 255, 255, 255 } )
|
||||
RL_SetTextureSource( TEXTURE_SOURCE_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.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
||||
end
|
||||
|
||||
@@ -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" )
|
||||
|
||||
-- print( "RL", RL, #RL )
|
||||
|
||||
-- for i, v in pairs( RL ) do
|
||||
-- print( i, v )
|
||||
-- end
|
||||
|
||||
local TILE_SIZE = 16
|
||||
local PLAYER_MAXSPEED = 1.5
|
||||
local PLAYER_ACCELL = 5
|
||||
@@ -11,11 +17,11 @@ local GRAVITY = 6
|
||||
local JUMP_STR = 3
|
||||
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 winScale = 5
|
||||
local winSize = res:scale( winScale )
|
||||
local framebuffer = RL_LoadRenderTexture( res )
|
||||
local framebuffer = RL.LoadRenderTexture( res )
|
||||
local monitor = 0
|
||||
local tilemap = {
|
||||
size = Vec2:new( res.x / TILE_SIZE, res.y / TILE_SIZE ),
|
||||
@@ -80,21 +86,21 @@ local function createMap()
|
||||
tilemap.tiles[1][8] = 6
|
||||
end
|
||||
|
||||
function init()
|
||||
local monitorPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
|
||||
local monitorSize = Vec2:new( RL_GetMonitorSize( monitor ) )
|
||||
function RL.init()
|
||||
local monitorPos = Vec2:new( RL.GetMonitorPosition( monitor ) )
|
||||
local monitorSize = Vec2:new( RL.GetMonitorSize( monitor ) )
|
||||
|
||||
RL_SetWindowTitle( "Platformer" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } )
|
||||
RL.SetWindowTitle( "Platformer" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { monitorPos.x + monitorSize.x / 2 - winSize.x / 2, monitorPos.y + monitorSize.y / 2 - winSize.y / 2 } )
|
||||
|
||||
createMap()
|
||||
end
|
||||
|
||||
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 ]
|
||||
else
|
||||
return false
|
||||
@@ -103,7 +109,7 @@ end
|
||||
|
||||
local function tileCollision( entity )
|
||||
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.
|
||||
|
||||
-- Move test rect to predicted position.
|
||||
@@ -172,14 +178,14 @@ end
|
||||
local function playerMovement( delta )
|
||||
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
|
||||
moving[1] = true
|
||||
|
||||
if 0 < player.vel.x then
|
||||
player.facing = 1
|
||||
end
|
||||
elseif RL_IsKeyDown( KEY_LEFT ) then
|
||||
elseif RL.IsKeyDown( RL.KEY_LEFT ) then
|
||||
player.vel.x = player.vel.x - PLAYER_ACCELL * delta
|
||||
moving[1] = true
|
||||
|
||||
@@ -188,7 +194,7 @@ local function playerMovement( delta )
|
||||
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.onFloor = false
|
||||
end
|
||||
@@ -205,7 +211,7 @@ local function playerMovement( delta )
|
||||
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
|
||||
|
||||
@@ -220,16 +226,16 @@ local function playerMovement( delta )
|
||||
player.colRect[2] = player.pos.y - player.colRect[4]
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsWindowResized() then
|
||||
winSize:set( RL_GetScreenSize() )
|
||||
function RL.process( delta )
|
||||
if RL.IsWindowResized() then
|
||||
winSize:set( RL.GetScreenSize() )
|
||||
end
|
||||
|
||||
playerMovement( delta )
|
||||
end
|
||||
|
||||
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 y = 1, tilemap.size.y do
|
||||
@@ -237,7 +243,7 @@ local function drawMap()
|
||||
local pos = Vec2:new( x - 1, y - 1 )
|
||||
|
||||
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
|
||||
@@ -250,7 +256,7 @@ local function drawPlayer()
|
||||
if math.abs( player.vel.x ) < 0.1 then
|
||||
player.curFrame = 1
|
||||
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 )
|
||||
|
||||
if #player.walkAnimFrames < frame then
|
||||
@@ -270,7 +276,7 @@ local function drawPlayer()
|
||||
|
||||
-- Draw rect.
|
||||
|
||||
local src = util.tableClone( player.frames[ player.curFrame ] )
|
||||
local src = Util.tableClone( player.frames[ player.curFrame ] )
|
||||
local dst = {
|
||||
player.pos.x - src[3] / 2,
|
||||
player.pos.y - src[4],
|
||||
@@ -282,19 +288,19 @@ local function drawPlayer()
|
||||
src[3] = -src[3]
|
||||
end
|
||||
|
||||
RL_DrawTexturePro( tex, src, dst, { 0, 0 }, 0.0, WHITE )
|
||||
RL.DrawTexturePro( tex, src, dst, { 0, 0 }, 0.0, RL.WHITE )
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RED )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RED )
|
||||
|
||||
RL_SetTextureSource( TEXTURE_SOURCE_TEXTURE )
|
||||
RL_BeginTextureMode( framebuffer )
|
||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
||||
RL.BeginTextureMode( framebuffer )
|
||||
drawMap()
|
||||
drawPlayer()
|
||||
RL_EndTextureMode()
|
||||
RL.EndTextureMode()
|
||||
|
||||
RL_SetTextureSource( 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_SetTextureSource( TEXTURE_SOURCE_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, RL.WHITE )
|
||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
||||
end
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package.path = package.path..";"..RL_GetBasePath().."../resources/lib/?.lua"
|
||||
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||
|
||||
util = require "utillib"
|
||||
Vec2 = require "vector2"
|
||||
@@ -8,7 +8,6 @@ local MOVE_SPEED = 0.5
|
||||
|
||||
local monitor = 0
|
||||
local camera = -1
|
||||
local texture = -1
|
||||
local tri = {
|
||||
a = Vec3:new( 0, 0, 0 ),
|
||||
-- a = Vec3:new( 0, 1, 0 ),
|
||||
@@ -26,27 +25,25 @@ local point = {
|
||||
local debugText = ""
|
||||
|
||||
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
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = { 1920, 1080 }
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowSize( winSize )
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 0, 1, 2 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
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.SetWindowSize( winSize )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 0, 1, 2 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_FREE )
|
||||
|
||||
calcNormal( tri )
|
||||
|
||||
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
debugText = ""
|
||||
|
||||
if RL_IsKeyDown( string.byte( "D" ) ) then
|
||||
if RL.IsKeyDown( string.byte( "D" ) ) then
|
||||
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
|
||||
end
|
||||
if RL_IsKeyDown( string.byte( "S" ) ) then
|
||||
if RL.IsKeyDown( string.byte( "S" ) ) then
|
||||
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
|
||||
end
|
||||
if RL_IsKeyDown( string.byte( "R" ) ) then
|
||||
if RL.IsKeyDown( string.byte( "R" ) ) then
|
||||
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
|
||||
end
|
||||
|
||||
if checkCollisionPointTriangle( point.pos, tri.a, tri.b, tri.c, tri.normal ) then
|
||||
point.color = RED
|
||||
point.color = RL.RED
|
||||
else
|
||||
point.color = GREEN
|
||||
point.color = RL.GREEN
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_UpdateCamera3D( camera )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL_DrawGrid( 8, 1 )
|
||||
RL_DrawTriangle3D( tri.a, tri.b, tri.c, { 200, 100, 100 } )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
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 )
|
||||
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 )
|
||||
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 )
|
||||
RL_DrawSphereWires( point.pos, point.radius, 3, 8, point.color )
|
||||
RL_EndMode3D()
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawGrid( 8, 1 )
|
||||
RL.DrawTriangle3D( tri.a, tri.b, tri.c, { 200, 100, 100 } )
|
||||
|
||||
RL_DrawText( 0, debugText, { 10, 10 }, 30, 4, WHITE )
|
||||
RL.DrawLine3D( { point.pos.x - point.lineLen, point.pos.y, point.pos.z },
|
||||
{ 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 },
|
||||
{ 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 },
|
||||
{ point.pos.x, point.pos.y, point.pos.z + point.lineLen }, RL.BLUE )
|
||||
RL.DrawSphereWires( point.pos, point.radius, 3, 8, point.color )
|
||||
RL.EndMode3D()
|
||||
|
||||
RL.DrawText( 0, debugText, { 10, 10 }, 30, 4, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -27,7 +27,7 @@ local function reset()
|
||||
-- Initialize player positions.
|
||||
playerLeft.pos[1] = playerLeft.size[1]
|
||||
playerLeft.pos[2] = winSize[2] / 2 - playerLeft.size[2] / 2
|
||||
|
||||
|
||||
playerRight.pos[1] = winSize[1] - playerRight.size[1] * 2
|
||||
playerRight.pos[2] = winSize[2] / 2 - playerRight.size[2] / 2
|
||||
|
||||
@@ -48,33 +48,33 @@ local function ballHit( padPos, padSize )
|
||||
ball.vel[2] = BALL_SPEED * relHitPos / padSize[2] * 2
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
-- Set window to center of monitor.
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowTitle( "Pong" )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "Pong" )
|
||||
|
||||
-- Initialize ball pos.
|
||||
math.randomseed( os.time() )
|
||||
reset()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
-- 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
|
||||
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
|
||||
end
|
||||
|
||||
-- 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
|
||||
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
|
||||
end
|
||||
|
||||
@@ -94,9 +94,9 @@ function process( delta )
|
||||
local playerRightRect = { playerRight.pos[1], playerRight.pos[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 )
|
||||
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 )
|
||||
end
|
||||
|
||||
@@ -110,18 +110,18 @@ function process( delta )
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( BLACK )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.BLACK )
|
||||
|
||||
-- Draw players.
|
||||
RL_DrawRectangle( { playerLeft.pos[1], playerLeft.pos[2], playerLeft.size[1], playerLeft.size[2] }, WHITE )
|
||||
RL_DrawRectangle( { playerRight.pos[1], playerRight.pos[2], playerRight.size[1], playerRight.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] }, RL.WHITE )
|
||||
|
||||
-- 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
|
||||
RL_DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, WHITE )
|
||||
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, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE )
|
||||
local rightTextSize = RL.MeasureText( 0, playerRight.score, 40, 2 )
|
||||
RL.DrawText( 0, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- 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"
|
||||
|
||||
@@ -54,33 +54,33 @@ local function ballHit( padPos, padSize )
|
||||
ball.vel.y = BALL_SPEED * relHitPos / padSize.y * 2
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
-- Set window to center of monitor.
|
||||
local mPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
|
||||
local mSize = Vec2:new( RL_GetMonitorSize( monitor ) )
|
||||
local mPos = Vec2:new( RL.GetMonitorPosition( monitor ) )
|
||||
local mSize = Vec2:new( RL.GetMonitorSize( monitor ) )
|
||||
|
||||
RL_SetConfigFlags( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } )
|
||||
RL_SetWindowTitle( "Pong" )
|
||||
RL.SetConfigFlags( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } )
|
||||
RL.SetWindowTitle( "Pong" )
|
||||
|
||||
-- Initialize ball pos.
|
||||
math.randomseed( os.time() )
|
||||
reset()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
-- 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
|
||||
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
|
||||
end
|
||||
|
||||
-- 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
|
||||
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
|
||||
end
|
||||
|
||||
@@ -99,9 +99,9 @@ function process( delta )
|
||||
local playerRightRect = { playerRight.pos.x, playerRight.pos.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 )
|
||||
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 )
|
||||
end
|
||||
|
||||
@@ -115,18 +115,18 @@ function process( delta )
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( BLACK )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.BLACK )
|
||||
|
||||
-- Draw players.
|
||||
RL_DrawRectangle( { playerLeft.pos.x, playerLeft.pos.y, playerLeft.size.x, playerLeft.size.y }, WHITE )
|
||||
RL_DrawRectangle( { playerRight.pos.x, playerRight.pos.y, playerRight.size.x, playerRight.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 }, RL.WHITE )
|
||||
|
||||
-- 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.
|
||||
RL_DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, WHITE )
|
||||
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, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE )
|
||||
local rightTextSize = Vec2:new( RL.MeasureText( 0, playerRight.score, 40, 2 ) )
|
||||
RL.DrawText( 0, playerRight.score, { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE )
|
||||
end
|
||||
|
||||
@@ -4,17 +4,17 @@ local ray = { { 0.5, 0, 4 }, { 0.1, 0, -1 } }
|
||||
|
||||
local function setupWindow()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
end
|
||||
|
||||
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
|
||||
print( "hit", rayCol.hit )
|
||||
@@ -24,35 +24,35 @@ function ray_collision()
|
||||
end
|
||||
end
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
setupWindow()
|
||||
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 0, 2, 4 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetCameraMode( camera, RL.CAMERA_FREE )
|
||||
|
||||
sphereMesh = RL_GenMeshSphere( 1.0, 8, 10 )
|
||||
sphereMesh = RL.GenMeshSphere( 1.0, 8, 10 )
|
||||
|
||||
ray_collision()
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsMouseButtonPressed( 0 ) then
|
||||
ray = RL_GetMouseRay( RL_GetMousePosition(), camera )
|
||||
function RL.process( delta )
|
||||
if RL.IsMouseButtonPressed( 0 ) then
|
||||
ray = RL.GetMouseRay( RL.GetMousePosition(), camera )
|
||||
ray_collision()
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( { 100, 150, 100 } )
|
||||
RL_UpdateCamera3D( camera )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL_DrawGrid( 8, 1 )
|
||||
RL_DrawRay( ray, { 255, 100, 100 } )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( { 100, 150, 100 } )
|
||||
RL.UpdateCamera3D( camera )
|
||||
|
||||
RL_DrawMesh( sphereMesh, 0, RL_MatrixIdentity() )
|
||||
RL_EndMode3D()
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawGrid( 8, 1 )
|
||||
RL.DrawRay( ray, { 255, 100, 100 } )
|
||||
|
||||
RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() )
|
||||
RL.EndMode3D()
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ Color = require( "color" )
|
||||
To
|
||||
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 = {
|
||||
@@ -39,7 +39,7 @@ Gui = {
|
||||
RECTANGLE_ROUNDED_LINES = 8,
|
||||
},
|
||||
|
||||
mouseButton = MOUSE_BUTTON_LEFT,
|
||||
mouseButton = RL.MOUSE_BUTTON_LEFT,
|
||||
font = 0,
|
||||
fontSize = 20,
|
||||
padding = 2,
|
||||
@@ -114,12 +114,12 @@ function Gui.set2Back( cell )
|
||||
end
|
||||
|
||||
function Gui.process( mousePosition )
|
||||
local mouseWheel = RL_GetMouseWheelMove()
|
||||
local mouseWheel = RL.GetMouseWheelMove()
|
||||
|
||||
Gui._mousePos = mousePosition
|
||||
|
||||
if Gui.heldCallback ~= nil then
|
||||
if RL_IsMouseButtonDown( Gui.mouseButton ) then
|
||||
if RL.IsMouseButtonDown( Gui.mouseButton ) then
|
||||
Gui.heldCallback()
|
||||
else
|
||||
Gui.heldCallback = nil
|
||||
@@ -129,7 +129,7 @@ function Gui.process( mousePosition )
|
||||
end
|
||||
|
||||
local foundFirst = false
|
||||
|
||||
|
||||
-- Go backwards on process check so we trigger the top most ui first and stop there.
|
||||
for i = #Gui._cells, 1, -1 do
|
||||
local cell = Gui._cells[i]
|
||||
@@ -137,11 +137,11 @@ function Gui.process( mousePosition )
|
||||
if cell ~= nil then
|
||||
if not foundFirst and cell.isMouseOver ~= nil and cell:isMouseOver( mousePosition ) and not cell.disabled then
|
||||
-- On clicked.
|
||||
if RL_IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then
|
||||
if RL.IsMouseButtonPressed( Gui.mouseButton ) and cell.onClicked ~= nil then
|
||||
cell:onClicked()
|
||||
end
|
||||
-- On held.
|
||||
if RL_IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then
|
||||
if RL.IsMouseButtonDown( Gui.mouseButton ) and cell.onHeld ~= nil then
|
||||
cell:onHeld()
|
||||
end
|
||||
-- Mouse wheel scrolling.
|
||||
@@ -149,19 +149,19 @@ function Gui.process( mousePosition )
|
||||
if cell._parent ~= nil and cell._parent.scrollable then
|
||||
cell = cell._parent
|
||||
end
|
||||
|
||||
|
||||
if cell.scrollable then
|
||||
local pos = Vec2:new( cell._scrollRect.x, cell._scrollRect.y )
|
||||
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 )
|
||||
end
|
||||
|
||||
|
||||
cell:scroll( pos - scrollVec )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
foundFirst = true
|
||||
elseif cell.notMouseOver ~= nil then
|
||||
cell:notMouseOver()
|
||||
@@ -172,7 +172,7 @@ function Gui.process( mousePosition )
|
||||
-- Text input.
|
||||
if Gui._inputItem ~= nil then
|
||||
repeat
|
||||
local char = RL_GetCharPressed()
|
||||
local char = RL.GetCharPressed()
|
||||
|
||||
if 0 < char then
|
||||
if utf8.len( Gui._inputItem.text ) < Gui._inputItem.maxTextLen then
|
||||
@@ -183,24 +183,24 @@ function Gui.process( mousePosition )
|
||||
until char == 0
|
||||
|
||||
repeat
|
||||
local key = RL_GetKeyPressed()
|
||||
local key = RL.GetKeyPressed()
|
||||
|
||||
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 )
|
||||
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
|
||||
Gui._inputItem.text = Gui._inputItem.text.."\n"
|
||||
else
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
elseif key == KEY_ESCAPE then
|
||||
elseif key == RL.KEY_ESCAPE then
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
end
|
||||
until key == 0
|
||||
|
||||
if readyToUnfocusInput and RL_IsMouseButtonPressed( Gui.mouseButton ) then
|
||||
if readyToUnfocusInput and RL.IsMouseButtonPressed( Gui.mouseButton ) then
|
||||
Gui.inputUnfocus()
|
||||
end
|
||||
|
||||
@@ -234,7 +234,7 @@ function Text:new( set )
|
||||
object.text = setProperty( set, "text", "" )
|
||||
object.fontSize = setProperty( set, "fontSize", Gui.fontSize )
|
||||
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.allowLineBreak = setProperty( set, "allowLineBreak", false )
|
||||
|
||||
@@ -253,7 +253,7 @@ function Text:set( text )
|
||||
self.text = text
|
||||
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.height = textSize.y
|
||||
@@ -264,7 +264,7 @@ function Text:draw()
|
||||
return
|
||||
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
|
||||
|
||||
-- Texture.
|
||||
@@ -283,7 +283,7 @@ function Texture:new( set )
|
||||
object.source = setProperty( set, "source", Rect:new( 0, 0, 0, 0 ) )
|
||||
object.origin = setProperty( set, "origin", Vec2:new( 0, 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.visible = setProperty( set, "visible", true )
|
||||
@@ -299,7 +299,7 @@ function Texture:set( texture )
|
||||
return
|
||||
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
|
||||
self.bounds.width = texSize.x
|
||||
@@ -326,9 +326,9 @@ function Texture:draw()
|
||||
}
|
||||
|
||||
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
|
||||
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
|
||||
|
||||
@@ -359,7 +359,7 @@ function Shape:new( set )
|
||||
object.roundness = setProperty( set, "roundness", 1 )
|
||||
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._parent = nil
|
||||
@@ -392,23 +392,23 @@ function Shape:draw()
|
||||
local pos = Vec2:new( self._parent.bounds.x, self._parent.bounds.y )
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
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
|
||||
|
||||
@@ -428,10 +428,10 @@ function Element:new( set )
|
||||
object.visible = setProperty( set, "visible", true )
|
||||
object.disabled = setProperty( set, "disabled", 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._visibilityBounds = nil
|
||||
-- Callbacks.
|
||||
object.onMouseOver = setProperty( set, "onMouseOver", nil )
|
||||
@@ -481,10 +481,10 @@ function Element:add( item )
|
||||
end
|
||||
|
||||
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
|
||||
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
end
|
||||
|
||||
if over and self.onMouseOver ~= nil then
|
||||
@@ -498,7 +498,7 @@ function Element:draw()
|
||||
local usedScissor = false
|
||||
|
||||
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.
|
||||
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 )
|
||||
or math.floor( rect.height ) ~= math.floor( self.bounds.height ) then
|
||||
usedScissor = true
|
||||
RL_BeginScissorMode( self._visibilityBounds )
|
||||
RL.BeginScissorMode( self._visibilityBounds )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
if self.drawBounds then
|
||||
RL_DrawRectangle( self.bounds, self.color )
|
||||
RL.DrawRectangle( self.bounds, self.color )
|
||||
end
|
||||
|
||||
for _, item in ipairs( self.items ) do
|
||||
@@ -519,7 +519,7 @@ function Element:draw()
|
||||
end
|
||||
|
||||
if usedScissor then
|
||||
RL_EndScissorMode()
|
||||
RL.EndScissorMode()
|
||||
end
|
||||
|
||||
end
|
||||
@@ -557,15 +557,15 @@ function Container:new( set )
|
||||
object.showScrollbar = setProperty( set, "showScrollbar", false )
|
||||
object.scrollbarWidth = setProperty( set, "scrollbarWidth", Gui.scrollbarWidth )
|
||||
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.drawScrollRect = setProperty( set, "drawScrollRect", false )
|
||||
-- For grid container. Do not set both.
|
||||
object.columns = setProperty( set, "columns", nil )
|
||||
object.rows = setProperty( set, "rows", nil )
|
||||
|
||||
|
||||
object.cells = {}
|
||||
|
||||
|
||||
object._visibilityBounds = nil -- Will give this to it's children.
|
||||
object._scrollRect = Rect:new( 0, 0, 0, 0 )
|
||||
object._VScrollbarRect = Rect:new( 0, 0, 0, 0 )
|
||||
@@ -638,10 +638,10 @@ function Container:mouseScroll( v )
|
||||
end
|
||||
|
||||
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
|
||||
over = RL_CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
over = RL.CheckCollisionPointRec( mousePosition, self._visibilityBounds )
|
||||
end
|
||||
|
||||
if over and self.onMouseOver ~= nil then
|
||||
@@ -668,7 +668,7 @@ function Container:updateScrollbar()
|
||||
self._VScrollbar.visible = false
|
||||
self._VScrollbar.disabled = true
|
||||
end
|
||||
|
||||
|
||||
if self.bounds.width < self._scrollRect.width then
|
||||
self._HScrollbar.bounds.width = self.bounds.width
|
||||
self._HScrollbar.bounds.height = self.scrollbarWidth
|
||||
@@ -701,7 +701,7 @@ function Container:update()
|
||||
self._VScrollbar = Element:new( {
|
||||
padding = 0,
|
||||
drawBounds = true,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 0, 1 ) ) end end,
|
||||
} )
|
||||
|
||||
@@ -710,7 +710,7 @@ function Container:update()
|
||||
VAling = Gui.ALING.NONE,
|
||||
bounds = Rect:new( 0, 0, 0, 0 ),
|
||||
shape = Gui.SHAPE.RECTANGLE_ROUNDED,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
end
|
||||
|
||||
@@ -718,7 +718,7 @@ function Container:update()
|
||||
self._HScrollbar = Element:new( {
|
||||
padding = 0,
|
||||
drawBounds = true,
|
||||
color = Color:new( GRAY ),
|
||||
color = Color:new( RL.GRAY ),
|
||||
onClicked = function() Gui.heldCallback = function() self:mouseScroll( Vec2:new( 1, 0 ) ) end end,
|
||||
} )
|
||||
|
||||
@@ -727,7 +727,7 @@ function Container:update()
|
||||
VAling = Gui.ALING.CENTER,
|
||||
bounds = Rect:new( 0, 0, 0, 0 ),
|
||||
shape = Gui.SHAPE.RECTANGLE_ROUNDED,
|
||||
color = Color:new( LIGHTGRAY ),
|
||||
color = Color:new( RL.LIGHTGRAY ),
|
||||
} ) )
|
||||
end
|
||||
end
|
||||
@@ -748,7 +748,7 @@ function Container:update()
|
||||
elseif self.HAling == Gui.ALING.RIGHT then
|
||||
pos.x = self.bounds.x + self.bounds.width - cell.bounds.width - self.spacing
|
||||
end
|
||||
|
||||
|
||||
cell.bounds.x = pos.x - self._scrollRect.x
|
||||
cell.bounds.y = pos.y - self._scrollRect.y
|
||||
|
||||
@@ -811,7 +811,7 @@ function Container:delete()
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:delete()
|
||||
end
|
||||
|
||||
|
||||
if self._VScrollbar ~= nil then
|
||||
Gui.delete( self._VScrollbar )
|
||||
end
|
||||
@@ -828,7 +828,7 @@ function Container:set2Top()
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:set2Top()
|
||||
end
|
||||
|
||||
|
||||
if self._VScrollbar ~= nil then
|
||||
Gui.set2Top( self._VScrollbar )
|
||||
end
|
||||
@@ -844,27 +844,27 @@ function Container:set2Back()
|
||||
if self._HScrollbar ~= nil then
|
||||
Gui.set2Back( self._HScrollbar )
|
||||
end
|
||||
|
||||
|
||||
for _, cell in ipairs( self.cells ) do
|
||||
cell:set2Back()
|
||||
end
|
||||
|
||||
|
||||
Gui.set2Back( self )
|
||||
end
|
||||
|
||||
function Container:draw()
|
||||
if self.drawBounds then
|
||||
RL_DrawRectangle( self.bounds, self.color )
|
||||
RL.DrawRectangle( self.bounds, self.color )
|
||||
end
|
||||
|
||||
if self.drawScrollRect then
|
||||
RL_DrawRectangleLines( {
|
||||
RL.DrawRectangleLines( {
|
||||
self.bounds.x - self._scrollRect.x,
|
||||
self.bounds.y - self._scrollRect.y,
|
||||
self._scrollRect.width,
|
||||
self._scrollRect.height,
|
||||
},
|
||||
RED )
|
||||
RL.RED )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function utillib.deepCopy( orig )
|
||||
for origKey, origValue in next, orig, nil do
|
||||
-- If object has clone method, use that.
|
||||
if type( origValue ) == "table" and type( origValue.clone ) == "function" then
|
||||
copy[ utillib.deepCopy( origKey ) ] = orig_value:clone()
|
||||
copy[ utillib.deepCopy( origKey ) ] = origValue:clone()
|
||||
else
|
||||
copy[ utillib.deepCopy( origKey ) ] = utillib.deepCopy( origValue )
|
||||
end
|
||||
@@ -128,9 +128,9 @@ end
|
||||
|
||||
function utillib.wrapAngleRad( angle )
|
||||
if angle < 0 then
|
||||
return math.fmod( angle, PI * 2 ) + PI * 2
|
||||
return math.fmod( angle, RL.PI * 2 ) + RL.PI * 2
|
||||
else
|
||||
return math.fmod( angle, PI * 2 )
|
||||
return math.fmod( angle, RL.PI * 2 )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ Vector2.meta = {
|
||||
return len
|
||||
end,
|
||||
__eq = function( v1, v2 )
|
||||
return RL_Vector2Equals( v1, v2 ) == 1
|
||||
return RL.Vector2Equals( v1, v2 ) == 1
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -91,79 +91,79 @@ function Vector2:max( v2 )
|
||||
end
|
||||
|
||||
function Vector2:addValue( value )
|
||||
return Vector2:new( RL_Vector2AddValue( self, value ) )
|
||||
return Vector2:new( RL.Vector2AddValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector2:subValue( value )
|
||||
return Vector2:new( RL_Vector2SubtractValue( self, value ) )
|
||||
return Vector2:new( RL.Vector2SubtractValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector2:length()
|
||||
return RL_Vector2Length( self )
|
||||
return RL.Vector2Length( self )
|
||||
end
|
||||
|
||||
function Vector2:lengthSqr()
|
||||
return RL_Vector2LengthSqr( self )
|
||||
return RL.Vector2LengthSqr( self )
|
||||
end
|
||||
|
||||
function Vector2:dot( v2 )
|
||||
return RL_Vector2DotProduct( self, v2 )
|
||||
return RL.Vector2DotProduct( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:distance( v2 )
|
||||
return RL_Vector2Distance( self, v2 )
|
||||
return RL.Vector2Distance( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:distanceSqr( v2 )
|
||||
return RL_Vector2DistanceSqr( self, v2 )
|
||||
return RL.Vector2DistanceSqr( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:angle( v2 )
|
||||
return RL_Vector2Angle( self, v2 )
|
||||
return RL.Vector2Angle( self, v2 )
|
||||
end
|
||||
|
||||
function Vector2:scale( scale )
|
||||
return Vector2:new( RL_Vector2Scale( self, scale ) )
|
||||
return Vector2:new( RL.Vector2Scale( self, scale ) )
|
||||
end
|
||||
|
||||
function Vector2:normalize()
|
||||
return Vector2:new( RL_Vector2Normalize( self ) )
|
||||
return Vector2:new( RL.Vector2Normalize( self ) )
|
||||
end
|
||||
|
||||
function Vector2:transform( mat )
|
||||
return Vector2:new( RL_Vector2Transform( self, mat ) )
|
||||
return Vector2:new( RL.Vector2Transform( self, mat ) )
|
||||
end
|
||||
|
||||
function Vector2:lerp( v2, value )
|
||||
return Vector2:new( RL_Vector2Lerp( self, v2, value ) )
|
||||
return Vector2:new( RL.Vector2Lerp( self, v2, value ) )
|
||||
end
|
||||
|
||||
function Vector2:reflect( normal )
|
||||
return Vector2:new( RL_Vector2Reflect( self, normal ) )
|
||||
return Vector2:new( RL.Vector2Reflect( self, normal ) )
|
||||
end
|
||||
|
||||
function Vector2:rotate( angle )
|
||||
return Vector2:new( RL_Vector2Rotate( self, angle ) )
|
||||
return Vector2:new( RL.Vector2Rotate( self, angle ) )
|
||||
end
|
||||
|
||||
function Vector2:moveTowards( target, maxDistance )
|
||||
return Vector2:new( RL_Vector2MoveTowards( self, target, maxDistance ) )
|
||||
return Vector2:new( RL.Vector2MoveTowards( self, target, maxDistance ) )
|
||||
end
|
||||
|
||||
function Vector2:invert()
|
||||
return Vector2:new( RL_Vector2Invert( self ) )
|
||||
return Vector2:new( RL.Vector2Invert( self ) )
|
||||
end
|
||||
|
||||
function Vector2:clamp( min, max )
|
||||
return Vector2:new( RL_Vector2Clamp( self, min, max ) )
|
||||
return Vector2:new( RL.Vector2Clamp( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector2:clampValue( min, max )
|
||||
return Vector2:new( RL_Vector2ClampValue( self, min, max ) )
|
||||
return Vector2:new( RL.Vector2ClampValue( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector2:equals( v2 )
|
||||
return RL_Vector2Equals( self, v2 )
|
||||
return RL.Vector2Equals( self, v2 )
|
||||
end
|
||||
|
||||
return Vector2
|
||||
|
||||
@@ -38,7 +38,7 @@ Vector3.meta = {
|
||||
return len
|
||||
end,
|
||||
__eq = function( v1, v2 )
|
||||
return RL_Vector3Equals( v1, v2 ) == 1
|
||||
return RL.Vector3Equals( v1, v2 ) == 1
|
||||
end,
|
||||
}
|
||||
|
||||
@@ -85,104 +85,104 @@ function Vector3:abs()
|
||||
end
|
||||
|
||||
function Vector3:min( v2 )
|
||||
return Vector3:new( RL_Vector3Min( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3Min( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:max( v2 )
|
||||
return Vector3:new( RL_Vector3Max( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3Max( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:addValue( value )
|
||||
return Vector3:new( RL_Vector3AddValue( self, value ) )
|
||||
return Vector3:new( RL.Vector3AddValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector3:subValue( value )
|
||||
return Vector3:new( RL_Vector3SubtractValue( self, value ) )
|
||||
return Vector3:new( RL.Vector3SubtractValue( self, value ) )
|
||||
end
|
||||
|
||||
function Vector3:scale( scalar )
|
||||
return Vector3:new( RL_Vector3Scale( self, scalar ) )
|
||||
return Vector3:new( RL.Vector3Scale( self, scalar ) )
|
||||
end
|
||||
|
||||
function Vector3:cross( v2 )
|
||||
return Vector3:new( RL_Vector3CrossProduct( self, v2 ) )
|
||||
return Vector3:new( RL.Vector3CrossProduct( self, v2 ) )
|
||||
end
|
||||
|
||||
function Vector3:perpendicular()
|
||||
return Vector3:new( RL_Vector3Perpendicular( self ) )
|
||||
return Vector3:new( RL.Vector3Perpendicular( self ) )
|
||||
end
|
||||
|
||||
function Vector3:length()
|
||||
return RL_Vector3Length( self )
|
||||
return RL.Vector3Length( self )
|
||||
end
|
||||
|
||||
function Vector3:lengthSqr()
|
||||
return RL_Vector3LengthSqr( self )
|
||||
return RL.Vector3LengthSqr( self )
|
||||
end
|
||||
|
||||
function Vector3:dot( v2 )
|
||||
return RL_Vector3DotProduct( self, v2 )
|
||||
return RL.Vector3DotProduct( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:distance( v2 )
|
||||
return RL_Vector3Distance( self, v2 )
|
||||
return RL.Vector3Distance( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:distanceSqr( v2 )
|
||||
return RL_Vector3DistanceSqr( self, v2 )
|
||||
return RL.Vector3DistanceSqr( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:angle( v2 )
|
||||
return RL_Vector3Angle( self, v2 )
|
||||
return RL.Vector3Angle( self, v2 )
|
||||
end
|
||||
|
||||
function Vector3:negate()
|
||||
return Vector3:new( RL_Vector3Negate( self ) )
|
||||
return Vector3:new( RL.Vector3Negate( self ) )
|
||||
end
|
||||
|
||||
function Vector3:normalize()
|
||||
return Vector3:new( RL_Vector3Normalize( self ) )
|
||||
return Vector3:new( RL.Vector3Normalize( self ) )
|
||||
end
|
||||
|
||||
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] )
|
||||
end
|
||||
|
||||
function Vector3:transform( mat )
|
||||
return Vector3:new( RL_Vector3Transform( self, mat ) )
|
||||
return Vector3:new( RL.Vector3Transform( self, mat ) )
|
||||
end
|
||||
|
||||
function Vector3:rotateByQuaternion( q )
|
||||
return Vector3:new( RL_Vector3RotateByQuaternion( self, q ) )
|
||||
return Vector3:new( RL.Vector3RotateByQuaternion( self, q ) )
|
||||
end
|
||||
|
||||
function Vector3:rotateByAxisAngle( axis, angle )
|
||||
return Vector3:new( RL_Vector3RotateByAxisAngle( self, axis, angle ) )
|
||||
return Vector3:new( RL.Vector3RotateByAxisAngle( self, axis, angle ) )
|
||||
end
|
||||
|
||||
function Vector3:lerp( v2, value )
|
||||
return Vector3:new( RL_Vector3Lerp( self, v2, value ) )
|
||||
return Vector3:new( RL.Vector3Lerp( self, v2, value ) )
|
||||
end
|
||||
|
||||
function Vector3:reflect( normal )
|
||||
return Vector3:new( RL_Vector3Reflect( self, normal ) )
|
||||
return Vector3:new( RL.Vector3Reflect( self, normal ) )
|
||||
end
|
||||
|
||||
function Vector3:invert()
|
||||
return Vector3:new( RL_Vector3Invert( self ) )
|
||||
return Vector3:new( RL.Vector3Invert( self ) )
|
||||
end
|
||||
|
||||
function Vector3:clamp( min, max )
|
||||
return Vector3:new( RL_Vector3Clamp( self, min, max ) )
|
||||
return Vector3:new( RL.Vector3Clamp( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector3:clampValue( min, max )
|
||||
return Vector3:new( RL_Vector3ClampValue( self, min, max ) )
|
||||
return Vector3:new( RL.Vector3ClampValue( self, min, max ) )
|
||||
end
|
||||
|
||||
function Vector3:equals( v2 )
|
||||
return RL_Vector3Equals( self, v2 )
|
||||
return RL.Vector3Equals( self, v2 )
|
||||
end
|
||||
|
||||
return Vector3
|
||||
|
||||
@@ -8,27 +8,27 @@ local GLSL_VERSION = "330" -- PLATFORM_DESKTOP
|
||||
|
||||
local secondsLoc
|
||||
|
||||
function init()
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.init()
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
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" )
|
||||
textureSize = RL_GetTextureSize( texture )
|
||||
shader = RL_LoadShader( nil, RL_GetBasePath().."../resources/shaders/glsl"..GLSL_VERSION.."/wave.fs" )
|
||||
texture = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
|
||||
textureSize = RL.GetTextureSize( texture )
|
||||
shader = RL.LoadShader( nil, RL.GetBasePath().."../resources/shaders/glsl"..GLSL_VERSION.."/wave.fs" )
|
||||
|
||||
secondsLoc = RL_GetShaderLocation( shader, "secondes" )
|
||||
local sizeLoc = RL_GetShaderLocation( shader, "size" )
|
||||
local freqXLoc = RL_GetShaderLocation( shader, "freqX" )
|
||||
local freqYLoc = RL_GetShaderLocation( shader, "freqY" )
|
||||
local ampXLoc = RL_GetShaderLocation( shader, "ampX" )
|
||||
local ampYLoc = RL_GetShaderLocation( shader, "ampY" )
|
||||
local speedXLoc = RL_GetShaderLocation( shader, "speedX" )
|
||||
local speedYLoc = RL_GetShaderLocation( shader, "speedY" )
|
||||
secondsLoc = RL.GetShaderLocation( shader, "secondes" )
|
||||
local sizeLoc = RL.GetShaderLocation( shader, "size" )
|
||||
local freqXLoc = RL.GetShaderLocation( shader, "freqX" )
|
||||
local freqYLoc = RL.GetShaderLocation( shader, "freqY" )
|
||||
local ampXLoc = RL.GetShaderLocation( shader, "ampX" )
|
||||
local ampYLoc = RL.GetShaderLocation( shader, "ampY" )
|
||||
local speedXLoc = RL.GetShaderLocation( shader, "speedX" )
|
||||
local speedYLoc = RL.GetShaderLocation( shader, "speedY" )
|
||||
|
||||
local freqX = 25.0
|
||||
local freqY = 25.0
|
||||
@@ -37,25 +37,25 @@ function init()
|
||||
local speedX = 8.0
|
||||
local speedY = 8.0
|
||||
|
||||
RL_SetShaderValue( shader, sizeLoc, textureSize, SHADER_UNIFORM_VEC2 )
|
||||
RL_SetShaderValue( shader, freqXLoc, { freqX }, SHADER_UNIFORM_FLOAT )
|
||||
RL_SetShaderValue( shader, freqYLoc, { freqY }, SHADER_UNIFORM_FLOAT )
|
||||
RL_SetShaderValue( shader, ampXLoc, { ampX }, SHADER_UNIFORM_FLOAT )
|
||||
RL_SetShaderValue( shader, ampYLoc, { ampY }, SHADER_UNIFORM_FLOAT )
|
||||
RL_SetShaderValue( shader, speedXLoc, { speedX }, SHADER_UNIFORM_FLOAT )
|
||||
RL_SetShaderValue( shader, speedYLoc, { speedY }, SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, sizeLoc, textureSize, RL.SHADER_UNIFORM_VEC2 )
|
||||
RL.SetShaderValue( shader, freqXLoc, { freqX }, RL.SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, freqYLoc, { freqY }, RL.SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, ampXLoc, { ampX }, RL.SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, ampYLoc, { ampY }, RL.SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, speedXLoc, { speedX }, RL.SHADER_UNIFORM_FLOAT )
|
||||
RL.SetShaderValue( shader, speedYLoc, { speedY }, RL.SHADER_UNIFORM_FLOAT )
|
||||
end
|
||||
|
||||
local seconds = 0.0
|
||||
|
||||
function draw()
|
||||
seconds = seconds + RL_GetFrameTime();
|
||||
function RL.draw()
|
||||
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_DrawTexture( texture, { 0, 0 }, WHITE );
|
||||
RL_EndShaderMode()
|
||||
RL.BeginShaderMode( shader )
|
||||
RL.DrawTexture( texture, { 0, 0 }, RL.WHITE );
|
||||
RL.EndShaderMode()
|
||||
end
|
||||
|
||||
@@ -7,8 +7,8 @@ local STATE = { TITLE = 0, GAME = 1, OVER = 2 } -- Enum wannabe.
|
||||
-- Resources
|
||||
local framebuffer = -1
|
||||
local monitor = 0
|
||||
local monitorPos = RL_GetMonitorPosition( monitor )
|
||||
local monitorSize = RL_GetMonitorSize( monitor )
|
||||
local monitorPos = RL.GetMonitorPosition( monitor )
|
||||
local monitorSize = RL.GetMonitorSize( monitor )
|
||||
local winScale = 6
|
||||
local winSize = { RESOLUTION[1] * winScale, RESOLUTION[2] * winScale }
|
||||
local gameState = STATE.GAME
|
||||
@@ -64,18 +64,18 @@ end
|
||||
|
||||
-- Init.
|
||||
|
||||
function init()
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowSize( winSize )
|
||||
RL_SetWindowPosition( { monitorPos[1] + monitorSize[1] / 2 - winSize[1] / 2, monitorPos[2] + monitorSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL_SetWindowTitle( "Snake" )
|
||||
RL_SetWindowIcon( RL_LoadImage( RL_GetBasePath().."../resources/images/apple.png" ) )
|
||||
function RL.init()
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowSize( winSize )
|
||||
RL.SetWindowPosition( { monitorPos[1] + monitorSize[1] / 2 - winSize[1] / 2, monitorPos[2] + monitorSize[2] / 2 - winSize[2] / 2 } )
|
||||
RL.SetWindowTitle( "Snake" )
|
||||
RL.SetWindowIcon( RL.LoadImage( RL.GetBasePath().."../resources/images/apple.png" ) )
|
||||
|
||||
framebuffer = RL_LoadRenderTexture( RESOLUTION )
|
||||
grassTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/grass.png" )
|
||||
snakeTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/snake.png" )
|
||||
appleTexture = RL_LoadTexture( RL_GetBasePath().."../resources/images/apple.png" )
|
||||
framebuffer = RL.LoadRenderTexture( RESOLUTION )
|
||||
grassTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/grass.png" )
|
||||
snakeTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/snake.png" )
|
||||
appleTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/apple.png" )
|
||||
|
||||
setSnake()
|
||||
setApplePos()
|
||||
@@ -122,25 +122,25 @@ local function moveSnake()
|
||||
moveTimer = moveTimer + 1.0
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
function RL.process( delta )
|
||||
if gameState == STATE.GAME then -- Run game.
|
||||
-- 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 }
|
||||
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 }
|
||||
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 }
|
||||
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 }
|
||||
end
|
||||
|
||||
|
||||
moveTimer = moveTimer - gameSpeed * delta
|
||||
|
||||
|
||||
if moveTimer <= 0.0 then
|
||||
moveSnake()
|
||||
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()
|
||||
setApplePos()
|
||||
gameState = STATE.GAME
|
||||
@@ -152,7 +152,7 @@ end
|
||||
local function drawGrass()
|
||||
for y = 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
|
||||
@@ -168,14 +168,14 @@ end
|
||||
|
||||
local function drawSnake()
|
||||
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 }
|
||||
|
||||
if i == 1 then -- Tail segment. Yes tail is actually the 'first' segment.
|
||||
source[1] = 8
|
||||
|
||||
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
|
||||
elseif i < #snake.segments and not vector2IsEqual( seg.heading, snake.segments[ i+1 ].heading ) then -- Turned middle segments.
|
||||
source[1] = 0
|
||||
@@ -191,34 +191,34 @@ local function drawSnake()
|
||||
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.
|
||||
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
|
||||
-- Let's draw the head last to keep it on top.
|
||||
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 )
|
||||
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, RL.WHITE )
|
||||
end
|
||||
|
||||
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
|
||||
|
||||
function draw()
|
||||
function RL.draw()
|
||||
-- Clear the window to black.
|
||||
RL_ClearBackground( BLACK )
|
||||
RL.ClearBackground( RL.BLACK )
|
||||
-- Draw to framebuffer.
|
||||
RL_BeginTextureMode( framebuffer )
|
||||
RL_ClearBackground( BLACK )
|
||||
RL.BeginTextureMode( framebuffer )
|
||||
RL.ClearBackground( RL.BLACK )
|
||||
drawGrass()
|
||||
drawSnake()
|
||||
drawApple()
|
||||
|
||||
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
|
||||
RL_EndTextureMode()
|
||||
RL.EndTextureMode()
|
||||
|
||||
-- Draw framebuffer to window.
|
||||
RL_SetTextureSource( 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_SetTextureSource( TEXTURE_SOURCE_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, RL.WHITE )
|
||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
||||
end
|
||||
|
||||
@@ -9,40 +9,40 @@
|
||||
local camera = -1
|
||||
local num_blocks = 15
|
||||
|
||||
function init()
|
||||
function RL.init()
|
||||
local monitor = 0
|
||||
local mPos = RL_GetMonitorPosition( monitor )
|
||||
local mSize = RL_GetMonitorSize( monitor )
|
||||
local winSize = RL_GetScreenSize()
|
||||
|
||||
RL_SetWindowTitle( "Waving cubes" )
|
||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
local mPos = RL.GetMonitorPosition( monitor )
|
||||
local mSize = RL.GetMonitorSize( monitor )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
camera = RL_CreateCamera3D()
|
||||
RL_SetCamera3DPosition( camera, { 30, 20, 30 } )
|
||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
RL.SetWindowTitle( "Waving cubes" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||
|
||||
camera = RL.CreateCamera3D()
|
||||
RL.SetCamera3DPosition( camera, { 30, 20, 30 } )
|
||||
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||
end
|
||||
|
||||
function draw()
|
||||
local t = RL_GetTime()
|
||||
function RL.draw()
|
||||
local t = RL.GetTime()
|
||||
local cos = math.cos
|
||||
local sin = math.sin
|
||||
|
||||
local scale = (2.0 + sin(t)) * 0.7
|
||||
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[3] = sin(camera_time) * 40.0
|
||||
|
||||
RL_SetCamera3DPosition( camera, camera_pos )
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
|
||||
RL_BeginMode3D( camera )
|
||||
RL_DrawGrid( 10, 5.0 )
|
||||
RL.SetCamera3DPosition( camera, camera_pos )
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
|
||||
RL.BeginMode3D( camera )
|
||||
RL.DrawGrid( 10, 5.0 )
|
||||
|
||||
for x = 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,
|
||||
(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
|
||||
|
||||
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
|
||||
RL_EndMode3D()
|
||||
RL.EndMode3D()
|
||||
|
||||
RL_DrawFPS( { 10, 10 } )
|
||||
RL.DrawFPS( { 10, 10 } )
|
||||
end
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
local textColor = BLACK
|
||||
local textColor = RL.BLACK
|
||||
local textPos = { 192, 200 }
|
||||
local imageFont = -1
|
||||
local text = "Congrats! You created your first window!"
|
||||
|
||||
function init()
|
||||
RL_SetWindowTitle( "First window" )
|
||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||
function RL.init()
|
||||
RL.SetWindowTitle( "First window" )
|
||||
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
|
||||
end
|
||||
|
||||
function process( delta )
|
||||
if RL_IsKeyPressed( KEY_ENTER ) then
|
||||
local textSize = RL_MeasureText( 0, text, 20, 2 )
|
||||
local winSize = RL_GetScreenSize()
|
||||
function RL.process( delta )
|
||||
if RL.IsKeyPressed( RL.KEY_ENTER ) then
|
||||
local textSize = RL.MeasureText( 0, text, 20, 2 )
|
||||
local winSize = RL.GetScreenSize()
|
||||
|
||||
textColor = BLUE
|
||||
textColor = RL.BLUE
|
||||
textPos = { winSize[1] / 2 - textSize[1] / 2, winSize[2] / 2 - textSize[2] / 2 }
|
||||
end
|
||||
|
||||
if RL_IsKeyPressed( KEY_SPACE ) then
|
||||
textColor = BLACK
|
||||
if RL.IsKeyPressed( RL.KEY_SPACE ) then
|
||||
textColor = RL.BLACK
|
||||
textPos = { 192, 200 }
|
||||
end
|
||||
end
|
||||
|
||||
function draw()
|
||||
RL_ClearBackground( RAYWHITE )
|
||||
RL_DrawText( 0, text, textPos, 20, 2, textColor )
|
||||
function RL.draw()
|
||||
RL.ClearBackground( RL.RAYWHITE )
|
||||
RL.DrawText( 0, text, textPos, 20, 2, textColor )
|
||||
end
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
#define STRING_LEN 1024
|
||||
|
||||
#define VERSION_MAJOR 0
|
||||
#define VERSION_MINOR 4
|
||||
#define VERSION_MINOR 5
|
||||
#define VERSION_PATCH 0
|
||||
#define VERSION_DEV 0
|
||||
#define VERSION_DEV 1
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
118
src/audio.c
118
src/audio.c
@@ -58,7 +58,7 @@ static void checkWaveRealloc( int i ) {
|
||||
*/
|
||||
|
||||
/*
|
||||
> success = RL_SetMasterVolume( float volume )
|
||||
> success = RL.SetMasterVolume( float volume )
|
||||
|
||||
Set master volume ( listener )
|
||||
|
||||
@@ -67,7 +67,7 @@ Set master volume ( listener )
|
||||
*/
|
||||
int laudioSetMasterVolume( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -91,7 +91,7 @@ Load sound from file
|
||||
*/
|
||||
int laudioLoadSound( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -126,7 +126,7 @@ Load wave data from file
|
||||
*/
|
||||
int laudioLoadWave( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -160,7 +160,7 @@ Load sound from wave data
|
||||
*/
|
||||
int laudioLoadSoundFromWave( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -186,7 +186,7 @@ int laudioLoadSoundFromWave( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> success = RL_UnloadSound( Sound sound )
|
||||
> success = RL.UnloadSound( Sound sound )
|
||||
|
||||
Unload sound
|
||||
|
||||
@@ -195,7 +195,7 @@ Unload sound
|
||||
*/
|
||||
int laudioUnloadSound( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -213,7 +213,7 @@ int laudioUnloadSound( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> success = RL_UnloadWave( Wave wave )
|
||||
> success = RL.UnloadWave( Wave wave )
|
||||
|
||||
Unload wave data
|
||||
|
||||
@@ -222,7 +222,7 @@ Unload wave data
|
||||
*/
|
||||
int laudioUnloadWave( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -249,7 +249,7 @@ Export wave data to file, returns true on success
|
||||
*/
|
||||
int laudioExportWave( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -274,7 +274,7 @@ Export wave sample data to code (.h), returns true on success
|
||||
*/
|
||||
int laudioExportWaveAsCode( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -294,7 +294,7 @@ int laudioExportWaveAsCode( lua_State *L ) {
|
||||
*/
|
||||
|
||||
/*
|
||||
> success = RL_PlaySound( Sound sound )
|
||||
> success = RL.PlaySound( Sound sound )
|
||||
|
||||
Play a sound
|
||||
|
||||
@@ -303,7 +303,7 @@ Play a sound
|
||||
*/
|
||||
int laudioPlaySound( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -329,7 +329,7 @@ Stop playing a sound
|
||||
*/
|
||||
int laudioStopSound( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -346,7 +346,7 @@ int laudioStopSound( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> success = RL_PauseSound( Sound sound )
|
||||
> success = RL.PauseSound( Sound sound )
|
||||
|
||||
Pause a sound
|
||||
|
||||
@@ -355,7 +355,7 @@ Pause a sound
|
||||
*/
|
||||
int laudioPauseSound( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -381,7 +381,7 @@ Resume a paused sound
|
||||
*/
|
||||
int laudioResumeSound( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -407,7 +407,7 @@ Play a sound ( Using multichannel buffer pool )
|
||||
*/
|
||||
int laudioPlaySoundMulti( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -424,7 +424,7 @@ int laudioPlaySoundMulti( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_StopSoundMulti()
|
||||
> RL.StopSoundMulti()
|
||||
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -457,7 +457,7 @@ Check if a sound is currently playing
|
||||
*/
|
||||
int laudioIsSoundPlaying( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -482,7 +482,7 @@ Set volume for a sound ( 1.0 is max level )
|
||||
*/
|
||||
int laudioSetSoundVolume( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -506,7 +506,7 @@ Set pitch for a sound ( 1.0 is base level )
|
||||
*/
|
||||
int laudioSetSoundPitch( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -530,7 +530,7 @@ Set pan for a sound ( 0.5 is center )
|
||||
*/
|
||||
int laudioSetSoundPan( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -554,7 +554,7 @@ Convert wave data to desired format
|
||||
*/
|
||||
int laudioWaveFormat( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -583,7 +583,7 @@ Copy a wave to a new wave
|
||||
*/
|
||||
int laudioWaveCopy( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -618,7 +618,7 @@ Crop a wave to defined samples range
|
||||
*/
|
||||
int laudioWaveCrop( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -650,7 +650,7 @@ Load music stream from file
|
||||
*/
|
||||
int laudioLoadMusicStream( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -668,7 +668,7 @@ int laudioLoadMusicStream( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_PlayMusicStream()
|
||||
> RL.PlayMusicStream()
|
||||
|
||||
Start music playing
|
||||
*/
|
||||
@@ -679,7 +679,7 @@ int laudioPlayMusicStream( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> playing = RL_PlayMusicStream()
|
||||
> playing = RL.IsMusicStreamPlaying()
|
||||
|
||||
Check if music is playing
|
||||
|
||||
@@ -692,7 +692,7 @@ int laudioIsMusicStreamPlaying( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_StopMusicStream()
|
||||
> RL.StopMusicStream()
|
||||
|
||||
Stop music playing
|
||||
*/
|
||||
@@ -703,7 +703,7 @@ int laudioStopMusicStream( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_PauseMusicStream()
|
||||
> RL.PauseMusicStream()
|
||||
|
||||
Pause music playing
|
||||
*/
|
||||
@@ -714,7 +714,7 @@ int laudioPauseMusicStream( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_ResumeMusicStream()
|
||||
> RL.ResumeMusicStream()
|
||||
|
||||
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 )
|
||||
|
||||
@@ -734,7 +734,7 @@ Seek music to a position ( in seconds )
|
||||
*/
|
||||
int laudioSeekMusicStream( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -754,7 +754,7 @@ Set volume for music ( 1.0 is max level )
|
||||
*/
|
||||
int laudioSetMusicVolume( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -774,7 +774,7 @@ Set pitch for a music ( 1.0 is base level )
|
||||
*/
|
||||
int laudioSetMusicPitch( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -794,7 +794,7 @@ Set pan for a music ( 0.5 is center )
|
||||
*/
|
||||
int laudioSetMusicPan( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -805,7 +805,7 @@ int laudioSetMusicPan( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> length = RL_GetMusicTimeLength()
|
||||
> length = RL.GetMusicTimeLength()
|
||||
|
||||
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 )
|
||||
|
||||
|
||||
542
src/core.c
542
src/core.c
File diff suppressed because it is too large
Load Diff
100
src/easings.c
100
src/easings.c
@@ -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
|
||||
|
||||
@@ -18,7 +18,7 @@ Ease linear
|
||||
*/
|
||||
int leasingsEaseLinear( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -41,7 +41,7 @@ Ease sine in
|
||||
*/
|
||||
int leasingsEaseSineIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -60,7 +60,7 @@ Ease sine out
|
||||
*/
|
||||
int leasingsEaseSineOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -79,7 +79,7 @@ Ease sine in out
|
||||
*/
|
||||
int leasingsEaseSineInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -102,7 +102,7 @@ Ease circle in
|
||||
*/
|
||||
int leasingsEaseCircIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -121,7 +121,7 @@ Ease circle out
|
||||
*/
|
||||
int leasingsEaseCircOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -140,7 +140,7 @@ Ease circle in out
|
||||
*/
|
||||
int leasingsEaseCircInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -163,7 +163,7 @@ Ease cubic in
|
||||
*/
|
||||
int leasingsEaseCubicIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -182,7 +182,7 @@ Ease cubic out
|
||||
*/
|
||||
int leasingsEaseCubicOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -201,7 +201,7 @@ Ease cubic in out
|
||||
*/
|
||||
int leasingsEaseCubicInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -224,7 +224,7 @@ Ease quadratic in
|
||||
*/
|
||||
int leasingsEaseQuadIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -243,7 +243,7 @@ Ease quadratic out
|
||||
*/
|
||||
int leasingsEaseQuadOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -262,7 +262,7 @@ Ease quadratic in out
|
||||
*/
|
||||
int leasingsEaseQuadInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -285,7 +285,7 @@ Ease exponential in
|
||||
*/
|
||||
int leasingsEaseExpoIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -304,7 +304,7 @@ Ease exponential out
|
||||
*/
|
||||
int leasingsEaseExpoOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -323,7 +323,7 @@ Ease exponential in out
|
||||
*/
|
||||
int leasingsEaseExpoInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -346,7 +346,7 @@ Ease back in
|
||||
*/
|
||||
int leasingsEaseBackIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -365,7 +365,7 @@ Ease back out
|
||||
*/
|
||||
int leasingsEaseBackOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -384,7 +384,7 @@ Ease back in out
|
||||
*/
|
||||
int leasingsEaseBackInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -407,7 +407,7 @@ Ease bounce in
|
||||
*/
|
||||
int leasingsEaseBounceIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -426,7 +426,7 @@ Ease bounce out
|
||||
*/
|
||||
int leasingsEaseBounceOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -445,7 +445,7 @@ Ease bounce in out
|
||||
*/
|
||||
int leasingsEaseBounceInOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -468,7 +468,7 @@ Ease elastic in
|
||||
*/
|
||||
int leasingsEaseElasticIn( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -487,7 +487,7 @@ Ease elastic out
|
||||
*/
|
||||
int leasingsEaseElasticOut( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -506,7 +506,7 @@ Ease elastic in out
|
||||
*/
|
||||
int leasingsEaseElasticInOut( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -46,7 +46,7 @@ Create a light and get shader locations
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -85,7 +85,7 @@ Send light properties to shader
|
||||
*/
|
||||
int llightsUpdateLightValues( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
1222
src/lua_core.c
1222
src/lua_core.c
File diff suppressed because it is too large
Load Diff
273
src/models.c
273
src/models.c
File diff suppressed because it is too large
Load Diff
190
src/rgui.c
190
src/rgui.c
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
> RL_GuiEnable()
|
||||
> RL.GuiEnable()
|
||||
|
||||
Enable gui controls ( global state )
|
||||
*/
|
||||
@@ -22,7 +22,7 @@ int lguiGuiEnable( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_GuiDisable()
|
||||
> RL.GuiDisable()
|
||||
|
||||
Disable gui controls ( global state )
|
||||
*/
|
||||
@@ -33,7 +33,7 @@ int lguiGuiDisable( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_GuiLock()
|
||||
> RL.GuiLock()
|
||||
|
||||
Lock gui controls ( global state )
|
||||
*/
|
||||
@@ -44,7 +44,7 @@ int lguiGuiLock( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_GuiUnlock()
|
||||
> RL.GuiUnlock()
|
||||
|
||||
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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -77,7 +77,7 @@ Set gui controls alpha ( global state ), alpha goes from 0.0f to 1.0f
|
||||
*/
|
||||
int lguiGuiFade( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -97,7 +97,7 @@ Set gui state ( global state )
|
||||
*/
|
||||
int lguiGuiSetState( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -108,7 +108,7 @@ int lguiGuiSetState( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> state = RL_GuiGetState()
|
||||
> state = RL.GuiGetState()
|
||||
|
||||
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 )
|
||||
|
||||
@@ -134,7 +134,7 @@ Set gui custom font ( Global state )
|
||||
*/
|
||||
int lguiGuiSetFont( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -158,7 +158,7 @@ Set one style property
|
||||
*/
|
||||
int lguiGuiSetStyle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -178,7 +178,7 @@ Get one style property
|
||||
*/
|
||||
int lguiGuiGetStyle( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -197,7 +197,7 @@ Load style file over global style variable ( .rgs )
|
||||
*/
|
||||
int lguiGuiLoadStyle( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -208,7 +208,7 @@ int lguiGuiLoadStyle( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL_GuiLoadStyleDefault()
|
||||
> RL.GuiLoadStyleDefault()
|
||||
|
||||
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
|
||||
|
||||
@@ -232,7 +232,7 @@ Window Box control, shows a window that can be closed
|
||||
*/
|
||||
int lguiGuiWindowBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -256,7 +256,7 @@ Group Box control with text name
|
||||
*/
|
||||
int lguiGuiGroupBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -281,7 +281,7 @@ Line separator control, could contain text
|
||||
*/
|
||||
int lguiGuiLine( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -306,7 +306,7 @@ Panel control, useful to group controls
|
||||
*/
|
||||
int lguiGuiPanel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -331,7 +331,7 @@ Scroll Panel control
|
||||
*/
|
||||
int lguiGuiScrollPanel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -364,7 +364,7 @@ Label control, shows text
|
||||
*/
|
||||
int lguiGuiLabel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -389,7 +389,7 @@ Button control, returns true when clicked
|
||||
*/
|
||||
int lguiGuiButton( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -413,7 +413,7 @@ Label button control, show true when clicked
|
||||
*/
|
||||
int lguiGuiLabelButton( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -437,7 +437,7 @@ Toggle Button control, returns true when active
|
||||
*/
|
||||
int lguiGuiToggle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -463,7 +463,7 @@ Toggle Group control, returns active toggle index
|
||||
*/
|
||||
int lguiGuiToggleGroup( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -489,7 +489,7 @@ Check Box control, returns true when active
|
||||
*/
|
||||
int lguiGuiCheckBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -515,7 +515,7 @@ Combo Box control, returns selected item index
|
||||
*/
|
||||
int lguiGuiComboBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -541,7 +541,7 @@ Text Box control, updates input text
|
||||
*/
|
||||
int lguiGuiTextBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -570,7 +570,7 @@ Text Box control with multiple lines
|
||||
*/
|
||||
int lguiGuiTextBoxMulti( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -600,7 +600,7 @@ Spinner control, returns selected value
|
||||
int lguiGuiSpinner( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -634,7 +634,7 @@ Value Box control, updates input text with numbers
|
||||
int lguiGuiValueBox( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -668,7 +668,7 @@ Slider control, returns selected value
|
||||
int lguiGuiSlider( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -702,7 +702,7 @@ Slider Bar control, returns selected value
|
||||
int lguiGuiSliderBar( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -736,7 +736,7 @@ Progress Bar control, shows current progress value
|
||||
int lguiGuiProgressBar( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -769,7 +769,7 @@ Scroll Bar control
|
||||
*/
|
||||
int lguiGuiScrollBar( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -796,7 +796,7 @@ Dropdown Box control, returns selected item
|
||||
*/
|
||||
int lguiGuiDropdownBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -825,7 +825,7 @@ Status Bar control, shows info text
|
||||
*/
|
||||
int lguiGuiStatusBar( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -850,7 +850,7 @@ Dummy control for placeholders
|
||||
*/
|
||||
int lguiGuiDummyRec( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -875,7 +875,7 @@ Grid control, returns mouse cell position
|
||||
*/
|
||||
int lguiGuiGrid( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -907,7 +907,7 @@ List View control, returns selected list item index and scroll index
|
||||
*/
|
||||
int lguiGuiListView( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -937,7 +937,7 @@ List View with extended parameters, returns selected list item index, scroll ind
|
||||
int lguiGuiListViewEx( lua_State *L ) {
|
||||
if ( !lua_istable( L, -5 ) || !lua_isstring( L, -4 ) || !lua_isnumber( L, -3 )
|
||||
|| !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 );
|
||||
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 )
|
||||
|
||||
@@ -969,7 +969,7 @@ Message Box control, displays a message, returns button index ( 0 is x button )
|
||||
*/
|
||||
int lguiGuiMessageBox( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -999,7 +999,7 @@ Text Input Box control, ask for text, supports secret
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -1038,7 +1038,7 @@ Color Picker control ( multiple color controls )
|
||||
*/
|
||||
int lguiGuiColorPicker( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1064,7 +1064,7 @@ Color Panel control
|
||||
*/
|
||||
int lguiGuiColorPanel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1090,7 +1090,7 @@ Color Bar Alpha control
|
||||
*/
|
||||
int lguiGuiColorBarAlpha( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1116,7 +1116,7 @@ Color Bar Hue control
|
||||
*/
|
||||
int lguiGuiColorBarHue( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -1146,7 +1146,7 @@ Get text with icon id prepended ( if supported )
|
||||
*/
|
||||
int lguiGuiIconText( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1175,7 +1175,7 @@ Draw icon
|
||||
*/
|
||||
int lguiGuiDrawIcon( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -1203,7 +1203,7 @@ Set icon scale ( 1 by default )
|
||||
*/
|
||||
int lguiGuiSetIconScale( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1223,7 +1223,7 @@ Set icon pixel value
|
||||
*/
|
||||
int lguiGuiSetIconPixel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1247,7 +1247,7 @@ Clear icon pixel value
|
||||
*/
|
||||
int lguiGuiClearIconPixel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1271,7 +1271,7 @@ Check icon pixel value
|
||||
*/
|
||||
int lguiGuiCheckIconPixel( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
> success = RL_rlSetLineWidth( float width )
|
||||
> success = RL.rlSetLineWidth( float width )
|
||||
|
||||
Set the line drawing width
|
||||
|
||||
@@ -17,7 +17,7 @@ Set the line drawing width
|
||||
*/
|
||||
int lrlglSetLineWidth( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ int lrlglSetLineWidth( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> width = RL_rlGetLineWidth()
|
||||
> width = RL.rlGetLineWidth()
|
||||
|
||||
Get the line drawing width
|
||||
|
||||
|
||||
424
src/rmath.c
424
src/rmath.c
File diff suppressed because it is too large
Load Diff
164
src/shapes.c
164
src/shapes.c
@@ -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
|
||||
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 ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -47,7 +47,7 @@ Draw a pixel
|
||||
*/
|
||||
int lshapesDrawPixel( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -71,7 +71,7 @@ Draw a line defining thickness
|
||||
*/
|
||||
int lshapesDrawLine( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -99,7 +99,7 @@ Draw a line using cubic-bezier curves in-out
|
||||
*/
|
||||
int lshapesDrawLineBezier( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -127,7 +127,7 @@ Draw line using quadratic bezier curves with a control point
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -158,7 +158,7 @@ Draw line using quadratic bezier curves with a control point
|
||||
int lshapesDrawLineBezierCubic( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -190,7 +190,7 @@ Draw lines sequence
|
||||
*/
|
||||
int lshapesDrawLineStrip( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -226,7 +226,7 @@ Draw a color-filled circle
|
||||
*/
|
||||
int lshapesDrawCircle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -253,7 +253,7 @@ Draw a piece of a circle
|
||||
int lshapesDrawCircleSector( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -286,7 +286,7 @@ Draw circle sector outline
|
||||
int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -318,7 +318,7 @@ Draw a gradient-filled circle
|
||||
*/
|
||||
int lshapesDrawCircleGradient( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -346,7 +346,7 @@ Draw circle outline
|
||||
*/
|
||||
int lshapesDrawCircleLines( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -372,7 +372,7 @@ Draw ellipse
|
||||
*/
|
||||
int lshapesDrawEllipse( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -400,7 +400,7 @@ Draw ellipse outline
|
||||
*/
|
||||
int lshapesDrawEllipseLines( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -429,7 +429,7 @@ Draw ring
|
||||
int lshapesDrawRing( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -464,7 +464,7 @@ Draw ring outline
|
||||
int lshapesDrawRingLines( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -498,7 +498,7 @@ Draw a color-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -522,7 +522,7 @@ Draw a color-filled rectangle with pro parameters
|
||||
*/
|
||||
int lshapesDrawRectanglePro( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -550,7 +550,7 @@ Draw a vertical-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -576,7 +576,7 @@ Draw a horizontal-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -602,7 +602,7 @@ Draw a gradient-filled rectangle with custom vertex colors
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -632,7 +632,7 @@ Draw rectangle outline
|
||||
*/
|
||||
int lshapesDrawRectangleLines( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -656,7 +656,7 @@ Draw rectangle outline with extended parameters
|
||||
*/
|
||||
int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -682,7 +682,7 @@ Draw rectangle with rounded edges
|
||||
*/
|
||||
int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -710,7 +710,7 @@ Draw rectangle with rounded edges outline
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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! )
|
||||
|
||||
@@ -740,7 +740,7 @@ Draw a color-filled triangle ( Vertex in counter-clockwise order! )
|
||||
*/
|
||||
int lshapesDrawTriangle( lua_State *L ) {
|
||||
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 );
|
||||
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! )
|
||||
|
||||
@@ -768,7 +768,7 @@ Draw triangle outline ( Vertex in counter-clockwise order! )
|
||||
*/
|
||||
int lshapesDrawTriangleLines( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -796,7 +796,7 @@ Draw a triangle fan defined by points ( first vertex is the center )
|
||||
*/
|
||||
int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -832,7 +832,7 @@ Draw a triangle strip defined by points
|
||||
*/
|
||||
int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -868,7 +868,7 @@ Draw a regular polygon ( Vector version )
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -898,7 +898,7 @@ Draw a polygon outline of n sides
|
||||
*/
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -929,7 +929,7 @@ Draw a polygon outline of n sides with extended parameters
|
||||
int lshapesDrawPolyLinesEx( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -965,7 +965,7 @@ Check collision between two rectangles
|
||||
*/
|
||||
int lshapesCheckCollisionRecs( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -988,7 +988,7 @@ Check collision between two circles
|
||||
*/
|
||||
int lshapesCheckCollisionCircles( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1015,7 +1015,7 @@ Check collision between circle and rectangle
|
||||
*/
|
||||
int lshapesCheckCollisionCircleRec( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1040,7 +1040,7 @@ Check if point is inside rectangle
|
||||
*/
|
||||
int lshapesCheckCollisionPointRec( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1063,7 +1063,7 @@ Check if point is inside circle
|
||||
*/
|
||||
int lshapesCheckCollisionPointCircle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1088,7 +1088,7 @@ Check if point is inside a triangle
|
||||
*/
|
||||
int lshapesCheckCollisionPointTriangle( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1115,7 +1115,7 @@ Check the collision between two lines defined by two points each, returns collis
|
||||
*/
|
||||
int lshapesCheckCollisionLines( lua_State *L ) {
|
||||
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 );
|
||||
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]
|
||||
|
||||
@@ -1145,7 +1145,7 @@ Check if point belongs to line created between two points [p1] and [p2] with def
|
||||
*/
|
||||
int lshapesCheckCollisionPointLine( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -1173,7 +1173,7 @@ Get collision rectangle for two rectangles collision
|
||||
int lshapesGetCollisionRec( lua_State *L ) {
|
||||
/* Rectangle rec1, Rectangle rec2 */
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
44
src/text.c
44
src/text.c
@@ -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 )
|
||||
|
||||
@@ -43,7 +43,7 @@ Load font from file into GPU memory ( VRAM )
|
||||
*/
|
||||
int ltextLoadFont( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -72,7 +72,7 @@ Load font from file with extended parameters. Loading the default character set
|
||||
*/
|
||||
int ltextLoadFontEx( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -101,7 +101,7 @@ Load font from Image ( XNA style )
|
||||
*/
|
||||
int ltextLoadFontFromImage( lua_State *L ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -142,7 +142,7 @@ Unload Font from GPU memory ( VRAM )
|
||||
*/
|
||||
int ltextUnloadFont( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -164,7 +164,7 @@ int ltextUnloadFont( lua_State *L ) {
|
||||
*/
|
||||
|
||||
/*
|
||||
> success = RL_DrawFPS( Vector2 pos )
|
||||
> success = RL.DrawFPS( Vector2 pos )
|
||||
|
||||
Draw current FPS
|
||||
|
||||
@@ -173,7 +173,7 @@ Draw current FPS
|
||||
*/
|
||||
int ltextDrawFPS( lua_State *L ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -196,7 +196,7 @@ Draw text using font and additional parameters
|
||||
int ltextDrawText( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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 )
|
||||
|
||||
@@ -231,7 +231,7 @@ Draw text using Font and pro parameters ( rotation )
|
||||
int ltextDrawTextPro( lua_State *L ) {
|
||||
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 ) ) {
|
||||
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 );
|
||||
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
|
||||
|
||||
@@ -273,7 +273,7 @@ Measure string size for Font
|
||||
*/
|
||||
int ltextMeasureText( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -293,7 +293,7 @@ int ltextMeasureText( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> baseSize = RL_GetFontBaseSize( Font font )
|
||||
> baseSize = RL.GetFontBaseSize( Font font )
|
||||
|
||||
Get font baseSize
|
||||
|
||||
@@ -302,7 +302,7 @@ Get font baseSize
|
||||
*/
|
||||
int ltextGetFontBaseSize( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ int ltextGetFontBaseSize( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> glyphCount = RL_GetFontGlyphCount( Font font )
|
||||
> glyphCount = RL.GetFontGlyphCount( Font font )
|
||||
|
||||
Get font glyphCount
|
||||
|
||||
@@ -327,7 +327,7 @@ Get font glyphCount
|
||||
*/
|
||||
int ltextGetFontGlyphCount( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
@@ -343,7 +343,7 @@ int ltextGetFontGlyphCount( lua_State *L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> glyphPadding = RL_GetFontGlyphPadding( Font font )
|
||||
> glyphPadding = RL.GetFontGlyphPadding( Font font )
|
||||
|
||||
Get font glyphPadding
|
||||
|
||||
@@ -352,7 +352,7 @@ Get font glyphPadding
|
||||
*/
|
||||
int ltextGetFontGlyphPadding( lua_State *L ) {
|
||||
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 );
|
||||
return 1;
|
||||
}
|
||||
|
||||
346
src/textures.c
346
src/textures.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user