Fixed examples.

This commit is contained in:
jussi
2023-10-29 19:45:18 +02:00
parent fcd2d2d8b5
commit 992310fb90
18 changed files with 62 additions and 54 deletions

10
API.md
View File

@@ -45,6 +45,16 @@ This function will be called on program close. Cleanup could be done here.
Arguments are stored in 'RL.arg' array. Arguments are stored in 'RL.arg' array.
## Default objects
> RL.defaultFont
Default Font object
> RL.defaultMaterial
Default Material object
## Types ## Types
Raylib structs in Lua Raylib structs in Lua

View File

@@ -60,7 +60,7 @@ end
function RL.draw() function RL.draw()
RL.ClearBackground( RL.RAYWHITE ) RL.ClearBackground( RL.RAYWHITE )
RL.DrawText( 0, "Congrats! You created your first window!", textPos, 20, 2, textColor ) RL.DrawText( RL.defaultFont, "Congrats! You created your first window!", textPos, 20, 2, textColor )
end end
``` ```

View File

@@ -25,15 +25,11 @@ local function getParamType( param )
if param == "Color" or param == "Vector2" or param == "Vector3" or param == "Vector4" if param == "Color" or param == "Vector2" or param == "Vector3" or param == "Vector4"
or param == "Quaternion" or param == "Matrix" or param == "Rectangle" then or param == "Quaternion" or param == "Matrix" or param == "Rectangle" then
return "table" return "table"
elseif param == "float" then elseif param == "float" then return "number"
return "number" elseif param == "int" then return "integer"
elseif param == "int" then elseif param == "string" then return "string"
return "integer" elseif param == "bool" then return "boolean"
elseif param == "string" then else
return "string"
elseif param == "bool" then
return "boolean"
else
return "any" return "any"
end end
end end
@@ -124,9 +120,21 @@ luaApiFile:write(
luaApiFile:write( luaApiFile:write(
"---"..FUNC_DESC.exit.."\nfunction RL.exit() end\n" ) "---"..FUNC_DESC.exit.."\nfunction RL.exit() end\n" )
-- Arguments.
apiFile:write( "\n## Arguments\n" ) apiFile:write( "\n## Arguments\n" )
apiFile:write( "\nArguments are stored in 'RL.arg' array.\n" ) apiFile:write( "\nArguments are stored in 'RL.arg' array.\n" )
-- Default objects.
apiFile:write( "\n## Default objects\n" )
apiFile:write( "\n> RL.defaultFont\n\nDefault Font object\n" )
apiFile:write( "\n> RL.defaultMaterial\n\nDefault Material object\n" )
-- luaApiFile:write( "\n--Default objects\n\n" )
-- luaApiFile:write( "--Default Font object\nRL.defaultFont = RL.GetFontDefault()\n" )
-- luaApiFile:write( "--Default Material object\nRL.defaultMaterial\n" )
-- Types. -- Types.
apiFile:write( "\n## Types\n\ apiFile:write( "\n## Types\n\

View File

@@ -83,7 +83,7 @@ function RL.draw()
end end
RL.DrawRectangle( { 0, 0, screenWidth, 40 }, RL.BLACK) RL.DrawRectangle( { 0, 0, screenWidth, 40 }, RL.BLACK)
RL.DrawText( 0, "bunnies: " .. #bunnies, { 120, 10 }, 20, 2, RL.GREEN ) RL.DrawText( RL.defaultFont, "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.DrawText( RL.defaultFont, "batched draw calls: " .. math.ceil( 1 + #bunnies / MAX_BATCH_ELEMENTS ), { 320, 10 }, 20, 2, RL.RED )
RL.DrawFPS( { 10, 10 } ) RL.DrawFPS( { 10, 10 } )
end end

View File

@@ -100,5 +100,5 @@ function RL.draw()
RL.ClearBackground( RL.RED ) RL.ClearBackground( RL.RED )
end end
RL.DrawText( 0, text, textPos, 20, 2, RL.BLACK ) RL.DrawText( RL.defaultFont, text, textPos, 20, 2, RL.BLACK )
end end

View File

@@ -68,5 +68,5 @@ function RL.draw()
text = text.."\nPress T to toggle target visible.\nVisible: "..tostring( targetVisible ) text = text.."\nPress T to toggle target visible.\nVisible: "..tostring( targetVisible )
RL.DrawText( 0, text, { 16, 16 }, 30, 4, RL.WHITE ) RL.DrawText( RL.defaultFont, text, { 16, 16 }, 30, 4, RL.WHITE )
end end

View File

@@ -26,7 +26,7 @@ function RL.init()
local mSize = RL.GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local winSize = { 1920, 1080 } local winSize = { 1920, 1080 }
RL.GuiSetFont( 0 ) RL.GuiSetFont( RL.defaultFont )
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL.SetWindowState( RL.FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL.SetWindowSize( winSize ) RL.SetWindowSize( winSize )

View File

@@ -13,7 +13,7 @@ function RL.init()
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE ) RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
RL.SetWindowState( RL.FLAG_VSYNC_HINT ) RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } ) RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
image = RL.GenImageColor( winSize[1], winSize[2], RL.WHITE ) image = RL.GenImageColor( winSize, RL.WHITE )
-- Test changing working directory. -- Test changing working directory.
RL.ChangeDirectory( RL.GetBasePath().."../resources" ) RL.ChangeDirectory( RL.GetBasePath().."../resources" )
catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" ) catImage = RL.LoadImage( RL.GetWorkingDirectory().."/images/cat.png" )
@@ -24,14 +24,14 @@ function RL.init()
RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE ) RL.ImageDrawRectangle( image, { 120, 64, 32, 64 }, RL.BLUE )
RL.ImageDrawRectangleLines( image, { 160, 64, 32, 64 }, 2.0, 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.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 ) RL.ImageDrawTextEx( image, RL.defaultFont, "Hello", { 300, 32 }, 48.0, 1.0, RL.WHITE )
local src = { 80, 70, 96, 96 } local src = { 80, 70, 96, 96 }
catCopy = RL.ImageFromImage( catImage, src ) catCopy = RL.ImageFromImage( catImage, src )
RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE ) RL.ImageDraw( image, catCopy, src, { 600, 200, src[3], src[4] }, RL.WHITE )
textImage = RL.ImageText( 0, "Cat", 10, 4, RL.WHITE ) textImage = RL.ImageText( RL.defaultFont, "Cat", 10, 4, RL.WHITE )
local imageSize = RL.GetImageSize( textImage ) local imageSize = RL.GetImageSize( textImage )
RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE ) RL.ImageDraw( image, textImage, { 0, 0, imageSize[1], imageSize[2] }, { 250, 40, imageSize[1], imageSize[2] }, RL.WHITE )

