diff options
| author | Ray <[email protected]> | 2019-05-20 16:40:30 +0200 |
|---|---|---|
| committer | Ray <[email protected]> | 2019-05-20 16:40:30 +0200 |
| commit | 3d7d174c70b2d00fd879ade64c5085d4ff34d4aa (patch) | |
| tree | 3b690948f186f855aa2ee8bab312b3ca28a56200 /examples/web/textures/textures_image_generation.c | |
| parent | 0b56b996bd053ec875c229e9793f7806b666839c (diff) | |
| download | raylib.com-3d7d174c70b2d00fd879ade64c5085d4ff34d4aa.tar.gz raylib.com-3d7d174c70b2d00fd879ade64c5085d4ff34d4aa.zip | |
Review and recompile ALL examples
Diffstat (limited to 'examples/web/textures/textures_image_generation.c')
| -rw-r--r-- | examples/web/textures/textures_image_generation.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/web/textures/textures_image_generation.c b/examples/web/textures/textures_image_generation.c index 25da8a9..4601d4a 100644 --- a/examples/web/textures/textures_image_generation.c +++ b/examples/web/textures/textures_image_generation.c @@ -20,20 +20,20 @@ //---------------------------------------------------------------------------------- // Global Variables Definition //---------------------------------------------------------------------------------- -int screenWidth = 800; -int screenHeight = 450; +const int screenWidth = 800; +const int screenHeight = 450; -Texture2D textures[NUM_TEXTURES]; +Texture2D textures[NUM_TEXTURES] = { 0 }; int currentTexture = 0; - + //---------------------------------------------------------------------------------- // Module Functions Declaration //---------------------------------------------------------------------------------- void UpdateDrawFrame(void); // Update and Draw one frame //---------------------------------------------------------------------------------- -// Main Enry Point +// Program Main Entry Point //---------------------------------------------------------------------------------- int main(void) { @@ -43,10 +43,10 @@ int main(void) Image verticalGradient = GenImageGradientV(screenWidth, screenHeight, RED, BLUE); Image horizontalGradient = GenImageGradientH(screenWidth, screenHeight, RED, BLUE); - Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.f, WHITE, BLACK); + Image radialGradient = GenImageGradientRadial(screenWidth, screenHeight, 0.0f, WHITE, BLACK); Image checked = GenImageChecked(screenWidth, screenHeight, 32, 32, RED, BLUE); Image whiteNoise = GenImageWhiteNoise(screenWidth, screenHeight, 0.5f); - Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 8.f); + Image perlinNoise = GenImagePerlinNoise(screenWidth, screenHeight, 50, 50, 4.0f); Image cellular = GenImageCellular(screenWidth, screenHeight, 32); textures[0] = LoadTextureFromImage(verticalGradient); @@ -56,7 +56,7 @@ int main(void) textures[4] = LoadTextureFromImage(whiteNoise); textures[5] = LoadTextureFromImage(perlinNoise); textures[6] = LoadTextureFromImage(cellular); - + // Unload image data (CPU RAM) UnloadImage(verticalGradient); UnloadImage(horizontalGradient); @@ -64,14 +64,14 @@ int main(void) UnloadImage(checked); UnloadImage(whiteNoise); UnloadImage(perlinNoise); - UnloadImage(cellular); - + UnloadImage(cellular); + #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,10 +81,10 @@ int main(void) // De-Initialization //-------------------------------------------------------------------------------------- - + // Unload textures data (GPU VRAM) for (int i = 0; i < NUM_TEXTURES; i++) UnloadTexture(textures[i]); - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- @@ -107,15 +107,15 @@ void UpdateDrawFrame(void) // 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; @@ -127,7 +127,7 @@ void UpdateDrawFrame(void) case 6: DrawText("CELLULAR", 670, 10, 20, RAYWHITE); break; default: break; } - + EndDrawing(); //---------------------------------------------------------------------------------- } |
