Пример #1
0
  App() : mTimer(0), mTimer2(0), mNextUpdate(0)
  {
   
   _makeOgre();
   _makeOIS();

  // Create Silverback and load in dejavu
  mSilverback = new Gorilla::Silverback();
  mSilverback->loadAtlas("dejavu");
  mScreen = mSilverback->createScreen(mViewport, "dejavu");
  mScreen->setOrientation(Ogre::OR_DEGREE_270);
  Ogre::Real vpW = mScreen->getWidth(), vpH = mScreen->getHeight();

  // Create our drawing layer
  mLayer = mScreen->createLayer(0);
  rect = mLayer->createRectangle(0,0, vpW, vpH);
  rect->background_gradient(Gorilla::Gradient_Diagonal, Gorilla::rgb(98,0,63), Gorilla::rgb(255,180,174));
  
  markup = mLayer->createMarkupText(9,5,5, "%@24%A Haiku\n%@14%Written by Betajaen%@9%\nSo many to choose from\nPretty typefaces on Ogre screen\nTime to update Git");
  
  caption = mLayer->createCaption(9, vpW - 55, 5, "9");
  caption->width(50);
  caption->align(Gorilla::TextAlign_Right);

  caption = mLayer->createCaption(14, vpW - 55, 18, "14");
  caption->width(50);
  caption->align(Gorilla::TextAlign_Right);

  caption = mLayer->createCaption(24, vpW - 55, 33, "24");
  caption->width(50);
  caption->align(Gorilla::TextAlign_Right);
  }
Пример #2
0
 App() : mCurrentTest(0)
 {
  
  _makeOgre();
  _makeOIS();
  
  // Create Silverback and load in dejavu
  mSilverback = new Gorilla::Silverback();
  mSilverback->loadAtlas("dejavu");
  
  registerTests(mTests, mSilverback, mViewport, mSceneMgr);
  
 }
Пример #3
0
 App() : mTimer(0), mTimer2(0), mBasePower(150), mNextUpdate(0)
 {
  
  _makeOgre();
  _makeOIS();
  
  // Create Silverback and load in dejavu
  mSilverback = new Gorilla::Silverback();
  mSilverback->loadAtlas("dejavu");
  
  createHUD();
  createControlPanel();
  
 }
Пример #4
0
  App() : mNextUpdate(0), mTimer(0)
  {
   
   _makeOgre();
   _makeOIS();
   _makeScene();
   
   // Initialise Gorilla
   mGorilla = new Gorilla::Silverback();
   mGorilla->loadAtlas("dejavu");
   mScreen = mGorilla->createScreen(mViewport, "dejavu");
   
   mFPSLayer = mScreen->createLayer(14);
   mFPS = mFPSLayer->createCaption(14, 10,10, Ogre::StringUtil::BLANK);

   mConsole = new OgreConsole();
   mConsole->init(mScreen);
   mConsole->addCommand("whoami", whoami);
   mConsole->addCommand("version", version);
   mConsole->addCommand("make", make);
   mConsole->addCommand("quit", quit);
  }