View File

@@ -4,7 +4,8 @@ local speed = 60.0
local monitor = 0 local monitor = 0
local mPos = RL.GetMonitorPosition( monitor ) local mPos = RL.GetMonitorPosition( monitor )
local mSize = RL.GetMonitorSize( monitor ) local mSize = RL.GetMonitorSize( monitor )
local framebuffer = -1 local framebuffer = nil
local framebufferTex = nil
local res = { 320, 180 } local res = { 320, 180 }
local scale = 5 local scale = 5
local winSize = { res[1] * scale, res[2] * scale } local winSize = { res[1] * scale, res[2] * scale }
@@ -17,6 +18,7 @@ function RL.init()
tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" ) tex = RL.LoadTexture( RL.GetBasePath().."../resources/images/cat.png" )
-- Create framebuffer. -- Create framebuffer.
framebuffer = RL.LoadRenderTexture( res ) framebuffer = RL.LoadRenderTexture( res )
framebufferTex = RL.GetRenderTextureTexture( framebuffer )
end end
function RL.process( delta ) function RL.process( delta )
@@ -46,9 +48,9 @@ function RL.draw()
RL.DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 255 } ) RL.DrawLine( { 120, 100 }, { 140, 150 }, 2.4, { 255, 150, 255 } )
RL.DrawRectangle( { 200, 120, 40, 50 }, { 100, 170, 255 } ) RL.DrawRectangle( { 200, 120, 40, 50 }, { 100, 170, 255 } )
RL.DrawTexturePro( tex, { 166, 138, 128, 128 }, { pos[1], pos[2], 128, 128 }, { 16, 16 }, 0.0, RL.WHITE ) RL.DrawTexturePro( tex, { 166, 138, 128, 128 }, { pos[1], pos[2], 128, 128 }, { 16, 16 }, 0.0, RL.WHITE )
RL.DrawText( 0, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } ) RL.DrawText( RL.defaultFont, "Cat MIAU!!", { 16, 32 }, 10, 1, { 255, 180, 155 } )
RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED ) RL.DrawTriangle( { 0, 32 }, { 32, 16 }, { 0, 0 }, RL.RED )
RL.EndTextureMode() RL.EndTextureMode()
RL.DrawTexturePro( framebuffer, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } ) RL.DrawTexturePro( framebufferTex, { 0, 0, res[1], -res[2] }, { 0, 0, winSize[1], winSize[2] }, { 0, 0 }, 0.0, { 255, 255, 255 } )
end end

