added FPS cap to the HTML5 version
This commit is contained in:
parent
794d00a4d7
commit
920c7c5a07
2 changed files with 4 additions and 5 deletions
Binary file not shown.
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 1.6 MiB |
|
@ -58,9 +58,8 @@ int main(void)
|
||||||
|
|
||||||
gameSetup();
|
gameSetup();
|
||||||
|
|
||||||
|
|
||||||
#if defined(PLATFORM_WEB)
|
#if defined(PLATFORM_WEB)
|
||||||
emscripten_set_main_loop(gameLoop, 0, 1);
|
emscripten_set_main_loop(gameLoop, 60, 1);
|
||||||
#else
|
#else
|
||||||
SetTargetFPS(60);
|
SetTargetFPS(60);
|
||||||
|
|
||||||
|
@ -100,7 +99,7 @@ void gameSetup(void)
|
||||||
};
|
};
|
||||||
|
|
||||||
ball.position = (Vector2){ 50, 50 };
|
ball.position = (Vector2){ 50, 50 };
|
||||||
ball.speed = (Vector2){ 6.0f, 5.0f };
|
ball.speed = (Vector2){ 400.0f, 300.0f };
|
||||||
ball.radius = 20;
|
ball.radius = 20;
|
||||||
ball.growth = 2;
|
ball.growth = 2;
|
||||||
ball.color = MAROON;
|
ball.color = MAROON;
|
||||||
|
@ -169,8 +168,8 @@ void updateGame(void)
|
||||||
if (ball.active) {
|
if (ball.active) {
|
||||||
score++;
|
score++;
|
||||||
// moveiement oof the balls
|
// moveiement oof the balls
|
||||||
ball.position.x += ball.speed.x;
|
ball.position.x += GetFrameTime() * ball.speed.x;
|
||||||
ball.position.y += ball.speed.y;
|
ball.position.y += GetFrameTime() * ball.speed.y;
|
||||||
|
|
||||||
if (score >= bestscore) bestscore = score;
|
if (score >= bestscore) bestscore = score;
|
||||||
// Ballz to da wallz collies
|
// Ballz to da wallz collies
|
||||||
|
|
Loading…
Reference in a new issue