Mercurial > hg > Game > Cerium
view TaskManager/Test/test_render/viewerSDL.cpp @ 141:56db76a03294 draft
TileList を作ろうとしたがに動かない。
今はTileList 無しver
author | gongo@charles.cr.ie.u-ryukyu.ac.jp |
---|---|
date | Sat, 29 Nov 2008 01:18:32 +0900 |
parents | 028ffc9c0375 |
children | f533a4104d41 |
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(); }