Ignore:
Timestamp:
2010-05-28 07:39:52 (2 years ago)
Author:
kpoole
Message:

Episode 5

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Classes/SDL/src/video/uikit/SDL_uikitopengles.m

    r4 r26  
    3131 
    3232static int UIKit_GL_Initialize(_THIS); 
     33 
     34extern UIView *gLandscapeView; 
     35UIView *gLandscapeView; 
     36 
     37extern unsigned char gFlippedGL; 
    3338 
    3439void * 
     
    8691    /* since now we've got something to draw 
    8792       make the window visible */ 
    88     [data->uiwindow makeKeyAndVisible]; 
     93//  [data->uiwindow makeKeyAndVisible]; 
    8994 
    9095    /* we need to let the event cycle run, or the OS won't update the OpenGL view! */ 
     
    111116    data->view = view; 
    112117     
     118     
    113119    /* add the view to our window */ 
    114120    [data->uiwindow addSubview: view ]; 
     
    121127        return NULL; 
    122128    } 
     129     
     130    // KP: added here 
     131     
     132#ifdef __IPAD__ 
     133    CGRect frameRect = CGRectMake(0.0, 0.0, 1024.0, 768.0); 
     134#else 
     135    CGRect frameRect = CGRectMake(0.0, 0.0, 480.0, 320.0); 
     136#endif 
     137    data->landscapeView = [[UIView alloc] initWithFrame: frameRect]; 
     138    CGAffineTransform tr = data->landscapeView.transform; // get current transform (portrait) 
     139    if (gFlippedGL) 
     140        tr = CGAffineTransformRotate(tr, -(M_PI / 2.0)); // rotate 90 degrees to go landscape 
     141    else 
     142        tr = CGAffineTransformRotate(tr, (M_PI / 2.0)); // rotate 90 degrees to go landscape 
     143 
     144    data->landscapeView.transform = tr; // set current transform (landscape) 
     145    data->landscapeView.center = data->uiwindow.center; 
     146     
     147     
     148    UIView* clearView = [[UIView alloc] initWithFrame:frameRect]; 
     149    clearView.backgroundColor = [UIColor colorWithRed:0.1f green:0.1f blue:0.1f alpha:0.75f]; 
     150    [data->landscapeView addSubview:clearView]; 
     151     
     152    [data->uiwindow addSubview:data->landscapeView]; 
     153     
     154    [data->uiwindow makeKeyAndVisible]; 
     155     
     156    gLandscapeView = data->landscapeView; 
     157    gLandscapeView.hidden = YES; 
    123158         
    124159    return view; 
Note: See TracChangeset for help on using the changeset viewer.