src/video/uikit/SDL_uikitviewcontroller.m
changeset 6003 fddf81967e2d
parent 6001 3ae3d1e58d59
child 6011 83a21d3bd5c1
equal deleted inserted replaced
6002:0c0aaaa1e5ed 6003:fddf81967e2d
    31 #import "SDL_uikitviewcontroller.h"
    31 #import "SDL_uikitviewcontroller.h"
    32 
    32 
    33 
    33 
    34 @implementation SDL_uikitviewcontroller
    34 @implementation SDL_uikitviewcontroller
    35 
    35 
    36 - (id)initWithSDLWindow:(SDL_Window *)_window {
    36 - (id)initWithSDLWindow:(SDL_Window *)_window
       
    37 {
    37     if ((self = [self init]) == nil) {
    38     if ((self = [self init]) == nil) {
    38         return nil;
    39         return nil;
    39     }
    40     }
    40     self->window = _window;
    41     self->window = _window;
    41     return self;
    42     return self;
    42 }
    43 }
    43 
    44 
    44 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient {
    45 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
       
    46 {
    45     const char *orientationsCString;
    47     const char *orientationsCString;
    46     if ((orientationsCString = SDL_GetHint(SDL_HINT_ORIENTATIONS)) != NULL) {
    48     if ((orientationsCString = SDL_GetHint(SDL_HINT_ORIENTATIONS)) != NULL) {
    47         BOOL rotate = NO;
    49         BOOL rotate = NO;
    48         NSString *orientationsNSString = [NSString stringWithCString:orientationsCString
    50         NSString *orientationsNSString = [NSString stringWithCString:orientationsCString
    49                                                             encoding:NSUTF8StringEncoding];
    51                                                             encoding:NSUTF8StringEncoding];
    94     }
    96     }
    95 
    97 
    96     return NO;  // Nothing else is acceptable.
    98     return NO;  // Nothing else is acceptable.
    97 }
    99 }
    98 
   100 
    99 - (void)loadView  {
   101 - (void)loadView
       
   102 {
   100     // do nothing.
   103     // do nothing.
   101 }
   104 }
   102 
   105 
   103 // Send a resized event when the orientation changes.
   106 // Send a resized event when the orientation changes.
   104 - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
   107 - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
       
   108 {
   105     if ((self->window->flags & SDL_WINDOW_RESIZABLE) == 0) {
   109     if ((self->window->flags & SDL_WINDOW_RESIZABLE) == 0) {
   106         return;   // don't care, we're just flipping over in this case.
   110         return;   // don't care, we're just flipping over in this case.
   107     }
   111     }
   108 
   112 
   109     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];
   113     const UIInterfaceOrientation toInterfaceOrientation = [self interfaceOrientation];