| 207 | } |
| 208 | |
| 209 | static void wndUpdateResolutionsList(void* pWindowResWidget) |
| 210 | { |
| 211 | ASSERT(pWindowResWidget); |
| 212 | UIWidget* pWidget = (UIWidget*)pWindowResWidget; |
| 213 | ASSERT(pWidget->mType == WIDGET_TYPE_DROPDOWN); |
| 214 | DropdownWidget* pDropdown = (DropdownWidget*)pWidget->pWidget; |
| 215 | |
| 216 | if (!pWindowRef) |
| 217 | { |
| 218 | pDropdown->mCount = 0; |
| 219 | return; |
| 220 | } |
| 221 | |
| 222 | char** pNames = (char**)pDropdown->pNames; |
| 223 | uint32_t monitorIdx = getActiveMonitorIdx(); |
| 224 | MonitorDesc* pMonitor = getMonitor(monitorIdx); |
| 225 | uint32_t monitorResolutionIdx = gMonitorResolution[monitorIdx]; |
| 226 | ASSERT(pMonitor->resolutions && monitorResolutionIdx < arrlen(pMonitor->resolutions)); |
| 227 | Resolution monitorResolution = pMonitor->resolutions[monitorResolutionIdx]; |
| 228 | |
| 229 | if (pWindowRef->fullScreen) |
| 230 | { |
| 231 | sprintf(pNames[0], "%ux%u##window_res", monitorResolution.mWidth, monitorResolution.mHeight); |
| 232 | pDropdown->mCount = 1; |
| 233 | *pDropdown->pData = 0; |
| 234 | return; |
| 235 | } |
| 236 | |
| 237 | uint32_t activeResIdx = MAX_WINDOW_RES_COUNT; |
| 238 | |
| 239 | pDropdown->mCount = (uint32_t)arrlen(pMonitor->resolutions) - 1; |
| 240 | |
| 241 | for (uint32_t i = 0; i < pDropdown->mCount; ++i) |
| 242 | { |
| 243 | monitorResolution = pMonitor->resolutions[i]; |
| 244 | sprintf(pNames[i], "%ux%u##window_res", monitorResolution.mWidth, monitorResolution.mHeight); |
| 245 | |
| 246 | if (pWindowRef->mWndW == (int32_t)monitorResolution.mWidth && pWindowRef->mWndH == (int32_t)monitorResolution.mHeight) |
| 247 | { |
| 248 | activeResIdx = i; |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | *pDropdown->pData = activeResIdx; |
| 253 | } |
| 254 | |
| 255 | #ifdef ENABLE_FORGE_UI |
| 256 |
no test coverage detected