--- deliantra/Deliantra-Client/Client.xs 2006/04/19 21:17:15 1.52 +++ deliantra/Deliantra-Client/Client.xs 2006/04/19 21:38:04 1.53 @@ -388,6 +388,9 @@ SDL_GL_SetAttribute (SDL_GL_BUFFER_SIZE, 15); SDL_GL_SetAttribute (SDL_GL_DEPTH_SIZE, 0); + SDL_EnableUNICODE (1); + SDL_EnableKeyRepeat (SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); + m = SDL_ListModes (0, SDL_FULLSCREEN | SDL_OPENGL); if (m && m != (SDL_Rect **)-1) @@ -412,8 +415,50 @@ OUTPUT: RETVAL -int -Mix_VolumeMusic (int newvol = -1) +void +SDL_PollEvent () + PPCODE: +{ + SDL_Event ev; + + while (SDL_PollEvent (&ev)) + { + HV *hv = newHV (); + hv_store (hv, "type", 4, newSViv (ev.type), 0); + switch (ev.type) + { + case SDL_KEYDOWN: + case SDL_KEYUP: + 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); + hv_store (hv, "unicode", 7, newSViv (ev.key.keysym.unicode), 0); + break; + + case SDL_ACTIVEEVENT: + hv_store (hv, "gain", 4, newSViv (ev.active.gain), 0); + hv_store (hv, "state", 5, newSViv (ev.active.state), 0); + break; + + case SDL_MOUSEMOTION: + 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); + hv_store (hv, "xrel", 4, newSViv (ev.motion.xrel), 0); + hv_store (hv, "yrel", 4, newSViv (ev.motion.yrel), 0); + break; + + case SDL_MOUSEBUTTONDOWN: + case SDL_MOUSEBUTTONUP: + 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); + hv_store (hv, "y", 1, newSViv (ev.button.y), 0); + } + + XPUSHs (sv_2mortal (newRV_noinc ((SV *)hv))); + } +} int Mix_OpenAudio (int frequency = 22050, int format = MIX_DEFAULT_FORMAT, int channels = 1, int chunksize = 512)