Centered image
This commit is contained in:
parent
1cfb148453
commit
f2961a006b
|
@ -259,11 +259,16 @@ int main(int argc, char *argv[]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
BeginDrawing();
|
BeginDrawing();
|
||||||
ClearBackground(DARKGRAY);
|
ClearBackground(BLACK);
|
||||||
|
|
||||||
Vector2 winwidth = (Vector2) {(float) GetScreenWidth(), (float) GetScreenHeight()};
|
Vector2 winwidth = (Vector2) {(float) GetScreenWidth(), (float) GetScreenHeight()};
|
||||||
Vector2 imagesize = (Vector2) {(float) current_player.tex.tex.width, (float) current_player.tex.tex.height};
|
Vector2 imagesize = (Vector2) {(float) current_player.tex.tex.width, (float) current_player.tex.tex.height};
|
||||||
DrawTextureEx(current_player.tex.tex, (Vector2) {0,0}, 0, ScaleToFit(imagesize, winwidth), WHITE);
|
|
||||||
|
Vector2 scaledsize = Vector2Scale(imagesize, ScaleToFit(imagesize, winwidth));
|
||||||
|
Vector2 fpos;
|
||||||
|
fpos.x = (winwidth.x *0.5) - (scaledsize.x * 0.5f);
|
||||||
|
fpos.y = (winwidth.y *0.5) - (scaledsize.y * 0.5f);
|
||||||
|
DrawTextureEx(current_player.tex.tex, fpos, 0, ScaleToFit(imagesize, winwidth), WHITE);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue