X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=laserbrain_demo;a=blobdiff_plain;f=src%2Fmain.cc;fp=src%2Fmain.cc;h=58e01dec9c9d562731d6b5a8dc02738a71d128b4;hp=4efca60226ad030180c89ef51b1e351dc6585641;hb=13c9481b0430d0bf6fc50b0952bcd81229022abc;hpb=c99f902fd316d625af8f57971561ef035cbfd59f diff --git a/src/main.cc b/src/main.cc index 4efca60..58e01de 100644 --- a/src/main.cc +++ b/src/main.cc @@ -17,11 +17,13 @@ static bool quit; static unsigned int start_time; static unsigned int modkeys; +SDL_GameController *gamepad; + static int scale_factor = 1; int main(int argc, char **argv) { - if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { + if(SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER | SDL_INIT_GAMECONTROLLER) != 0) { fprintf(stderr, "failed to initialize SDL\n"); return 1; } @@ -55,6 +57,17 @@ int main(int argc, char **argv) SDL_GL_GetDrawableSize(win, &win_width, &win_height); win_aspect = (float)win_width / (float)win_height; + printf("detected %d joysticks\n", SDL_NumJoysticks()); + for(int i=0; icaxis.axis, ev->caxis.value / 65535.0f); + break; } }