src/video/uikit/SDL_uikitviewcontroller.m
author Kees Bakker <kees@ijzerbout.nl>
Tue, 27 Sep 2011 21:02:26 +0200
changeset 6001 3ae3d1e58d59
parent 5640 04b5b11985c8
child 6003 fddf81967e2d
permissions -rw-r--r--
Cleanup out trailing whitespace in src/video/uikit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     1
/*
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     2
 Simple DirectMedia Layer
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     3
 Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
     4
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     5
 This software is provided 'as-is', without any express or implied
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     6
 warranty.  In no event will the authors be held liable for any damages
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     7
 arising from the use of this software.
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
     8
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
     9
 Permission is granted to anyone to use this software for any purpose,
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    10
 including commercial applications, and to alter it and redistribute it
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    11
 freely, subject to the following restrictions:
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    12
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    13
 1. The origin of this software must not be misrepresented; you must not
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    14
 claim that you wrote the original software. If you use this software
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    15
 in a product, an acknowledgment in the product documentation would be
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    16
 appreciated but is not required.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    17
 2. Altered source versions must be plainly marked as such, and must not be
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    18
 misrepresented as being the original software.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    19
 3. This notice may not be removed or altered from any source distribution.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    20
 */
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    21
#include "SDL_config.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    22
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    23
#include "SDL_video.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    24
#include "SDL_assert.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    25
#include "SDL_hints.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    26
#include "../SDL_sysvideo.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    27
#include "../../events/SDL_events_c.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    28
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    29
#include "SDL_uikitwindow.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    30
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    31
#import "SDL_uikitviewcontroller.h"
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    32
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    33
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    34
@implementation SDL_uikitviewcontroller
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    35
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    36
- (id)initWithSDLWindow:(SDL_Window *)_window {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    37
    if ((self = [self init]) == nil) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    38
        return nil;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    39
    }
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    40
    self->window = _window;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    41
    return self;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    42
}
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    43
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    44
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    45
    const char *orientationsCString;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    46
    if ((orientationsCString = SDL_GetHint(SDL_HINT_ORIENTATIONS)) != NULL) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    47
        BOOL rotate = NO;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    48
        NSString *orientationsNSString = [NSString stringWithCString:orientationsCString
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    49
                                                            encoding:NSUTF8StringEncoding];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    50
        NSArray *orientations = [orientationsNSString componentsSeparatedByCharactersInSet:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    51
                                 [NSCharacterSet characterSetWithCharactersInString:@" "]];
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    52
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    53
        switch (orient) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    54
            case UIInterfaceOrientationLandscapeLeft:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    55
                rotate = [orientations containsObject:@"LandscapeLeft"];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    56
                break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    57
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    58
            case UIInterfaceOrientationLandscapeRight:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    59
                rotate = [orientations containsObject:@"LandscapeRight"];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    60
                break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    61
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    62
            case UIInterfaceOrientationPortrait:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    63
                rotate = [orientations containsObject:@"Portrait"];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    64
                break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    65
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    66
            case UIInterfaceOrientationPortraitUpsideDown:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    67
                rotate = [orientations containsObject:@"PortraitUpsideDown"];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    68
                break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    69
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    70
            default: break;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    71
        }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    72
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    73
        return rotate;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    74
    }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    75
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    76
    if (self->window->flags & SDL_WINDOW_RESIZABLE) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    77
        return YES;  // any orientation is okay.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    78
    }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    79
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    80
    // If not resizable, allow device to orient to other matching sizes
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    81
    //  (that is, let the user turn the device upside down...same screen
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    82
    //   dimensions, but it lets the user place the device where it's most
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    83
    //   comfortable in relation to its physical buttons, headphone jack, etc).
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    84
    switch (orient) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    85
        case UIInterfaceOrientationLandscapeLeft:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    86
        case UIInterfaceOrientationLandscapeRight:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    87
            return (self->window->w >= self->window->h);
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    88
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    89
        case UIInterfaceOrientationPortrait:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    90
        case UIInterfaceOrientationPortraitUpsideDown:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    91
            return (self->window->h >= self->window->w);
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    92
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    93
        default: break;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    94
    }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
    95
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    96
    return NO;  // Nothing else is acceptable.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    97
}
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    98
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
    99
- (void)loadView  {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   100
    // do nothing.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   101
}
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   102
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   103
// Send a resized event when the orientation changes.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   104
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   105
    if ((self->window->flags & SDL_WINDOW_RESIZABLE) == 0) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   106
        return;   // don't care, we're just flipping over in this case.
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   107
    }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   108
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   109
    const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   110
    SDL_WindowData *data = self->window->driverdata;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   111
    UIWindow *uiwindow = data->uiwindow;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   112
    UIScreen *uiscreen = [uiwindow screen];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   113
    const int noborder = self->window->flags & SDL_WINDOW_BORDERLESS;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   114
    CGRect frame = noborder ? [uiscreen bounds] : [uiscreen applicationFrame];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   115
    const CGSize size = frame.size;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   116
    int w, h;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   117
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   118
    switch (toInterfaceOrientation) {
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   119
        case UIInterfaceOrientationPortrait:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   120
        case UIInterfaceOrientationPortraitUpsideDown:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   121
            w = (size.width < size.height) ? size.width : size.height;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   122
            h = (size.width > size.height) ? size.width : size.height;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   123
            break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   124
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   125
        case UIInterfaceOrientationLandscapeLeft:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   126
        case UIInterfaceOrientationLandscapeRight:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   127
            w = (size.width > size.height) ? size.width : size.height;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   128
            h = (size.width < size.height) ? size.width : size.height;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   129
            break;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   130
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   131
        default:
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   132
            SDL_assert(0 && "Unexpected interface orientation!");
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   133
            return;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   134
    }
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   135
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   136
    frame.size.width = w;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   137
    frame.size.height = h;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   138
    frame.origin.x = 0;
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   139
    frame.origin.y = 0;
6001
3ae3d1e58d59 Cleanup out trailing whitespace in src/video/uikit
Kees Bakker <kees@ijzerbout.nl>
parents: 5640
diff changeset
   140
5640
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   141
    [uiwindow setFrame:frame];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   142
    [data->view updateFrame];
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   143
    SDL_SendWindowEvent(self->window, SDL_WINDOWEVENT_RESIZED, w, h);
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   144
}
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   145
04b5b11985c8 Split off SDL_uikitviewcontroller in its own module
Kees Bakker <kees@tweeler.com>
parents:
diff changeset
   146
@end