src/video/psp/SDL_pspvideo.c
changeset 7191 75360622e65f
parent 7147 370f207f24ec
child 7677 871d43c6968a
equal deleted inserted replaced
7190:11612d544fcd 7191:75360622e65f
    49 }
    49 }
    50 
    50 
    51 static void
    51 static void
    52 PSP_Destroy(SDL_VideoDevice * device)
    52 PSP_Destroy(SDL_VideoDevice * device)
    53 {
    53 {
    54 //    SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata;
    54 /*    SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */
    55 
    55 
    56     if (device->driverdata != NULL) {
    56     if (device->driverdata != NULL) {
    57         device->driverdata = NULL;
    57         device->driverdata = NULL;
    58     }
    58     }
    59 }
    59 }
    85     if (phdata == NULL) {
    85     if (phdata == NULL) {
    86         SDL_OutOfMemory();
    86         SDL_OutOfMemory();
    87         SDL_free(device);
    87         SDL_free(device);
    88         return NULL;
    88         return NULL;
    89     }
    89     }
    90         
    90 
    91 		gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
    91         gldata = (SDL_GLDriverData *) SDL_calloc(1, sizeof(SDL_GLDriverData));
    92     if (gldata == NULL) {
    92     if (gldata == NULL) {
    93         SDL_OutOfMemory();
    93         SDL_OutOfMemory();
    94         SDL_free(device);
    94         SDL_free(device);
    95         return NULL;
    95         return NULL;
    96     }	
    96     }
    97     device->gl_data = gldata;
    97     device->gl_data = gldata;
    98     
    98 
    99     device->driverdata = phdata;
    99     device->driverdata = phdata;
   100 
   100 
   101     phdata->egl_initialized = SDL_TRUE;
   101     phdata->egl_initialized = SDL_TRUE;
   102 
   102 
   103 
   103 
   134     device->GL_MakeCurrent = PSP_GL_MakeCurrent;
   134     device->GL_MakeCurrent = PSP_GL_MakeCurrent;
   135     device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
   135     device->GL_SetSwapInterval = PSP_GL_SetSwapInterval;
   136     device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
   136     device->GL_GetSwapInterval = PSP_GL_GetSwapInterval;
   137     device->GL_SwapWindow = PSP_GL_SwapWindow;
   137     device->GL_SwapWindow = PSP_GL_SwapWindow;
   138     device->GL_DeleteContext = PSP_GL_DeleteContext;
   138     device->GL_DeleteContext = PSP_GL_DeleteContext;
   139 	device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
   139     device->HasScreenKeyboardSupport = PSP_HasScreenKeyboardSupport;
   140 	device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
   140     device->ShowScreenKeyboard = PSP_ShowScreenKeyboard;
   141 	device->HideScreenKeyboard = PSP_HideScreenKeyboard;
   141     device->HideScreenKeyboard = PSP_HideScreenKeyboard;
   142 	device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
   142     device->IsScreenKeyboardShown = PSP_IsScreenKeyboardShown;
   143     
   143 
   144     device->PumpEvents = PSP_PumpEvents;
   144     device->PumpEvents = PSP_PumpEvents;
   145 
   145 
   146     return device;
   146     return device;
   147 }
   147 }
   148 
   148 
   161 {
   161 {
   162     SDL_VideoDisplay display;
   162     SDL_VideoDisplay display;
   163     SDL_DisplayMode current_mode;
   163     SDL_DisplayMode current_mode;
   164 
   164 
   165     SDL_zero(current_mode);
   165     SDL_zero(current_mode);
   166     
   166 
   167     current_mode.w = 480;
   167     current_mode.w = 480;
   168     current_mode.h = 272;
   168     current_mode.h = 272;
   169     
   169 
   170     current_mode.refresh_rate = 60;
   170     current_mode.refresh_rate = 60;
   171     // 32 bpp for default 
   171     /* 32 bpp for default */
   172    // current_mode.format = SDL_PIXELFORMAT_RGBA8888;
       
   173     current_mode.format = SDL_PIXELFORMAT_ABGR8888;
   172     current_mode.format = SDL_PIXELFORMAT_ABGR8888;
   174     
   173 
   175     current_mode.driverdata = NULL;
   174     current_mode.driverdata = NULL;
   176 
   175 
   177     SDL_zero(display);
   176     SDL_zero(display);
   178     display.desktop_mode = current_mode;
   177     display.desktop_mode = current_mode;
   179     display.current_mode = current_mode;
   178     display.current_mode = current_mode;
   199 int
   198 int
   200 PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
   199 PSP_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode)
   201 {
   200 {
   202     return 0;
   201     return 0;
   203 }
   202 }
   204 #define EGLCHK(stmt)							\
   203 #define EGLCHK(stmt)                            \
   205 	do {										\
   204     do {                                        \
   206 		EGLint err;								\
   205         EGLint err;                             \
   207 												\
   206                                                 \
   208 		stmt;									\
   207         stmt;                                   \
   209 		err = eglGetError();					\
   208         err = eglGetError();                    \
   210 		if (err != EGL_SUCCESS) {				\
   209         if (err != EGL_SUCCESS) {               \
   211 			SDL_SetError("EGL error %d", err);	\
   210             SDL_SetError("EGL error %d", err);  \
   212 			return 0;							\
   211             return 0;                           \
   213 		}										\
   212         }                                       \
   214 	} while (0)
   213     } while (0)
   215 	
   214 
   216 int
   215 int
   217 PSP_CreateWindow(_THIS, SDL_Window * window)
   216 PSP_CreateWindow(_THIS, SDL_Window * window)
   218 {
   217 {
   219 //    SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata;
       
   220 
       
   221     SDL_WindowData *wdata;
   218     SDL_WindowData *wdata;
   222 
   219 
   223     /* Allocate window internal data */
   220     /* Allocate window internal data */
   224     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
   221     wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData));
   225     if (wdata == NULL) {
   222     if (wdata == NULL) {
   286 
   283 
   287 }
   284 }
   288 void
   285 void
   289 PSP_DestroyWindow(_THIS, SDL_Window * window)
   286 PSP_DestroyWindow(_THIS, SDL_Window * window)
   290 {
   287 {
   291 	
       
   292 //    eglTerminate(_this->gl_data->display);
       
   293 }
   288 }
   294 
   289 
   295 /*****************************************************************************/
   290 /*****************************************************************************/
   296 /* SDL Window Manager function                                               */
   291 /* SDL Window Manager function                                               */
   297 /*****************************************************************************/
   292 /*****************************************************************************/
   322 void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
   317 void PSP_HideScreenKeyboard(_THIS, SDL_Window *window)
   323 {
   318 {
   324 }
   319 }
   325 SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
   320 SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window)
   326 {
   321 {
   327 	return SDL_FALSE;
   322     return SDL_FALSE;
   328 }
   323 }
   329 
   324 
   330 
   325 
   331 #endif /* SDL_VIDEO_DRIVER_PSP */
   326 #endif /* SDL_VIDEO_DRIVER_PSP */
   332 
   327