EXPOSE_API_SYMBOLS, SetShaderValueWithBuffer and SetShaderValueVWithBuffer.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user