View File

@@ -116,5 +116,5 @@ function RL.draw()
RL.DrawSphereWires( point.pos, point.radius, 3, 8, point.color ) RL.DrawSphereWires( point.pos, point.radius, 3, 8, point.color )
RL.EndMode3D() RL.EndMode3D()
RL.DrawText( 0, debugText, { 10, 10 }, 30, 4, RL.WHITE ) RL.DrawText( RL.defaultFont, debugText, { 10, 10 }, 30, 4, RL.WHITE )
end end

View File

@@ -121,7 +121,7 @@ function RL.draw()
RL.DrawCircle( ball.pos, ball.radius, RL.WHITE ) RL.DrawCircle( ball.pos, ball.radius, RL.WHITE )
-- Draw scire -- Draw scire
RL.DrawText( 0, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE ) RL.DrawText( RL.defaultFont, playerLeft.score, { 50, 10 }, 40, 2, RL.WHITE )
local rightTextSize = RL.MeasureText( 0, playerRight.score, 40, 2 ) local rightTextSize = RL.MeasureText( RL.defaultFont, playerRight.score, 40, 2 )
RL.DrawText( 0, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE ) RL.DrawText( RL.defaultFont, playerRight.score, { winSize[1] - 50 - rightTextSize[1], 10 }, 40, 2, RL.WHITE )
end end

View File

@@ -126,7 +126,7 @@ function RL.draw()
RL.DrawCircle( ball.pos, ball.radius, RL.WHITE ) RL.DrawCircle( ball.pos, ball.radius, RL.WHITE )
-- Draw score. -- Draw score.
RL.DrawText( 0, tostring( playerLeft.score ), { 50, 10 }, 40, 2, RL.WHITE ) RL.DrawText( RL.defaultFont, tostring( playerLeft.score ), { 50, 10 }, 40, 2, RL.WHITE )
local rightTextSize = Vec2:new( RL.MeasureText( 0, tostring( playerRight.score ), 40, 2 ) ) local rightTextSize = Vec2:new( RL.MeasureText( RL.defaultFont, tostring( playerRight.score ), 40, 2 ) )
RL.DrawText( 0, tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE ) RL.DrawText( RL.defaultFont, tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, 2, RL.WHITE )
end end

View File

