annotate src/video/uikit/SDL_uikitwindow.m @ 2378:d76ecec0c3f7 gsoc2008_iphone

iPhone SDL 1.3 demos go here. All these demos are written using pure SDL 1.3 code. No compatibility calls! Perhaps if they are any good they could be use as tests for the SDL 1.3 release.
author Holmes Futrell <hfutrell@umail.ucsb.edu>
date Fri, 18 Jul 2008 20:46:02 +0000
parents 2e4fea4a4416
children d904584ea86d
rev   line source
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
1 /*
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
4
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
9
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
13 Lesser General Public License for more details.
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
14
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
18
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
19 Sam Lantinga
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
20 slouken@libsdl.org
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
21 */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
22 #include "SDL_config.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
23
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
24 /* Dummy SDL video driver implementation; this is just enough to make an
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
25 * SDL-based application THINK it's got a working video driver, for
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
26 * applications that call SDL_Init(SDL_INIT_VIDEO) when they don't need it,
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
27 * and also for use as a collection of stubs when porting SDL to a new
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
28 * platform for which you haven't yet written a valid video driver.
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
29 *
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
30 * This is also a great way to determine bottlenecks: if you think that SDL
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
31 * is a performance problem for a given platform, enable this driver, and
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
32 * then see if your application runs faster without video overhead.
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
33 *
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
34 * Initial work by Ryan C. Gordon (icculus@icculus.org). A good portion
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
35 * of this was cut-and-pasted from Stephane Peter's work in the AAlib
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
36 * SDL video driver. Renamed to "DUMMY" by Sam Lantinga.
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
37 */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
38
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
39 #include "SDL_video.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
40 #include "SDL_mouse.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
41 #include "../SDL_sysvideo.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
42 #include "../SDL_pixels_c.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
43 #include "../../events/SDL_events_c.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
44
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
45 #include "SDL_uikitvideo.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
46 #include "SDL_uikitevents.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
47 #include "SDL_uikitwindow.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
48 #import "SDL_uikitappdelegate.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
49
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
50 #import "SDL_uikitopenglview.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
51 #import "SDL_renderer_sw.h"
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
52
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
53 #include <UIKit/UIKit.h>
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
54 #include <Foundation/Foundation.h>
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
55
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
56
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
57
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
58 extern UIWindow *uikitWindow;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
59 extern SDL_uikitopenglview *uikitEAGLView;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
60
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
61 int UIKit_CreateWindow(_THIS, SDL_Window *window) {
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
62
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
63 printf("Create window! UIKIT!\n");
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
64
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
65 uikitWindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
66
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
67 if (window->flags & SDL_WINDOW_BORDERLESS) {
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
68 /* hide status bar */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
69 [UIApplication sharedApplication].statusBarHidden = YES;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
70 }
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
71
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
72 window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
73 window->flags |= SDL_WINDOW_OPENGL; /* window is always OpenGL */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
74 window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
75 window->flags |= SDL_WINDOW_SHOWN; /* only one window on iPod touch, always shown */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
76 window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
77
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
78 return 1;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
79
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
80 }
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
81
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
82 void UIKit_DestroyWindow(_THIS, SDL_Window * window) {
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
83 ;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
84 }
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
85
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
86
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
87
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
88 /* vi: set ts=4 sw=4 expandtab: */