]> git.tdb.fi Git - libs/gui.git/commitdiff
OpenGL can now be required as a package on all archs
authorMikko Rasa <tdb@tdb.fi>
Wed, 19 Mar 2008 11:42:50 +0000 (11:42 +0000)
committerMikko Rasa <tdb@tdb.fi>
Wed, 19 Mar 2008 11:42:50 +0000 (11:42 +0000)
Fix win32 compilation

Build
source/gbase/drawcontext.cpp
source/gbase/drawcontext.h
source/input/keyboard.cpp
source/input/keys.cpp

diff --git a/Build b/Build
index 17a6fdc19fe005d24e4302b5f487ca83d42da53b..e68abea116a842c0bf562d9194db0234ade3c915 100644 (file)
--- a/Build
+++ b/Build
@@ -8,11 +8,10 @@ package "mspgbase"
        require "mspcore";
        require "mspstrings";
        require "sigc++-2.0";
-       // The OpenGL stuff is hackish, but only way to do it right now
+       require "opengl";
        if "arch!=win32"
        {
                require "xlib";
-               require "opengl";
                build_info
                {
                        library "Xxf86vm";
@@ -22,7 +21,6 @@ package "mspgbase"
        {
                build_info
                {
-                       library "opengl32";
                        library "gdi32";
                };
        };
index d3ac4856324811d04059dbf94c919e207ce48f13..86edf56a95a83cd416a92d39edf197cda2782cfb 100644 (file)
@@ -20,8 +20,7 @@ namespace Graphics {
 
 DrawContext::DrawContext(Window &w):
        display(w.get_display()),
-       window(w),
-       image(0)
+       window(w)
 {
 #ifndef WIN32
        ::Display *dpy=display.get_display();
@@ -70,6 +69,24 @@ DrawContext::~DrawContext()
 #endif
 }
 
+unsigned DrawContext::get_depth() const
+{
+#ifdef WIN32
+       return 0;
+#else
+       return image->bits_per_pixel;
+#endif
+}
+
+unsigned char *DrawContext::get_data()
+{
+#ifdef WIN32
+       return 0;
+#else
+       return reinterpret_cast<unsigned char *>(image->data);
+#endif
+}
+
 void DrawContext::update()
 {
 #ifndef WIN32
index 54ae3b364a0323d3b417844b12bac90486a9a746..b21ac3cde57714bbdc8c05d75bf594a718ff808f 100644 (file)
@@ -35,8 +35,8 @@ public:
        ~DrawContext();
 
        Window &get_window() const { return window; }
-       unsigned get_depth() const { return image->bits_per_pixel; }
-       unsigned char *get_data() { return reinterpret_cast<unsigned char *>(image->data); }
+       unsigned get_depth() const;
+       unsigned char *get_data();
        void update();
 };
 
index 4372be4f42bd5fbcfc707a842eae1494511c9665..1d7bb659e4973944ff2cc7b6665ed089c1c7ddf8 100644 (file)
@@ -10,6 +10,8 @@ Distributed under the LGPL
 #include "keyboard.h"
 #include "keys.h"
 
+#define MAPVK_VK_TO_VSC 0
+
 namespace Msp {
 namespace Input {
 
@@ -35,7 +37,7 @@ std::string Keyboard::get_button_name(unsigned btn) const
        return str;
 #else
        char buf[128];
-       unsigned scan=MapVirtualKey(key_to_sys(btn), MAPVK_VK_TO_VCS);
+       unsigned scan=MapVirtualKey(key_to_sys(btn), MAPVK_VK_TO_VSC);
        if(!GetKeyNameText(scan<<16, buf, sizeof(buf)))
                return format("Key %d", btn);
        return buf;
index d7de3b1b326ae007168a4ca324edda30d66356f3..4446a7f731568fe828d1b823bc93bf56bd00e675 100644 (file)
@@ -6,7 +6,9 @@ Distributed under the LGPL
 */
 
 #include <map>
-#ifndef WIN32
+#ifdef WIN32
+#include <windows.h>
+#else
 #include <X11/keysym.h>
 #endif
 #include <msp/core/except.h>