| 82 | static void centerWindowOnDisplay(SDL_Window* window, uint32_t displayIndex, int32_t width, int32_t height); |
| 83 | |
| 84 | static SDL_DisplayID getDisplayIdFromIndex(uint32_t displayIndex) |
| 85 | { |
| 86 | int32_t numDisplays = 0; |
| 87 | auto displayIds = SDL_GetDisplays(&numDisplays); |
| 88 | if (displayIds == nullptr || numDisplays <= 0) |
| 89 | { |
| 90 | return SDL_GetPrimaryDisplay(); |
| 91 | } |
| 92 | |
| 93 | const auto clampedIndex = std::clamp(static_cast<int32_t>(displayIndex), 0, numDisplays - 1); |
| 94 | const auto displayId = displayIds[clampedIndex]; |
| 95 | SDL_free(displayIds); |
| 96 | return displayId; |
| 97 | } |
| 98 | |
| 99 | static uint32_t getDisplayIndex(SDL_DisplayID displayId) |
| 100 | { |
no outgoing calls
no test coverage detected