diff options
| author | jussi | 2022-09-22 20:25:18 +0300 |
|---|---|---|
| committer | jussi | 2022-09-22 20:25:18 +0300 |
| commit | 0fad8239b626678980f7f8093c0602acbe5c817b (patch) | |
| tree | 2c6f9f3fcf0f873c89d231d512fe1c006e9f7074 /examples | |
| parent | e5f437d05e8277861ea85e6c8d2ede32c4be32ef (diff) | |
| download | reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.gz reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.tar.bz2 reilua-enhanced-0fad8239b626678980f7f8093c0602acbe5c817b.zip | |
v0.3.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/dungeon_crawler/main.lua | 2 | ||||
| -rw-r--r-- | examples/gui/main.lua | 3 | ||||
| -rw-r--r-- | examples/platformer/main.lua | 28 | ||||
| -rw-r--r-- | examples/point_triangle_collision/main.lua | 2 |
4 files changed, 5 insertions, 30 deletions
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 ) |
