diff options
| author | Ray <[email protected]> | 2019-05-20 16:36:42 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-20 16:36:42 +0200 |
| commit | b525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch) | |
| tree | 08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/shapes/shapes_easings_ball_anim.c | |
| parent | a43a7980a30a52462956b23f2473e8ef8f38d1fb (diff) | |
| download | raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip | |
Review ALL examples
Diffstat (limited to 'examples/shapes/shapes_easings_ball_anim.c')
| -rw-r--r-- | examples/shapes/shapes_easings_ball_anim.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/shapes/shapes_easings_ball_anim.c b/examples/shapes/shapes_easings_ball_anim.c index 4477203c..5bb2b4c6 100644 --- a/examples/shapes/shapes_easings_ball_anim.c +++ b/examples/shapes/shapes_easings_ball_anim.c @@ -11,9 +11,9 @@ #include "raylib.h" -#include "easings.h" // Required for easing functions +#include "easings.h" // Required for easing functions -int main() +int main(void) { // Initialization //-------------------------------------------------------------------------------------- @@ -21,16 +21,16 @@ int main() const int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings ball anim"); - + // Ball variable value to be animated with easings int ballPositionX = -100; int ballRadius = 20; float ballAlpha = 0.0f; - + int state = 0; int framesCounter = 0; - - SetTargetFPS(60); + + SetTargetFPS(60); // Set our game to run at 60 frames-per-second //-------------------------------------------------------------------------------------- // Main game loop @@ -42,7 +42,7 @@ int main() { framesCounter++; ballPositionX = EaseElasticOut(framesCounter, -100, screenWidth/2 + 100, 120); - + if (framesCounter >= 120) { framesCounter = 0; @@ -53,7 +53,7 @@ int main() { framesCounter++; ballRadius = EaseElasticIn(framesCounter, 20, 500, 200); - + if (framesCounter >= 200) { framesCounter = 0; @@ -64,7 +64,7 @@ int main() { framesCounter++; ballAlpha = EaseCubicOut(framesCounter, 0.0f, 1.0f, 200); - + if (framesCounter >= 200) { framesCounter = 0; @@ -73,7 +73,7 @@ int main() } else if (state == 3) // Reset state to play again { - if (IsKeyPressed(KEY_ENTER)) + if (IsKeyPressed(KEY_ENTER)) { // Reset required variables to play again ballPositionX = -100; @@ -82,7 +82,7 @@ int main() state = 0; } } - + if (IsKeyPressed(KEY_R)) framesCounter = 0; //---------------------------------------------------------------------------------- @@ -94,15 +94,15 @@ int main() if (state >= 2) DrawRectangle(0, 0, screenWidth, screenHeight, GREEN); DrawCircle(ballPositionX, 200, ballRadius, Fade(RED, 1.0f - ballAlpha)); - + if (state == 3) DrawText("PRESS [ENTER] TO PLAY AGAIN!", 240, 200, 20, BLACK); - + EndDrawing(); //---------------------------------------------------------------------------------- } // De-Initialization - //-------------------------------------------------------------------------------------- + //-------------------------------------------------------------------------------------- CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- |
