summaryrefslogtreecommitdiffhomepage
path: root/examples/shaders/shaders_shapes_textures.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_shapes_textures.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/shaders/shaders_shapes_textures.c')
-rw-r--r--examples/shaders/shaders_shapes_textures.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/shaders/shaders_shapes_textures.c b/examples/shaders/shaders_shapes_textures.c
index 5ee5d560..cf53bf99 100644
--- a/examples/shaders/shaders_shapes_textures.c
+++ b/examples/shaders/shaders_shapes_textures.c
@@ -24,23 +24,23 @@
#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 - shapes and texture shaders");
-
+
Texture2D fudesumi = LoadTexture("resources/fudesumi.png");
// Load shader to be used on some parts drawing
- // NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
+ // NOTE 1: Using GLSL 330 shader version, on OpenGL ES 2.0 use GLSL 100 shader version
// NOTE 2: Defining 0 (NULL) for vertex shader forces usage of internal default vertex shader
Shader shader = LoadShader(0, FormatText("resources/shaders/glsl%i/grayscale.fs", GLSL_VERSION));
- SetTargetFPS(60);
+ SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------
// Main game loop
@@ -56,19 +56,19 @@ int main()
BeginDrawing();
ClearBackground(RAYWHITE);
-
+
// Start drawing with default shader
DrawText("USING DEFAULT SHADER", 20, 40, 10, RED);
-
+
DrawCircle(80, 120, 35, DARKBLUE);
DrawCircleGradient(80, 220, 60, GREEN, SKYBLUE);
DrawCircleLines(80, 340, 80, DARKBLUE);
-
+
// Activate our custom shader to be applied on next shapes/textures drawings
BeginShaderMode(shader);
-
+
DrawText("USING CUSTOM SHADER", 190, 40, 10, RED);
DrawRectangle(250 - 60, 90, 120, 60, RED);
@@ -77,29 +77,29 @@ int main()
// Activate our default shader for next drawings
EndShaderMode();
-
+
DrawText("USING DEFAULT SHADER", 370, 40, 10, RED);
-
+
DrawTriangle((Vector2){430, 80},
(Vector2){430 - 60, 150},
(Vector2){430 + 60, 150}, VIOLET);
-
+
DrawTriangleLines((Vector2){430, 160},
(Vector2){430 - 20, 230},
(Vector2){430 + 20, 230}, DARKBLUE);
DrawPoly((Vector2){430, 320}, 6, 80, 0, BROWN);
-
+
// Activate our custom shader to be applied on next shapes/textures drawings
BeginShaderMode(shader);
DrawTexture(fudesumi, 500, -30, WHITE); // Using custom shader
-
+
// Activate our default shader for next drawings
EndShaderMode();
-
+
DrawText("(c) Fudesumi sprite by Eiden Marsal", 380, screenHeight - 20, 10, GRAY);
-
+
EndDrawing();
//----------------------------------------------------------------------------------
}
@@ -108,7 +108,7 @@ int main()
//--------------------------------------------------------------------------------------
UnloadShader(shader); // Unload shader
UnloadTexture(fudesumi); // Unload texture
-
+
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------