From: Mikko Rasa Date: Wed, 19 Mar 2008 11:42:50 +0000 (+0000) Subject: OpenGL can now be required as a package on all archs X-Git-Tag: 0.9~4 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=9164e74de9dc17c74ee9f3cea21c4d247a3835d9;p=libs%2Fgui.git OpenGL can now be required as a package on all archs Fix win32 compilation --- diff --git a/Build b/Build index 17a6fdc..e68abea 100644 --- 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"; }; }; diff --git a/source/gbase/drawcontext.cpp b/source/gbase/drawcontext.cpp index d3ac485..86edf56 100644 --- a/source/gbase/drawcontext.cpp +++ b/source/gbase/drawcontext.cpp @@ -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(image->data); +#endif +} + void DrawContext::update() { #ifndef WIN32 diff --git a/source/gbase/drawcontext.h b/source/gbase/drawcontext.h index 54ae3b3..b21ac3c 100644 --- a/source/gbase/drawcontext.h +++ b/source/gbase/drawcontext.h @@ -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(image->data); } + unsigned get_depth() const; + unsigned char *get_data(); void update(); }; diff --git a/source/input/keyboard.cpp b/source/input/keyboard.cpp index 4372be4..1d7bb65 100644 --- a/source/input/keyboard.cpp +++ b/source/input/keyboard.cpp @@ -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; diff --git a/source/input/keys.cpp b/source/input/keys.cpp index d7de3b1..4446a7f 100644 --- a/source/input/keys.cpp +++ b/source/input/keys.cpp @@ -6,7 +6,9 @@ Distributed under the LGPL */ #include -#ifndef WIN32 +#ifdef WIN32 +#include +#else #include #endif #include