Mercurial > sdl-ios-xcode
comparison src/video/ataricommon/SDL_biosevents.c @ 1420:2405517b5eab
Added preliminary support for MiNT /dev/mouse driver (disabled atm)
author | Patrice Mandin <patmandin@gmail.com> |
---|---|
date | Thu, 23 Feb 2006 21:51:10 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb f1816773a309 |
comparison
equal
deleted
inserted
replaced
1419:36a5068bf7df | 1420:2405517b5eab |
---|---|
35 #include "../../events/SDL_events_c.h" | 35 #include "../../events/SDL_events_c.h" |
36 | 36 |
37 #include "SDL_atarikeys.h" | 37 #include "SDL_atarikeys.h" |
38 #include "SDL_atarievents_c.h" | 38 #include "SDL_atarievents_c.h" |
39 #include "SDL_xbiosevents_c.h" | 39 #include "SDL_xbiosevents_c.h" |
40 #include "SDL_ataridevmouse_c.h" | |
40 | 41 |
41 /* To save state of keyboard */ | 42 /* To save state of keyboard */ |
42 #define ATARIBIOS_MAXKEYS 128 | 43 #define ATARIBIOS_MAXKEYS 128 |
43 | 44 |
44 static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS]; | 45 static unsigned char bios_currentkeyboard[ATARIBIOS_MAXKEYS]; |
45 static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS]; | 46 static unsigned char bios_previouskeyboard[ATARIBIOS_MAXKEYS]; |
46 static unsigned char bios_currentascii[ATARIBIOS_MAXKEYS]; | 47 static unsigned char bios_currentascii[ATARIBIOS_MAXKEYS]; |
48 static SDL_bool use_dev_mouse = SDL_FALSE; | |
47 | 49 |
48 /* Special keys state */ | 50 /* Special keys state */ |
49 enum { | 51 enum { |
50 K_RSHIFT=0, | 52 K_RSHIFT=0, |
51 K_LSHIFT, | 53 K_LSHIFT, |
99 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; | 101 keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; |
100 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; | 102 keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; |
101 keymap[SCANCODE_LEFTALT] = SDLK_LALT; | 103 keymap[SCANCODE_LEFTALT] = SDLK_LALT; |
102 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; | 104 keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; |
103 | 105 |
104 vectors_mask = ATARI_XBIOS_MOUSEEVENTS|ATARI_XBIOS_JOYSTICKEVENTS; | 106 use_dev_mouse = (SDL_AtariDevMouse_Open()!=0) ? SDL_TRUE : SDL_FALSE; |
107 | |
108 vectors_mask = ATARI_XBIOS_JOYSTICKEVENTS; /* XBIOS joystick events */ | |
109 if (!use_dev_mouse) { | |
110 vectors_mask |= ATARI_XBIOS_MOUSEEVENTS; /* XBIOS mouse events */ | |
111 } | |
105 if (Getcookie(C_MiNT, &dummy)==C_FOUND) { | 112 if (Getcookie(C_MiNT, &dummy)==C_FOUND) { |
106 vectors_mask = 0; | 113 vectors_mask = 0; |
107 } | 114 } |
108 | 115 |
109 SDL_AtariXbios_InstallVectors(vectors_mask); | 116 SDL_AtariXbios_InstallVectors(vectors_mask); |
144 if (bios_previouskeyboard[i] && !bios_currentkeyboard[i]) | 151 if (bios_previouskeyboard[i] && !bios_currentkeyboard[i]) |
145 SDL_PrivateKeyboard(SDL_RELEASED, | 152 SDL_PrivateKeyboard(SDL_RELEASED, |
146 TranslateKey(i, bios_currentascii[i], &keysym, SDL_FALSE)); | 153 TranslateKey(i, bios_currentascii[i], &keysym, SDL_FALSE)); |
147 } | 154 } |
148 | 155 |
149 SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE); | 156 if (use_dev_mouse) { |
157 SDL_AtariDevMouse_PostMouseEvents(this, SDL_TRUE); | |
158 } else { | |
159 SDL_AtariXbios_PostMouseEvents(this, SDL_TRUE); | |
160 } | |
150 | 161 |
151 /* Will be previous table */ | 162 /* Will be previous table */ |
152 SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, ATARIBIOS_MAXKEYS); | 163 SDL_memcpy(bios_previouskeyboard, bios_currentkeyboard, ATARIBIOS_MAXKEYS); |
153 } | 164 } |
154 | 165 |
190 } | 201 } |
191 | 202 |
192 void AtariBios_ShutdownEvents(void) | 203 void AtariBios_ShutdownEvents(void) |
193 { | 204 { |
194 SDL_AtariXbios_RestoreVectors(); | 205 SDL_AtariXbios_RestoreVectors(); |
195 } | 206 if (use_dev_mouse) { |
207 SDL_AtariDevMouse_Close(); | |
208 } | |
209 } |