Mercurial > sdl-ios-xcode
annotate src/video/riscos/SDL_riscosevents.c @ 1415:a30f8553eeb1
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 22 Feb 2006 00:33:10 +0000 |
parents | d910939febfa |
children | 782fd950bd46 c121d94672cb a1b03ba2fcd0 |
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 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1035
diff
changeset
|
20 slouken@libsdl.org |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
1402
d910939febfa
Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents:
1379
diff
changeset
|
22 #include "SDL_config.h" |
630
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 /* |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
25 File added by Alan Buckley (alan_baa@hotmail.com) for RISC OS compatability |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 27 March 2003 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 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
|
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #include "SDL.h" |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
33 #include "../../timer/SDL_timer_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
34 #include "../../events/SDL_sysevents.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
35 #include "../../events/SDL_events_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
36 #include "../SDL_cursor_c.h" |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 #include "SDL_riscosvideo.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 #include "SDL_riscosevents_c.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 #include "memory.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 #include "stdlib.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 #include "ctype.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 #include "kernel.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 #include "swis.h" |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
47 /* The translation table from a RISC OS internal key numbers to a SDL keysym */ |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 static SDLKey RO_keymap[SDLK_LAST]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
50 /* RISC OS Key codes */ |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 #define ROKEY_SHIFT 0 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 #define ROKEY_CTRL 1 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 #define ROKEY_ALT 2 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 /* 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
|
55 #define ROKEY_LEFT_SHIFT 3 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 /* 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
|
58 #define ROKEY_LEFT_MOUSE 9 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 #define ROKEY_CENTRE_MOUSE 10 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 #define ROKEY_RIGHT_MOUSE 11 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 /* 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
|
63 #define ROKEY_NONE 255 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 /* Id of last key in keyboard */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 #define ROKEY_LAST_KEY 124 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 /* Size of array for all keys */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 #define ROKEYBD_ARRAYSIZE 125 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 static char RO_pressed[ROKEYBD_ARRAYSIZE]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 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
|
74 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 void RISCOS_PollMouse(_THIS); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 void RISCOS_PollKeyboard(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 void RISCOS_PollMouseHelper(_THIS, int fullscreen); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
80 #if SDL_THREADS_DISABLED |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 extern void DRenderer_FillBuffers(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 /* Timer running function */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 extern void RISCOS_CheckTimer(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 |
955
d74fbf56f2f6
Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
86 #endif |
d74fbf56f2f6
Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
87 |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 void FULLSCREEN_PumpEvents(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 /* 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
|
91 RISCOS_PollKeyboard(); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 RISCOS_PollMouse(this); |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1336
diff
changeset
|
93 #if SDL_THREADS_DISABLED |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
94 // DRenderer_FillBuffers(); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 if (SDL_timer_running) RISCOS_CheckTimer(); |
955
d74fbf56f2f6
Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
96 #endif |
630
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 void RISCOS_InitOSKeymap(_THIS) |
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 int i; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 /* Map the VK keysyms */ |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
105 for ( i=0; i<SDL_arraysize(RO_keymap); ++i ) |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 RO_keymap[i] = SDLK_UNKNOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 RO_keymap[3] = SDLK_LSHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 RO_keymap[4] = SDLK_LCTRL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 RO_keymap[5] = SDLK_LALT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 RO_keymap[6] = SDLK_RSHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 RO_keymap[7] = SDLK_RCTRL; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 RO_keymap[8] = SDLK_RALT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 RO_keymap[16] = SDLK_q; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 RO_keymap[17] = SDLK_3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 RO_keymap[18] = SDLK_4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 RO_keymap[19] = SDLK_5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 RO_keymap[20] = SDLK_F4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 RO_keymap[21] = SDLK_8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 RO_keymap[22] = SDLK_F7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 RO_keymap[23] = SDLK_MINUS, |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 RO_keymap[25] = SDLK_LEFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 RO_keymap[26] = SDLK_KP6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 RO_keymap[27] = SDLK_KP7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 RO_keymap[28] = SDLK_F11; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 RO_keymap[29] = SDLK_F12; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 RO_keymap[30] = SDLK_F10; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 RO_keymap[31] = SDLK_SCROLLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 RO_keymap[32] = SDLK_PRINT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 RO_keymap[33] = SDLK_w; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 RO_keymap[34] = SDLK_e; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 RO_keymap[35] = SDLK_t; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 RO_keymap[36] = SDLK_7; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 RO_keymap[37] = SDLK_i; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 RO_keymap[38] = SDLK_9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 RO_keymap[39] = SDLK_0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 RO_keymap[41] = SDLK_DOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 RO_keymap[42] = SDLK_KP8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 RO_keymap[43] = SDLK_KP9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 RO_keymap[44] = SDLK_BREAK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 RO_keymap[45] = SDLK_BACKQUOTE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 /* 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
|
143 RO_keymap[47] = SDLK_BACKSPACE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 RO_keymap[48] = SDLK_1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 RO_keymap[49] = SDLK_2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 RO_keymap[50] = SDLK_d; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 RO_keymap[51] = SDLK_r; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 RO_keymap[52] = SDLK_6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 RO_keymap[53] = SDLK_u; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 RO_keymap[54] = SDLK_o; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
151 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
|
152 RO_keymap[56] = SDLK_LEFTBRACKET; |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
153 RO_keymap[57] = SDLK_UP; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
154 RO_keymap[58] = SDLK_KP_PLUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
155 RO_keymap[59] = SDLK_KP_MINUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
156 RO_keymap[60] = SDLK_KP_ENTER; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
157 RO_keymap[61] = SDLK_INSERT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
158 RO_keymap[62] = SDLK_HOME; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
159 RO_keymap[63] = SDLK_PAGEUP; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
160 RO_keymap[64] = SDLK_CAPSLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
161 RO_keymap[65] = SDLK_a; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
162 RO_keymap[66] = SDLK_x; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
163 RO_keymap[67] = SDLK_f; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
164 RO_keymap[68] = SDLK_y; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 RO_keymap[69] = SDLK_j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
166 RO_keymap[70] = SDLK_k; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
167 RO_keymap[72] = SDLK_SEMICOLON; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
168 RO_keymap[73] = SDLK_RETURN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 RO_keymap[74] = SDLK_KP_DIVIDE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
170 RO_keymap[76] = SDLK_KP_PERIOD; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
171 RO_keymap[77] = SDLK_NUMLOCK; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
172 RO_keymap[78] = SDLK_PAGEDOWN; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
173 RO_keymap[79] = SDLK_QUOTE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
174 RO_keymap[81] = SDLK_s; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
175 RO_keymap[82] = SDLK_c; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
176 RO_keymap[83] = SDLK_g; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
177 RO_keymap[84] = SDLK_h; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
178 RO_keymap[85] = SDLK_n; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
179 RO_keymap[86] = SDLK_l; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
180 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
|
181 RO_keymap[88] = SDLK_RIGHTBRACKET; |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
182 RO_keymap[89] = SDLK_DELETE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
183 RO_keymap[90] = SDLK_KP_MINUS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
184 RO_keymap[91] = SDLK_KP_MULTIPLY; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
185 RO_keymap[93] = SDLK_EQUALS; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
186 RO_keymap[94] = SDLK_BACKSLASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
187 RO_keymap[96] = SDLK_TAB; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
188 RO_keymap[97] = SDLK_z; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
189 RO_keymap[98] = SDLK_SPACE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
190 RO_keymap[99] = SDLK_v; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
191 RO_keymap[100] = SDLK_b; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
192 RO_keymap[101] = SDLK_m; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
193 RO_keymap[102] = SDLK_COMMA; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
194 RO_keymap[103] = SDLK_PERIOD; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
195 RO_keymap[104] = SDLK_SLASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
196 RO_keymap[105] = SDLK_END; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
197 RO_keymap[106] = SDLK_KP0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
198 RO_keymap[107] = SDLK_KP1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
199 RO_keymap[108] = SDLK_KP3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
200 RO_keymap[112] = SDLK_ESCAPE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
201 RO_keymap[113] = SDLK_F1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
202 RO_keymap[114] = SDLK_F2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
203 RO_keymap[115] = SDLK_F3; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
204 RO_keymap[116] = SDLK_F5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
205 RO_keymap[117] = SDLK_F6; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
206 RO_keymap[118] = SDLK_F8; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
207 RO_keymap[119] = SDLK_F9; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
208 RO_keymap[120] = SDLK_HASH; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
209 RO_keymap[121] = SDLK_RIGHT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
210 RO_keymap[122] = SDLK_KP4; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
211 RO_keymap[123] = SDLK_KP5; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
212 RO_keymap[124] = SDLK_KP2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
213 |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
214 SDL_memset(RO_pressed, 0, ROKEYBD_ARRAYSIZE); |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
215 } |
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
218 /* Variable for mouse relative processing */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
219 int mouse_relative = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
220 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
221 /* 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
|
222 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
223 void RISCOS_CheckMouseMode(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
224 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
225 /* 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
|
226 if ( !(SDL_cursorstate & CURSOR_VISIBLE) && |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
227 (this->input_grab != SDL_GRAB_OFF) ) { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
228 mouse_relative = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
229 } else { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
230 mouse_relative = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
231 } |
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
235 void RISCOS_PollMouse(_THIS) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
236 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
237 RISCOS_PollMouseHelper(this, 1); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
238 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
239 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
240 extern int mouseInWindow; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
241 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
242 void WIMP_PollMouse(_THIS) |
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 /* 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
|
245 if (!mouseInWindow) return; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
246 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
247 RISCOS_PollMouseHelper(this, 0); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
248 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
249 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
250 /* 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
|
251 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
|
252 static int last_buttons = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
253 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
254 /* 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
|
255 passing on events */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
256 void RISCOS_PollMouseHelper(_THIS, int fullscreen) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
257 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
258 _kernel_swi_regs regs; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
259 static int starting = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
260 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
261 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
|
262 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
263 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
|
264 Sint16 new_y = regs.r[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
265 |
1035
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
266 /* Discard mouse events until they let go of the mouse after starting */ |
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
267 if (starting && regs.r[2] != 0) |
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
268 return; |
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
269 else |
974ba6ae0fa3
Date: Wed, 26 Jan 2005 13:37:09 GMT
Sam Lantinga <slouken@libsdl.org>
parents:
955
diff
changeset
|
270 starting = 0; |
630
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 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
|
273 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
274 /* Something changed so generate appropriate events */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
275 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
|
276 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
|
277 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
278 if (fullscreen) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
279 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
280 topLeftX = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
281 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
|
282 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
283 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
284 int window_state[9]; |
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 /* Get current window state */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
287 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
|
288 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
|
289 _kernel_swi(Wimp_GetWindowState, ®s, ®s); |
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 topLeftX = window_state[1]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
292 topLeftY = window_state[4]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
293 } |
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 /* Convert co-ordinates to workspace */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
296 x = new_x - topLeftX; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
297 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
|
298 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
299 /* Convert OS units to pixels */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
300 x >>= this->hidden->xeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
301 y >>= this->hidden->yeig; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
302 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
303 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
|
304 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
305 if (mouse_relative) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
306 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
307 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
|
308 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
|
309 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
310 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
|
311 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
312 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
|
313 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
|
314 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
|
315 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
316 /* 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
|
317 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
|
318 or screen. |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
319 */ |
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 unsigned char block[5]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
322 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
323 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
|
324 block[1] = last_x & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
325 block[2] = (last_x >> 8) & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
326 block[3] = last_y & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
327 block[4] = (last_y >> 8) & 0xFF; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
328 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
329 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
|
330 regs.r[1] = (int)block; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
331 _kernel_swi(OS_Word, ®s, ®s); |
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 } else |
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 last_x = new_x; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
337 last_y = new_y; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
338 SDL_PrivateMouseMotion(0,0,x,y); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
339 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
340 } |
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 if (last_buttons != regs.r[2]) |
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 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
|
345 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
|
346 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
|
347 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
|
348 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
|
349 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
350 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
351 } |
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
354 void RISCOS_PollKeyboard() |
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 int which_key = ROKEY_LEFT_SHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
357 int j; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
358 int min_key, max_key; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
359 SDL_keysym 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 /* 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
|
362 while (which_key <= ROKEY_LAST_KEY) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
363 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
364 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
|
365 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
|
366 { |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
367 switch(which_key) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
368 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
369 /* Skip over mouse keys */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
370 case ROKEY_LEFT_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
371 case ROKEY_CENTRE_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
372 case ROKEY_RIGHT_MOUSE: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
373 which_key = ROKEY_RIGHT_MOUSE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
374 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
375 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
376 /* 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
|
377 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
|
378 break; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
379 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
380 /* 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
|
381 case 44: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
382 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
383 |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
384 default: |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
385 RO_pressed[which_key] += 2; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
386 break; |
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 which_key++; |
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 } |
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 /* Generate key released messages */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
393 min_key = ROKEY_LAST_KEY+1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
394 max_key = ROKEY_LEFT_SHIFT; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
395 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
396 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
|
397 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
398 if (RO_pressed[j]) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
399 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
400 if (RO_pressed[j] == 1) |
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 RO_pressed[j] = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
403 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
|
404 } else |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
405 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
406 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
|
407 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
|
408 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
409 } |
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 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
412 /* Generate key pressed messages */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
413 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
|
414 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
415 if (RO_pressed[j]) |
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 if (RO_pressed[j] == 2) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
418 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
419 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
|
420 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
421 RO_pressed[j] = 1; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
422 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
423 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
424 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
425 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
426 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
|
427 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
428 /* Set the keysym information */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
429 keysym->scancode = (unsigned char) intkey; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
430 keysym->sym = RO_keymap[intkey]; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
431 keysym->mod = KMOD_NONE; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
432 keysym->unicode = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
433 if ( pressed && SDL_TranslateUNICODE ) |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
434 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
435 int state; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
436 int ch; |
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 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
|
439 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
440 /*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
|
441 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
442 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
|
443 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
444 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
|
445 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
446 ch = 0; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
447 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
448 } else if (state & 64) /* Control on */ |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
449 { |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
450 ch = ch & 31; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
451 |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
452 } else |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
453 { |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
454 int topOfKey = 0; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
455 if (state & 8) /* Shift on */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
456 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
457 topOfKey = 1; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
458 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
459 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
460 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
|
461 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
462 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
|
463 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
464 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
|
465 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
466 /* All letter become upper case */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
467 topOfKey = 1; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
468 } else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
469 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
470 /* Shift+Letters gives lower case */ |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
471 topOfKey = 1 - topOfKey; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
472 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
473 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
474 } |
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 if (topOfKey) |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
477 { |
733
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
478 /* 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
|
479 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
480 /* 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
|
481 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
|
482 else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
483 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
484 switch(ch) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
485 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
486 case SDLK_HASH: ch = '~'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
487 case SDLK_QUOTE: ch = '@'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
488 case SDLK_COMMA: ch = '<'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
489 case SDLK_MINUS: ch = '_'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
490 case SDLK_PERIOD: ch = '>'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
491 case SDLK_SLASH: ch = '?'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
492 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
493 case SDLK_0: ch = ')'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
494 case SDLK_1: ch = '!'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
495 case SDLK_2: ch = '"'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
496 case SDLK_3: ch = '£'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
497 case SDLK_4: ch = '$'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
498 case SDLK_5: ch = '%'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
499 case SDLK_6: ch = '^'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
500 case SDLK_7: ch = '&'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
501 case SDLK_8: ch = '*'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
502 case SDLK_9: ch = '('; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
503 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
504 case SDLK_SEMICOLON: ch = ':'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
505 case SDLK_EQUALS: ch = '+'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
506 case SDLK_LEFTBRACKET: ch = '{'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
507 case SDLK_BACKSLASH: ch = '|'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
508 case SDLK_RIGHTBRACKET: ch = '}'; break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
509 case SDLK_BACKQUOTE: ch = '¬'; break; |
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 default: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
512 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
|
513 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
514 } |
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 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
517 } else if (ch > 126) |
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 /* 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
|
520 /* 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
|
521 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
|
522 else |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
523 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
524 /* 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
|
525 switch(ch) |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
526 { |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
527 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
|
528 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
|
529 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
|
530 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
|
531 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
|
532 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
|
533 |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
534 default: |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
535 /* 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
|
536 ch = 0; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
537 break; |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
538 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
539 } |
9557ac1857a3
Date: Mon, 13 Oct 2003 13:37:18 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
658
diff
changeset
|
540 } |
630
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
541 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
542 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
543 keysym->unicode = ch; |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
544 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
545 return(keysym); |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
546 } |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
547 |
550bccdf04bd
Added initial support for RISC OS (thanks Peter Naulls!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
548 /* end of SDL_riscosevents.c ... */ |
955
d74fbf56f2f6
Date: Fri, 25 Jun 2004 13:29:15 +0100
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
549 |