summaryrefslogtreecommitdiffhomepage
path: root/examples/textures/textures_srcrec_dstrec.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/textures/textures_srcrec_dstrec.c
parenta43a7980a30a52462956b23f2473e8ef8f38d1fb (diff)
downloadraylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.tar.gz
raylib-b525039e0ab8bcaa2fd6bde34c72a6405f88ae49.zip
Review ALL examples
Diffstat (limited to 'examples/textures/textures_srcrec_dstrec.c')
-rw-r--r--examples/textures/textures_srcrec_dstrec.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/examples/textures/textures_srcrec_dstrec.c b/examples/textures/textures_srcrec_dstrec.c
index 298a0c65..e86b729d 100644
--- a/examples/textures/textures_srcrec_dstrec.c
+++ b/examples/textures/textures_srcrec_dstrec.c
@@ -11,32 +11,33 @@
#include "raylib.h"
-int main()
+int main(void)
{
// Initialization
//--------------------------------------------------------------------------------------
- int screenWidth = 800;
- int screenHeight = 450;
+ const int screenWidth = 800;
+ const 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 scarfy = LoadTexture("resources/scarfy.png"); // Texture loading
int frameWidth = scarfy.width/6;
int frameHeight = scarfy.height;
-
- // NOTE: Source rectangle (part of the texture to use for drawing)
+
+ // Source rectangle (part of the texture to use for drawing)
Rectangle sourceRec = { 0.0f, 0.0f, frameWidth, frameHeight };
- // NOTE: Destination rectangle (screen rectangle where drawing part of texture)
+ // Destination rectangle (screen rectangle where drawing part of texture)
Rectangle destRec = { screenWidth/2, screenHeight/2, frameWidth*2, frameHeight*2 };
- // NOTE: Origin of the texture (rotation/scale point), it's relative to destination rectangle size
+ // Origin of the texture (rotation/scale point), it's relative to destination rectangle size
Vector2 origin = { frameWidth, frameHeight };
-
+
int rotation = 0;
-
+
SetTargetFPS(60);
//--------------------------------------------------------------------------------------
@@ -63,7 +64,7 @@ int main()
DrawLine((int)destRec.x, 0, (int)destRec.x, screenHeight, GRAY);
DrawLine(0, (int)destRec.y, screenWidth, (int)destRec.y, GRAY);
-
+
DrawText("(c) Scarfy sprite by Eiden Marsal", screenWidth - 200, screenHeight - 20, 10, GRAY);
EndDrawing();