@@ -53,7 +53,7 @@ function RL.draw()
RL.DrawGrid( 8, 1 ) RL.DrawGrid( 8, 1 )
RL.DrawRay( ray, { 255, 100, 100 } ) RL.DrawRay( ray, { 255, 100, 100 } )
RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() ) RL.DrawMesh( sphereMesh, RL.defaultMaterial, RL.MatrixIdentity() )
RL.DrawSphereWires( rayCol.point, 0.05, 4, 8, RL.BLUE ) RL.DrawSphereWires( rayCol.point, 0.05, 4, 8, RL.BLUE )
RL.DrawLine3D( rayCol.point, RL.Vector3Add( rayCol.point, rayCol.normal ), RL.GREEN ) RL.DrawLine3D( rayCol.point, RL.Vector3Add( rayCol.point, rayCol.normal ), RL.GREEN )
RL.EndMode3D() RL.EndMode3D()

View File

@@ -40,7 +40,7 @@ Gui = {
}, },
mouseButton = RL.MOUSE_BUTTON_LEFT, mouseButton = RL.MOUSE_BUTTON_LEFT,
font = 0, font = RL.defaultFont,
fontSize = 20, fontSize = 20,
padding = 2, padding = 2,
spacing = 4, spacing = 4,

View File

@@ -215,7 +215,7 @@ function RL.draw()
drawApple() drawApple()
if gameState == STATE.OVER then if gameState == STATE.OVER then
RL.DrawText( 0, "Press Enter to\nrestart", { 10, 10 }, 10, 2, RL.WHITE ) RL.DrawText( RL.defaultFont, "Press Enter to\nrestart", { 10, 10 }, 10, 2, RL.WHITE )
end end
RL.EndTextureMode() RL.EndTextureMode()

View File

