22 |
22 |
23 #include "SDL_uikitopengles.h" |
23 #include "SDL_uikitopengles.h" |
24 #include "SDL_uikitopenglview.h" |
24 #include "SDL_uikitopenglview.h" |
25 #include "SDL_uikitappdelegate.h" |
25 #include "SDL_uikitappdelegate.h" |
26 #include "SDL_uikitwindow.h" |
26 #include "SDL_uikitwindow.h" |
27 #include "jump.h" |
27 #include "jumphack.h" |
28 #include "SDL_sysvideo.h" |
28 #include "SDL_sysvideo.h" |
29 #include "SDL_loadso.h" |
29 #include "SDL_loadso.h" |
30 #include <dlfcn.h> |
30 #include <dlfcn.h> |
31 |
31 |
32 static int UIKit_GL_Initialize(_THIS); |
32 static int UIKit_GL_Initialize(_THIS); |
59 } |
59 } |
60 |
60 |
61 int |
61 int |
62 UIKit_GL_LoadLibrary(_THIS, const char *path) |
62 UIKit_GL_LoadLibrary(_THIS, const char *path) |
63 { |
63 { |
64 /* shouldn't be passing a path into this function */ |
64 /* |
|
65 shouldn't be passing a path into this function |
|
66 why? Because we've already loaded the library |
|
67 and because the SDK forbids loading an external SO |
|
68 */ |
65 if (path != NULL) { |
69 if (path != NULL) { |
66 SDL_SetError("iPhone GL Load Library just here for compatibility"); |
70 SDL_SetError("iPhone GL Load Library just here for compatibility"); |
67 return -1; |
71 return -1; |
68 } |
72 } |
69 return 0; |
73 return 0; |
93 |
97 |
94 SDL_uikitopenglview *view; |
98 SDL_uikitopenglview *view; |
95 |
99 |
96 SDL_WindowData *data = (SDL_WindowData *)window->driverdata; |
100 SDL_WindowData *data = (SDL_WindowData *)window->driverdata; |
97 |
101 |
|
102 /* construct our view, passing in SDL's OpenGL configuration data */ |
98 view = [[SDL_uikitopenglview alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame] \ |
103 view = [[SDL_uikitopenglview alloc] initWithFrame: [[UIScreen mainScreen] applicationFrame] \ |
99 retainBacking: _this->gl_config.retained_backing \ |
104 retainBacking: _this->gl_config.retained_backing \ |
100 rBits: _this->gl_config.red_size \ |
105 rBits: _this->gl_config.red_size \ |
101 gBits: _this->gl_config.green_size \ |
106 gBits: _this->gl_config.green_size \ |
102 bBits: _this->gl_config.blue_size \ |
107 bBits: _this->gl_config.blue_size \ |
103 aBits: _this->gl_config.alpha_size \ |
108 aBits: _this->gl_config.alpha_size \ |
104 depthBits: _this->gl_config.depth_size]; |
109 depthBits: _this->gl_config.depth_size]; |
105 |
110 |
106 view.multipleTouchEnabled = YES; |
|
107 |
|
108 data->view = view; |
111 data->view = view; |
109 |
112 |
|
113 /* add the view to our window */ |
110 [data->uiwindow addSubview: view ]; |
114 [data->uiwindow addSubview: view ]; |
111 |
115 |
112 /* Don't worry, the window retained the view */ |
116 /* Don't worry, the window retained the view */ |
113 [view release]; |
117 [view release]; |
114 |
118 |