diff options
| author | jussi | 2024-12-10 21:50:10 +0200 |
|---|---|---|
| committer | jussi | 2024-12-10 21:50:10 +0200 |
| commit | cdb719b23998f4ba73cf3c696c7a82e2f4dc5342 (patch) | |
| tree | 5d18ff52578014ee62dd57d6ba27d3ef6ccea711 /examples | |
| parent | cb2b0e4dff5e1d98054f9e5f809fd3a14cd220a1 (diff) | |
| download | reilua-enhanced-cdb719b23998f4ba73cf3c696c7a82e2f4dc5342.tar.gz reilua-enhanced-cdb719b23998f4ba73cf3c696c7a82e2f4dc5342.tar.bz2 reilua-enhanced-cdb719b23998f4ba73cf3c696c7a82e2f4dc5342.zip | |
EXPOSE_API_SYMBOLS, SetShaderValueWithBuffer and SetShaderValueVWithBuffer.
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/pong/main.lua | 22 | ||||
| -rw-r--r-- | examples/resources/lib/vector2.lua | 2 | ||||
| -rw-r--r-- | examples/shaders/main.lua | 6 | ||||
| -rw-r--r-- | examples/snake/main.lua | 2 |
4 files changed, 16 insertions, 16 deletions
diff --git a/examples/pong/main.lua b/examples/pong/main.lua index 4211d3f..8de5de9 100644 --- a/examples/pong/main.lua +++ b/examples/pong/main.lua @@ -1,9 +1,9 @@ package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua" -Vec2 = require "vector2" +Vector2 = require "vector2" -- Settings. -local winSize = Vec2:new( 800, 600 ) +local winSize = Vector2:new( 800, 600 ) local monitor = 0 -- Constants. @@ -12,19 +12,19 @@ local BALL_SPEED = 330 -- Pixels per second. -- Game objects. local playerLeft = { - pos = Vec2:new( 0, 0 ), - size = Vec2:new( 10, 70 ), + pos = Vector2:new( 0, 0 ), + size = Vector2:new( 10, 70 ), score = 0, } local playerRight = { - pos = Vec2:new( 0, 0 ), - size = Vec2:new( 10, 70 ), + pos = Vector2:new( 0, 0 ), + size = Vector2:new( 10, 70 ), score = 0, } local ball = { - pos = Vec2:new( 0, 0 ), + pos = Vector2:new( 0, 0 ), radius = 8.0, - vel = Vec2:new( 0, 0 ), + vel = Vector2:new( 0, 0 ), } local function reset() @@ -54,8 +54,8 @@ end function RL.init() -- Set window to center of monitor. - local mPos = Vec2:newT( RL.GetMonitorPosition( monitor ) ) - local mSize = Vec2:newT( RL.GetMonitorSize( monitor ) ) + local mPos = Vector2:newT( RL.GetMonitorPosition( monitor ) ) + local mSize = Vector2:newT( RL.GetMonitorSize( monitor ) ) RL.SetConfigFlags( RL.FLAG_VSYNC_HINT ) RL.SetWindowSize( winSize ) @@ -125,6 +125,6 @@ function RL.draw() -- Draw score. RL.DrawText( tostring( playerLeft.score ), { 50, 10 }, 40, RL.WHITE ) - local rightTextSize = Vec2:newT( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) ) + local rightTextSize = Vector2:newT( RL.MeasureTextEx( RL.GetFontDefault(), tostring( playerRight.score ), 40, 2 ) ) RL.DrawText( tostring( playerRight.score ), { winSize.x - 50 - rightTextSize.x, 10 }, 40, RL.WHITE ) end diff --git a/examples/resources/lib/vector2.lua b/examples/resources/lib/vector2.lua index 6da1977..d46f2af 100644 --- a/examples/resources/lib/vector2.lua +++ b/examples/resources/lib/vector2.lua @@ -164,7 +164,7 @@ function Vector2:lineAngle( v2 ) end function Vector2:atan2() - return math.atan( self.y, self.x ) + return math.atan2 and math.atan2( self.y, self.x ) or math.atan( self.y, self.x ) end function Vector2:scale( scale ) diff --git a/examples/shaders/main.lua b/examples/shaders/main.lua index e5f59ed..3ab72a2 100644 --- a/examples/shaders/main.lua +++ b/examples/shaders/main.lua @@ -1,7 +1,7 @@ local monitor = 0 -local shader = -1 -local texture = -1 -local textureSize +local shader = nil +local texture = nil +local textureSize = nil local GLSL_VERSION = "330" -- PLATFORM_DESKTOP -- local GLSL_VERSION = "100" -- PLATFORM_RPI, PLATFORM_ANDROID, PLATFORM_WEB diff --git a/examples/snake/main.lua b/examples/snake/main.lua index f88794f..03a3918 100644 --- a/examples/snake/main.lua +++ b/examples/snake/main.lua @@ -114,7 +114,7 @@ local function moveSnake() snake.heading:set( snake.control.x, snake.control.y ) snake.headPos:set( snake.headPos.x + snake.heading.x, snake.headPos.y + snake.heading.y ) - -- Check appple eating. + -- Check apple eating. if snake.headPos == applePos then snake.grow = snake.grow + 1 setApplePos() |
