Example #1
0
/**
 * The App object takes care of initializing the even system.
 */
NoDice::App::
App(const NoDice::Config& config)
: m_config(config)
, m_sdlInit()
, m_video(m_config)
{
	std::srand(std::time(NULL));
	pushGameState(GameStatePtr(new IntroState(m_config, m_video)));
}
Example #2
0
void TheEscape::init()
{
	m_logger.createLog("default.log", true, false, true);

	try
	{
		delete m_config;
		m_config = new LuaConfiguration("config.lua");
	}
	catch(MessageException& e)
	{
		Ogre::LogManager::getSingleton().logMessage(Ogre::LML_NORMAL, e.getMessage());
	}

	if(SDL_Init(SDL_INIT_NOPARACHUTE))
		Ogre::LogManager::getSingleton().logMessage(Ogre::LML_CRITICAL, "Error initializing SDL: " + std::string(SDL_GetError()));


	delete m_renderer;
	m_renderer = new RenderSystem(*this);
  SDL_WM_SetCaption("Escape", NULL);

	/* ResourceGroupManager */
	Ogre::ResourceGroupManager &resGroupMgr = Ogre::ResourceGroupManager::getSingleton();
	resGroupMgr.addResourceLocation("../graphix", "FileSystem");
#ifdef WIN32
#else
	resGroupMgr.addResourceLocation("/usr/share/fonts/TTF", "FileSystem");
#endif
	resGroupMgr.initialiseAllResourceGroups();
	Ogre::FontManager &fontMgr = Ogre::FontManager::getSingleton();
	Ogre::MaterialManager& material_mgr = Ogre::MaterialManager::getSingleton();
	Ogre::ResourcePtr font = fontMgr.create("FreeSans","General");
	font->setParameter("type","truetype");
	font->setParameter("source","DejaVuSans.ttf");
	font->setParameter("size","16");
	font->setParameter("resolution","96");
	font->load();


	delete m_input;
	m_input = new InputSystem(*this);

	m_game_states["main"] = new MainState(*this);
	pushGameState("main");
}