comparison Renderer/Engine/viewerSDL.cc @ 984:dbebc7afd08e draft

minor fix
author root@henri.cr.ie.u-ryukyu.ac.jp
date Fri, 01 Oct 2010 01:25:45 +0900
parents b662e9dd26b0
children da1cec21f0c9
comparison
equal deleted inserted replaced
983:ad2bc8afc7b9 984:dbebc7afd08e
1 #include "viewerSDL.h" 1 #include "viewerSDL.h"
2 #include "Func.h" 2 #include "Func.h"
3 #include "TaskManager.h" 3 #include "TaskManager.h"
4 #include "viewer_types.h" 4 #include "viewer_types.h"
5
6 #define UGA 1
5 7
6 extern void post2runLoop(void *); 8 extern void post2runLoop(void *);
7 9
8 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK 10 #define default_sdl_flag SDL_INIT_TIMER | SDL_INIT_JOYSTICK
9 11
19 if (SDL_Init(sdl_flag) < 0) { 21 if (SDL_Init(sdl_flag) < 0) {
20 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError()); 22 fprintf(stderr,"Couldn't initialize SDL: %s\n", SDL_GetError());
21 exit(1); 23 exit(1);
22 } 24 }
23 25
24 screen = SDL_SetVideoMode(width, height, bpp, SDL_SWSURFACE); 26 screen = SDL_SetVideoMode(width, height, bpp, SDL_HWSURFACE);
25 if (screen == NULL) { 27 if (screen == NULL) {
26 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError()); 28 fprintf(stderr, "Couldn't set GL mode: %s\n", SDL_GetError());
27 SDL_Quit(); 29 SDL_Quit();
28 exit(1); 30 exit(1);
29 } 31 }
43 45
44 void 46 void
45 ViewerSDL::clean_pixels() 47 ViewerSDL::clean_pixels()
46 { 48 {
47 //bzero(pixels, sizeof(int)*width*height); 49 //bzero(pixels, sizeof(int)*width*height);
50 #if !UGA
48 SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0)); 51 SDL_FillRect(screen,NULL,SDL_MapRGB(screen->format,0,0,0));
52 #endif
49 } 53 }
50 54
51 void 55 void
52 ViewerSDL::clear_screen() 56 ViewerSDL::clear_screen()
53 { 57 {
58 #if !UGA
54 SDL_BlitSurface(bitmap, NULL, screen, NULL); 59 SDL_BlitSurface(bitmap, NULL, screen, NULL);
55 SDL_UpdateRect(screen, 0, 0, 0, 0); 60 SDL_UpdateRect(screen, 0, 0, 0, 0);
61 #endif
62 }
63
64 uint32_t *
65 ViewerSDL::flip_screen(uint32_t *old)
66 {
67 #if UGA
68 SDL_BlitSurface(bitmap,NULL,screen,NULL);
69 SDL_UpdateRect(screen,0,0,0,0);
70 #endif
71 return old;
56 } 72 }
57 73
58 void 74 void
59 ViewerSDL::free_device() 75 ViewerSDL::free_device()
60 { 76 {