9 Display::Display(const string &)
11 for(unsigned i=0;; ++i)
14 if(!EnumDisplaySettings(0, i, &info))
17 VideoMode mode(info.dmPelsWidth, info.dmPelsHeight);
18 mode.rate = info.dmDisplayFrequency;
19 modes.push_back(mode);
23 if(EnumDisplaySettings(0, ENUM_CURRENT_SETTINGS, &info))
25 orig_mode = VideoMode(info.dmPelsWidth, info.dmPelsHeight);
26 orig_mode.rate = info.dmDisplayFrequency;
34 void Display::set_mode(const VideoMode &mode)
37 info.dmSize = sizeof(DEVMODE);
38 info.dmFields = DM_PELSWIDTH|DM_PELSHEIGHT;
39 info.dmPelsWidth = mode.width;
40 info.dmPelsHeight = mode.height;
43 info.dmFields |= DM_DISPLAYFREQUENCY;
44 info.dmDisplayFrequency = mode.rate;
47 LONG ret = ChangeDisplaySettings(&info, CDS_FULLSCREEN);
48 if(ret!=DISP_CHANGE_SUCCESSFUL)
49 throw unsupported_video_mode(mode);
52 bool Display::process_events()
55 if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
57 DispatchMessage(&msg);
64 void Display::check_error()
69 } // namespace Graphics