diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2009-12-18 13:31:07 +0100 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2009-12-18 13:31:07 +0100 |
commit | 4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f (patch) | |
tree | e39e9698513687a3213ecae7eab942bce88b12d6 /src/zoom.cpp | |
parent | b3b74dc2afe4c67a6b74c2a681aa7bbad7077511 (diff) | |
download | zoom++-4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f.tar zoom++-4e3efa239c9bcb5dd26b4ad9a4d43d4d6a266e6f.zip |
Use multi-pass rendering with seperate ambient and light shaders
Diffstat (limited to 'src/zoom.cpp')
-rw-r--r-- | src/zoom.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/zoom.cpp b/src/zoom.cpp index e0050c5..8193d6a 100644 --- a/src/zoom.cpp +++ b/src/zoom.cpp @@ -22,6 +22,8 @@ #include "config.h" #include "gl.h" +#include <cstdio> + #ifdef _WIN32 #else @@ -69,7 +71,7 @@ bool WGLInit(HINSTANCE hInstance, HWND *hWnd, HDC *hDC, HGLRC *hRC) { if (!RegisterClass(&wc)) { MessageBox(0, "Failed To Register The Window Class.", "ERROR", MB_OK|MB_ICONEXCLAMATION); - return false; // Exit And Return FALSE + return false; } DWORD dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; @@ -421,24 +423,29 @@ int main() { case GenericEvent: if(event.xcookie.extension == xi_opcode && XGetEventData(disp, &event.xcookie)) { - XIRawEvent *rawEvent = reinterpret_cast<XIRawEvent*>(event.xcookie.data); - - float deltaX = 0, deltaY = 0; - double *rawValuator = rawEvent->raw_values; - - if(XIMaskIsSet(rawEvent->valuators.mask, 0)) { - deltaX = (float)*rawValuator; - ++rawValuator; + switch(event.xcookie.evtype) { + case XI_RawMotion: + XIRawEvent *rawEvent = reinterpret_cast<XIRawEvent*>(event.xcookie.data); + + float deltaX = 0, deltaY = 0; + double *rawValuator = rawEvent->raw_values; + + if(rawEvent->valuators.mask_len >= 1) { + if(XIMaskIsSet(rawEvent->valuators.mask, 0)) { + deltaX = (float)*rawValuator; + ++rawValuator; + } + + if(XIMaskIsSet(rawEvent->valuators.mask, 1)) { + deltaY = (float)*rawValuator; + ++rawValuator; + } + } + + if(deltaX != 0 || deltaY != 0) + game.turn(deltaX, deltaY); } - if(XIMaskIsSet(rawEvent->valuators.mask, 1)) { - deltaY = (float)*rawValuator; - ++rawValuator; - } - - if(deltaX != 0 || deltaY != 0) - game.turn(deltaX, deltaY); - XFreeEventData(disp, &event.xcookie); } } |