| 146 | } |
| 147 | |
| 148 | static Point getCenteredPositionOnDisplay(uint32_t displayIndex, int32_t width, int32_t height) |
| 149 | { |
| 150 | SDL_Rect displayBounds{}; |
| 151 | const auto displayId = getDisplayIdFromIndex(displayIndex); |
| 152 | if (!SDL_GetDisplayUsableBounds(displayId, &displayBounds)) |
| 153 | { |
| 154 | displayBounds = { 0, 0, width, height }; |
| 155 | } |
| 156 | |
| 157 | const auto x = displayBounds.x + std::max(0, (displayBounds.w - width) / 2); |
| 158 | const auto y = displayBounds.y + std::max(0, (displayBounds.h - height) / 2); |
| 159 | return { x, y }; |
| 160 | } |
| 161 | |
| 162 | static void centerWindowOnDisplay(SDL_Window* window, uint32_t displayIndex, int32_t width, int32_t height) |
| 163 | { |
no test coverage detected