Review ALL examples
This commit is contained in:
parent
a43a7980a3
commit
b525039e0a
96 changed files with 1301 additions and 1317 deletions
|
@ -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
|
||||
//--------------------------------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue