RegionViewer::RegionViewer(Region *region) :m_region(region), m_roomSurfaces(), m_roomWidth(420), m_roomHeight(420), m_roomPainter(), m_wallSurface(NULL), m_numPainted(0), m_lock(NULL), m_loadColor(m_roomPainter.randomColor()), m_loadingSurface(NULL), m_loadingX(0), m_loadingY(0) { //System::get_instance()->get_size(&m_roomWidth, &m_roomHeight); m_lock = SDL_CreateSemaphore(1); ResourceManager *rm = ResourceManager::get_instance(); m_wallSurface = rm->get_image("wall.png"); m_wallSurface->set_color_key(0, 0xFF, 0xFF); m_loadingSurface = rm->get_image("loading.png"); System *system = System::get_instance(); int systemWidth = system->get_width(); int systemHeight = system->get_height(); int loadingWidth = m_loadingSurface->get_w(); int loadingHeight = m_loadingSurface->get_h(); m_loadingX = (systemWidth - loadingWidth) / 2; m_loadingY = (systemHeight - loadingHeight) / 4; unsigned int numRooms = region->numRooms(); for (Direction direction : s_DirectionArray) m_roomSurfaces[direction] = vector<Surface *>(numRooms); SDL_CreateThread(threadMakeSurfaces, this); }
Title::Title(InputDevice *inputDevice) :Screen(inputDevice), m_titleSurface(NULL) { ResourceManager *rm = ResourceManager::get_instance(); m_titleSurface = rm->get_image("title.png"); System *system = System::get_instance(); int systemWidth = system->get_width(); int systemHeight = system->get_height(); int titleWidth = m_titleSurface->get_w(); int titleHeight = m_titleSurface->get_h(); m_titleX = (systemWidth - titleWidth) / 2; m_titleY = (systemHeight - titleHeight) / 4; }