Mercurial > sdl-ios-xcode
comparison src/video/bwindow/SDL_BWin.h @ 1361:19418e4422cb
New configure-based build system. Still work in progress, but much improved
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 16 Feb 2006 10:11:48 +0000 |
parents | 3692456e7b0f |
children | e440d5c488c1 |
comparison
equal
deleted
inserted
replaced
1360:70a9cfb4cf1b | 1361:19418e4422cb |
---|---|
25 | 25 |
26 #include <stdio.h> | 26 #include <stdio.h> |
27 #include <AppKit.h> | 27 #include <AppKit.h> |
28 #include <InterfaceKit.h> | 28 #include <InterfaceKit.h> |
29 #include <be/game/DirectWindow.h> | 29 #include <be/game/DirectWindow.h> |
30 #ifdef HAVE_OPENGL | 30 #if SDL_VIDEO_OPENGL |
31 #include <be/opengl/GLView.h> | 31 #include <be/opengl/GLView.h> |
32 #endif | 32 #endif |
33 #include <support/UTF8.h> | 33 #include <support/UTF8.h> |
34 | 34 |
35 #include "SDL_BeApp.h" | 35 #include "SDL_BeApp.h" |
36 #include "SDL_events.h" | 36 #include "SDL_events.h" |
37 #include "SDL_BView.h" | 37 #include "SDL_BView.h" |
38 | 38 |
39 extern "C" { | 39 extern "C" { |
40 #include "SDL_events_c.h" | 40 #include "../../events/SDL_events_c.h" |
41 }; | 41 }; |
42 | 42 |
43 class SDL_BWin : public BDirectWindow | 43 class SDL_BWin : public BDirectWindow |
44 { | 44 { |
45 public: | 45 public: |
47 BDirectWindow(bounds, "Untitled", B_TITLED_WINDOW, 0) { | 47 BDirectWindow(bounds, "Untitled", B_TITLED_WINDOW, 0) { |
48 InitKeyboard(); | 48 InitKeyboard(); |
49 last_buttons = 0; | 49 last_buttons = 0; |
50 | 50 |
51 the_view = NULL; | 51 the_view = NULL; |
52 #ifdef HAVE_OPENGL | 52 #if SDL_VIDEO_OPENGL |
53 SDL_GLView = NULL; | 53 SDL_GLView = NULL; |
54 #endif | 54 #endif |
55 SDL_View = NULL; | 55 SDL_View = NULL; |
56 Unlock(); | 56 Unlock(); |
57 shown = false; | 57 shown = false; |
59 } | 59 } |
60 | 60 |
61 virtual ~SDL_BWin() { | 61 virtual ~SDL_BWin() { |
62 Lock(); | 62 Lock(); |
63 if ( the_view ) { | 63 if ( the_view ) { |
64 #ifdef HAVE_OPENGL | 64 #if SDL_VIDEO_OPENGL |
65 if ( the_view == SDL_GLView ) { | 65 if ( the_view == SDL_GLView ) { |
66 SDL_GLView->UnlockGL(); | 66 SDL_GLView->UnlockGL(); |
67 } | 67 } |
68 #endif | 68 #endif |
69 RemoveChild(the_view); | 69 RemoveChild(the_view); |
70 the_view = NULL; | 70 the_view = NULL; |
71 } | 71 } |
72 Unlock(); | 72 Unlock(); |
73 #ifdef HAVE_OPENGL | 73 #if SDL_VIDEO_OPENGL |
74 if ( SDL_GLView ) { | 74 if ( SDL_GLView ) { |
75 delete SDL_GLView; | 75 delete SDL_GLView; |
76 } | 76 } |
77 #endif | 77 #endif |
78 if ( SDL_View ) { | 78 if ( SDL_View ) { |
216 int retval; | 216 int retval; |
217 | 217 |
218 retval = 0; | 218 retval = 0; |
219 Lock(); | 219 Lock(); |
220 if ( flags & SDL_OPENGL ) { | 220 if ( flags & SDL_OPENGL ) { |
221 #ifdef HAVE_OPENGL | 221 #if SDL_VIDEO_OPENGL |
222 if ( SDL_GLView == NULL ) { | 222 if ( SDL_GLView == NULL ) { |
223 SDL_GLView = new BGLView(Bounds(), "SDL GLView", | 223 SDL_GLView = new BGLView(Bounds(), "SDL GLView", |
224 B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS), | 224 B_FOLLOW_ALL_SIDES, (B_WILL_DRAW|B_FRAME_EVENTS), |
225 gl_flags); | 225 gl_flags); |
226 } | 226 } |
240 if ( SDL_View == NULL ) { | 240 if ( SDL_View == NULL ) { |
241 SDL_View = new SDL_BView(Bounds()); | 241 SDL_View = new SDL_BView(Bounds()); |
242 } | 242 } |
243 if ( the_view != SDL_View ) { | 243 if ( the_view != SDL_View ) { |
244 if ( the_view ) { | 244 if ( the_view ) { |
245 #ifdef HAVE_OPENGL | 245 #if SDL_VIDEO_OPENGL |
246 if ( the_view == SDL_GLView ) { | 246 if ( the_view == SDL_GLView ) { |
247 SDL_GLView->UnlockGL(); | 247 SDL_GLView->UnlockGL(); |
248 } | 248 } |
249 #endif | 249 #endif |
250 RemoveChild(the_view); | 250 RemoveChild(the_view); |
258 } | 258 } |
259 virtual void SetBitmap(BBitmap *bitmap) { | 259 virtual void SetBitmap(BBitmap *bitmap) { |
260 SDL_View->SetBitmap(bitmap); | 260 SDL_View->SetBitmap(bitmap); |
261 } | 261 } |
262 virtual void SetXYOffset(int x, int y) { | 262 virtual void SetXYOffset(int x, int y) { |
263 #ifdef HAVE_OPENGL | 263 #if SDL_VIDEO_OPENGL |
264 if ( the_view == SDL_GLView ) { | 264 if ( the_view == SDL_GLView ) { |
265 return; | 265 return; |
266 } | 266 } |
267 #endif | 267 #endif |
268 SDL_View->SetXYOffset(x, y); | 268 SDL_View->SetXYOffset(x, y); |
269 } | 269 } |
270 virtual void GetXYOffset(int &x, int &y) { | 270 virtual void GetXYOffset(int &x, int &y) { |
271 #ifdef HAVE_OPENGL | 271 #if SDL_VIDEO_OPENGL |
272 if ( the_view == SDL_GLView ) { | 272 if ( the_view == SDL_GLView ) { |
273 x = 0; | 273 x = 0; |
274 y = 0; | 274 y = 0; |
275 return; | 275 return; |
276 } | 276 } |
285 } | 285 } |
286 virtual void EndDraw(void) { | 286 virtual void EndDraw(void) { |
287 SDL_View->Sync(); | 287 SDL_View->Sync(); |
288 Unlock(); | 288 Unlock(); |
289 } | 289 } |
290 #ifdef HAVE_OPENGL | 290 #if SDL_VIDEO_OPENGL |
291 virtual void SwapBuffers(void) { | 291 virtual void SwapBuffers(void) { |
292 SDL_GLView->UnlockGL(); | 292 SDL_GLView->UnlockGL(); |
293 SDL_GLView->LockGL(); | 293 SDL_GLView->LockGL(); |
294 SDL_GLView->SwapBuffers(); | 294 SDL_GLView->SwapBuffers(); |
295 } | 295 } |
538 } | 538 } |
539 BDirectWindow::DispatchMessage(msg, target); | 539 BDirectWindow::DispatchMessage(msg, target); |
540 } | 540 } |
541 | 541 |
542 private: | 542 private: |
543 #ifdef HAVE_OPENGL | 543 #if SDL_VIDEO_OPENGL |
544 BGLView *SDL_GLView; | 544 BGLView *SDL_GLView; |
545 #endif | 545 #endif |
546 SDL_BView *SDL_View; | 546 SDL_BView *SDL_View; |
547 BView *the_view; | 547 BView *the_view; |
548 | 548 |