--- deliantra/Deliantra-Client/Client.xs 2006/05/21 00:02:01 1.89 +++ deliantra/Deliantra-Client/Client.xs 2006/05/23 18:54:37 1.93 @@ -493,6 +493,18 @@ PPCODE: { SDL_Event ev; + int i; + static int modifier; + static int modkey[] = { + SDLK_RSHIFT, KMOD_RSHIFT, + SDLK_LSHIFT, KMOD_LSHIFT, + SDLK_RCTRL, KMOD_RCTRL, + SDLK_LCTRL, KMOD_LCTRL, + SDLK_RALT, KMOD_RALT, + SDLK_LALT, KMOD_LALT, + SDLK_RMETA, KMOD_RMETA, + SDLK_LMETA, KMOD_LMETA, + }; while (SDL_PollEvent (&ev)) { @@ -503,6 +515,17 @@ { case SDL_KEYDOWN: case SDL_KEYUP: + + for (i = 0; i < sizeof (modkey) / (sizeof (int) * 2); i++) + if (modkey [i * 2] == ev.key.keysym.sym) + { + if (ev.type == SDL_KEYDOWN) + modifier |= modkey [i * 2 + 1]; + else + modifier &= ~modkey [i * 2 + 1]; + break; + } + hv_store (hv, "state", 5, newSViv (ev.key.state), 0); hv_store (hv, "sym", 3, newSViv (ev.key.keysym.sym), 0); hv_store (hv, "mod", 3, newSViv (ev.key.keysym.mod), 0); @@ -515,6 +538,8 @@ break; case SDL_MOUSEMOTION: + hv_store (hv, "mod", 3, newSViv (modifier), 0); + hv_store (hv, "state", 5, newSViv (ev.motion.state), 0); hv_store (hv, "x", 1, newSViv (ev.motion.x), 0); hv_store (hv, "y", 1, newSViv (ev.motion.y), 0); @@ -524,6 +549,8 @@ case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONUP: + hv_store (hv, "mod", 3, newSViv (modifier), 0); + hv_store (hv, "button", 6, newSViv (ev.button.button), 0); hv_store (hv, "state", 5, newSViv (ev.button.state), 0); hv_store (hv, "x", 1, newSViv (ev.button.x), 0); @@ -561,6 +588,13 @@ #endif char * +gl_vendor () + CODE: + RETVAL = (char *)glGetString (GL_VENDOR); + OUTPUT: + RETVAL + +char * gl_version () CODE: RETVAL = (char *)glGetString (GL_VERSION); @@ -1637,7 +1671,10 @@ void glLoadIdentity () -# near and far are due to microsofts buggy c compiler +# near_ and far_ are due to microsofts buggy "c" compiler +void glFrustum (double left, double right, double bottom, double top, double near_, double far_) + +# near_ and far_ are due to microsofts buggy "c" compiler void glOrtho (double left, double right, double bottom, double top, double near_, double far_) void glViewport (int x, int y, int width, int height) @@ -1663,6 +1700,7 @@ void glColor (float r, float g, float b, float a = 1.0) PROTOTYPE: @ CODE: + // microsoft visual "c" rounds instead of truncating... glColor4ub (MIN ((int)(r * 255.f), 255), MIN ((int)(g * 255.f), 255), MIN ((int)(b * 255.f), 255), @@ -1674,6 +1712,11 @@ # 1.2 void glDrawRangeElements (int mode, int start, int end +void glRasterPos (float x, float y, float z = 0.) + CODE: + glRasterPos3f (0, 0, z); + glBitmap (0, 0, 0, 0, x, y, 0); + void glVertex (float x, float y, float z = 0.) CODE: glVertex3f (x, y, z); @@ -1710,9 +1753,7 @@ void glCopyTexImage2D (int target, int level, int internalformat, int x, int y, int width, int height, int border) -void glRasterPos (int x, int y) - CODE: - glRasterPos2i (x, y); +void glDrawPixels (int width, int height, int format, int type, char *pixels) void glCopyPixels (int x, int y, int width, int height, int type = GL_COLOR)