diff options
Diffstat (limited to 'backends')
-rw-r--r-- | backends/platform/ios7/iOS7AppDelegate.h | 9 | ||||
-rw-r--r-- | backends/platform/ios7/iOS7AppDelegate.mm (renamed from backends/platform/ios7/iOS7MainApplication.mm) | 70 | ||||
-rw-r--r-- | backends/platform/ios7/iOS7MainApplication.h | 39 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_main.mm | 2 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_events.cpp | 32 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.cpp | 2 | ||||
-rw-r--r-- | backends/platform/ios7/ios7_osys_main.h | 4 | ||||
-rw-r--r-- | backends/platform/ios7/module.mk | 2 |
8 files changed, 56 insertions, 104 deletions
diff --git a/backends/platform/ios7/iOS7AppDelegate.h b/backends/platform/ios7/iOS7AppDelegate.h new file mode 100644 index 0000000000..49411698c1 --- /dev/null +++ b/backends/platform/ios7/iOS7AppDelegate.h @@ -0,0 +1,9 @@ +// +// Created by Vincent Bénony on 07/12/2015. +// + +#import <UIKit/UIKit.h> + + +@interface iOS7AppDelegate : NSObject<UIApplicationDelegate> +@end diff --git a/backends/platform/ios7/iOS7MainApplication.mm b/backends/platform/ios7/iOS7AppDelegate.mm index c21c017174..784566228c 100644 --- a/backends/platform/ios7/iOS7MainApplication.mm +++ b/backends/platform/ios7/iOS7AppDelegate.mm @@ -1,40 +1,23 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#import "iOS7MainApplication.h" -#import "iOS7ScummVMViewController.h" +// +// Created by Vincent Bénony on 07/12/2015. +// #define FORBIDDEN_SYMBOL_ALLOW_ALL -#import "ios7_common.h" +#import "iOS7AppDelegate.h" +#import "iOS7ScummVMViewController.h" #import "ios7_video.h" +@implementation iOS7AppDelegate { + UIWindow *_window; + iOS7ScummVMViewController *_controller; + iPhoneView *_view; +} -@implementation iOS7MainApplication - --(id)init { - [super init]; - _window = nil; - _view = nil; +- (id)init { + if (self = [super init]) { + _window = nil; + _view = nil; + } return self; } @@ -46,10 +29,6 @@ exit(0); } -- (iPhoneView *)getView { - return _view; -} - - (void)applicationDidFinishLaunching:(UIApplication *)application { CGRect rect = [[UIScreen mainScreen] bounds]; @@ -84,21 +63,11 @@ [NSThread detachNewThreadSelector:@selector(mainLoop:) toTarget:self withObject:nil]; } -- (void)applicationDidResume { -} - -- (void)applicationWillSuspend { -} - -- (void)applicationWillTerminate { -} - -- (void)applicationSuspend:(struct __GSEvent *)event { - //[self setApplicationBadge:NSLocalizedString(@"ON", nil)]; +- (void)applicationDidEnterBackground:(UIApplication *)application { [_view applicationSuspend]; } -- (void)applicationResume:(struct __GSEvent *)event { +- (void)applicationWillEnterForeground:(UIApplication *)application { [_view applicationResume]; } @@ -107,13 +76,8 @@ [_view deviceOrientationChanged:screenOrientation]; } -- (UIWindow*) getWindow { - return _window; -} - @end - const char *iOS7_getDocumentsDir() { NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = [paths objectAtIndex:0]; diff --git a/backends/platform/ios7/iOS7MainApplication.h b/backends/platform/ios7/iOS7MainApplication.h deleted file mode 100644 index a47f5da9ce..0000000000 --- a/backends/platform/ios7/iOS7MainApplication.h +++ /dev/null @@ -1,39 +0,0 @@ -/* ScummVM - Graphic Adventure Engine - * - * ScummVM is the legal property of its developers, whose names - * are too numerous to list here. Please refer to the COPYRIGHT - * file distributed with this source distribution. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version 2 - * of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - * - */ - - -#import <UIKit/UIKit.h> - -@class iOS7ScummVMViewController; -@class iPhoneView; - -@interface iOS7MainApplication : UIApplication { - UIWindow *_window; - iOS7ScummVMViewController *_controller; - iPhoneView *_view; -} - -- (void)mainLoop:(id)param; -- (iPhoneView *)getView; -- (UIWindow *)getWindow; -- (void)didRotate:(NSNotification *)notification; -@end diff --git a/backends/platform/ios7/ios7_main.mm b/backends/platform/ios7/ios7_main.mm index c6ca14d490..96f41f4c02 100644 --- a/backends/platform/ios7/ios7_main.mm +++ b/backends/platform/ios7/ios7_main.mm @@ -39,7 +39,7 @@ int main(int argc, char **argv) { iOS7_argc = argc; iOS7_argv = argv; - returnCode = UIApplicationMain(argc, argv, @"iOS7MainApplication", @"iOS7MainApplication"); + returnCode = UIApplicationMain(argc, argv, @"UIApplication", @"iOS7AppDelegate"); } return returnCode; diff --git a/backends/platform/ios7/ios7_osys_events.cpp b/backends/platform/ios7/ios7_osys_events.cpp index da44983b03..7e805f34b7 100644 --- a/backends/platform/ios7/ios7_osys_events.cpp +++ b/backends/platform/ios7/ios7_osys_events.cpp @@ -68,12 +68,14 @@ bool OSystem_iOS7::pollEvent(Common::Event &event) { case kInputOrientationChanged: handleEvent_orientationChanged(internalEvent.value1); return false; - break; case kInputApplicationSuspended: - suspendLoop(); + handleEvent_applicationSuspended(); + return false; + + case kInputApplicationResumed: + handleEvent_applicationResumed(); return false; - break; case kInputMouseSecondDragged: if (!handleEvent_mouseSecondDragged(event, internalEvent.value1, internalEvent.value2)) @@ -353,16 +355,28 @@ void OSystem_iOS7::handleEvent_orientationChanged(int orientation) { return; } - if (_screenOrientation != newOrientation) { _screenOrientation = newOrientation; - updateOutputSurface(); + rebuildSurface(); + } +} - dirtyFullScreen(); - if (_videoContext->overlayVisible) +void OSystem_iOS7::rebuildSurface() { + updateOutputSurface(); + + dirtyFullScreen(); + if (_videoContext->overlayVisible) { dirtyFullOverlayScreen(); - updateScreen(); - } + } + updateScreen(); +} + +void OSystem_iOS7::handleEvent_applicationSuspended() { + suspendLoop(); +} + +void OSystem_iOS7::handleEvent_applicationResumed() { + rebuildSurface(); } void OSystem_iOS7::handleEvent_keyPressed(Common::Event &event, int keyPressed) { diff --git a/backends/platform/ios7/ios7_osys_main.cpp b/backends/platform/ios7/ios7_osys_main.cpp index 84ddff26df..a58aa10340 100644 --- a/backends/platform/ios7/ios7_osys_main.cpp +++ b/backends/platform/ios7/ios7_osys_main.cpp @@ -339,6 +339,6 @@ void iOS7_main(int argc, char **argv) { assert(g_system); // Invoke the actual ScummVM main entry point: - scummvm_main(argc, argv); + scummvm_main(argc, (const char *const *) argv); g_system->quit(); // TODO: Consider removing / replacing this! } diff --git a/backends/platform/ios7/ios7_osys_main.h b/backends/platform/ios7/ios7_osys_main.h index 50114a9112..26b147e2a1 100644 --- a/backends/platform/ios7/ios7_osys_main.h +++ b/backends/platform/ios7/ios7_osys_main.h @@ -210,6 +210,8 @@ protected: bool handleEvent_tap(Common::Event &event, UIViewTapDescription type, int touches); void handleEvent_keyPressed(Common::Event &event, int keyPressed); void handleEvent_orientationChanged(int orientation); + void handleEvent_applicationSuspended(); + void handleEvent_applicationResumed(); bool handleEvent_mouseDown(Common::Event &event, int x, int y); bool handleEvent_mouseUp(Common::Event &event, int x, int y); @@ -219,6 +221,8 @@ protected: bool handleEvent_mouseDragged(Common::Event &event, int x, int y); bool handleEvent_mouseSecondDragged(Common::Event &event, int x, int y); + + void rebuildSurface(); }; #endif diff --git a/backends/platform/ios7/module.mk b/backends/platform/ios7/module.mk index fad69d715e..5ee4c7a601 100644 --- a/backends/platform/ios7/module.mk +++ b/backends/platform/ios7/module.mk @@ -9,7 +9,7 @@ MODULE_OBJS := \ ios7_video.o \ ios7_keyboard.o \ iOS7ScummVMViewController.o \ - iOS7MainApplication.o + iOS7AppDelegate.o # We don't use rules.mk but rather manually update OBJS and MODULE_DIRS. MODULE_OBJS := $(addprefix $(MODULE)/, $(MODULE_OBJS)) |