| 211 | }; |
| 212 | |
| 213 | static void ResolutionCommand_Execute(const cc_string* args, int argsCount) { |
| 214 | int width, height; |
| 215 | if (argsCount < 2) { |
| 216 | Chat_Add4("&e/client: &fCurrent resolution is %i@%f2 x %i@%f2", |
| 217 | &Window_Main.Width, &DisplayInfo.ScaleX, &Window_Main.Height, &DisplayInfo.ScaleY); |
| 218 | } else if (!Convert_ParseInt(&args[0], &width) || !Convert_ParseInt(&args[1], &height)) { |
| 219 | Chat_AddRaw("&e/client: &cWidth and height must be integers."); |
| 220 | } else if (width <= 0 || height <= 0) { |
| 221 | Chat_AddRaw("&e/client: &cWidth and height must be above 0."); |
| 222 | } else { |
| 223 | Window_SetSize(width, height); |
| 224 | /* Window_Create uses these, but scales by DPI. Hence DPI unscale them here. */ |
| 225 | Options_SetInt(OPT_WINDOW_WIDTH, (int)(width / DisplayInfo.ScaleX)); |
| 226 | Options_SetInt(OPT_WINDOW_HEIGHT, (int)(height / DisplayInfo.ScaleY)); |
| 227 | } |
| 228 | } |
| 229 | |
| 230 | static struct ChatCommand ResolutionCommand = { |
| 231 | "Resolution", ResolutionCommand_Execute, |
nothing calls this directly
no test coverage detected