Commit 359431d209ea551f260cbd45a82e920063fec36f

Authored by DarkGod
1 parent 9047f45a

Removed preliminary gamepad until it can be fixed

Showing 1 changed file with 71 additions and 71 deletions
... ... @@ -61,7 +61,7 @@ char **g_argv;
61 61 SDL_Window *window = NULL;
62 62 SDL_Surface *windowIconSurface = NULL;
63 63 SDL_GLContext maincontext; /* Our opengl context handle */
64   -SDL_Joystick* gamepad = NULL;
  64 +// SDL_Joystick* gamepad = NULL;
65 65 bool is_fullscreen = FALSE;
66 66 bool is_borderless = FALSE;
67 67 static lua_State *L = NULL;
... ... @@ -533,71 +533,71 @@ bool on_event(SDL_Event *event)
533 533 docall(L, 6, 0);
534 534 }
535 535 return TRUE;
536   - case SDL_JOYAXISMOTION:
537   - if (current_mousehandler != LUA_NOREF)
538   - {
539   - float v = (float)event->jaxis.value / 32770;
540   - if (v > -JOY_DEADZONE && v < JOY_DEADZONE) return FALSE;
541   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
542   - lua_pushstring(L, "receiveJoyAxis");
543   - lua_gettable(L, -2);
544   - lua_remove(L, -2);
545   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
546   - lua_pushnumber(L, event->jaxis.axis);
547   - lua_pushnumber(L, MIN(1, MAX(-1, v)));
548   - docall(L, 3, 0);
549   - }
550   - return TRUE;
551   - case SDL_JOYBALLMOTION:
552   - if (current_mousehandler != LUA_NOREF)
553   - {
554   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
555   - lua_pushstring(L, "receiveJoyBall");
556   - lua_gettable(L, -2);
557   - lua_remove(L, -2);
558   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
559   - lua_pushnumber(L, event->jball.ball);
560   - lua_pushnumber(L, event->jball.xrel);
561   - lua_pushnumber(L, event->jball.yrel);
562   - docall(L, 4, 0);
563   - }
564   - return TRUE;
565   - case SDL_JOYHATMOTION:
566   - if (current_mousehandler != LUA_NOREF)
567   - {
568   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
569   - lua_pushstring(L, "receiveJoyHat");
570   - lua_gettable(L, -2);
571   - lua_remove(L, -2);
572   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
573   - lua_pushnumber(L, event->jhat.hat);
574   - switch (event->jhat.value) {
575   - case SDL_HAT_UP: lua_pushnumber(L, 8); break;
576   - case SDL_HAT_DOWN: lua_pushnumber(L, 2); break;
577   - case SDL_HAT_LEFT: lua_pushnumber(L, 4); break;
578   - case SDL_HAT_RIGHT: lua_pushnumber(L, 6); break;
579   - case SDL_HAT_LEFTUP: lua_pushnumber(L, 7); break;
580   - case SDL_HAT_LEFTDOWN: lua_pushnumber(L, 1); break;
581   - case SDL_HAT_RIGHTUP: lua_pushnumber(L, 9); break;
582   - case SDL_HAT_RIGHTDOWN: lua_pushnumber(L, 3); break;
583   - }
584   - docall(L, 3, 0);
585   - }
586   - return TRUE;
587   - case SDL_JOYBUTTONDOWN:
588   - case SDL_JOYBUTTONUP:
589   - if (current_mousehandler != LUA_NOREF)
590   - {
591   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler);
592   - lua_pushstring(L, "receiveJoyButton");
593   - lua_gettable(L, -2);
594   - lua_remove(L, -2);
595   - lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler);
596   - lua_pushnumber(L, event->jbutton.button);
597   - lua_pushboolean(L, event->jbutton.state == SDL_RELEASED ? TRUE : FALSE);
598   - docall(L, 3, 0);
599   - }
600   - return TRUE;
  536 + // case SDL_JOYAXISMOTION:
  537 + // if (current_mousehandler != LUA_NOREF)
  538 + // {
  539 + // float v = (float)event->jaxis.value / 32770;
  540 + // if (v > -JOY_DEADZONE && v < JOY_DEADZONE) return FALSE;
  541 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  542 + // lua_pushstring(L, "receiveJoyAxis");
  543 + // lua_gettable(L, -2);
  544 + // lua_remove(L, -2);
  545 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  546 + // lua_pushnumber(L, event->jaxis.axis);
  547 + // lua_pushnumber(L, MIN(1, MAX(-1, v)));
  548 + // docall(L, 3, 0);
  549 + // }
  550 + // return TRUE;
  551 + // case SDL_JOYBALLMOTION:
  552 + // if (current_mousehandler != LUA_NOREF)
  553 + // {
  554 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  555 + // lua_pushstring(L, "receiveJoyBall");
  556 + // lua_gettable(L, -2);
  557 + // lua_remove(L, -2);
  558 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  559 + // lua_pushnumber(L, event->jball.ball);
  560 + // lua_pushnumber(L, event->jball.xrel);
  561 + // lua_pushnumber(L, event->jball.yrel);
  562 + // docall(L, 4, 0);
  563 + // }
  564 + // return TRUE;
  565 + // case SDL_JOYHATMOTION:
  566 + // if (current_mousehandler != LUA_NOREF)
  567 + // {
  568 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  569 + // lua_pushstring(L, "receiveJoyHat");
  570 + // lua_gettable(L, -2);
  571 + // lua_remove(L, -2);
  572 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_mousehandler);
  573 + // lua_pushnumber(L, event->jhat.hat);
  574 + // switch (event->jhat.value) {
  575 + // case SDL_HAT_UP: lua_pushnumber(L, 8); break;
  576 + // case SDL_HAT_DOWN: lua_pushnumber(L, 2); break;
  577 + // case SDL_HAT_LEFT: lua_pushnumber(L, 4); break;
  578 + // case SDL_HAT_RIGHT: lua_pushnumber(L, 6); break;
  579 + // case SDL_HAT_LEFTUP: lua_pushnumber(L, 7); break;
  580 + // case SDL_HAT_LEFTDOWN: lua_pushnumber(L, 1); break;
  581 + // case SDL_HAT_RIGHTUP: lua_pushnumber(L, 9); break;
  582 + // case SDL_HAT_RIGHTDOWN: lua_pushnumber(L, 3); break;
  583 + // }
  584 + // docall(L, 3, 0);
  585 + // }
  586 + // return TRUE;
  587 + // case SDL_JOYBUTTONDOWN:
  588 + // case SDL_JOYBUTTONUP:
  589 + // if (current_mousehandler != LUA_NOREF)
  590 + // {
  591 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler);
  592 + // lua_pushstring(L, "receiveJoyButton");
  593 + // lua_gettable(L, -2);
  594 + // lua_remove(L, -2);
  595 + // lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler);
  596 + // lua_pushnumber(L, event->jbutton.button);
  597 + // lua_pushboolean(L, event->jbutton.state == SDL_RELEASED ? TRUE : FALSE);
  598 + // docall(L, 3, 0);
  599 + // }
  600 + // return TRUE;
601 601 }
602 602 return FALSE;
603 603 }
... ... @@ -1429,11 +1429,11 @@ int main(int argc, char *argv[])
1429 1429 return 2;
1430 1430 }
1431 1431
1432   - if (SDL_NumJoysticks() >= 1) {
1433   - if (gamepad = SDL_JoystickOpen(0)) {
1434   - printf("Found gamepad, enabling support\n");
1435   - }
1436   - }
  1432 + // if (SDL_NumJoysticks() >= 1) {
  1433 + // if (gamepad = SDL_JoystickOpen(0)) {
  1434 + // printf("Found gamepad, enabling support\n");
  1435 + // }
  1436 + // }
1437 1437
1438 1438 // Filter events, to catch the quit event
1439 1439 SDL_SetEventFilter(event_filter, NULL);
... ...