Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions examples/textures/textures_srcrec_dstrec.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ int main(void)

Texture2D scarfy = LoadTexture("resources/scarfy.png"); // Texture loading

// Dividing by 6 to only get the first sprite of the spritesheet
int frameWidth = scarfy.width/6;
int frameHeight = scarfy.height;

Expand All @@ -41,7 +42,8 @@ int main(void)
Rectangle destRec = { screenWidth/2.0f, screenHeight/2.0f, frameWidth*2.0f, frameHeight*2.0f };

// Origin of the texture (rotation/scale point), it's relative to destination rectangle size
Vector2 origin = { (float)frameWidth, (float)frameHeight };
// Dividing by two for its center point
Vector2 origin = { (float)destRec.width / 2 , (float)destRec.height / 2 };

int rotation = 0;

Expand Down Expand Up @@ -86,4 +88,4 @@ int main(void)
//--------------------------------------------------------------------------------------

return 0;
}
}