annotate src/video/dc/SDL_dcevents.c @ 1667:1fddae038bc8 SDL-1.3

Implemented many compatibility functions
author Sam Lantinga <slouken@libsdl.org>
date Mon, 29 May 2006 03:53:21 +0000
parents 782fd950bd46
children 4da1ee79c9af
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
1312
c9b51268668f Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents: 1223
diff changeset
3 Copyright (C) 1997-2006 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
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #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
25 #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
26 #include "../../events/SDL_events_c.h"
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 #include "SDL_dcvideo.h"
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 #include "SDL_dcevents_c.h"
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #include <dc/maple.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31 #include <dc/maple/mouse.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
32 #include <dc/maple/keyboard.h>
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
33
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
34 const static unsigned short sdl_key[] = {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
35 /*0 */ 0, 0, 0, 0, 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i',
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
36 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
37 'u', 'v', 'w', 'x', 'y', 'z',
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
38 /*1e */ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0',
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
39 /*28 */ SDLK_RETURN, SDLK_ESCAPE, SDLK_BACKSPACE, SDLK_TAB, SDLK_SPACE,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
40 SDLK_MINUS, SDLK_PLUS, SDLK_LEFTBRACKET,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
41 SDLK_RIGHTBRACKET, SDLK_BACKSLASH, 0, SDLK_SEMICOLON, SDLK_QUOTE,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
42 /*35 */ '~', SDLK_COMMA, SDLK_PERIOD, SDLK_SLASH, SDLK_CAPSLOCK,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
43 SDLK_F1, SDLK_F2, SDLK_F3, SDLK_F4, SDLK_F5, SDLK_F6, SDLK_F7, SDLK_F8,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
44 SDLK_F9, SDLK_F10, SDLK_F11, SDLK_F12,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
45 /*46 */ SDLK_PRINT, SDLK_SCROLLOCK, SDLK_PAUSE, SDLK_INSERT, SDLK_HOME,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
46 SDLK_PAGEUP, SDLK_DELETE, SDLK_END, SDLK_PAGEDOWN, SDLK_RIGHT,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
47 SDLK_LEFT, SDLK_DOWN, SDLK_UP,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
48 /*53 */ SDLK_NUMLOCK, SDLK_KP_DIVIDE, SDLK_KP_MULTIPLY, SDLK_KP_MINUS,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
49 SDLK_KP_PLUS, SDLK_KP_ENTER,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
50 SDLK_KP1, SDLK_KP2, SDLK_KP3, SDLK_KP4, SDLK_KP5, SDLK_KP6,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
51 /*5f */ SDLK_KP7, SDLK_KP8, SDLK_KP9, SDLK_KP0, SDLK_KP_PERIOD, 0
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
52 /* S3 */
509
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
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 const static unsigned short sdl_shift[] = {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
56 SDLK_LCTRL, SDLK_LSHIFT, SDLK_LALT, 0 /* S1 */ ,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
57 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
58 };
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 #define MOUSE_WHEELUP (1<<4)
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 #define MOUSE_WHEELDOWN (1<<5)
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
63 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
64 mouse_update (void)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
66 const static char sdl_mousebtn[] = {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
67 MOUSE_LEFTBUTTON,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
68 MOUSE_RIGHTBUTTON,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
69 MOUSE_SIDEBUTTON,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
70 MOUSE_WHEELUP,
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
71 MOUSE_WHEELDOWN
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
72 };
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
74 uint8 addr;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
75 mouse_cond_t cond;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
76
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
77 static int prev_buttons;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
78 int buttons, changed;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
79 int i;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
81 if ((addr = maple_first_mouse ()) == 0
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
82 || mouse_get_cond (addr, &cond) < 0)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
83 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
85 buttons = cond.buttons ^ 0xff;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
86 if (cond.dz < 0)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
87 buttons |= MOUSE_WHEELUP;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
88 if (cond.dz > 0)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
89 buttons |= MOUSE_WHEELDOWN;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
91 if (cond.dx || cond.dy)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
92 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
93
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
94 changed = buttons ^ prev_buttons;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
95 for (i = 0; i < sizeof (sdl_mousebtn); i++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
96 if (changed & sdl_mousebtn[i]) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
97 SDL_PrivateMouseButton ((buttons & sdl_mousebtn[i]) ?
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
98 SDL_PRESSED : SDL_RELEASED, i, 0, 0);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
99 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
100 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
101 prev_buttons = buttons;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
104 static void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
105 keyboard_update (void)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
107 static kbd_state_t old_state;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
108 static uint8 old_addr;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
110 kbd_state_t *state;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
111 uint8 addr;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
112 int port, unit;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
113
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
114 int shiftkeys;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
115 SDL_keysym keysym;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
117 int i;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
119 addr = maple_first_kb ();
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
121 if (addr == 0)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
122 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
124 if (addr != old_addr) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
125 old_addr = addr;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
126 SDL_memset (&old_state, 0, sizeof (old_state));
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
127 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
129 maple_raddr (addr, &port, &unit);
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
131 state = maple_dev_state (port, unit);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
132 if (!state)
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
133 return;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
135 shiftkeys = state->shift_keys ^ old_state.shift_keys;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
136 for (i = 0; i < sizeof (sdl_shift); i++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
137 if ((shiftkeys >> i) & 1) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
138 keysym.sym = sdl_shift[i];
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
139 SDL_PrivateKeyboard (((state->
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
140 shift_keys >> i) & 1) ? SDL_PRESSED :
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
141 SDL_RELEASED, &keysym);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
142 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
143 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
145 for (i = 0; i < sizeof (sdl_key); i++) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
146 if (state->matrix[i] != old_state.matrix[i]) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
147 int key = sdl_key[i];
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
148 if (key) {
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
149 keysym.sym = key;
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
150 SDL_PrivateKeyboard (state->
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
151 matrix[i] ? SDL_PRESSED :
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
152 SDL_RELEASED, &keysym);
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
153 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
154 }
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
155 }
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
157 old_state = *state;
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
160 void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
161 DC_PumpEvents (_THIS)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
163 keyboard_update ();
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
164 mouse_update ();
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
167 void
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
168 DC_InitOSKeymap (_THIS)
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 {
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
170 /* do nothing. */
509
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 }
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172
dad72daf44b3 Added initial support for Dreamcast (thanks HERO!)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173 /* end of SDL_dcevents.c ... */
1662
782fd950bd46 Revamp of the video system in progress - adding support for multiple displays, multiple windows, and a full video mode selection API.
Sam Lantinga <slouken@libsdl.org>
parents: 1461
diff changeset
174 /* vi: set ts=4 sw=4 expandtab: */