Mercurial > sdl-ios-xcode
annotate src/video/riscos/SDL_riscosevents.c @ 946:8520712f8ef0
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sat, 21 Aug 2004 14:54:49 +0000 |
parents | b8d311d90021 |
children | d74fbf56f2f6 |
rev | line source |
---|---|
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
769
b8d311d90021
Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents:
733
diff
changeset
|
3 Copyright (C) 1997-2004 Sam Lantinga |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Library General Public |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2 of the License, or (at your option) any later version. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Library General Public License for more details. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Library General Public |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@devolution.com |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 /* |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 File added by Alan Buckley (alan_baa@hotmail.com) for RISCOS compatability |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
25 27 March 2003 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 Implements keyboard setup, event pump and keyboard and mouse polling |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #include "SDL.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #include "SDL_sysevents.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 #include "SDL_events_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 #include "SDL_riscosvideo.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 #include "SDL_riscosevents_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 #include "SDL_timer_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 #include "SDL_cursor_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 #include "memory.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 #include "stdlib.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 #include "ctype.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 #include "kernel.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 #include "swis.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 /* The translation table from a RISCOS internal key numbers to a SDL keysym */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 static SDLKey RO_keymap[SDLK_LAST]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 /* RISCOS Key codes */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 #define ROKEY_SHIFT 0 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 #define ROKEY_CTRL 1 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 #define ROKEY_ALT 2 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 /* Left shift is first key we will check for */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 #define ROKEY_LEFT_SHIFT 3 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 /* Need to ignore mouse buttons as they are processed separately */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 #define ROKEY_LEFT_MOUSE 9 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 #define ROKEY_CENTRE_MOUSE 10 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 #define ROKEY_RIGHT_MOUSE 11 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 /* No key has been pressed return value*/ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 #define ROKEY_NONE 255 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 /* Id of last key in keyboard */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 #define ROKEY_LAST_KEY 124 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 /* Size of array for all keys */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 #define ROKEYBD_ARRAYSIZE 125 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 static char RO_pressed[ROKEYBD_ARRAYSIZE]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 static SDL_keysym *TranslateKey(int intkey, SDL_keysym *keysym, int pressed); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 void RISCOS_PollMouse(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 void RISCOS_PollKeyboard(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 void RISCOS_PollMouseHelper(_THIS, int fullscreen); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 extern void DRenderer_FillBuffers(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 /* Timer running function */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 extern void RISCOS_CheckTimer(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 void FULLSCREEN_PumpEvents(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 /* Current implementation requires keyboard and mouse polling */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 RISCOS_PollKeyboard(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 RISCOS_PollMouse(this); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 DRenderer_FillBuffers(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 if (SDL_timer_running) RISCOS_CheckTimer(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 void RISCOS_InitOSKeymap(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 int i; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 /* Map the VK keysyms */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 for ( i=0; i<SDL_TABLESIZE(RO_keymap); ++i ) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 RO_keymap[i] = SDLK_UNKNOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 RO_keymap[3] = SDLK_LSHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 RO_keymap[4] = SDLK_LCTRL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 RO_keymap[5] = SDLK_LALT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 RO_keymap[6] = SDLK_RSHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 RO_keymap[7] = SDLK_RCTRL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 RO_keymap[8] = SDLK_RALT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 RO_keymap[16] = SDLK_q; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 RO_keymap[17] = SDLK_3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 RO_keymap[18] = SDLK_4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 RO_keymap[19] = SDLK_5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 RO_keymap[20] = SDLK_F4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 RO_keymap[21] = SDLK_8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 RO_keymap[22] = SDLK_F7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 RO_keymap[23] = SDLK_MINUS, |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 RO_keymap[25] = SDLK_LEFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 RO_keymap[26] = SDLK_KP6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 RO_keymap[27] = SDLK_KP7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 RO_keymap[28] = SDLK_F11; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 RO_keymap[29] = SDLK_F12; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 RO_keymap[30] = SDLK_F10; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 RO_keymap[31] = SDLK_SCROLLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 RO_keymap[32] = SDLK_PRINT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 RO_keymap[33] = SDLK_w; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 RO_keymap[34] = SDLK_e; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 RO_keymap[35] = SDLK_t; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 RO_keymap[36] = SDLK_7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 RO_keymap[37] = SDLK_i; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 RO_keymap[38] = SDLK_9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 RO_keymap[39] = SDLK_0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 RO_keymap[41] = SDLK_DOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 RO_keymap[42] = SDLK_KP8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 RO_keymap[43] = SDLK_KP9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 RO_keymap[44] = SDLK_BREAK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 RO_keymap[45] = SDLK_BACKQUOTE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 /* RO_keymap[46] = SDLK_currency; TODO: Figure out if this has a value */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 RO_keymap[47] = SDLK_BACKSPACE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 RO_keymap[48] = SDLK_1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 RO_keymap[49] = SDLK_2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 RO_keymap[50] = SDLK_d; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 RO_keymap[51] = SDLK_r; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 RO_keymap[52] = SDLK_6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 RO_keymap[53] = SDLK_u; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 RO_keymap[54] = SDLK_o; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 RO_keymap[55] = SDLK_p; |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
146 RO_keymap[56] = SDLK_LEFTBRACKET; |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 RO_keymap[57] = SDLK_UP; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 RO_keymap[58] = SDLK_KP_PLUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 RO_keymap[59] = SDLK_KP_MINUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 RO_keymap[60] = SDLK_KP_ENTER; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 RO_keymap[61] = SDLK_INSERT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
152 RO_keymap[62] = SDLK_HOME; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 RO_keymap[63] = SDLK_PAGEUP; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 RO_keymap[64] = SDLK_CAPSLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 RO_keymap[65] = SDLK_a; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 RO_keymap[66] = SDLK_x; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 RO_keymap[67] = SDLK_f; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 RO_keymap[68] = SDLK_y; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 RO_keymap[69] = SDLK_j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 RO_keymap[70] = SDLK_k; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 RO_keymap[72] = SDLK_SEMICOLON; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 RO_keymap[73] = SDLK_RETURN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 RO_keymap[74] = SDLK_KP_DIVIDE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 RO_keymap[76] = SDLK_KP_PERIOD; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 RO_keymap[77] = SDLK_NUMLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 RO_keymap[78] = SDLK_PAGEDOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 RO_keymap[79] = SDLK_QUOTE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 RO_keymap[81] = SDLK_s; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 RO_keymap[82] = SDLK_c; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 RO_keymap[83] = SDLK_g; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 RO_keymap[84] = SDLK_h; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 RO_keymap[85] = SDLK_n; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 RO_keymap[86] = SDLK_l; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 RO_keymap[87] = SDLK_SEMICOLON; |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
175 RO_keymap[88] = SDLK_RIGHTBRACKET; |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 RO_keymap[89] = SDLK_DELETE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 RO_keymap[90] = SDLK_KP_MINUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 RO_keymap[91] = SDLK_KP_MULTIPLY; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 RO_keymap[93] = SDLK_EQUALS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 RO_keymap[94] = SDLK_BACKSLASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
181 RO_keymap[96] = SDLK_TAB; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 RO_keymap[97] = SDLK_z; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 RO_keymap[98] = SDLK_SPACE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 RO_keymap[99] = SDLK_v; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 RO_keymap[100] = SDLK_b; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 RO_keymap[101] = SDLK_m; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 RO_keymap[102] = SDLK_COMMA; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 RO_keymap[103] = SDLK_PERIOD; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 RO_keymap[104] = SDLK_SLASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 RO_keymap[105] = SDLK_END; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 RO_keymap[106] = SDLK_KP0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 RO_keymap[107] = SDLK_KP1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 RO_keymap[108] = SDLK_KP3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 RO_keymap[112] = SDLK_ESCAPE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 RO_keymap[113] = SDLK_F1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 RO_keymap[114] = SDLK_F2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 RO_keymap[115] = SDLK_F3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 RO_keymap[116] = SDLK_F5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 RO_keymap[117] = SDLK_F6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 RO_keymap[118] = SDLK_F8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 RO_keymap[119] = SDLK_F9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 RO_keymap[120] = SDLK_HASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 RO_keymap[121] = SDLK_RIGHT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 RO_keymap[122] = SDLK_KP4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 RO_keymap[123] = SDLK_KP5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 RO_keymap[124] = SDLK_KP2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 memset(RO_pressed, 0, ROKEYBD_ARRAYSIZE); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 /* Variable for mouse relative processing */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 int mouse_relative = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
214 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 /* Check to see if we need to enter or leave mouse relative mode */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
216 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
217 void RISCOS_CheckMouseMode(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 /* If the mouse is hidden and input is grabbed, we use relative mode */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 if ( !(SDL_cursorstate & CURSOR_VISIBLE) && |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 (this->input_grab != SDL_GRAB_OFF) ) { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
222 mouse_relative = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 } else { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 mouse_relative = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
226 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 void RISCOS_PollMouse(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 RISCOS_PollMouseHelper(this, 1); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
232 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
233 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
234 extern int mouseInWindow; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 void WIMP_PollMouse(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 /* Only poll when mouse is over the window */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 if (!mouseInWindow) return; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 RISCOS_PollMouseHelper(this, 0); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
243 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
244 /* Static variables so only changes are reported */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
245 static Sint16 last_x = -1, last_y = -1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 static int last_buttons = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 /* Share routine between WIMP and FULLSCREEN for polling mouse and |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 passing on events */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 void RISCOS_PollMouseHelper(_THIS, int fullscreen) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
251 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
252 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 static int starting = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
255 if (_kernel_swi(OS_Mouse, ®s, ®s) == NULL) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 Sint16 new_x = regs.r[0]; /* Initialy get as OS units */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 Sint16 new_y = regs.r[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 /* Discard mouse events until the let go of the mouse after starting */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 if (starting && regs.r[2] != 0) return; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
262 else starting = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
264 if (new_x != last_x || new_y != last_y || last_buttons != regs.r[2]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
266 /* Something changed so generate appropriate events */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
267 int topLeftX, topLeftY; /* Top left OS units */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
268 int x, y; /* Mouse position in SDL pixels */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
269 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
270 if (fullscreen) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
271 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
272 topLeftX = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
273 topLeftY = (this->hidden->height << this->hidden->yeig) - 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
276 int window_state[9]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
277 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 /* Get current window state */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 window_state[0] = this->hidden->window_handle; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 regs.r[1] = (unsigned int)window_state; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 _kernel_swi(Wimp_GetWindowState, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
282 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 topLeftX = window_state[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 topLeftY = window_state[4]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
285 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
286 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 /* Convert co-ordinates to workspace */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
288 x = new_x - topLeftX; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
289 y = topLeftY - new_y; /* Y goes from top of window/screen */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
290 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
291 /* Convert OS units to pixels */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 x >>= this->hidden->xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 y >>= this->hidden->yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
294 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
295 if (last_x != new_x || last_y != new_y) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 if (mouse_relative) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
298 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 int centre_x = SDL_VideoSurface->w/2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 int centre_y = SDL_VideoSurface->h/2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 if (centre_x != x || centre_y != y) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
304 if (SDL_VideoSurface) SDL_PrivateMouseMotion(0,1,x - centre_x, y - centre_y); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 last_x = topLeftX + (centre_x << this->hidden->xeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 last_y = topLeftY - (centre_y << this->hidden->yeig); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
308 /* Re-centre the mouse pointer, so we still get relative |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
309 movement when the mouse is at the edge of the window |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 or screen. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
311 */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
313 unsigned char block[5]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
314 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
315 block[0] = 3; /* OSWORD move pointer sub-reason code */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 block[1] = last_x & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
317 block[2] = (last_x >> 8) & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
318 block[3] = last_y & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 block[4] = (last_y >> 8) & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
320 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
321 regs.r[0] = 21; /* OSWORD pointer stuff code */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 regs.r[1] = (int)block; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 _kernel_swi(OS_Word, ®s, ®s); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
324 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 last_x = new_x; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 last_y = new_y; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
330 SDL_PrivateMouseMotion(0,0,x,y); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
332 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
333 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
334 if (last_buttons != regs.r[2]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
335 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
336 int changed = last_buttons ^ regs.r[2]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 last_buttons = regs.r[2]; |
658
e71b7108d2d7
Use SDL's internal x, y for mouse button events - fixes relative motion bug.
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
338 if (changed & 4) SDL_PrivateMouseButton((last_buttons & 4) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT, 0, 0); |
e71b7108d2d7
Use SDL's internal x, y for mouse button events - fixes relative motion bug.
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
339 if (changed & 2) SDL_PrivateMouseButton((last_buttons & 2) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE, 0, 0); |
e71b7108d2d7
Use SDL's internal x, y for mouse button events - fixes relative motion bug.
Sam Lantinga <slouken@libsdl.org>
parents:
630
diff
changeset
|
340 if (changed & 1) SDL_PrivateMouseButton((last_buttons & 1) ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT, 0, 0); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
341 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
342 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
343 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
344 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
345 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
346 void RISCOS_PollKeyboard() |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
347 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
348 int which_key = ROKEY_LEFT_SHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
349 int j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 int min_key, max_key; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 SDL_keysym key; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
352 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
353 /* Scan the keyboard to see what is pressed */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 while (which_key <= ROKEY_LAST_KEY) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
355 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
356 which_key = (_kernel_osbyte(121, which_key, 0) & 0xFF); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 if (which_key != ROKEY_NONE) |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
358 { |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 switch(which_key) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
360 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
361 /* Skip over mouse keys */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
362 case ROKEY_LEFT_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 case ROKEY_CENTRE_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 case ROKEY_RIGHT_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
365 which_key = ROKEY_RIGHT_MOUSE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
366 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 /* Ignore keys that cause 2 internal number to be generated */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 case 71: case 24: case 87: case 40: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
372 /* Ignore break as it can be latched on */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
373 case 44: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
374 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
375 |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 default: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
377 RO_pressed[which_key] += 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
378 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
380 which_key++; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
381 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
382 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
383 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 /* Generate key released messages */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 min_key = ROKEY_LAST_KEY+1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 max_key = ROKEY_LEFT_SHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
387 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
388 for (j = ROKEY_LEFT_SHIFT; j <= ROKEY_LAST_KEY; j++) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
389 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
390 if (RO_pressed[j]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
391 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
392 if (RO_pressed[j] == 1) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 RO_pressed[j] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 SDL_PrivateKeyboard(SDL_RELEASED, TranslateKey(j,&key,0)); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
397 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 if (j < min_key) min_key = j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 if (j > max_key) max_key = j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
401 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
402 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
404 /* Generate key pressed messages */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 for (j = min_key; j <= max_key; j++) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
407 if (RO_pressed[j]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
408 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 if (RO_pressed[j] == 2) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
410 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
411 SDL_PrivateKeyboard(SDL_PRESSED,TranslateKey(j,&key,1)); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 RO_pressed[j] = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
414 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
416 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
417 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 static SDL_keysym *TranslateKey(int intkey, SDL_keysym *keysym, int pressed) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
420 /* Set the keysym information */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 keysym->scancode = (unsigned char) intkey; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 keysym->sym = RO_keymap[intkey]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 keysym->mod = KMOD_NONE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 keysym->unicode = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 if ( pressed && SDL_TranslateUNICODE ) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
427 int state; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 int ch; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 state = (_kernel_osbyte(202, 0, 255) & 0xFF); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
432 /*TODO: Take into account other keyboard layouts */ |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
434 ch = keysym->sym; /* This should handle most unshifted keys */ |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
436 if (intkey < 9 || ch == SDLK_UNKNOWN) |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
437 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
438 ch = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
439 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
440 } else if (state & 64) /* Control on */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
441 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
442 ch = ch & 31; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
443 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
444 } else |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
445 { |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
446 int topOfKey = 0; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
447 if (state & 8) /* Shift on */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
448 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
449 topOfKey = 1; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
450 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
451 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
452 if ((state & 16) == 0) /* Caps lock is on */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
453 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
454 if (ch >= SDLK_a && ch <= SDLK_z) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
455 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
456 if ((state & 128) == 0) /* Shift Enable off */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
457 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
458 /* All letter become upper case */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
459 topOfKey = 1; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
460 } else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
461 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
462 /* Shift+Letters gives lower case */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
463 topOfKey = 1 - topOfKey; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
464 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
465 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
466 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
467 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
468 if (topOfKey) |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
469 { |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
470 /* Key produced with shift held down */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
471 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
472 /* Letters just give upper case version */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
473 if (ch >= SDLK_a && ch <= SDLK_z) ch = toupper(ch); |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
474 else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
475 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
476 switch(ch) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
477 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
478 case SDLK_HASH: ch = '~'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
479 case SDLK_QUOTE: ch = '@'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
480 case SDLK_COMMA: ch = '<'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
481 case SDLK_MINUS: ch = '_'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
482 case SDLK_PERIOD: ch = '>'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
483 case SDLK_SLASH: ch = '?'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
484 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
485 case SDLK_0: ch = ')'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
486 case SDLK_1: ch = '!'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
487 case SDLK_2: ch = '"'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
488 case SDLK_3: ch = '£'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
489 case SDLK_4: ch = '$'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
490 case SDLK_5: ch = '%'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
491 case SDLK_6: ch = '^'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
492 case SDLK_7: ch = '&'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
493 case SDLK_8: ch = '*'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
494 case SDLK_9: ch = '('; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
495 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
496 case SDLK_SEMICOLON: ch = ':'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
497 case SDLK_EQUALS: ch = '+'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
498 case SDLK_LEFTBRACKET: ch = '{'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
499 case SDLK_BACKSLASH: ch = '|'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
500 case SDLK_RIGHTBRACKET: ch = '}'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
501 case SDLK_BACKQUOTE: ch = '¬'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
502 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
503 default: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
504 ch = 0; /* Map to zero character if we don't understand it */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
505 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
506 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
507 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
508 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
509 } else if (ch > 126) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
510 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
511 /* SDL key code < 126 map directly onto their Unicode equivalents */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
512 /* Keypad 0 to 9 maps to numeric equivalent */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
513 if (ch >= SDLK_KP0 && ch <= SDLK_KP9) ch = ch - SDLK_KP0 + '0'; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
514 else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
515 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
516 /* Following switch maps other keys that produce an Ascii value */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
517 switch(ch) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
518 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
519 case SDLK_KP_PERIOD: ch = '.'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
520 case SDLK_KP_DIVIDE: ch = '/'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
521 case SDLK_KP_MULTIPLY: ch = '*'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
522 case SDLK_KP_MINUS: ch = '-'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
523 case SDLK_KP_PLUS: ch = '+'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
524 case SDLK_KP_EQUALS: ch = '='; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
525 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
526 default: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
527 /* If we don't know what it is set the Unicode to 0 */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
528 ch = 0; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
529 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
530 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
531 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
532 } |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
533 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
534 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
535 keysym->unicode = ch; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
536 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
537 return(keysym); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
538 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
539 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
540 /* end of SDL_riscosevents.c ... */ |