diff options
Diffstat (limited to 'examples/textures_srcrec_dstrec.c')
| -rw-r--r-- | examples/textures_srcrec_dstrec.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/textures_srcrec_dstrec.c b/examples/textures_srcrec_dstrec.c index 27d9610e..1f0b56e2 100644 --- a/examples/textures_srcrec_dstrec.c +++ b/examples/textures_srcrec_dstrec.c @@ -19,11 +19,11 @@ int main() int screenHeight = 450; InitWindow(screenWidth, screenHeight, "raylib [textures] examples - texture source and destination rectangles"); - + // NOTE: Textures MUST be loaded after Window initialization (OpenGL context is required) Texture2D texture = LoadTexture("resources/raylib_logo.png"); // Texture loading - // NOTE: Source rectangle (part of the texture to use for drawing) + // NOTE: Source rectangle (part of the texture to use for drawing) Rectangle sourceRec = { 128, 128, 128, 128 }; // NOTE: Destination rectangle (screen rectangle where drawing part of texture) @@ -32,7 +32,7 @@ int main() // NOTE: Origin of the texture in case of rotation, it's relative to destination rectangle size Vector2 origin = { 128, 128 }; //-------------------------------------------------------------------------------------- - + // Main game loop while (!WindowShouldClose()) // Detect window close button or ESC key { @@ -40,19 +40,19 @@ int main() //---------------------------------------------------------------------------------- // TODO: Update your variables here //---------------------------------------------------------------------------------- - + // Draw //---------------------------------------------------------------------------------- BeginDrawing(); - + ClearBackground(RAYWHITE); - + // NOTE: Using DrawTexturePro() we can easily rotate and scale the part of the texture we draw DrawTexturePro(texture, sourceRec, destRec, origin, 45, LIGHTGRAY); - + DrawLine(destRec.x, 0, destRec.x, screenHeight, RED); DrawLine(0, destRec.y, screenWidth, destRec.y, RED); - + EndDrawing(); //---------------------------------------------------------------------------------- } @@ -60,9 +60,9 @@ int main() // De-Initialization //-------------------------------------------------------------------------------------- UnloadTexture(texture); // Texture unloading - + CloseWindow(); // Close window and OpenGL context //-------------------------------------------------------------------------------------- - + return 0; }
\ No newline at end of file |
