Removed autoset fps.
This commit is contained in:
@@ -59,6 +59,7 @@ function init()
|
|||||||
local mPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
|
local mPos = Vec2:new( RL_GetMonitorPosition( monitor ) )
|
||||||
local mSize = Vec2:new( RL_GetMonitorSize( monitor ) )
|
local mSize = Vec2:new( RL_GetMonitorSize( monitor ) )
|
||||||
|
|
||||||
|
RL_SetConfigFlags( FLAG_VSYNC_HINT )
|
||||||
RL_SetWindowSize( winSize )
|
RL_SetWindowSize( winSize )
|
||||||
RL_SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } )
|
RL_SetWindowPosition( { mPos.x + mSize.x / 2 - winSize.x / 2, mPos.y + mSize.y / 2 - winSize.y / 2 } )
|
||||||
RL_SetWindowTitle( "Pong" )
|
RL_SetWindowTitle( "Pong" )
|
||||||
|
|||||||
@@ -158,11 +158,11 @@ end
|
|||||||
|
|
||||||
--[[ Check if next segment is on left side. There are more mathematically elegant solution to this, but there is
|
--[[ Check if next segment is on left side. There are more mathematically elegant solution to this, but there is
|
||||||
only four possibilities so we can just check them all. ]]--
|
only four possibilities so we can just check them all. ]]--
|
||||||
local function onLeft( this, next )
|
local function onLeft( this, nextSeg )
|
||||||
return ( vector2IsEqual( this, { 0, -1 } ) and vector2IsEqual( next, { -1, 0 } ) )
|
return ( vector2IsEqual( this, { 0, -1 } ) and vector2IsEqual( nextSeg, { -1, 0 } ) )
|
||||||
or ( vector2IsEqual( this, { -1, 0 } ) and vector2IsEqual( next, { 0, 1 } ) )
|
or ( vector2IsEqual( this, { -1, 0 } ) and vector2IsEqual( nextSeg, { 0, 1 } ) )
|
||||||
or ( vector2IsEqual( this, { 0, 1 } ) and vector2IsEqual( next, { 1, 0 } ) )
|
or ( vector2IsEqual( this, { 0, 1 } ) and vector2IsEqual( nextSeg, { 1, 0 } ) )
|
||||||
or ( vector2IsEqual( this, { 1, 0 } ) and vector2IsEqual( next, { 0, -1 } ) )
|
or ( vector2IsEqual( this, { 1, 0 } ) and vector2IsEqual( nextSeg, { 0, -1 } ) )
|
||||||
end
|
end
|
||||||
|
|
||||||
local function drawSnake()
|
local function drawSnake()
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ typedef struct {
|
|||||||
bool run;
|
bool run;
|
||||||
lua_State *luaState;
|
lua_State *luaState;
|
||||||
Vector2 resolution;
|
Vector2 resolution;
|
||||||
int targetFPS;
|
|
||||||
int textureSource;
|
int textureSource;
|
||||||
/* Resources. */
|
/* Resources. */
|
||||||
/* Images. */
|
/* Images. */
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ bool stateInit( const char *exePath ) {
|
|||||||
state->run = true;
|
state->run = true;
|
||||||
state->resolution = (Vector2){ 1024, 720 };
|
state->resolution = (Vector2){ 1024, 720 };
|
||||||
state->luaState = NULL;
|
state->luaState = NULL;
|
||||||
state->targetFPS = 60;
|
|
||||||
state->textureSource = TEXTURE_SOURCE_TEXTURE;
|
state->textureSource = TEXTURE_SOURCE_TEXTURE;
|
||||||
/* Images. */
|
/* Images. */
|
||||||
state->imageAlloc = ALLOC_PAGE_SIZE;
|
state->imageAlloc = ALLOC_PAGE_SIZE;
|
||||||
@@ -106,12 +105,10 @@ bool stateInit( const char *exePath ) {
|
|||||||
state->hasWindow = false;
|
state->hasWindow = false;
|
||||||
state->run = false;
|
state->run = false;
|
||||||
}
|
}
|
||||||
else {
|
if ( state->run ) {
|
||||||
SetTargetFPS( state->targetFPS );
|
|
||||||
}
|
|
||||||
|
|
||||||
InitAudioDevice();
|
InitAudioDevice();
|
||||||
state->run = luaInit();
|
state->run = luaInit();
|
||||||
|
}
|
||||||
|
|
||||||
return state->run;
|
return state->run;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user