X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmain.cc;h=169dbd312d4906abca7620e1214c1e97914d6166;hb=3674b7a5b534224cc22551673a9d0ae9b83206c4;hp=58e01dec9c9d562731d6b5a8dc02738a71d128b4;hpb=13c9481b0430d0bf6fc50b0952bcd81229022abc;p=laserbrain_demo diff --git a/src/main.cc b/src/main.cc index 58e01de..169dbd3 100644 --- a/src/main.cc +++ b/src/main.cc @@ -184,15 +184,14 @@ static void process_event(SDL_Event *ev) case SDL_MOUSEMOTION: if(mouse_grabbed) { - // XXX xrel/yrel seems faster by default - app_mouse_delta(ev->motion.xrel * 0.75, ev->motion.yrel * 0.75); + app_mouse_delta(ev->motion.xrel, ev->motion.yrel); } else { app_mouse_motion(ev->motion.x * scale_factor, ev->motion.y * scale_factor); } break; case SDL_WINDOWEVENT: - if(ev->window.event == SDL_WINDOWEVENT_RESIZED) { + if(ev->window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { SDL_GL_GetDrawableSize(win, &win_width, &win_height); win_aspect = (float)win_width / (float)win_height; scale_factor = win_width / ev->window.data1; @@ -201,7 +200,12 @@ static void process_event(SDL_Event *ev) break; case SDL_CONTROLLERAXISMOTION: - app_gamepad_axis(ev->caxis.axis, ev->caxis.value / 65535.0f); + app_gamepad_axis(ev->caxis.axis, ev->caxis.value / 32768.0f); + break; + + case SDL_CONTROLLERBUTTONDOWN: + case SDL_CONTROLLERBUTTONUP: + app_gamepad_button(ev->cbutton.button, ev->type == SDL_CONTROLLERBUTTONDOWN); break; } }