Skip to content

Commit

Permalink
de-hardcode changes to SDL 2.0.3 source code.
Browse files Browse the repository at this point in the history
Added a subclass of SDLUIKitDelegate to Exult's code to display the dpad and ESC button. Unfortunately it still needs a line in SDL_uikitwindow.m to full work
  • Loading branch information
DominusExult committed Sep 4, 2016
1 parent 711f982 commit 84c7732
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
3 changes: 0 additions & 3 deletions ios/SDL2-2.0.3/src/video/uikit/SDL_uikitappdelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@
#import <UIKit/UIKit.h>

@interface SDLUIKitDelegate : NSObject<UIApplicationDelegate> {
UIWindow *window;
}

@property (nonatomic, retain) UIWindow *window;

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

Expand Down
1 change: 0 additions & 1 deletion ios/SDL2-2.0.3/src/video/uikit/SDL_uikitappdelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ - (void)updateSplashImage:(UIInterfaceOrientation)interfaceOrientation


@implementation SDLUIKitDelegate
@synthesize window;

/* convenience method */
+ (id) sharedAppDelegate
Expand Down
4 changes: 2 additions & 2 deletions ios/SDL2-2.0.3/src/video/uikit/SDL_uikitwindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo
/* !!! FIXME: can we have a smaller view? */
UIWindow *uiwindow = [UIWindow alloc];
uiwindow = [uiwindow initWithFrame:[data->uiscreen bounds]];
[[[UIApplication sharedApplication] delegate] setWindow:uiwindow];

// !!! FIXME: this needs to be in Exult code
[[[UIApplication sharedApplication] delegate] setWindow:uiwindow];
/* put the window on an external display if appropriate. This implicitly
* does [uiwindow setframe:[uiscreen bounds]], so don't do it on the
* main display, where we land by default, as that would eat the
Expand Down
28 changes: 28 additions & 0 deletions ios/ios_utils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,41 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "GamePadView.h"
#import "./SDL2-2.0.3/src/video/uikit/SDL_uikitappdelegate.h"
#include "Configuration.h"

#include <cassert>

static char docs_dir[512];
extern "C" int SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode);

// Add a 'category' to the SDL app delegate class
@interface ExultAppDelegate : SDLUIKitDelegate
{
UIWindow* window;
}
@property (nonatomic, retain) UIWindow *window;

@end

@implementation SDLUIKitDelegate (Exult)
+ (NSString *)getAppDelegateClassName
{
//override this SDL method so an instance of our subclass is used
return @"ExultAppDelegate";
}

@end

@implementation ExultAppDelegate
@synthesize window;

-(void) dealloc {
[window release];
[super dealloc];
}

@end

@interface UIManager : NSObject<UIAlertViewDelegate, KeyInputDelegate, GamePadButtonDelegate>
{
Expand Down

0 comments on commit 84c7732

Please sign in to comment.