Display :: Display(const boost::shared_ptr<Map>& m, const Robot& r) : _map(m), _robot(r) { _w = _map->get_pixel_w(); _h = _map->get_pixel_h(); if (SDL_Init(SDL_INIT_VIDEO) == -1) throw Exception(SDL_GetError()); _screen = SDL_SetVideoMode(_w, _h, 32, SDL_SWSURFACE); if (!_screen) throw Exception(SDL_GetError()); Uint32 rmask, gmask, bmask, amask; #if SDL_BYTEORDER == SDL_BIG_ENDIAN rmask = 0xff000000; gmask = 0x00ff0000; bmask = 0x0000ff00; amask = 0x000000ff; #else rmask = 0x000000ff; gmask = 0x0000ff00; bmask = 0x00ff0000; amask = 0xff000000; #endif _map_bmp = SDL_CreateRGBSurface(SDL_SWSURFACE, _w, _h, 32, rmask, gmask, bmask, amask); _blit_map(); _bb_to_sdl(_robot.get_bb(), &_prev_bb); }
void update_map() { _blit_map(); }