[SDL] How to make SDL 2.0, iOS work together. (Game Center too)

BJ brad at wildfire.com.au
Wed May 2 21:56:55 PDT 2012


If you need access to the application delegate, window, view or view controller here is how to do it.


Code:

#include "./sdl/src/video/uikit/SDL_uikitappDelegate.h"
#include "./sdl/src/video/uikit/SDL_uikitwindow.h"

SDL_uikitviewcontroller *gViewColtroller = NULL;
UIWindow *gWindow = NULL;
SDL_uikitopenglview *gView = NULL;
SDLUIKitDelegate *gApplicationDelegate = NULL;

void SetUIViewController(SDL_Window *aWindow)
{
    SDL_WindowData *data = (SDL_WindowData *)aWindow->driverdata;
    gViewColtroller = data->viewcontroller;
    gWindow = data->uiwindow;
    gView = data->view;

    gApplicationDelegate = [SDLUIKitDelegate sharedAppDelegate];
}



Just pass in the window, that you have made. Your includes maybe different depending where you have placed the SDL library.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20120502/ee010ac7/attachment.htm>


More information about the SDL mailing list