7 #define kPollEveryNFrames 3
9 static uint32 joypads[2];
16 static void processEvent(const SDL_Event& event)
21 if (Config.action[event.key.keysym.scancode])
22 S9xDoAction(Config.action[event.key.keysym.scancode]);
23 joypads[0] |= Config.joypad1Mapping[event.key.keysym.scancode];
26 joypads[0] &= ~Config.joypad1Mapping[event.key.keysym.scancode];
28 case SDL_MOUSEBUTTONUP:
29 case SDL_MOUSEBUTTONDOWN:
30 mouse.x = event.button.x;
31 mouse.y = event.button.y;
36 mouse.pressed = event.button.state == SDL_PRESSED;
39 mouse.x = event.motion.x;
40 mouse.y = event.motion.y;
47 Config.quitting = true;
52 uint32 S9xReadJoypad (int which)
54 if (which < 0 || which > 2) {
58 return joypads[which];
61 bool8 S9xReadMousePosition(int which1, int& x, int& y, uint32& buttons)
63 if (which1 != 0) return FALSE;
67 buttons = mouse.pressed ? 1 : 0;
72 bool8 S9xReadSuperScopePosition(int& x, int& y, uint32& buttons)
76 buttons = mouse.pressed ? 8 : 0;
81 void S9xProcessEvents(bool8_32 block)
86 SDL_WaitEvent(&event);
89 while(SDL_PollEvent(&event))
96 void S9xInitInputDevices()
101 switch (Settings.ControllerOption) {
103 joypads[0] = 0x80000000UL;
104 printf("Input: 1 joypad, keyboard only\n");
107 joypads[0] = 0x80000000UL;
108 printf("Input: 1 joypad + mouse\n");
110 case SNES_MOUSE_SWAPPED:
111 printf("Input: mouse\n");
113 case SNES_SUPERSCOPE:
114 joypads[0] = 0x80000000UL;
115 printf("Input: 1 joypad + superscope\n");
118 printf("Input: unknown\n");
123 void S9xDeinitInputDevices()
128 void S9xInputFullscreenChanged()