summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjussi2022-09-22 20:25:18 +0300
committerjussi2022-09-22 20:25:18 +0300
commit0fad8239b626678980f7f8093c0602acbe5c817b (patch)
tree2c6f9f3fcf0f873c89d231d512fe1c006e9f7074
parente5f437d05e8277861ea85e6c8d2ede32c4be32ef (diff)
downloadreilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.gz
reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.bz2
reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.zip
v0.3.
-rw-r--r--API.md3
-rw-r--r--examples/dungeon_crawler/main.lua2
-rw-r--r--examples/gui/main.lua3
-rw-r--r--examples/platformer/main.lua28
-rw-r--r--examples/point_triangle_collision/main.lua2
-rw-r--r--src/models.c13
6 files changed, 15 insertions, 36 deletions
diff --git a/API.md b/API.md
index 793d6c2..40e005f 100644
--- a/API.md
+++ b/API.md
@@ -4017,7 +4017,8 @@ Generate custom mesh from vertex attribute data and uploads it into a VAO ( if s
> success = RL_UpdateMesh( Mesh{} )
-Update mesh vertex data in GPU. ( Mainly intented to be used with custom meshes )
+Update mesh vertex data in GPU.
+Note! Mainly intented to be used with custom meshes.
- Failure return false
- Success return true
diff --git a/examples/dungeon_crawler/main.lua b/examples/dungeon_crawler/main.lua
index 070eb97..9465ed3 100644
--- a/examples/dungeon_crawler/main.lua
+++ b/examples/dungeon_crawler/main.lua
@@ -2,7 +2,6 @@ local pos = { 2, 0.5, 6 }
local speed = 5.0
local camera = -1
local texture = -1
-local mesh = -1
local textureSize = { 256, 96 }
local res = { 384, 216 }
local winSize = RL_GetWindowSize()
@@ -79,7 +78,6 @@ function init()
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
camera = RL_CreateCamera3D()
- mesh = RL_GenMeshCube( { 1, 2, 1 } )
RL_SetCamera3DPosition( camera, pos )
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
diff --git a/examples/gui/main.lua b/examples/gui/main.lua
index e412201..e569b0a 100644
--- a/examples/gui/main.lua
+++ b/examples/gui/main.lua
@@ -24,11 +24,12 @@ function init()
local monitor = 0
local mPos = RL_GetMonitorPosition( monitor )
local mSize = RL_GetMonitorSize( monitor )
- local winSize = RL_GetWindowSize()
+ 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 } )
end
diff --git a/examples/platformer/main.lua b/examples/platformer/main.lua
index 0032d0d..d68b3b8 100644
--- a/examples/platformer/main.lua
+++ b/examples/platformer/main.lua
@@ -32,7 +32,7 @@ local tilemap = {
local player = {
vel = Vec2:new( 0, 0 ),
- pos = Vec2:new( 32, 32 ), -- Center down.
+ pos = Vec2:new( 32, 32 ), -- Center bottom.
colRect = { 0, 0, 12, 14 },
onFloor = false,
frames = {
@@ -49,11 +49,6 @@ local player = {
facing = 1,
}
-local kissa = { Vec2:new( 2, 4 ), 23 }
-
--- print( table.concat( kissa ) )
-print( kissa[1] )
-
local function createMap()
for x = 1, tilemap.size.x do
table.insert( tilemap.tiles, {} )
@@ -199,16 +194,6 @@ local function playerMovement( delta )
end
end
- -- Alternative top down movement.
-
- -- if RL_IsKeyDown( KEY_DOWN ) then
- -- player.vel.y = player.vel.y + PLAYER_ACCELL * delta
- -- moving[2] = true
- -- elseif RL_IsKeyDown( KEY_UP ) then
- -- player.vel.y = player.vel.y - PLAYER_ACCELL * delta
- -- moving[2] = true
- -- end
-
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then
player.vel.y = -JUMP_STR
player.onFloor = false
@@ -226,18 +211,7 @@ local function playerMovement( delta )
end
end
- -- if not moving[2] then
- -- if delta * PLAYER_DEACCELL < player.vel.y then
- -- player.vel.y = player.vel.y - PLAYER_DEACCELL * delta
- -- elseif player.vel.y < -delta * PLAYER_DEACCELL then
- -- player.vel.y = player.vel.y + PLAYER_DEACCELL * delta
- -- else
- -- player.vel.y = 0.0
- -- end
- -- end
-
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
- -- player.vel.y = util.clamp( player.vel.y, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
player.vel.y = player.vel.y + GRAVITY * delta
diff --git a/examples/point_triangle_collision/main.lua b/examples/point_triangle_collision/main.lua
index 0a7c1ea..3c16e5e 100644
--- a/examples/point_triangle_collision/main.lua
+++ b/examples/point_triangle_collision/main.lua
@@ -45,6 +45,8 @@ function init()
RL_SetCameraMode( camera, CAMERA_FREE )
calcNormal( tri )
+
+ texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
end
local function checkCollisionPointTriangle( p, a, b, c, n )
diff --git a/src/models.c b/src/models.c
index 3028459..bc84f6c 100644
--- a/src/models.c
+++ b/src/models.c
@@ -567,7 +567,7 @@ Note! Could be replaced something like "DrawPlaneTextureRec"
- Success return true
*/
int lmodelDrawQuad3DTexture( lua_State *L ) {
- if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
+ if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawQuad3DTexture( texture, Vector3{} vertices, Vector2{} texCoords, Color color )" );
lua_pushboolean( L, false );
return 1;
@@ -605,6 +605,10 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
lua_pop( L, 1 );
}
lua_pop( L, 1 );
+
+ //TODO Normals. maybe something like Vector3Normalize(Vector3CrossProduct(Vector3Subtract(vB, vA), Vector3Subtract(vC, vA)));
+
+ /* Texture. */
size_t texId = lua_tointeger( L, -1 );
if ( !validSourceTexture( texId ) ) {
@@ -612,12 +616,10 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
return 1;
}
- // Draw.
+ /* Draw. */
rlCheckRenderBatchLimit( 4 );
rlSetTexture( texturesGetSourceTexture( texId )->id );
- //TODO Normals. maybe something like Vector3Normalize(Vector3CrossProduct(Vector3Subtract(vB, vA), Vector3Subtract(vC, vA)));
-
rlBegin( RL_QUADS );
rlColor4ub( color.r, color.g, color.b, color.a );
@@ -1091,7 +1093,8 @@ int lmodelsGenMeshCustom( lua_State *L ) {
/*
> success = RL_UpdateMesh( Mesh{} )
-Update mesh vertex data in GPU. ( Mainly intented to be used with custom meshes )
+Update mesh vertex data in GPU.
+Note! Mainly intented to be used with custom meshes.
- Failure return false
- Success return true