src/video/uikit/SDL_uikitappdelegate.h
author Sam Lantinga <slouken@libsdl.org>
Tue, 05 Apr 2011 09:50:25 -0700
changeset 5532 8a04b596b472
parent 5262 b530ef003506
child 5535 96594ac5fd1a
permissions -rw-r--r--
Allow overriding the app delegate on iOS Vittorio G. to Eric, Sam Actually this is much simpler than i thought, I just had to specify a class method to get the delegate name and then the category can override that method! I've attached the patch that enables this features: in my code i could remove my custom main() and simply add @implementation SDLUIKitDelegate (customDelegate) +(NSString *)getAppDelegateClassName { return @"HedgewarsAppDelegate"; } @end I tested it and with the sdl demos it loads the normal SDLUIKitDelegate, while in my code it loads my HedgewarsAppDelegate!

/*
    SDL - Simple DirectMedia Layer
    Copyright (C) 1997-2011 Sam Lantinga

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Lesser General Public
    License as published by the Free Software Foundation; either
    version 2.1 of the License, or (at your option) any later version.

    This library 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
    Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public
    License along with this library; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

    Sam Lantinga
    slouken@libsdl.org
*/

#import <UIKit/UIKit.h>
#import "SDL_uikitopenglview.h"

/* *INDENT-OFF* */
@interface SDLUIKitDelegate:NSObject<UIApplicationDelegate> {
}

+(SDLUIKitDelegate *)sharedAppDelegate;
+(NSString *)getAppDelegateClassName;

@end
/* *INDENT-ON* */

/* vi: set ts=4 sw=4 expandtab: */