summaryrefslogtreecommitdiffhomepage
path: root/examples/textures/textures_image_generation.c
diff options
context:
space:
mode:
authorRay <[email protected]>2019-05-20 16:36:42 +0200
committerRay <[email protected]>2019-05-20 16:36:42 +0200
commitb525039e0ab8bcaa2fd6bde34c72a6405f88ae49 (patch)
tree08f1c79bfe693643564ed78202c9474b7eb83a79 /examples/textures/textures_image_generation.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/textures/textures_image_generation.c')
-rw-r--r--examples/textures/textures_image_generation.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/textures/textures_image_generation.c b/examples/textures/textures_image_generation.c
index b9608c89..d9a39a25 100644
--- a/examples/textures/textures_image_generation.c
+++ b/examples/textures/textures_image_generation.c
@@ -13,12 +13,12 @@
#define NUM_TEXTURES 7 // Currently we have 7 generation algorithms
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [textures] example - procedural images generation");
@@ -38,7 +38,7 @@ int main()
textures[4] = LoadTextureFromImage(whiteNoise);
textures[5] = LoadTextureFromImage(perlinNoise);
textures[6] = LoadTextureFromImage(cellular);
-
+
// Unload image data (CPU RAM)
UnloadImage(verticalGradient);
UnloadImage(horizontalGradient);
@@ -49,10 +49,10 @@ int main()
UnloadImage(cellular);
int currentTexture = 0;
-
+
SetTargetFPS(60);
//---------------------------------------------------------------------------------------
-
+
// Main game loop
while (!WindowShouldClose())
{
@@ -67,15 +67,15 @@ int main()
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
-
+
ClearBackground(RAYWHITE);
-
+
DrawTexture(textures[currentTexture], 0, 0, WHITE);
-
+
DrawRectangle(30, 400, 325, 30, Fade(SKYBLUE, 0.5f));
DrawRectangleLines(30, 400, 325, 30, Fade(WHITE, 0.5f));
DrawText("MOUSE LEFT BUTTON to CYCLE PROCEDURAL TEXTURES", 40, 410, 10, WHITE);
-
+
switch(currentTexture)
{
case 0: DrawText("VERTICAL GRADIENT", 560, 10, 20, RAYWHITE); break;
@@ -87,19 +87,19 @@ int main()
case 6: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break;
default: break;
}
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
-
+
// Unload textures data (GPU VRAM)
for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]);
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
-
+
return 0;
}