annotate src/video/bwindow/SDL_BWin.h @ 910:4ab6d1fd028f

Date: Sat, 26 Jun 2004 14:58:42 +0300 From: "Mike Gorchak" Subject: QNX 6.3 fixes for SDL Sam, I've added new OpenGL framework for SDL, which appeared in the new QNX version - 6.3. I've leave compatibility with previous QNX versions. And I've moved all GL specific functions to the separate module, like it done for the other platforms. SDL is now ready for the QNX 6.3 :)
author Sam Lantinga <slouken@libsdl.org>
date Sun, 18 Jul 2004 19:46:38 +0000
parents 3bd4d7a1ee04
children a649064a3215
rev   line source
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
1 /*
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
769
b8d311d90021 Updated copyright information for 2004 (Happy New Year!)
Sam Lantinga <slouken@libsdl.org>
parents: 297
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
4
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
9
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
13 Library General Public License for more details.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
14
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
18
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
19 Sam Lantinga
252
e8157fcb3114 Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents: 1
diff changeset
20 slouken@libsdl.org
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
21 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
22
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
23 #ifdef SAVE_RCSID
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
24 static char rcsid =
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
25 "@(#) $Id$";
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
26 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
27
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
28 #ifndef _SDL_BWin_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
29 #define _SDL_BWin_h
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
30
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
31 #include <stdio.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
32 #include <AppKit.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
33 #include <InterfaceKit.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
34 #include <be/game/DirectWindow.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
35 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
36 #include <be/opengl/GLView.h>
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
37 #endif
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
38 #include <support/UTF8.h>
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
39
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
40 #include "SDL_BeApp.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
41 #include "SDL_events.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
42 #include "SDL_BView.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
43
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
44 extern "C" {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
45 #include "SDL_events_c.h"
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
46 };
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
47
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
48 class SDL_BWin : public BDirectWindow
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
49 {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
50 public:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
51 SDL_BWin(BRect bounds) :
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
52 BDirectWindow(bounds, "Untitled", B_TITLED_WINDOW, 0) {
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
53 InitKeyboard();
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
54 last_buttons = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
55
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
56 the_view = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
57 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
58 SDL_GLView = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
59 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
60 SDL_View = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
61 Unlock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
62 shown = false;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
63 inhibit_resize = false;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
64 }
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
65
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
66 virtual ~SDL_BWin() {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
67 Lock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
68 if ( the_view ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
69 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
70 if ( the_view == SDL_GLView ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
71 SDL_GLView->UnlockGL();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
72 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
73 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
74 RemoveChild(the_view);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
75 the_view = NULL;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
76 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
77 Unlock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
78 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
79 if ( SDL_GLView ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
80 delete SDL_GLView;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
81 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
82 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
83 if ( SDL_View ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
84 delete SDL_View;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
85 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
86 }
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
87
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
88 virtual void InitKeyboard(void) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
89 for ( uint i=0; i<SDL_TABLESIZE(keymap); ++i )
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
90 keymap[i] = SDLK_UNKNOWN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
91
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
92 keymap[0x01] = SDLK_ESCAPE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
93 keymap[B_F1_KEY] = SDLK_F1;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
94 keymap[B_F2_KEY] = SDLK_F2;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
95 keymap[B_F3_KEY] = SDLK_F3;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
96 keymap[B_F4_KEY] = SDLK_F4;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
97 keymap[B_F5_KEY] = SDLK_F5;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
98 keymap[B_F6_KEY] = SDLK_F6;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
99 keymap[B_F7_KEY] = SDLK_F7;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
100 keymap[B_F8_KEY] = SDLK_F8;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
101 keymap[B_F9_KEY] = SDLK_F9;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
102 keymap[B_F10_KEY] = SDLK_F10;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
103 keymap[B_F11_KEY] = SDLK_F11;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
104 keymap[B_F12_KEY] = SDLK_F12;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
105 keymap[B_PRINT_KEY] = SDLK_PRINT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
106 keymap[B_SCROLL_KEY] = SDLK_SCROLLOCK;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
107 keymap[B_PAUSE_KEY] = SDLK_PAUSE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
108 keymap[0x11] = SDLK_BACKQUOTE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
109 keymap[0x12] = SDLK_1;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
110 keymap[0x13] = SDLK_2;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
111 keymap[0x14] = SDLK_3;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
112 keymap[0x15] = SDLK_4;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
113 keymap[0x16] = SDLK_5;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
114 keymap[0x17] = SDLK_6;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
115 keymap[0x18] = SDLK_7;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
116 keymap[0x19] = SDLK_8;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
117 keymap[0x1a] = SDLK_9;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
118 keymap[0x1b] = SDLK_0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
119 keymap[0x1c] = SDLK_MINUS;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
120 keymap[0x1d] = SDLK_EQUALS;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
121 keymap[0x1e] = SDLK_BACKSPACE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
122 keymap[0x1f] = SDLK_INSERT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
123 keymap[0x20] = SDLK_HOME;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
124 keymap[0x21] = SDLK_PAGEUP;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
125 keymap[0x22] = SDLK_NUMLOCK;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
126 keymap[0x23] = SDLK_KP_DIVIDE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
127 keymap[0x24] = SDLK_KP_MULTIPLY;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
128 keymap[0x25] = SDLK_KP_MINUS;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
129 keymap[0x26] = SDLK_TAB;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
130 keymap[0x27] = SDLK_q;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
131 keymap[0x28] = SDLK_w;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
132 keymap[0x29] = SDLK_e;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
133 keymap[0x2a] = SDLK_r;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
134 keymap[0x2b] = SDLK_t;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
135 keymap[0x2c] = SDLK_y;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
136 keymap[0x2d] = SDLK_u;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
137 keymap[0x2e] = SDLK_i;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
138 keymap[0x2f] = SDLK_o;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
139 keymap[0x30] = SDLK_p;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
140 keymap[0x31] = SDLK_LEFTBRACKET;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
141 keymap[0x32] = SDLK_RIGHTBRACKET;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
142 keymap[0x33] = SDLK_BACKSLASH;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
143 keymap[0x34] = SDLK_DELETE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
144 keymap[0x35] = SDLK_END;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
145 keymap[0x36] = SDLK_PAGEDOWN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
146 keymap[0x37] = SDLK_KP7;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
147 keymap[0x38] = SDLK_KP8;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
148 keymap[0x39] = SDLK_KP9;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
149 keymap[0x3a] = SDLK_KP_PLUS;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
150 keymap[0x3b] = SDLK_CAPSLOCK;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
151 keymap[0x3c] = SDLK_a;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
152 keymap[0x3d] = SDLK_s;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
153 keymap[0x3e] = SDLK_d;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
154 keymap[0x3f] = SDLK_f;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
155 keymap[0x40] = SDLK_g;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
156 keymap[0x41] = SDLK_h;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
157 keymap[0x42] = SDLK_j;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
158 keymap[0x43] = SDLK_k;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
159 keymap[0x44] = SDLK_l;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
160 keymap[0x45] = SDLK_SEMICOLON;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
161 keymap[0x46] = SDLK_QUOTE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
162 keymap[0x47] = SDLK_RETURN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
163 keymap[0x48] = SDLK_KP4;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
164 keymap[0x49] = SDLK_KP5;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
165 keymap[0x4a] = SDLK_KP6;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
166 keymap[0x4b] = SDLK_LSHIFT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
167 keymap[0x4c] = SDLK_z;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
168 keymap[0x4d] = SDLK_x;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
169 keymap[0x4e] = SDLK_c;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
170 keymap[0x4f] = SDLK_v;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
171 keymap[0x50] = SDLK_b;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
172 keymap[0x51] = SDLK_n;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
173 keymap[0x52] = SDLK_m;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
174 keymap[0x53] = SDLK_COMMA;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
175 keymap[0x54] = SDLK_PERIOD;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
176 keymap[0x55] = SDLK_SLASH;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
177 keymap[0x56] = SDLK_RSHIFT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
178 keymap[0x57] = SDLK_UP;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
179 keymap[0x58] = SDLK_KP1;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
180 keymap[0x59] = SDLK_KP2;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
181 keymap[0x5a] = SDLK_KP3;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
182 keymap[0x5b] = SDLK_KP_ENTER;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
183 keymap[0x5c] = SDLK_LCTRL;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
184 keymap[0x5d] = SDLK_LALT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
185 keymap[0x5e] = SDLK_SPACE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
186 keymap[0x5f] = SDLK_RALT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
187 keymap[0x60] = SDLK_RCTRL;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
188 keymap[0x61] = SDLK_LEFT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
189 keymap[0x62] = SDLK_DOWN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
190 keymap[0x63] = SDLK_RIGHT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
191 keymap[0x64] = SDLK_KP0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
192 keymap[0x65] = SDLK_KP_PERIOD;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
193 keymap[0x66] = SDLK_LMETA;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
194 keymap[0x67] = SDLK_RMETA;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
195 keymap[0x68] = SDLK_MENU;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
196 keymap[0x69] = SDLK_EURO;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
197 keymap[0x6a] = SDLK_KP_EQUALS;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
198 keymap[0x6b] = SDLK_POWER;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
199 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
200
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
201 /* Override the Show() method so we can tell when we've been shown */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
202 virtual void Show(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
203 BWindow::Show();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
204 shown = true;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
205 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
206 virtual bool Shown(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
207 return (shown);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
208 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
209 /* If called, the next resize event will not be forwarded to SDL. */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
210 virtual void InhibitResize(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
211 inhibit_resize=true;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
212 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
213 /* Handle resizing of the window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
214 virtual void FrameResized(float width, float height) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
215 if(inhibit_resize)
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
216 inhibit_resize = false;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
217 else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
218 SDL_PrivateResize((int)width, (int)height);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
219 }
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
220 virtual int CreateView(Uint32 flags, Uint32 gl_flags) {
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
221 int retval;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
222
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
223 retval = 0;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
224 Lock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
225 if ( flags & SDL_OPENGL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
226 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
227 if ( SDL_GLView == NULL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
228 SDL_GLView = new BGLView(Bounds(), "SDL GLView",
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
229 B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS),
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
230 gl_flags);
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
231 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
232 if ( the_view != SDL_GLView ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
233 if ( the_view ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
234 RemoveChild(the_view);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
235 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
236 AddChild(SDL_GLView);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
237 SDL_GLView->LockGL();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
238 the_view = SDL_GLView;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
239 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
240 #else
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
241 SDL_SetError("OpenGL support not enabled");
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
242 retval = -1;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
243 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
244 } else {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
245 if ( SDL_View == NULL ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
246 SDL_View = new SDL_BView(Bounds());
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
247 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
248 if ( the_view != SDL_View ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
249 if ( the_view ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
250 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
251 if ( the_view == SDL_GLView ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
252 SDL_GLView->UnlockGL();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
253 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
254 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
255 RemoveChild(the_view);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
256 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
257 AddChild(SDL_View);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
258 the_view = SDL_View;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
259 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
260 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
261 Unlock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
262 return(retval);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
263 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
264 virtual void SetBitmap(BBitmap *bitmap) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
265 SDL_View->SetBitmap(bitmap);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
266 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
267 virtual void SetXYOffset(int x, int y) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
268 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
269 if ( the_view == SDL_GLView ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
270 return;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
271 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
272 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
273 SDL_View->SetXYOffset(x, y);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
274 }
1
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
275 virtual void GetXYOffset(int &x, int &y) {
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
276 #ifdef HAVE_OPENGL
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
277 if ( the_view == SDL_GLView ) {
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
278 x = 0;
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
279 y = 0;
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
280 return;
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
281 }
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
282 #endif
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
283 SDL_View->GetXYOffset(x, y);
cf2af46e9e2a Changes since SDL 1.2.0 release
Sam Lantinga <slouken@lokigames.com>
parents: 0
diff changeset
284 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
285 virtual bool BeginDraw(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
286 return(Lock());
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
287 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
288 virtual void DrawAsync(BRect updateRect) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
289 SDL_View->DrawAsync(updateRect);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
290 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
291 virtual void EndDraw(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
292 SDL_View->Sync();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
293 Unlock();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
294 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
295 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
296 virtual void SwapBuffers(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
297 SDL_GLView->UnlockGL();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
298 SDL_GLView->LockGL();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
299 SDL_GLView->SwapBuffers();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
300 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
301 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
302 virtual BView *View(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
303 return(the_view);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
304 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
305
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
306 /* Hook functions -- overridden */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
307 virtual void Minimize(bool minimize) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
308 /* This is only called when mimimized, not when restored */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
309 //SDL_PrivateAppActive(minimize, SDL_APPACTIVE);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
310 BWindow::Minimize(minimize);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
311 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
312 virtual void WindowActivated(bool active) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
313 SDL_PrivateAppActive(active, SDL_APPINPUTFOCUS);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
314 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
315 virtual bool QuitRequested(void) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
316 if ( SDL_BeAppActive > 0 ) {
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
317 SDL_PrivateQuit();
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
318 /* We don't ever actually close the window here because
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
319 the application should respond to the quit request,
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
320 or ignore it as desired.
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
321 */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
322 return(false);
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
323 }
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
324 return(true); /* Close the app window */
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
325 }
906
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
326 virtual void Quit() {
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
327 if (!IsLocked())
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
328 Lock();
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
329 BDirectWindow::Quit();
a48acf6ee48f Date: Sat, 03 Jul 2004 02:23:48 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 769
diff changeset
330 }
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
331
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
332 virtual int16 Translate2Unicode(const char *buf) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
333 int32 state, srclen, dstlen;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
334 unsigned char destbuf[2];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
335 Uint16 unicode = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
336
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
337 if ((uchar)buf[0] > 127) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
338 state = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
339 srclen = strlen(buf);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
340 dstlen = sizeof(destbuf);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
341 convert_from_utf8(B_UNICODE_CONVERSION, buf, &srclen, (char *)destbuf, &dstlen, &state);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
342 unicode = destbuf[0];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
343 unicode <<= 8;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
344 unicode |= destbuf[1];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
345 } else
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
346 unicode = buf[0];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
347
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
348 /* For some reason function keys map to control characters */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
349 # define CTRL(X) ((X)-'@')
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
350 switch (unicode) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
351 case CTRL('A'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
352 case CTRL('B'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
353 case CTRL('C'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
354 case CTRL('D'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
355 case CTRL('E'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
356 case CTRL('K'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
357 case CTRL('L'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
358 case CTRL('P'):
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
359 if ( ! (SDL_GetModState() & KMOD_CTRL) )
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
360 unicode = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
361 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
362 /* Keyboard input maps newline to carriage return */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
363 case '\n':
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
364 unicode = '\r';
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
365 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
366 default:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
367 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
368 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
369
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
370 return unicode;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
371 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
372
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
373 virtual void DispatchMessage(BMessage *msg, BHandler *target) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
374 switch (msg->what) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
375 case B_MOUSE_MOVED:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
376 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
377 BPoint where;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
378 int32 transit;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
379 if (msg->FindPoint("where", &where) == B_OK && msg->FindInt32("be:transit", &transit) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
380 if (transit == B_EXITED_VIEW) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
381 if ( SDL_GetAppState() & SDL_APPMOUSEFOCUS ) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
382 SDL_PrivateAppActive(0, SDL_APPMOUSEFOCUS);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
383 be_app->SetCursor(B_HAND_CURSOR);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
384 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
385 } else {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
386 int x, y;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
387 if ( ! (SDL_GetAppState() & SDL_APPMOUSEFOCUS) ) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
388 SDL_PrivateAppActive(1, SDL_APPMOUSEFOCUS);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
389 SDL_SetCursor(NULL);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
390 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
391 GetXYOffset(x, y);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
392 x = (int)where.x - x;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
393 y = (int)where.y - y;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
394 SDL_PrivateMouseMotion(0, 0, x, y);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
395 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
396 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
397 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
398 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
399
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
400 case B_MOUSE_DOWN:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
401 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
402 /* it looks like mouse down is send only for first clicked
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
403 button, each next is not send while last one is holded */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
404 int32 buttons;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
405 int sdl_buttons = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
406 if (msg->FindInt32("buttons", &buttons) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
407 /* Add any mouse button events */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
408 if (buttons & B_PRIMARY_MOUSE_BUTTON) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
409 sdl_buttons |= SDL_BUTTON_LEFT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
410 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
411 if (buttons & B_SECONDARY_MOUSE_BUTTON) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
412 sdl_buttons |= SDL_BUTTON_RIGHT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
413 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
414 if (buttons & B_TERTIARY_MOUSE_BUTTON) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
415 sdl_buttons |= SDL_BUTTON_MIDDLE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
416 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
417 SDL_PrivateMouseButton(SDL_PRESSED, sdl_buttons, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
418
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
419 last_buttons = buttons;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
420 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
421 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
422 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
423
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
424 case B_MOUSE_UP:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
425 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
426 /* mouse up doesn't give which button was released,
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
427 only state of buttons (after release, so it's always = 0),
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
428 which is is not what we need ;]
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
429 So we need to store button in mouse down, and restore
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
430 in mouse up :(
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
431 mouse up is (similarly to mouse down) send only when
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
432 no more buttons are down */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
433 int32 buttons;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
434 int sdl_buttons = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
435 if (msg->FindInt32("buttons", &buttons) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
436 /* Add any mouse button events */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
437 if ((buttons ^ B_PRIMARY_MOUSE_BUTTON) & last_buttons) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
438 sdl_buttons |= SDL_BUTTON_LEFT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
439 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
440 if ((buttons ^ B_SECONDARY_MOUSE_BUTTON) & last_buttons) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
441 sdl_buttons |= SDL_BUTTON_RIGHT;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
442 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
443 if ((buttons ^ B_TERTIARY_MOUSE_BUTTON) & last_buttons) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
444 sdl_buttons |= SDL_BUTTON_MIDDLE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
445 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
446 SDL_PrivateMouseButton(SDL_RELEASED, sdl_buttons, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
447
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
448 last_buttons = buttons;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
449 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
450 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
451 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
452
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
453 case B_MOUSE_WHEEL_CHANGED:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
454 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
455 float x, y;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
456 x = y = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
457 if (msg->FindFloat("be:wheel_delta_x", &x) == B_OK && msg->FindFloat("be:wheel_delta_y", &y) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
458 if (x < 0 || y < 0) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
459 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELDOWN, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
460 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELDOWN, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
461 } else if (x > 0 || y > 0) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
462 SDL_PrivateMouseButton(SDL_PRESSED, SDL_BUTTON_WHEELUP, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
463 SDL_PrivateMouseButton(SDL_RELEASED, SDL_BUTTON_WHEELUP, 0, 0);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
464 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
465 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
466 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
467 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
468
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
469 case B_KEY_DOWN:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
470 case B_UNMAPPED_KEY_DOWN: /* modifier keys are unmapped */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
471 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
472 int32 key;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
473 int32 modifiers;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
474 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
475 SDL_keysym keysym;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
476 keysym.scancode = key;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
477 if (key < 128) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
478 keysym.sym = keymap[key];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
479 } else {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
480 keysym.sym = SDLK_UNKNOWN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
481 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
482 /* FIX THIS?
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
483 it seems SDL_PrivateKeyboard() changes mod value
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
484 anyway, and doesn't care about what we setup here */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
485 keysym.mod = KMOD_NONE;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
486 keysym.unicode = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
487 if (SDL_TranslateUNICODE) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
488 const char *bytes;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
489 if (msg->FindString("bytes", &bytes) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
490 /* FIX THIS?
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
491 this cares only about first "letter",
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
492 so if someone maps some key to print
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
493 "BeOS rulez!" only "B" will be used. */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
494 keysym.unicode = Translate2Unicode(bytes);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
495 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
496 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
497 SDL_PrivateKeyboard(SDL_PRESSED, &keysym);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
498 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
499 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
500 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
501
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
502 case B_KEY_UP:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
503 case B_UNMAPPED_KEY_UP: /* modifier keys are unmapped */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
504 {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
505 int32 key;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
506 int32 modifiers;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
507 if (msg->FindInt32("key", &key) == B_OK && msg->FindInt32("modifiers", &modifiers) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
508 SDL_keysym keysym;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
509 keysym.scancode = key;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
510 if (key < 128) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
511 keysym.sym = keymap[key];
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
512 } else {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
513 keysym.sym = SDLK_UNKNOWN;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
514 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
515 keysym.mod = KMOD_NONE; /* FIX THIS? */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
516 keysym.unicode = 0;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
517 if (SDL_TranslateUNICODE) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
518 const char *bytes;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
519 if (msg->FindString("bytes", &bytes) == B_OK) {
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
520 keysym.unicode = Translate2Unicode(bytes);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
521 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
522 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
523 SDL_PrivateKeyboard(SDL_RELEASED, &keysym);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
524 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
525 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
526 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
527
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
528 default:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
529 /* move it after switch{} so it's always handled
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
530 that way we keep BeOS feautures like:
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
531 - CTRL+Q to close window (and other shortcuts)
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
532 - PrintScreen to make screenshot into /boot/home
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
533 - etc.. */
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
534 //BDirectWindow::DispatchMessage(msg, target);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
535 break;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
536 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
537 BDirectWindow::DispatchMessage(msg, target);
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
538 }
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
539
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
540 private:
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
541 #ifdef HAVE_OPENGL
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
542 BGLView *SDL_GLView;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
543 #endif
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
544 SDL_BView *SDL_View;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
545 BView *the_view;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
546
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
547 bool shown;
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
548 bool inhibit_resize;
907
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
549
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
550 int32 last_buttons;
3bd4d7a1ee04 Date: Mon, 21 Jun 2004 16:52:47 +0200
Sam Lantinga <slouken@libsdl.org>
parents: 906
diff changeset
551 SDLKey keymap[128];
0
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
552 };
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
553
74212992fb08 Initial revision
Sam Lantinga <slouken@lokigames.com>
parents:
diff changeset
554 #endif /* _SDL_BWin_h */