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); }
Gorilla::Layer* Gui3D::createLayerScreen(const Ogre::String& screenName, const Ogre::String& layerName) { // Tests if already exists Gorilla::Layer* layer = getLayerScreen(screenName, layerName); if (layer != NULLPTR) return layer; // Try to find the screen Gorilla::Screen* screen = mScreens[screenName]->mScreen; if (screen != NULLPTR) { Gorilla::Layer* layer = screen->createLayer(); mScreens[screenName]->mLayers[layerName] = layer; return layer; } return NULLPTR; }
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"); }
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); }