@@ -35,7 +35,6 @@ static void defineBuffer() {
/* Image */ /* Image */
static int gcImage( lua_State *L ) { static int gcImage( lua_State *L ) {
Image *image = luaL_checkudata ( L, 1, "Image" ); Image *image = luaL_checkudata ( L, 1, "Image" );
printf( "gcImage\n" );
UnloadImage( *image ); UnloadImage( *image );
} }
@@ -53,7 +52,6 @@ static void defineImage() {
/* Texture */ /* Texture */
static int gcTexture( lua_State *L ) { static int gcTexture( lua_State *L ) {
Texture *texture = luaL_checkudata ( L, 1, "Texture" ); Texture *texture = luaL_checkudata ( L, 1, "Texture" );
printf( "gcTexture\n" );
UnloadTexture( *texture ); UnloadTexture( *texture );
} }
@@ -71,7 +69,6 @@ static void defineTexture() {
/* RenderRexture. */ /* RenderRexture. */
static int gcRenderTexture( lua_State *L ) { static int gcRenderTexture( lua_State *L ) {
RenderTexture *renderTexture = luaL_checkudata ( L, 1, "RenderTexture" ); RenderTexture *renderTexture = luaL_checkudata ( L, 1, "RenderTexture" );
printf( "gcRenderTexture\n" );
UnloadRenderTexture( *renderTexture ); UnloadRenderTexture( *renderTexture );
} }
@@ -107,7 +104,6 @@ static void defineCamera3D() {
/* Shader. */ /* Shader. */
static int gcShader( lua_State *L ) { static int gcShader( lua_State *L ) {
Shader *shader = luaL_checkudata ( L, 1, "Shader" ); Shader *shader = luaL_checkudata ( L, 1, "Shader" );
printf( "gcShader\n" );
UnloadShader( *shader ); UnloadShader( *shader );
} }
@@ -125,7 +121,6 @@ static void defineShader() {
/* Font. */ /* Font. */
static int gcFont( lua_State *L ) { static int gcFont( lua_State *L ) {
Font *font = luaL_checkudata ( L, 1, "Font" ); Font *font = luaL_checkudata ( L, 1, "Font" );
printf( "gcFont\n" );
UnloadFont( *font ); UnloadFont( *font );
} }
@@ -143,7 +138,6 @@ static void defineFont() {
/* Wave. */ /* Wave. */
static int gcWave( lua_State *L ) { static int gcWave( lua_State *L ) {
Wave *wave = luaL_checkudata ( L, 1, "Wave" ); Wave *wave = luaL_checkudata ( L, 1, "Wave" );
printf( "gcWave\n" );
UnloadWave( *wave ); UnloadWave( *wave );
} }
@@ -161,7 +155,6 @@ static void defineWave() {
/* Sound. */ /* Sound. */
static int gcSound( lua_State *L ) { static int gcSound( lua_State *L ) {
Sound *sound = luaL_checkudata ( L, 1, "Sound" ); Sound *sound = luaL_checkudata ( L, 1, "Sound" );
printf( "gcSound\n" );
UnloadSound( *sound ); UnloadSound( *sound );
} }
@@ -179,7 +172,6 @@ static void defineSound() {
/* Music. */ /* Music. */
static int gcMusic( lua_State *L ) { static int gcMusic( lua_State *L ) {
Music *music = luaL_checkudata ( L, 1, "Music" ); Music *music = luaL_checkudata ( L, 1, "Music" );
printf( "gcMusic\n" );
UnloadMusicStream( *music ); UnloadMusicStream( *music );
} }
@@ -206,7 +198,6 @@ static void defineLight() {
/* Material. */ /* Material. */
static int gcMaterial( lua_State *L ) { static int gcMaterial( lua_State *L ) {
Material *material = luaL_checkudata ( L, 1, "Material" ); Material *material = luaL_checkudata ( L, 1, "Material" );
printf( "gcMaterial\n" );
// int MAX_MATERIAL_MAPS = 12; // int MAX_MATERIAL_MAPS = 12;
@@ -238,7 +229,6 @@ static void defineMaterial() {
/* Mesh. */ /* Mesh. */
static int gcMesh( lua_State *L ) { static int gcMesh( lua_State *L ) {
Mesh *mesh = luaL_checkudata ( L, 1, "Mesh" ); Mesh *mesh = luaL_checkudata ( L, 1, "Mesh" );
printf( "gcMesh\n" );
UnloadMesh( *mesh ); UnloadMesh( *mesh );
} }
@@ -256,7 +246,6 @@ static void defineMesh() {
/* Model. */ /* Model. */
static int gcModel( lua_State *L ) { static int gcModel( lua_State *L ) {
Model *model = luaL_checkudata ( L, 1, "Model" ); Model *model = luaL_checkudata ( L, 1, "Model" );
printf( "gcModel\n" );
UnloadModel( *model ); UnloadModel( *model );
// UnloadModelKeepMeshes( *model ); // UnloadModelKeepMeshes( *model );
@@ -275,7 +264,6 @@ static void defineModel() {
/* ModelAnimation. */ /* ModelAnimation. */
static int gcModelAnimation( lua_State *L ) { static int gcModelAnimation( lua_State *L ) {
ModelAnimation *modelAnimation = luaL_checkudata ( L, 1, "ModelAnimation" ); ModelAnimation *modelAnimation = luaL_checkudata ( L, 1, "ModelAnimation" );
printf( "gcModelAnimation\n" );
UnloadModelAnimation( *modelAnimation ); UnloadModelAnimation( *modelAnimation );
} }

View File

@@ -335,7 +335,7 @@ Toggle Button control, returns true when active
*/ */
int lguiGuiToggle( lua_State *L ) { int lguiGuiToggle( lua_State *L ) {
Rectangle bounds = uluaGetRectangleIndex( L, 1 ); Rectangle bounds = uluaGetRectangleIndex( L, 1 );
bool checked = lua_toboolean( L, 3 ); bool checked = uluaGetBoolean( L, 3 );
lua_pushboolean( L, GuiToggle( bounds, luaL_checkstring( L, 2 ), checked ) ); lua_pushboolean( L, GuiToggle( bounds, luaL_checkstring( L, 2 ), checked ) );
@@ -367,7 +367,7 @@ Check Box control, returns true when active
*/ */
int lguiGuiCheckBox( lua_State *L ) { int lguiGuiCheckBox( lua_State *L ) {
Rectangle bounds = uluaGetRectangleIndex( L, 1 ); Rectangle bounds = uluaGetRectangleIndex( L, 1 );
bool checked = lua_toboolean( L, 3 ); bool checked = uluaGetBoolean( L, 3 );
lua_pushboolean( L, GuiCheckBox( bounds, luaL_checkstring( L, 2 ), checked ) ); lua_pushboolean( L, GuiCheckBox( bounds, luaL_checkstring( L, 2 ), checked ) );
@@ -403,7 +403,7 @@ int lguiGuiTextBox( lua_State *L ) {
// char text[ STRING_LEN ] = { '\0' }; // char text[ STRING_LEN ] = { '\0' };
char text[ textSize + 1 ]; char text[ textSize + 1 ];
strcpy( text, luaL_checkstring( L, 2 ) ); strcpy( text, luaL_checkstring( L, 2 ) );
bool editMode = lua_toboolean( L, 4 ); bool editMode = uluaGetBoolean( L, 4 );
lua_pushboolean( L, GuiTextBox( bounds, text, textSize, editMode ) ); lua_pushboolean( L, GuiTextBox( bounds, text, textSize, editMode ) );
lua_pushstring( L, text ); lua_pushstring( L, text );
@@ -424,7 +424,7 @@ int lguiGuiTextBoxMulti( lua_State *L ) {
// char text[ STRING_LEN ] = { '\0' }; // char text[ STRING_LEN ] = { '\0' };
char text[ textSize + 1 ]; char text[ textSize + 1 ];
strcpy( text, luaL_checkstring( L, 2 ) ); strcpy( text, luaL_checkstring( L, 2 ) );
bool editMode = lua_toboolean( L, 4 ); bool editMode = uluaGetBoolean( L, 4 );
lua_pushboolean( L, GuiTextBoxMulti( bounds, text, textSize, editMode ) ); lua_pushboolean( L, GuiTextBoxMulti( bounds, text, textSize, editMode ) );
lua_pushstring( L, text ); lua_pushstring( L, text );
@@ -444,7 +444,7 @@ int lguiGuiSpinner( lua_State *L ) {
int value = luaL_checkinteger( L, 3 ); int value = luaL_checkinteger( L, 3 );
int minValue = luaL_checkinteger( L, 4 ); int minValue = luaL_checkinteger( L, 4 );
int maxValue = luaL_checkinteger( L, 5 ); int maxValue = luaL_checkinteger( L, 5 );
bool editMode = lua_toboolean( L, 6 ); bool editMode = uluaGetBoolean( L, 6 );
lua_pushboolean( L, GuiSpinner( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode ) ); lua_pushboolean( L, GuiSpinner( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode ) );
lua_pushinteger( L, value ); lua_pushinteger( L, value );
@@ -464,7 +464,7 @@ int lguiGuiValueBox( lua_State *L ) {
int value = luaL_checkinteger( L, 3 ); int value = luaL_checkinteger( L, 3 );
int minValue = luaL_checkinteger( L, 4 ); int minValue = luaL_checkinteger( L, 4 );
int maxValue = luaL_checkinteger( L, 5 ); int maxValue = luaL_checkinteger( L, 5 );
bool editMode = lua_toboolean( L, 6 ); bool editMode = uluaGetBoolean( L, 6 );
lua_pushboolean( L, GuiValueBox( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode ) ); lua_pushboolean( L, GuiValueBox( bounds, luaL_checkstring( L, 2 ), &value, minValue, maxValue, editMode ) );
lua_pushinteger( L, value ); lua_pushinteger( L, value );
@@ -554,7 +554,7 @@ Dropdown Box control, returns selected item
int lguiGuiDropdownBox( lua_State *L ) { int lguiGuiDropdownBox( lua_State *L ) {
Rectangle bounds = uluaGetRectangleIndex( L, 1 ); Rectangle bounds = uluaGetRectangleIndex( L, 1 );
int active = luaL_checkinteger( L, 3 ); int active = luaL_checkinteger( L, 3 );
bool editMode = lua_toboolean( L, 4 ); bool editMode = uluaGetBoolean( L, 4 );
lua_pushboolean( L, GuiDropdownBox( bounds, luaL_checkstring( L, 2 ), &active, editMode ) ); lua_pushboolean( L, GuiDropdownBox( bounds, luaL_checkstring( L, 2 ), &active, editMode ) );
lua_pushinteger( L, active ); lua_pushinteger( L, active );

View File

@@ -929,7 +929,7 @@ Load a vertex buffer attribute
*/ */
int lrlglLoadVertexBuffer( lua_State *L ) { int lrlglLoadVertexBuffer( lua_State *L ) {
Buffer *buffer = luaL_checkudata( L, 1, "Buffer" ); Buffer *buffer = luaL_checkudata( L, 1, "Buffer" );
bool dynamic = luaL_checkinteger( L, 2 ); bool dynamic = uluaGetBoolean( L, 2 );
lua_pushinteger( L, rlLoadVertexBuffer( buffer->data, buffer->size, dynamic ) ); lua_pushinteger( L, rlLoadVertexBuffer( buffer->data, buffer->size, dynamic ) );
@@ -945,7 +945,7 @@ Load a new attributes element buffer
*/ */
int lrlglLoadVertexBufferElement( lua_State *L ) { int lrlglLoadVertexBufferElement( lua_State *L ) {
Buffer *buffer = luaL_checkudata( L, 1, "Buffer" ); Buffer *buffer = luaL_checkudata( L, 1, "Buffer" );
bool dynamic = luaL_checkinteger( L, 2 ); bool dynamic = uluaGetBoolean( L, 2 );
lua_pushinteger( L, rlLoadVertexBufferElement( buffer->data, buffer->size, dynamic ) ); lua_pushinteger( L, rlLoadVertexBufferElement( buffer->data, buffer->size, dynamic ) );
@@ -1013,7 +1013,7 @@ int lrlglSetVertexAttribute( lua_State *L ) {
int index = luaL_checkinteger( L, 1 ); int index = luaL_checkinteger( L, 1 );
int compSize = luaL_checkinteger( L, 2 ); int compSize = luaL_checkinteger( L, 2 );
int type = luaL_checkinteger( L, 3 ); int type = luaL_checkinteger( L, 3 );
bool normalized = lua_toboolean( L, 4 ); bool normalized = uluaGetBoolean( L, 4 );
int stride = luaL_checkinteger( L, 5 ); int stride = luaL_checkinteger( L, 5 );
int pointer = luaL_checkinteger( L, 6 ); int pointer = luaL_checkinteger( L, 6 );
@@ -1151,7 +1151,7 @@ Load depth texture/renderbuffer (to be attached to fbo)
*/ */
int lrlglLoadTextureDepth( lua_State *L ) { int lrlglLoadTextureDepth( lua_State *L ) {
Vector2 size = uluaGetVector2Index( L, 1 ); Vector2 size = uluaGetVector2Index( L, 1 );
bool useRenderBuffer = lua_toboolean( L, 2 ); bool useRenderBuffer = uluaGetBoolean( L, 2 );
lua_pushinteger( L, rlLoadTextureDepth( size.x, size.y, useRenderBuffer ) ); lua_pushinteger( L, rlLoadTextureDepth( size.x, size.y, useRenderBuffer ) );