annotate src/video/dc/SDL_dcevents.c @ 3055:cd863dd2082b

indent
author Sam Lantinga <slouken@libsdl.org>
date Sat, 07 Feb 2009 18:03:46 +0000
parents 4e4d814884aa
children
rev   line source
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
2859
99210400e8b9 Updated copyright date
Sam Lantinga <slouken@libsdl.org>
parents: 2735
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
6 modify it under the terms of the GNU Lesser General Public
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
13 Lesser General Public License for more details.
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
15 You should have received a copy of the GNU Lesser General Public
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
16 License along with this library; if not, write to the Free Software
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
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: 1361
diff changeset
22 #include "SDL_config.h"
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1336
diff changeset
24 #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
25 #include "../../events/SDL_events_c.h"
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 #include "SDL_dcvideo.h"
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_dcevents_c.h"
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29 #include <dc/maple.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <dc/maple/mouse.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <dc/maple/keyboard.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
33 const static unsigned short sdl_key[] = {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
34 /*0 */ 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
35 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
36 'u', 'v', 'w', 'x', 'y', 'z',
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
37 /*1e */ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
38 /*28 */ SDLK_RETURN, SDLK_ESCAPE, SDLK_BACKSPACE, SDLK_TAB, SDLK_SPACE,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
39 SDLK_MINUS, SDLK_PLUS, SDLK_LEFTBRACKET,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
40 SDLK_RIGHTBRACKET, SDLK_BACKSLASH, 0, SDLK_SEMICOLON, SDLK_QUOTE,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
41 /*35 */ '~', SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_CAPSLOCK,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
42 SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
43 SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
44 /*46 */ SDLK_PRINT, SDLK_SCROLLOCK, SDLK_PAUSE, SDLK_INSERT, SDLK_HOME,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
45 SDLK_PAGEUP, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, SDLK_RIGHT,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
46 SDLK_LEFT, SDLK_DOWN, SDLK_UP,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
47 /*53 */ SDLK_NUMLOCK, SDLK_KP_DIVIDE, SDLK_KP_MULTIPLY, SDLK_KP_MINUS,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
48 SDLK_KP_PLUS, SDLK_KP_ENTER,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
49 SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4, SDLK_KP5, SDLK_KP6,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
50 /*5f */ SDLK_KP7, SDLK_KP8, SDLK_KP9, SDLK_KP0, SDLK_KP_PERIOD, 0
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
51 /* S3 */
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 };
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54 const static unsigned short sdl_shift[] = {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
55 SDLK_LCTRL, SDLK_LSHIFT, SDLK_LALT, 0 /* S1 */ ,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
56 SDLK_RCTRL, SDLK_RSHIFT, SDLK_RALT, 0 /* S2 */ ,
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 };
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 #define MOUSE_WHEELUP (1<<4)
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 #define MOUSE_WHEELDOWN (1<<5)
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
62 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
63 mouse_update(void)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
65 const static char sdl_mousebtn[] = {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
66 MOUSE_LEFTBUTTON,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
67 MOUSE_RIGHTBUTTON,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
68 MOUSE_SIDEBUTTON,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
69 MOUSE_WHEELUP,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
70 MOUSE_WHEELDOWN
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
71 };
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
73 uint8 addr;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
74 mouse_cond_t cond;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
75
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
76 static int prev_buttons;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
77 int buttons, changed;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
78 int i;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
80 if ((addr = maple_first_mouse()) == 0 || mouse_get_cond(addr, &cond) < 0)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
81 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
83 buttons = cond.buttons ^ 0xff;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
84 if (cond.dz < 0)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
85 buttons |= MOUSE_WHEELUP;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
86 if (cond.dz > 0)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
87 buttons |= MOUSE_WHEELDOWN;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
89 if (cond.dx || cond.dy)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
90 SDL_PrivateMouseMotion(0, 1, cond.dx, cond.dy);
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
92 changed = buttons ^ prev_buttons;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
93 for (i = 0; i < sizeof(sdl_mousebtn); i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
94 if (changed & sdl_mousebtn[i]) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
95 SDL_PrivateMouseButton((buttons & sdl_mousebtn[i]) ?
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
96 SDL_PRESSED : SDL_RELEASED, i, 0, 0);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
97 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
98 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
99 prev_buttons = buttons;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
102 static void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
103 keyboard_update(void)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
105 static kbd_state_t old_state;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
106 static uint8 old_addr;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
108 kbd_state_t *state;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
109 uint8 addr;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
110 int port, unit;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
111
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
112 int shiftkeys;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
113 SDL_keysym keysym;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
115 int i;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
117 addr = maple_first_kb();
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
119 if (addr == 0)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
120 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
122 if (addr != old_addr) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
123 old_addr = addr;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
124 SDL_memset(&old_state, 0, sizeof(old_state));
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
125 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
127 maple_raddr(addr, &port, &unit);
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
129 state = maple_dev_state(port, unit);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
130 if (!state)
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
131 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
133 shiftkeys = state->shift_keys ^ old_state.shift_keys;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
134 for (i = 0; i < sizeof(sdl_shift); i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
135 if ((shiftkeys >> i) & 1) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
136 keysym.sym = sdl_shift[i];
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
137 SDL_PrivateKeyboard(((state->shift_keys >> i) & 1) ? SDL_PRESSED :
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
138 SDL_RELEASED, &keysym);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
139 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
140 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
142 for (i = 0; i < sizeof(sdl_key); i++) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
143 if (state->matrix[i] != old_state.matrix[i]) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
144 int key = sdl_key[i];
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
145 if (key) {
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
146 keysym.sym = key;
2735
204be4fc2726 Final merge of Google Summer of Code 2008 work...
Sam Lantinga <slouken@libsdl.org>
parents: 1895
diff changeset
147 SDL_PrivateKeyboard(state->matrix[i] ? SDL_PRESSED :
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
148 SDL_RELEASED, &keysym);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
149 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
150 }
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
151 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
153 old_state = *state;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
156 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
157 DC_PumpEvents(_THIS)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
159 keyboard_update();
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
160 mouse_update();
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
163 void
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
164 DC_InitOSKeymap(_THIS)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 {
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
166 /* do nothing. */
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 /* end of SDL_dcevents.c ... */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
170 /* vi: set ts=4 sw=4 expandtab: */