Пример #5
0
bool Lagom::initExtra()
{


    m_pViewport = m_pRenderWnd->addViewport(0);
    m_pViewport->setBackgroundColour(ColourValue(0.0f, 0.0f, 0.0f, 1.0f));
	//m_pViewport->setClearEveryFrame(false);
    m_pViewport->setCamera(0);
	LogMessage("Viewport Initialized");
	if(!LagomInput::getSingletonPtr())
		new LagomInput();

	LagomInput::getSingletonPtr()->Initialize(m_pRenderWnd);
	LogMessage("Input Initialized");
	
	//initialize Resources
			

	LogMessage("Adding resource locations");
	
#if defined( ANDROID )

	Ogre::ResourceGroupManager::getSingleton().addResourceLocation(_dataFile, "Android");  
#elif !defined(_DEBUG)
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation(_dataFile, "Zip");  
#else

	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/models", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/scripts", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/materials/textures", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/gui", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/SSAO", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/music", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/sound", "FileSystem");
	Ogre::ResourceGroupManager::getSingleton().addResourceLocation("media/units", "FileSystem");

#endif

	LogMessage("Lagom Resources Added");

	Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource("LargeFont.gorilla");
	if(!stream.getPointer())
		LogMessage("Expected Resource does not exist");
	else
		LogMessage("Expected Resource exists");
		
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( MIP_UNLIMITED );
	Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();

	LogMessage("Resource Groups Initialized complete"); 
	/*
#ifndef ANDROID // on android this is done from the JNI
    Ogre::String secName, typeName, archName;
    Ogre::ConfigFile cf;
    cf.load(_dataFile);

    Ogre::ConfigFile::SectionIterator seci = cf.getSectionIterator();
    while (seci.hasMoreElements())
    {
        secName = seci.peekNextKey();
        Ogre::ConfigFile::SettingsMultiMap *settings = seci.getNext();
        Ogre::ConfigFile::SettingsMultiMap::iterator i;
        for (i = settings->begin(); i != settings->end(); ++i)
        {
            typeName = i->first;
            archName = i->second;
            Ogre::ResourceGroupManager::getSingleton().addResourceLocation(archName, typeName, secName);
        }
    }
    Ogre::TextureManager::getSingleton().setDefaultNumMipmaps( MIP_UNLIMITED );
    Ogre::ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
	LogMessage("Resources Initialized");
#endif*/

    //m_pTrayMgr = new OgreBites::SdkTrayManager("AOFTrayMgr", m_pRenderWnd, m_pMouse, 0);

    m_pTimer = new Ogre::Timer();
    m_pTimer->reset();
	
	LogMessage("Timer Initialized");
	//init CEGUI
	//CEGUI::ImagesetManager::getSingleton().createFromImageFile("LagomLogo","LagomLogo.png","General");
	
	//CEGUI::Imageset &imageset = CEGUI::ImagesetManager::getSingleton().createFromImageFile((CEGUI::utf8 *)"tutorialSet", (CEGUI::utf8 *)"Tutorial.png",(CEGUI::utf8 *)"General");
	//imageset.defineImage((CEGUI::utf8 *)"tutorialImage", CEGUI::Rect(0, 0, 800, 600), CEGUI::Vector2(0, 0));

	// setup compositors

	if (CompositorManager::getSingleton().addCompositor(m_pViewport, "SSAO/GBuffer"))
		CompositorManager::getSingleton().setCompositorEnabled(m_pViewport, "SSAO/GBuffer", false);
	else
		LogManager::getSingleton().logMessage("SSAO: Failed to add GBuffer compositor \n");
	LogMessage("Compositors Initialized");
	/*
	for (unsigned int i = 0; i < nCompositorNames; i++)
	{
		if (CompositorManager::getSingleton().addCompositor(m_pViewport, compositorNames[i]))
			CompositorManager::getSingleton().setCompositorEnabled(m_pViewport, compositorNames[i], false);
		else
			LogManager::getSingleton().logMessage("SSAO: Failed to add compositor: " + compositorNames[i] + "\n");
	}

	for (unsigned int i = 0; i < nPostprocessingNames; i++)
	{

		if (CompositorManager::getSingleton().addCompositor(m_pViewport, postprocessingNames[i]))
			CompositorManager::getSingleton().setCompositorEnabled(m_pViewport, postprocessingNames[i], false);
		else
			LogManager::getSingleton().logMessage("SSAO: Failed to add " + postprocessingNames[i] + " compositor \n");
	}
	*/
	
	Ogre::Plane plane(Ogre::Vector3::UNIT_Y, 0);
	Ogre::MeshManager::getSingleton().createPlane("terrain", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
        plane, 150, 150, 100, 100, true, 1, 1, 1, Ogre::Vector3::UNIT_Z);
	
	LogMessage("Base Objects Initialized");
	setSSAO();

	_BufferFlush.start(3);
	
	LogMessage("Flush Buffers Initialized");
	//setup sound

	SoundManager* soundManager = new SoundManager;
	soundManager->Initialize();
	
	LogMessage("Sound Manager Initialized");
	//setup Gorilla
	
	Gorilla::Silverback* silverback = new Gorilla::Silverback();
	silverback->loadAtlas("LargeFont");
	silverback->loadAtlas("MediumFont");
	silverback->loadAtlas("SmallFont");
	silverback->loadAtlas("dejavu");
	LogMessage("Gorilla Initialized");
	// play music
	
	//m_ceguiRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
	LogMessage("CEGUI Initialization Begin");
	m_ceguiRenderer =  &CEGUI::OgreRenderer::create(*m_pRenderWnd);
	LogMessage("CEGUI Renderer Initialized");
    CEGUI::OgreResourceProvider& rp = CEGUI::OgreRenderer::createOgreResourceProvider();
	LogMessage("CEGUI Resource Provider Initialized");
    CEGUI::OgreImageCodec& ic = CEGUI::OgreRenderer::createOgreImageCodec();
	LogMessage("CEGUI Image Coded Initialized");
	CEGUI::System::create( *m_ceguiRenderer  ,&rp, static_cast<CEGUI::XMLParser*>(0), &ic);
	LogMessage("CEGUI Base Initialized");
	// Load the scheme
	CEGUI::SchemeManager::getSingleton().create( (std::string(sDefaultGUITheme)+".scheme").c_str()	);
	LogMessage("GUIScheme Initialized");
	// Set the defaults
	CEGUI::System::getSingleton().setDefaultFont( "SmallFont" );
	CEGUI::System::getSingleton().setDefaultMouseCursor( std::string(sDefaultGUISheme).c_str(), sDefaultGUIMouseArrow );
	CEGUI::System::getSingleton().setDefaultTooltip( (CEGUI::utf8*)"Sunrise/Tooltip" );
	LogMessage("GUI defaults Initialized");
	//CEGUI::FontManager::getSingleton().get("LargeFont").setAutoScaled(
	
	m_ceguiRenderer->setRenderingEnabled(true);
	LogMessage("CEGUI Initialized");

	PlayRandomMusic();
	
	LogMessage("Lagom Initialization Complete");
    return true;
}