Mercurial > hg > Members > kono > Cerium
view TaskManager/Test/test_render/viewerSDL.cpp @ 264:a59868d37093
merge 151 263
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 03 Jun 2009 23:57:38 +0900 |
parents | 5c194c71eca8 |
children | cf2aa37d2fe7 |
line wrap: on
line source
#include "viewerSDL.h" #include "Func.h" #include "TaskManager.h" extern void post2runLoop(void *); extern void ViewerSDL::video_init() { Uint32 sdl_flag = default_sdl_flag | SDL_INIT_VIDEO; Uint32 *p; if (SDL_Init(sdl_flag) < 0) { fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE); if (screen == NULL) { fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); SDL_Quit(); exit(1); } pixels = (Uint32*)screen->pixels; p = (Uint32*)manager->malloc(sizeof(int)*width*height); bitmap = SDL_CreateRGBSurfaceFrom((void *)p, width, height, 32, width*4, redMask, greenMask, blueMask, alphaMask); } void ViewerSDL::clean_pixels() { //bzero(pixels, sizeof(int)*width*height); } void ViewerSDL::run_loop(void) { #if !defined(__LINUX__) SDL_BlitSurface(bitmap, NULL, screen, NULL); SDL_UpdateRect(screen, 0, 0, 0, 0); #endif Viewer::run_loop(); } void ViewerSDL::run_finish(void) { SDL_FreeSurface(bitmap); Viewer::run_finish(); }