summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders/shaders_texture_drawing.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/shaders/shaders_texture_drawing.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/shaders/shaders_texture_drawing.c')
-rw-r--r--examples/shaders/shaders_texture_drawing.c19
1 files changed, 10 insertions, 9 deletions
diff --git a/examples/shaders/shaders_texture_drawing.c b/examples/shaders/shaders_texture_drawing.c
index 3a540098..697000bc 100644
--- a/examples/shaders/shaders_texture_drawing.c
+++ b/examples/shaders/shaders_texture_drawing.c
@@ -21,12 +21,12 @@
#define GLSL_VERSION 100
#endif
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const int screenHeight = 450;
InitWindow(screenWidth, screenHeight, "raylib [shaders] example - texture drawing");
@@ -41,17 +41,18 @@ int main()
int timeLoc = GetShaderLocation(shader, "uTime");
SetShaderValue(shader, timeLoc, &time, UNIFORM_FLOAT);
- SetTargetFPS(60);
- //--------------------------------------------------------------------------------------
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
+ // -------------------------------------------------------------------------------------------------------------
- while (!WindowShouldClose())
+ // Main game loop
+ while (!WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
time = GetTime();
SetShaderValue(shader, timeLoc, &time, UNIFORM_FLOAT);
//----------------------------------------------------------------------------------
-
+
// Draw
//----------------------------------------------------------------------------------
BeginDrawing();
@@ -61,13 +62,13 @@ int main()
BeginShaderMode(shader); // Enable our custom shader for next shapes/textures drawings
DrawTexture(texture, 0, 0, WHITE); // Drawing BLANK texture, all magic happens on shader
EndShaderMode(); // Disable our custom shader, return to default shader
-
+
DrawText("BACKGROUND is PAINTED and ANIMATED on SHADER!", 10, 10, 20, MAROON);
EndDrawing();
//----------------------------------------------------------------------------------
}
-
+
// De-Initialization
//--------------------------------------------------------------------------------------
UnloadShader(shader);