X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fmain.cc;h=d24428cc65e9362b8820a5f525a60ad5da0f0ed0;hb=59af92c432928d1a325393472cb8ec7a4a1594ad;hp=e2e969a6806a4b4592f1de146479fbbb09b70eca;hpb=9802d969be55668e4dcc10fe427b0dcdeb6302be;p=laserbrain_demo diff --git a/src/main.cc b/src/main.cc index e2e969a..d24428c 100644 --- a/src/main.cc +++ b/src/main.cc @@ -48,6 +48,7 @@ int main(int argc, char **argv) int val; SDL_GL_GetAttribute(SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, &val); printf("SDL says we %s an sRGB framebuffer\n", val ? "got" : "didn't get"); + fb_srgb = val; if(!(ctx = SDL_GL_CreateContext(win))) { fprintf(stderr, "failed to create OpenGL context\n"); @@ -184,15 +185,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; @@ -203,6 +203,11 @@ static void process_event(SDL_Event *ev) case SDL_CONTROLLERAXISMOTION: 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; } }