src/Graphics/Display.cc
branchnew_graphics
changeset 410 41fd46cffc52
child 411 106aaf6eadfe
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/Graphics/Display.cc	Wed Jan 21 01:57:24 2009 +0200
@@ -0,0 +1,30 @@
+
+#include "Display.hh"
+
+namespace graphics
+{
+
+const std::vector<CL_DisplayMode> & Graphics::getDisplayModes (void) {
+    return CL_DisplayMode::get_display_modes();
+}
+
+const CL_DisplayMode Graphics::getBestMode (void) {
+    const std::vector<CL_DisplayMode> &modes = Graphics::getDisplayModes();
+
+    const CL_DisplayMode *best_mode = NULL;
+    
+    for (std::vector<CL_DisplayMode>::const_iterator it = modes.begin(); it != modes.end(); it++)
+        if (best_mode == NULL || (
+                it->get_resolution().width * it->get_resolution().height > 
+                best_mode->get_resolution().width * best_mode->get_resolution().height    
+        ))
+            best_mode = &*it;
+    
+    if (best_mode == NULL)
+        throw Error("No available video modes!");
+    
+    return *best_mode;
+}
+
+}
+