comparison Renderer/Engine/viewerSDL.cc @ 996:78ebcdaae8bc

add sdl_test file
author yutaka@charles.cr.ie.u-ryukyu.ac.jp
date Mon, 11 Oct 2010 18:56:51 +0900
parents 33616b2789de
children 625be5ca53ab
comparison
equal deleted inserted replaced
995:143e4f9af7be 996:78ebcdaae8bc
63 if (SDL_Init(sdl_flag) < 0) { 63 if (SDL_Init(sdl_flag) < 0) {
64 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); 64 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError());
65 exit(1); 65 exit(1);
66 } 66 }
67 67
68 screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE); 68 screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE);
69 if (screen == NULL) { 69 if (screen == NULL) {
70 fprintf(stderr, "Couldn't set SDL mode: %s\n", SDL_GetError()); 70 fprintf(stderr, "Couldn't set SDL mode: %s\n", SDL_GetError());
71 SDL_Quit(); 71 SDL_Quit();
72 exit(1); 72 exit(1);
73 } 73 }
74
74 this->width = screen->w; 75 this->width = screen->w;
75 this->height = screen->h; 76 this->height = screen->h;
76 this->bpp = screen->format->BitsPerPixel; 77 this->bpp = screen->format->BitsPerPixel;
77 78
78 p = (Uint32*)manager->allocate(screen->pitch*height); 79 p = (Uint32*)manager->allocate(screen->pitch*height);
82 83
83 void 84 void
84 ViewerSDL::clean_pixels() 85 ViewerSDL::clean_pixels()
85 { 86 {
86 //bzero(pixels, sizeof(int)*width*height); 87 //bzero(pixels, sizeof(int)*width*height);
88
87 //SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0)); 89 //SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
88 } 90 }
89 91
90 void 92 void
91 ViewerSDL::clear_screen() 93 ViewerSDL::clear_screen()