equal
deleted
inserted
replaced
|
1 |
|
2 #include "Display.hh" |
|
3 |
|
4 namespace graphics |
|
5 { |
|
6 |
|
7 const std::vector<CL_DisplayMode> & Graphics::getDisplayModes (void) { |
|
8 return CL_DisplayMode::get_display_modes(); |
|
9 } |
|
10 |
|
11 const CL_DisplayMode Graphics::getBestMode (void) { |
|
12 const std::vector<CL_DisplayMode> &modes = Graphics::getDisplayModes(); |
|
13 |
|
14 const CL_DisplayMode *best_mode = NULL; |
|
15 |
|
16 for (std::vector<CL_DisplayMode>::const_iterator it = modes.begin(); it != modes.end(); it++) |
|
17 if (best_mode == NULL || ( |
|
18 it->get_resolution().width * it->get_resolution().height > |
|
19 best_mode->get_resolution().width * best_mode->get_resolution().height |
|
20 )) |
|
21 best_mode = &*it; |
|
22 |
|
23 if (best_mode == NULL) |
|
24 throw Error("No available video modes!"); |
|
25 |
|
26 return *best_mode; |
|
27 } |
|
28 |
|
29 } |
|
30 |