Centered image
This commit is contained in:
parent
1cfb148453
commit
f2961a006b
11
src/main.cpp
11
src/main.cpp
|
@ -259,11 +259,16 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
BeginDrawing();
|
||||
ClearBackground(DARKGRAY);
|
||||
ClearBackground(BLACK);
|
||||
|
||||
Vector2 winwidth = (Vector2) {(float) GetScreenWidth(), (float) GetScreenHeight()};
|
||||
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);
|
||||
|
||||
|
||||
|
||||
|
@ -370,4 +375,4 @@ int main(int argc, char *argv[]) {
|
|||
//--------------------------------------------------------------------------------------
|
||||
curl_global_cleanup();
|
||||
return 0;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue