コード例 #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
ファイル: gorilla_3d.cpp プロジェクト: ViteFalcon/gorilla
 void createHUD()
 {
  mHUD = mSilverback->createScreen(mViewport, "dejavu");
  mHUDLayer = mHUD->createLayer();
  
  Gorilla::Caption* fakeHealth = mHUDLayer->createCaption(24, 0, 0, "+ 100");
  fakeHealth->width(mViewport->getActualWidth()-16);
  fakeHealth->height(mViewport->getActualHeight()-4);
  fakeHealth->align(Gorilla::TextAlign_Right);
  fakeHealth->vertical_align(Gorilla::VerticalAlign_Bottom);
  
  Gorilla::Caption* fakeAmmo = mHUDLayer->createCaption(24, 16, 0, ": 60");
  fakeAmmo->width(mViewport->getActualWidth());
  fakeAmmo->height(mViewport->getActualHeight()-4);
  fakeAmmo->vertical_align(Gorilla::VerticalAlign_Bottom);
  
  mCrosshairLayer = mHUD->createLayer();
  mCrosshair = mCrosshairLayer->createRectangle((mViewport->getActualWidth() * 0.5f) - 11, (mViewport->getActualHeight() * 0.5f) - 11, 22, 22);
  mCrosshair->background_image("crosshair");
  
 }
コード例 #3
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);
  }
コード例 #4
0
ファイル: GameState.cpp プロジェクト: jaschmid/Lagom
void GameState::createScene()
{
	// CREATE 3D SCENE
	
    m_bQuit					= false;
	
	_highScoreEntryDialog	= nullptr;
	_gameTime				= 0.0f;
	_physicsTime			= 0.0f;
	_playerScore			= 0.0f;
	_pauseState				= PAUSE_STATE_NONE;
	_pulsePower				= 0.0f;
	_pulseTime				= 0.0f;
	_gameOverTime			= 0.0f;

	_energyDrainFactor		= 1.0f;
	_vibrationStrength		= 0.0f;

	// BULLET SETUP
	
	 // Build the broadphase
    _btBroadphase = new (alignedMalloc<btDbvtBroadphase>()) btDbvtBroadphase();
 
    // Set up the collision configuration and dispatcher
    _btCollisionConfiguration = new (alignedMalloc<btDefaultCollisionConfiguration>()) btDefaultCollisionConfiguration();
    _btDispatcher = new (alignedMalloc<btCollisionDispatcher>()) btCollisionDispatcher(_btCollisionConfiguration);
 
    // The actual physics solver
    _btSolver = new (alignedMalloc<btSequentialImpulseConstraintSolver>()) btSequentialImpulseConstraintSolver;
 
    // The world.
    _btDynamicsWorld = new (alignedMalloc<btDiscreteDynamicsWorld>()) btDiscreteDynamicsWorld(_btDispatcher,_btBroadphase,_btSolver,_btCollisionConfiguration);
    _btDynamicsWorld->setGravity(btVector3(0,-10,0));

	_btGroundShape = new (alignedMalloc<btStaticPlaneShape>()) btStaticPlaneShape(btVector3(0,1,0),1);
	_btGroundMotionState = new (alignedMalloc<btDefaultMotionState>()) btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
	btRigidBody::btRigidBodyConstructionInfo  groundRigidBodyCI(0,_btGroundMotionState,_btGroundShape,btVector3(0,0,0));
    _btGroundRigidBody = new (alignedMalloc<btRigidBody>()) btRigidBody(groundRigidBodyCI);
	assert((int)_btGroundRigidBody % 16 == 0);
	_btGroundRigidBody->setRestitution(1.0f);
	_btGroundRigidBody->setActivationState(DISABLE_DEACTIVATION);

	_btDynamicsWorld->addRigidBody(_btGroundRigidBody,COL_STATIC,COL_ALL);

	// CREATE ACTORS

	_playerBase = new LagomPlayerBase(this);

	boost::shared_ptr<LagomPlayerBase> playerBase(_playerBase);

	RegisterActor(playerBase);

	// Effects stuff

	_particleManager = new LagomParticleManager(m_pSceneMgr,_btDynamicsWorld,1000,0.5f);
	_billboardManager = new BillboardManager(m_pSceneMgr,m_pCamera);
	
	//need a HUD too!
	
	Gorilla::Silverback*		silverback = Gorilla::Silverback::getSingletonPtr(); 

	_gScreen[0] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "LargeFont");
	_gScreen[1] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "MediumFont");
	_gScreen[2] = silverback->createScreen(Lagom::getSingleton().m_pViewport, "SmallFont");
	_gTutorialScreen = silverback->createScreen(Lagom::getSingleton().m_pViewport, "dejavu");
	_gLayer[0] = _gScreen[0]->createLayer(12);
	_gLayer[1] = _gScreen[1]->createLayer(13);
	_gLayer[2] = _gScreen[2]->createLayer(15);
	_gTutorialLayer = _gTutorialScreen->createLayer(18);

	int x,y,w,h;
	Lagom::getSingleton().m_pViewport->getActualDimensions(x,y,w,h);
	
	_gDisplays[0]._gText = _gLayer[1]->createCaption(24,w/2,h, "");
	_gDisplays[1]._gText = _gLayer[0]->createCaption(48,w/2,h, "");
	_gDisplays[2]._gText = _gLayer[1]->createCaption(24,w/2,h, "");

	for(auto it = _gDisplays.begin(); it< _gDisplays.end(); ++it)
	{
		it->_text = "";
		it->_displayPingTime = 0.0f;
		it->_displayVisibleTime = 0.0f;
		it->_gText->align(Gorilla::TextAlign_Centre);
	}

	_gDisplays[0]._gText->vertical_align(Gorilla::VerticalAlign_Top);
	_gDisplays[0]._gText->top(0+5);
	_gDisplays[1]._gText->vertical_align(Gorilla::VerticalAlign_Middle);
	_gDisplays[1]._gText->top(h/2);
	_gDisplays[2]._gText->vertical_align(Gorilla::VerticalAlign_Bottom);
	_gDisplays[2]._gText->top(h-5);
	_gameTime= 0.0f;
	_displayTime = 0.0f;
	_inputTime = 0.0;

	//set up fader
	Ogre::ResourcePtr resptr = Ogre::MaterialManager::getSingleton().getByName("fadeToBlackMaterial");
    Ogre::Material * mat = dynamic_cast<Ogre::Material*>(resptr.getPointer());
 
    Ogre::Technique *tech = mat->getTechnique(0);    // Get the technique
    Ogre::Pass *pass = tech->getPass(0);            // Get the pass
    _fadeTexUnit = pass->getTextureUnitState(0);        // Get the texture_unit state
 
    _fadeOverlay = Ogre::OverlayManager::getSingleton().getByName("fadeToBlackOverlay");

	//set overlay to black
    _fadeOverlay->show();
    _fadeTexUnit->setAlphaOperation(LBX_MODULATE, LBS_MANUAL, LBS_TEXTURE, 1.0f);
	
	calculatePlayArea();
	//now load level if any

	_stageSpawner = new StageSpawnManager(this,playerBase);

	// set proper state for fade in

	SetPauseState(PAUSE_STATE_FADING);
	_fadeFactor = -1.0f;
}