src/video/uikit/SDL_uikitwindow.m
author Holmes Futrell <hfutrell@umail.ucsb.edu>
Sat, 16 Aug 2008 00:18:40 +0000
branchgsoc2008_iphone
changeset 2453 ac67f7719ba8
parent 2399 d904584ea86d
permissions -rw-r--r--
removed NULL comment ... it's UIKit now, not NULL
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
#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
    25
#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
    26
#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
    27
#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
    28
#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
    29
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    30
#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
    31
#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
    32
#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
    33
#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
    34
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    35
#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
    36
#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
    37
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    38
#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
    39
#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
    40
2399
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    41
static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bool created) {
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    42
2399
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    43
    SDL_WindowData *data;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    44
		
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    45
    /* Allocate the window data */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    46
    data = (SDL_WindowData *)SDL_malloc(sizeof(*data));
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    47
    if (!data) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    48
        SDL_OutOfMemory();
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    49
        return -1;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    50
    }
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    51
    data->windowID = window->id;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    52
    data->uiwindow = uiwindow;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    53
	data->view = nil;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    54
		
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    55
    /* Fill in the SDL window with the window data */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    56
	{
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    57
        window->x = 0;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    58
        window->y = 0;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    59
        window->w = (int)uiwindow.frame.size.width;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    60
        window->h = (int)uiwindow.frame.size.height;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    61
    }
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    62
	
2399
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    63
	window->driverdata = data;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    64
	
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
    65
	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
    66
	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
    67
	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
    68
	window->flags |= SDL_WINDOW_SHOWN;			/* only one window on iPod touch, always shown */
2399
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    69
	window->flags |= SDL_WINDOW_INPUT_FOCUS;	/* always has input focus */	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    70
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    71
	/* SDL_WINDOW_BORDERLESS controls whether status bar is hidden */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    72
	if (window->flags & SDL_WINDOW_BORDERLESS) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    73
		[UIApplication sharedApplication].statusBarHidden = YES;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    74
	}
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    75
	else {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    76
		[UIApplication sharedApplication].statusBarHidden = NO;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    77
	}
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    78
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    79
    return 0;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    80
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    81
}
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    82
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    83
int UIKit_CreateWindow(_THIS, SDL_Window *window) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    84
		
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    85
	/* iPhone applications are single window only */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    86
	if (nil != [SDLUIKitDelegate sharedAppDelegate].window) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    87
		SDL_SetError("Window already exists, no multi-window support.");
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    88
		return -1;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    89
	}
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    90
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    91
	/* ignore the size user requested, and make a fullscreen window */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    92
	UIWindow *uiwindow = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    93
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    94
	if (SetupWindowData(_this, window, uiwindow, SDL_TRUE) < 0) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    95
        [uiwindow release];
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    96
        return -1;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    97
    }	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    98
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
    99
	[SDLUIKitDelegate sharedAppDelegate].window = uiwindow;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   100
	[uiwindow release]; /* release the window (the app delegate has retained it) */
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   101
	
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   102
	return 1;
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   103
	
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   104
}
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   105
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   106
void UIKit_DestroyWindow(_THIS, SDL_Window * window) {
2399
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   107
	/* don't worry, the delegate will automatically release the window */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   108
	
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   109
	SDL_WindowData *data = (SDL_WindowData *)window->driverdata;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   110
	if (data) {
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   111
		SDL_free( window->driverdata );
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   112
	}
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   113
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   114
	/* this will also destroy the window */
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   115
	[SDLUIKitDelegate sharedAppDelegate].window = nil;
d904584ea86d Added SDL_WindowData for UIKit video driver. Now looks up instances here instead of assuming we're referring to a singleton.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents: 2354
diff changeset
   116
2354
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   117
}
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   118
2e4fea4a4416 These files contain the window related functions for the UIKit video driver.
Holmes Futrell <hfutrell@umail.ucsb.edu>
parents:
diff changeset
   119
/* vi: set ts=4 sw=4 expandtab: */