2011-08-17 23:26:58 +02:00
|
|
|
/*
|
2011-10-31 05:56:58 -04:00
|
|
|
Simple DirectMedia Layer
|
2014-02-02 00:53:27 -08:00
|
|
|
Copyright (C) 1997-2014 Sam Lantinga <slouken@libsdl.org>
|
2011-10-31 05:56:58 -04:00
|
|
|
|
|
|
|
This software is provided 'as-is', without any express or implied
|
|
|
|
warranty. In no event will the authors be held liable for any damages
|
|
|
|
arising from the use of this software.
|
|
|
|
|
|
|
|
Permission is granted to anyone to use this software for any purpose,
|
|
|
|
including commercial applications, and to alter it and redistribute it
|
|
|
|
freely, subject to the following restrictions:
|
|
|
|
|
|
|
|
1. The origin of this software must not be misrepresented; you must not
|
|
|
|
claim that you wrote the original software. If you use this software
|
|
|
|
in a product, an acknowledgment in the product documentation would be
|
|
|
|
appreciated but is not required.
|
|
|
|
2. Altered source versions must be plainly marked as such, and must not be
|
|
|
|
misrepresented as being the original software.
|
|
|
|
3. This notice may not be removed or altered from any source distribution.
|
|
|
|
*/
|
2013-11-24 23:56:17 -05:00
|
|
|
#include "../../SDL_internal.h"
|
2011-08-17 23:26:58 +02:00
|
|
|
|
2011-10-31 05:56:58 -04:00
|
|
|
#if SDL_VIDEO_DRIVER_UIKIT
|
|
|
|
|
2011-08-17 23:26:58 +02:00
|
|
|
#include "SDL_video.h"
|
|
|
|
#include "SDL_assert.h"
|
|
|
|
#include "SDL_hints.h"
|
|
|
|
#include "../SDL_sysvideo.h"
|
|
|
|
#include "../../events/SDL_events_c.h"
|
|
|
|
|
2011-11-27 23:30:02 -05:00
|
|
|
#include "SDL_uikitviewcontroller.h"
|
|
|
|
#include "SDL_uikitvideo.h"
|
2012-09-29 17:23:40 -07:00
|
|
|
#include "SDL_uikitmodes.h"
|
|
|
|
#include "SDL_uikitwindow.h"
|
|
|
|
|
2011-08-17 23:26:58 +02:00
|
|
|
|
|
|
|
@implementation SDL_uikitviewcontroller
|
|
|
|
|
2011-09-28 21:42:02 +02:00
|
|
|
@synthesize window;
|
|
|
|
|
2011-09-27 22:51:26 +02:00
|
|
|
- (id)initWithSDLWindow:(SDL_Window *)_window
|
|
|
|
{
|
2014-07-29 00:05:48 -03:00
|
|
|
if (self = [super initWithNibName:nil bundle:nil]) {
|
|
|
|
self.window = _window;
|
2011-08-17 23:26:58 +02:00
|
|
|
}
|
|
|
|
return self;
|
|
|
|
}
|
|
|
|
|
2012-09-18 23:13:35 -07:00
|
|
|
- (void)loadView
|
|
|
|
{
|
2013-05-18 14:17:52 -07:00
|
|
|
/* do nothing. */
|
2012-09-18 23:13:35 -07:00
|
|
|
}
|
|
|
|
|
2012-09-23 03:46:49 -07:00
|
|
|
- (void)viewDidLayoutSubviews
|
2012-09-18 23:13:35 -07:00
|
|
|
{
|
2014-07-29 00:05:48 -03:00
|
|
|
const CGSize size = self.view.bounds.size;
|
2014-07-17 18:05:12 -03:00
|
|
|
int w = (int) size.width;
|
|
|
|
int h = (int) size.height;
|
2013-05-18 14:17:52 -07:00
|
|
|
|
2014-07-17 18:05:12 -03:00
|
|
|
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, w, h);
|
2012-09-18 23:13:35 -07:00
|
|
|
}
|
|
|
|
|
2012-09-23 03:46:49 -07:00
|
|
|
- (NSUInteger)supportedInterfaceOrientations
|
2011-09-27 22:51:26 +02:00
|
|
|
{
|
2014-11-20 17:19:26 -04:00
|
|
|
return UIKit_GetSupportedOrientations(window);
|
2011-08-17 23:26:58 +02:00
|
|
|
}
|
|
|
|
|
2012-09-23 03:46:49 -07:00
|
|
|
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient
|
2011-09-27 22:51:26 +02:00
|
|
|
{
|
2012-09-23 03:46:49 -07:00
|
|
|
NSUInteger orientationMask = [self supportedInterfaceOrientations];
|
|
|
|
return (orientationMask & (1 << orient));
|
2011-08-17 23:26:58 +02:00
|
|
|
}
|
|
|
|
|
2013-10-20 23:05:53 -07:00
|
|
|
- (BOOL)prefersStatusBarHidden
|
|
|
|
{
|
2014-11-27 20:25:54 -04:00
|
|
|
return (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0;
|
2013-10-20 23:05:53 -07:00
|
|
|
}
|
|
|
|
|
2014-07-16 20:05:00 -03:00
|
|
|
- (UIStatusBarStyle)preferredStatusBarStyle
|
|
|
|
{
|
2014-11-20 17:19:26 -04:00
|
|
|
/* We assume most SDL apps don't have a bright white background. */
|
2014-07-16 20:05:00 -03:00
|
|
|
return UIStatusBarStyleLightContent;
|
|
|
|
}
|
|
|
|
|
2011-08-17 23:26:58 +02:00
|
|
|
@end
|
2012-09-18 23:13:35 -07:00
|
|
|
|
2012-09-23 03:46:49 -07:00
|
|
|
#endif /* SDL_VIDEO_DRIVER_UIKIT */
|
|
|
|
|
2012-09-18 23:13:35 -07:00
|
|
|
/* vi: set ts=4 sw=4 expandtab: */
|