summaryrefslogtreecommitdiffhomepage
path: root/examples/web/shapes/shapes_easings_rectangle_array.c
diff options
context:
space:
mode:
Diffstat (limited to 'examples/web/shapes/shapes_easings_rectangle_array.c')
-rw-r--r--examples/web/shapes/shapes_easings_rectangle_array.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/examples/web/shapes/shapes_easings_rectangle_array.c b/examples/web/shapes/shapes_easings_rectangle_array.c
index dda786e..dcd452a 100644
--- a/examples/web/shapes/shapes_easings_rectangle_array.c
+++ b/examples/web/shapes/shapes_easings_rectangle_array.c
@@ -2,7 +2,7 @@
*
* raylib [shapes] example - easings rectangle array
*
-* NOTE: This example requires 'easings.h' library, provided on raylib/src. Just copy
+* NOTE: This example requires 'easings.h' library, provided on raylib/src. Just copy
* the library to same directory as example or make sure it's available on include path.
*
* This example has been created using raylib 2.0 (www.raylib.com)
@@ -40,7 +40,7 @@ Rectangle recs[MAX_RECS_X*MAX_RECS_Y];
float rotation = 0.0f;
int framesCounter = 0;
-int state = 0; // Rectangles animation state: 0-Playing, 1-Finished
+int state = 0; // Rectangles animation state: 0-Playing, 1-Finished
//----------------------------------------------------------------------------------
// Module Functions Declaration
@@ -48,14 +48,14 @@ int state = 0; // Rectangles animation state: 0-Playing, 1-Fini
void UpdateDrawFrame(void); // Update and Draw one frame
//----------------------------------------------------------------------------------
-// Main Enry Point
+// Program Main Entry Point
//----------------------------------------------------------------------------------
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
InitWindow(screenWidth, screenHeight, "raylib [shapes] example - easings rectangle array");
-
+
for (int y = 0; y < MAX_RECS_Y; y++)
{
for (int x = 0; x < MAX_RECS_X; x++)
@@ -66,13 +66,13 @@ int main()
recs[y*MAX_RECS_X + x].height = RECS_HEIGHT;
}
}
-
+
#if defined(PLATFORM_WEB)
emscripten_set_main_loop(UpdateDrawFrame, 0, 1);
#else
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
@@ -81,7 +81,7 @@ int main()
#endif
// De-Initialization
- //--------------------------------------------------------------------------------------
+ //--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
@@ -99,16 +99,16 @@ void UpdateDrawFrame(void)
{
framesCounter++;
- for (int i = 0; i < MAX_RECS_X*MAX_RECS_Y; i++)
+ for (int i = 0; i < MAX_RECS_X*MAX_RECS_Y; i++)
{
recs[i].height = EaseCircOut(framesCounter, RECS_HEIGHT, -RECS_HEIGHT, PLAY_TIME_IN_FRAMES);
recs[i].width = EaseCircOut(framesCounter, RECS_WIDTH, -RECS_WIDTH, PLAY_TIME_IN_FRAMES);
-
+
if (recs[i].height < 0) recs[i].height = 0;
if (recs[i].width < 0) recs[i].width = 0;
-
+
if ((recs[i].height == 0) && (recs[i].width == 0)) state = 1; // Finish playing
-
+
rotation = EaseLinearIn(framesCounter, 0.0f, 360.0f, PLAY_TIME_IN_FRAMES);
}
}
@@ -116,13 +116,13 @@ void UpdateDrawFrame(void)
{
// When animation has finished, press space to restart
framesCounter = 0;
-
- for (int i = 0; i < MAX_RECS_X*MAX_RECS_Y; i++)
+
+ for (int i = 0; i < MAX_RECS_X*MAX_RECS_Y; i++)
{
recs[i].height = RECS_HEIGHT;
recs[i].width = RECS_WIDTH;
}
-
+
state = 0;
}
//----------------------------------------------------------------------------------