mirror of
https://github.com/HarbourMasters/Starship.git
synced 2025-05-07 11:13:58 +03:00
Initial attempt at centered UI
This commit is contained in:
parent
0bc2bf22a4
commit
63fa98d02f
4 changed files with 58 additions and 38 deletions
|
@ -547,6 +547,14 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) {
|
|||
(gfx_native_dimensions.width - v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromLeftEdgeCentered(float v) {
|
||||
return (gfx_native_dimensions.width / 2 - gfx_native_dimensions.height / 2 + (v));
|
||||
}
|
||||
|
||||
extern "C" float OTRGetDimensionFromRightEdgeCentered(float v) {
|
||||
return (gfx_native_dimensions.width / 2 + gfx_native_dimensions.height / 2 -
|
||||
(gfx_native_dimensions.width - v));
|
||||
}
|
||||
// Gets the width of the current render target area
|
||||
extern "C" uint32_t OTRGetGameRenderWidth() {
|
||||
return gfx_current_dimensions.width;
|
||||
|
@ -565,6 +573,14 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) {
|
|||
return ((int) ceilf(OTRGetDimensionFromRightEdge(v)));
|
||||
}
|
||||
|
||||
extern "C" int16_t OTRGetRectDimensionFromLeftEdgeCentered(float v) {
|
||||
return ((int) floorf(OTRGetDimensionFromLeftEdgeCentered(v)));
|
||||
}
|
||||
|
||||
extern "C" int16_t OTRGetRectDimensionFromRightEdgeCentered(float v) {
|
||||
return ((int) ceilf(OTRGetDimensionFromRightEdgeCentered(v)));
|
||||
}
|
||||
|
||||
extern "C" int32_t OTRConvertHUDXToScreenX(int32_t v) {
|
||||
float gameAspectRatio = gfx_current_dimensions.aspect_ratio;
|
||||
int32_t gameHeight = gfx_current_dimensions.height;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue