Esempio n. 1
0
void Application::setupCEGUI()
{
	// CEGUI setup
	m_renderer = new CEGUI::OgreCEGUIRenderer(m_window, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, m_sceneManager);
	m_system = new CEGUI::System(m_renderer);

	CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");

	m_system->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
	m_system->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");

	CEGUI::WindowManager *win = CEGUI::WindowManager::getSingletonPtr();
	CEGUI::Window *sheet = win->createWindow("DefaultGUISheet", "Sheet");

	float distanceBorder = 0.01;
	float sizeX = 0.2;
	float sizeY = 0.05;
	float posX = distanceBorder;
	float posY = distanceBorder;

	debugWindow = win->createWindow("TaharezLook/StaticText", "Widget1");
	debugWindow->setPosition(CEGUI::UVector2(CEGUI::UDim(posX, 0), CEGUI::UDim(posY, 0)));
	debugWindow->setSize(CEGUI::UVector2(CEGUI::UDim(sizeX, 0), CEGUI::UDim(sizeY, 0)));
	debugWindow->setText("Debug Info!");

	sheet->addChildWindow(debugWindow);
	m_system->setGUISheet(sheet);
}
Esempio n. 2
0
/**
 * Create all widgets and their initial contents.
 *
 * CEGUI is based on tree structure of Windows. On top of that
 * tree is a GUISheet, named "root". Each child has a position and
 * a size - both given as values relative to the parent elements area.
 * Position is given as the top left corner of a child within the parent area.
 * Size is given as the relative portions of the parent area.
 */
void createGUIWindow()
{
    CEGUI::System *ceguiSystem= CEGUI::System::getSingletonPtr();
    assert(ceguiSystem);
    CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
    assert(winMgr);

    CEGUI::Window *ceguiRoot = winMgr->createWindow("DefaultGUISheet","root");
    assert(ceguiRoot);
    ceguiSystem->setGUISheet(ceguiRoot); // Top element, fills the display area

    CEGUI::UVector2 buttonSize = CEGUI::UVector2(CEGUI::UDim(0.6, 0), CEGUI::UDim(0.1, 0));

    setupCEGUIResources();

    // Create a button of type "TaharezLook/Button" and name "root/Button"
    mButton = winMgr->createWindow(
        reinterpret_cast<const CEGUI::utf8*>("TaharezLook/Button"),
        reinterpret_cast<const CEGUI::utf8*>("root/Button"));

    mButton->setAlpha(0.5f);
    mButton->setText("Hello World!");
    mButton->setSize(buttonSize);
    mButton->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.6, 0)));

    mEditBox = winMgr->createWindow(
	reinterpret_cast<const CEGUI::utf8*>("TaharezLook/Editbox"),
	reinterpret_cast<const CEGUI::utf8*>("root/EditBox"));
    mEditBox->setAlpha(0.5f);
    mEditBox->setSize(CEGUI::UVector2(CEGUI::UDim(0.6, 0), CEGUI::UDim(0.1, 0)));
    mEditBox->setPosition(CEGUI::UVector2(CEGUI::UDim(0.2, 0), CEGUI::UDim(0.3, 0)));

    // Add both created elements to the GUI sheet.
    ceguiRoot->addChildWindow(mEditBox);
    ceguiRoot->addChildWindow(mButton);

    /* Add event subscribers to both elements.
     * CEGUI input handling is based on function pointers being subscribed
     * to certain events - events of each window type are defined in the 
     * CEGUI API docs.  When the event occurs, all subscriber functions
     * are called (in some order?)
     */
    // EventTextAccepted occurs when input box has focus, and user presses
    // Enter, Return or Tab, and so accepts the input.
    mEditBox->subscribeEvent(CEGUI::Editbox::EventTextAccepted,
			     CEGUI::Event::Subscriber(&inputEntered));
    // EventClicked occurs when button is clicked.
    mButton->subscribeEvent(CEGUI::PushButton::EventClicked,
			    CEGUI::Event::Subscriber(&inputEntered));
}
void InGameMenuWindow::createMenu(MenuBase* menu)
{
	CEGUI::WindowManager* windowMan = CEGUI::WindowManager::getSingletonPtr();

	const ActionVector actions = ActionManager::getSingleton().getInGameGlobalActions();
	map<CeGuiString, PopupMenu*> menuGroups;

	for (ActionVector::const_iterator actIter = actions.begin(); actIter != actions.end(); actIter++)
	{
        Action* action = *actIter;
		ActionGroup* group = action->getGroup();
		if (group != NULL)
		{
			PopupMenu* menuGrp;
			map<CeGuiString, PopupMenu*>::iterator grpIter = menuGroups.find(group->getName());
			if (grpIter != menuGroups.end())
			{
				menuGrp = (*grpIter).second;
			}
			else
			{
				MenuItem* grpItem = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
					getNamePrefix()+"IngameMenu/"+group->getName()));
				grpItem->setText(group->getName());
				menu->addChildWindow(grpItem);

				menuGrp = static_cast<PopupMenu*>(windowMan->createWindow("RastullahLook/PopupMenu",
					getNamePrefix()+"IngameMenu/Menu"+group->getName()));
				grpItem->addChildWindow(menuGrp);

				menuGroups[group->getName()] = menuGrp;
			}

			MenuItem* item = static_cast<MenuItem*>(windowMan->createWindow("RastullahLook/MenuItem",
				getNamePrefix()+"IngameMenu/"+group->getName()+"/"+action->getName()));
			item->setText(action->getDescription());
			menuGrp->addChildWindow(item);

			setAction(item, action);
		}
	}
}
Esempio n. 4
0
CEGUI::Window* TestAARHUD::CreateText(const std::string& name, CEGUI::Window* parent, const std::string& text,
                                 float x, float y, float width, float height)
{
   CEGUI::WindowManager* wm = CEGUI::WindowManager::getSingletonPtr();

   // create base window and set our default attribs
   CEGUI::Window* result = wm->createWindow("WindowsLook/StaticText", name);
   parent->addChildWindow(result);
   result->setText(text);
   result->setPosition(CEGUI::UVector2(cegui_absdim(x), cegui_absdim(y)));
   result->setSize(CEGUI::UVector2(cegui_absdim(width), cegui_absdim(height)));
   result->setProperty("FrameEnabled", "false");
   result->setProperty("BackgroundEnabled", "false");
   result->setHorizontalAlignment(CEGUI::HA_LEFT);
   result->setVerticalAlignment(CEGUI::VA_TOP);
   // set default color to white
   result->setProperty("TextColours", 
      CEGUI::PropertyHelper::colourToString(CEGUI::colour(1.0f, 1.0f, 1.0f)));
   result->show();

   return result;
}
Esempio n. 5
0
void BasicWindow::createGUI(void) {
	mRenderer = &CEGUI::OgreRenderer::bootstrapSystem();
	
	CEGUI::Imageset::setDefaultResourceGroup("Imagesets");
	CEGUI::Font::setDefaultResourceGroup("Fonts");
	CEGUI::Scheme::setDefaultResourceGroup("Schemes");
	CEGUI::WidgetLookManager::setDefaultResourceGroup("LookNFeel");
	CEGUI::WindowManager::setDefaultResourceGroup("Layouts");
	
	CEGUI::SchemeManager::getSingleton().create("TaharezLook.scheme");
	CEGUI::System::getSingleton().setDefaultMouseCursor("TaharezLook", "MouseArrow");

	CEGUI::WindowManager* winMgr = CEGUI::WindowManager::getSingletonPtr();
	CEGUI::System* guiSystem     = CEGUI::System::getSingletonPtr();
	CEGUI::Window* rootWindow    = winMgr->createWindow("DefaultWindow", "root");
	guiSystem->setGUISheet(rootWindow);

	/* not using the gui quite yet:
	try {
		rootWindow->addChildWindow(CEGUI::WindowManager::getSingleton().loadWindowLayout("Console.layout"));
		rootWindow->addChildWindow(CEGUI::WindowManager::getSingleton().loadWindowLayout("RightPanel.layout"));
	} catch (CEGUI::Exception& e) {
		OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, std::string(e.getMessage().c_str()), "Error parsing gui layout");
	}
	*/

	/*
	// "Quit" button:
	CEGUI::WindowManager& winMgr = CEGUI::WindowManager::getSingleton();
	CEGUI::Window* sheet         = winMgr.createWindow("DefaultWindow", "CEGUIDemo/Sheet");
	CEGUI::Window* quit          = winMgr.createWindow("TaharezLook/Button", "CEGUIDemo/QuitButton");
	quit->setText("Quit");
	quit->setSize(CEGUI::UVector2(CEGUI::UDim(0.15f, 0), CEGUI::UDim(0.05f, 0)));
	quit->subscribeEvent(CEGUI::PushButton::EventClicked, CEGUI::Event::Subscriber(&BasicWindow::quit, this));
	sheet->addChildWindow(quit);
	CEGUI::System::getSingleton().setGUISheet(sheet);
	*/
}
Esempio n. 6
0
bool StartMe::Application()
{
  // Set up window transparency. Must happen _before_ system is opened!
  csRef<iGraphics2D> g2d = csQueryRegistry<iGraphics2D> (GetObjectRegistry ());
  if (!g2d) return ReportError ("Failed to obtain canvas!");
  natwin = scfQueryInterface<iNativeWindow> (g2d);
  if (natwin)
  {
    natwin->SetWindowTransparent (true);
  }

  // Open the main system. This will open all the previously loaded plug-ins.
  // i.e. all windows will be opened.
  if (!OpenApplication(GetObjectRegistry()))
    return ReportError("Error opening system!");

  // The window is open, so lets make it disappear! 
  if (natwin)
  {
    natwin->SetWindowDecoration (iNativeWindow::decoCaption, false);
    natwin->SetWindowDecoration (iNativeWindow::decoClientFrame, false);
  }

  // Now get the pointer to various modules we need. We fetch them
  // from the object registry. The RequestPlugins() call we did earlier
  // registered all loaded plugins with the object registry.
  g3d = csQueryRegistry<iGraphics3D> (GetObjectRegistry());
  if (!g3d) return ReportError("Failed to locate 3D renderer!");

  engine = csQueryRegistry<iEngine> (GetObjectRegistry());
  if (!engine) return ReportError("Failed to locate 3D engine!");

  vc = csQueryRegistry<iVirtualClock> (GetObjectRegistry());
  if (!vc) return ReportError("Failed to locate Virtual Clock!");

  kbd = csQueryRegistry<iKeyboardDriver> (GetObjectRegistry());
  if (!kbd) return ReportError("Failed to locate Keyboard Driver!");

  loader = csQueryRegistry<iLoader> (GetObjectRegistry());
  if (!loader) return ReportError("Failed to locate Loader!");

  vfs = csQueryRegistry<iVFS> (GetObjectRegistry());
  if (!vfs) return ReportError("Failed to locate VFS!");

  confman = csQueryRegistry<iConfigManager> (GetObjectRegistry());
  if (!confman) return ReportError("Failed to locate Config Manager!");

  cegui = csQueryRegistry<iCEGUI> (GetObjectRegistry());
  if (!cegui) return ReportError("Failed to locate CEGUI plugin");

  // Initialize the CEGUI wrapper
  cegui->Initialize ();
  
  // Let the CEGUI plugin take care of the rendering by itself
  cegui->SetAutoRender (true);
  
  // Set the logging level
  cegui->GetLoggerPtr ()->setLoggingLevel(CEGUI::Informative);

  vfs->ChDir ("/cegui/");

  // Load the 'ice' skin (which uses the Falagard skinning system)
  cegui->GetSchemeManagerPtr ()->create("ice.scheme");

  cegui->GetSystemPtr ()->setDefaultMouseCursor("ice", "MouseArrow");

  // Setup the fonts
  cegui->GetFontManagerPtr ()->createFreeTypeFont
    (FONT_NORMAL, 10, true, "/fonts/ttf/DejaVuSerif.ttf");
  cegui->GetFontManagerPtr ()->createFreeTypeFont
    (FONT_NORMAL_ITALIC, 10, true, "/fonts/ttf/DejaVuSerif-Italic.ttf");
  cegui->GetFontManagerPtr ()->createFreeTypeFont
    (FONT_TITLE, 15, true, "/fonts/ttf/DejaVuSerif-Bold.ttf");
  cegui->GetFontManagerPtr ()->createFreeTypeFont
    (FONT_TITLE_ITALIC, 15, true, "/fonts/ttf/DejaVuSerif-BoldItalic.ttf");

  CEGUI::WindowManager* winMgr = cegui->GetWindowManagerPtr ();

  // Load the CEGUI layout and set it as the root layout
  vfs->ChDir ("/data/startme/");
  cegui->GetSchemeManagerPtr ()->create ("crystal.scheme");
  cegui->GetSystemPtr ()->setGUISheet(winMgr->loadWindowLayout ("startme.layout"));

  // We need a View to the virtual world.
  view.AttachNew (new csView (engine, g3d));

  LoadConfig ();

  CEGUI::Window* logo = winMgr->getWindow("Logo");
  logo->subscribeEvent(CEGUI::Window::EventMouseClick,
      CEGUI::Event::Subscriber(&StartMe::OnLogoClicked, this));

  ///TODO: Using 'EventMouseEntersArea' is more correct but is only available 
  /// in 0.7.2+
  logo->subscribeEvent(CEGUI::Window::EventMouseEnters,
      CEGUI::Event::Subscriber(&StartMe::OnEnterLogo, this));
  logo->subscribeEvent(CEGUI::Window::EventMouseLeaves,
      CEGUI::Event::Subscriber(&StartMe::OnLeaveLogo, this));

  vfs->ChDir ("/lib/startme");

  CEGUI::Window* root = winMgr->getWindow("root");

  for (size_t i = 0 ; i < demos.GetSize () ; i++)
  {
    demos[i].window = winMgr->createWindow("crystal/Icon");
    demos[i].window->setSize(CEGUI::UVector2(CEGUI::UDim(0.0f, 128.0f), CEGUI::UDim(0.0f, 128.0f)));
    demos[i].window->setPosition(CEGUI::UVector2(CEGUI::UDim(0.0f, 0.0f), CEGUI::UDim(0.0f, 0.0f)));
    demos[i].window->setVisible(false);

    CEGUI::ImagesetManager* imsetmgr = cegui->GetImagesetManagerPtr();
    if (!imsetmgr->isDefined(demos[i].image))
      imsetmgr->createFromImageFile(demos[i].image, demos[i].image);
    std::string img = "set:"+std::string(demos[i].image)+" image:full_image";
    demos[i].window->setProperty("Image", img);

    root->addChildWindow(demos[i].window);

    demos[i].window->subscribeEvent(CEGUI::Window::EventMouseClick,
      CEGUI::Event::Subscriber(&StartMe::OnClick, this));
  }

  // Initialize the starting position of the demo wheel to a random value
  csRandomFloatGen frandomGenerator;
  position = frandomGenerator.Get (demos.GetSize () - 1);

  // Let the engine prepare everything
  engine->Prepare ();
  printer.AttachNew (new FramePrinter (object_reg));

  // This calls the default runloop. This will basically just keep
  // broadcasting process events to keep the application going on.
  Run();

  return true;
}
Esempio n. 7
0
void OgreWiiApp::setupCEGUI()
{
    //mWindow = mRoot->getAutoCreatedWindow();
    mRenderer = new CEGUI::OgreCEGUIRenderer(mWindow, Ogre::RENDER_QUEUE_OVERLAY, false, 3000, mSceneMgr);
    mSystem = new CEGUI::System(mRenderer);

	CEGUI::SchemeManager::getSingleton().loadScheme((CEGUI::utf8*)"TaharezLookSkin.scheme");
	mSystem->setDefaultMouseCursor((CEGUI::utf8*)"TaharezLook", (CEGUI::utf8*)"MouseArrow");
    mSystem->setDefaultFont((CEGUI::utf8*)"BlueHighway-12");

	CEGUI::WindowManager *winMgr = CEGUI::WindowManager::getSingletonPtr();
	CEGUI::Window *sheet = winMgr->createWindow("DefaultGUISheet", "Vp/Sheet");

  CEGUI::UVector2 buttonSize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0));
  CEGUI::UVector2 checkboxSize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.05, 0));
  CEGUI::UVector2 comboboxSize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.15, 0));
  CEGUI::UVector2 infoboxSize(CEGUI::UDim(0.5, 0.0), CEGUI::UDim(0.1, 0.0));
  CEGUI::UVector2 controlboxSize(CEGUI::UDim(0.5, 0.0), CEGUI::UDim(0.5, 0.0));
  CEGUI::UVector2 scrollSize(CEGUI::UDim(0.15, 0), CEGUI::UDim(0.025, 0));
  float dy = 0.06f;
  float y = 0.01f;

	CEGUI::Window *win = winMgr->createWindow("TaharezLook/Editbox", "Vp/OscAddress");
	win->setText(mAddress);
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(buttonSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/Editbox", "Vp/OscPort");
  win->setText(StringConverter::toString(mPort));
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(buttonSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/Button", "Vp/Reconnect");
	win->setText("Reconnect");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(buttonSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/Checkbox", "Vp/FirstPersonView");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
  win->setText("First Person View");
	win->setSize(checkboxSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/HorizontalScrollbar", "Vp/Scrollbar1");
	win->setText("Scrollbar1");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(scrollSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/HorizontalScrollbar", "Vp/Scrollbar2");
	win->setText("Scrollbar1");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(scrollSize);
	sheet->addChildWindow(win);

  y+=dy;
	win = winMgr->createWindow("TaharezLook/HorizontalScrollbar", "Vp/Scrollbar3");
	win->setText("Scrollbar1");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(scrollSize);
	sheet->addChildWindow(win);

  // Snapshot button
  y+=dy;
	win = winMgr->createWindow("TaharezLook/Button", "Vp/SnapButton");
	win->setText("Shapshot");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(buttonSize);
	sheet->addChildWindow(win);

  // Quit button
  y+=dy;
	win = winMgr->createWindow("TaharezLook/Button", "Vp/QuitButton");
	win->setText("Quit");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( y, 0 ) ) );
	win->setSize(buttonSize);
	sheet->addChildWindow(win);

  // Info txt box
  win = winMgr->createWindow("TaharezLook/StaticText", "Vp/TextBoxInfo");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.01f, 0 ), CEGUI::UDim( 0.85f, 0 ) ) );
  win->setSize(infoboxSize);
  sheet->addChildWindow(win);

  // Info txt box
  win = winMgr->createWindow("TaharezLook/StaticText", "Vp/TextBoxAR");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.6f, 0 ), CEGUI::UDim( 0.85f, 0 ) ) );
  win->setSize(infoboxSize);
  win->setVisible(true);
  sheet->addChildWindow(win);

  // Controls txt box
  /*
	win = winMgr->createWindow("TaharezLook/StaticText", "Vp/TextBoxControls");
  win->setPosition( CEGUI::UVector2( CEGUI::UDim( 0.5f, 0 ), CEGUI::UDim( 0.0f, 0 ) ) );
  win->setSize(controlboxSize);
  sheet->addChildWindow(win);
  */

  mSystem->setGUISheet(sheet);


}
Esempio n. 8
0
void TestAARHUD::SetupGUI(dtCore::DeltaWin& win,
                          dtCore::Keyboard& keyboard,
                          dtCore::Mouse& mouse)
{
   char clin[HUDCONTROLMAXTEXTSIZE]; // general buffer to print
   float curYPos;
   float helpTextWidth = 400;
   float taskTextWidth = 300;

   try
   {
      // Initialize CEGUI
      mGUI = new dtGUI::CEUIDrawable(&win, &keyboard, &mouse);

      std::string scheme = "gui/schemes/WindowsLook.scheme";
      std::string path = dtCore::FindFileInPathList(scheme);
      if (path.empty())
      {
         throw dtUtil::Exception(ARRHUDException::INIT_ERROR,
            "Failed to find the scheme file.", __FILE__, __LINE__);
      }

      std::string dir = path.substr(0, path.length() - (scheme.length() - 3));
      dtUtil::FileUtils::GetInstance().PushDirectory(dir);
      CEGUI::SchemeManager::getSingleton().loadScheme(path);
      dtUtil::FileUtils::GetInstance().PopDirectory();

      CEGUI::WindowManager* wm = CEGUI::WindowManager::getSingletonPtr();
      CEGUI::System::getSingleton().setDefaultFont("DejaVuSans-10");
      CEGUI::System::getSingleton().getDefaultFont()->setProperty("PointSize", "14");

      mMainWindow = wm->createWindow("DefaultGUISheet", "root");
      CEGUI::System::getSingleton().setGUISheet(mMainWindow);

      // MEDIUM FIELDS - on in Medium or max

      mHUDOverlay = wm->createWindow("WindowsLook/StaticImage", "medium_overlay");
      mMainWindow->addChildWindow(mHUDOverlay);
      mHUDOverlay->setPosition(CEGUI::UVector2(cegui_reldim(0.0f),cegui_reldim(0.0f)));
      mHUDOverlay->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim(1.0f)));
      mHUDOverlay->setProperty("FrameEnabled", "false");
      mHUDOverlay->setProperty("BackgroundEnabled", "false");

      // Main State - idle/playback/record
      mStateText = CreateText("State Text", mHUDOverlay, "", 10.0f, 20.0f, 120.0f, mTextHeight + 5);
      mStateText->setProperty("TextColours", "tl:FFFF1919 tr:FFFF1919 bl:FFFF1919 br:FFFF1919");
      //mStateText->setFont("DejaVuSans-10");

      // Core sim info
      mSimTimeText = CreateText("Sim Time", mHUDOverlay, "Sim Time",
         0.0f, 0.0f, mRightTextXOffset - 2, mTextHeight);
      mSpeedFactorText = CreateText("Speed Factor", mHUDOverlay, "Speed",
         0.0f, 0.0f, mRightTextXOffset - 2, mTextHeight);

      // Detailed record/playback info
      mRecordDurationText = CreateText(std::string("Duration"), mHUDOverlay, std::string("Duration"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mNumMessagesText = CreateText(std::string("Num Msgs"), mHUDOverlay, std::string("Num Msgs"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mNumTagsText = CreateText(std::string("Num Tags"), mHUDOverlay, std::string("Num Tags"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mLastTagText = CreateText(std::string("Last Tag"), mHUDOverlay, std::string("LastTag:"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mNumFramesText = CreateText(std::string("Num Frames"), mHUDOverlay, std::string("Num Frames"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mLastFrameText = CreateText(std::string("Last Frame"), mHUDOverlay, std::string("Last Frame"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mCurLogText = CreateText(std::string("Cur Log"), mHUDOverlay, std::string("Cur Log"),
         0, 0, mRightTextXOffset - 2, mTextHeight);
      mCurMapText = CreateText(std::string("Cur Map"), mHUDOverlay, std::string("Cur Map"),
         0, 0, mRightTextXOffset - 2, mTextHeight);

      // Core Tips at top of screen (HUD Toggle and Help)
      mFirstTipText = CreateText(std::string("First Tip"), mHUDOverlay, std::string("(F2 for MED HUD)"),
         0, mTextYTopOffset, 160, mTextHeight + 2);
      mFirstTipText->setHorizontalAlignment(CEGUI::HA_CENTRE);
      mSecondTipText = CreateText(std::string("Second Tip"), mHUDOverlay, std::string("  (F1 for Help)"),
         0, mTextYTopOffset + mTextHeight + 3, 160, mTextHeight + 2);
      mSecondTipText->setHorizontalAlignment(CEGUI::HA_CENTRE);


      // TASK FIELDS

      // task header
      curYPos = 70;
      mTasksHeaderText = CreateText(std::string("Task Header"), mHUDOverlay, std::string("Tasks:"),
         4, curYPos, taskTextWidth - 2, mTextHeight + 2);
      //mTasksHeaderText->setFont("DejaVuSans-10");
      curYPos += 2;

      // 11 placeholders for tasks
      for (int i = 0; i < 11; i++)
      {
         snprintf(clin, HUDCONTROLMAXTEXTSIZE, "Task %i", i);
         curYPos += mTextHeight + 2;
         mTaskTextList.push_back(CreateText(std::string(clin), mHUDOverlay, std::string(clin),
            12, curYPos, taskTextWidth - 2, mTextHeight + 2));
      }

      // HELP FIELDS

      mHelpOverlay = static_cast<CEGUI::Window*>(wm->createWindow
         ("WindowsLook/StaticImage", "Help Overlay"));
      mMainWindow->addChildWindow(mHelpOverlay);
      mHelpOverlay->setPosition(CEGUI::UVector2(cegui_reldim(0.0f), cegui_reldim(0.0f)));
      mHelpOverlay->setSize(CEGUI::UVector2(cegui_reldim(1.0f), cegui_reldim(1.0f)));
      mHelpOverlay->setProperty("FrameEnabled", "false");
      mHelpOverlay->setProperty("BackgroundEnabled", "false");
      mHelpOverlay->hide();

      // help tip
      mHelpTipText = CreateText(std::string("Help Tip"), mHelpOverlay, std::string("(F2 to Toggle HUD)"),
         0, mTextYTopOffset, 160, mTextHeight + 2);
      mHelpTipText->setHorizontalAlignment(CEGUI::HA_CENTRE);

      // HELP - Speed Settings
      curYPos = mTextYTopOffset;
      mHelp1Text = CreateText(std::string("Help1"), mHelpOverlay, std::string("[-] Slower (min 0.1X)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp2Text = CreateText(std::string("Help2"), mHelpOverlay, std::string("[+] Faster (max 10.0X)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp3Text = CreateText(std::string("Help3"), mHelpOverlay, std::string("[0] Normal Speed (1.0X)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp7Text = CreateText(std::string("Help7"), mHelpOverlay, std::string("[P] Pause/Unpause"),
         5, curYPos, helpTextWidth, mTextHeight + 2);

      // HELP - Camera Movement
      curYPos += mTextHeight * 2;
      mHelp17Text = CreateText(std::string("Help17"), mHelpOverlay, std::string("[Mouse] Turn Camera"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp13Text = CreateText(std::string("Help13"), mHelpOverlay, std::string("[A & D] Move Camera Left & Right"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp14Text = CreateText(std::string("Help14"), mHelpOverlay, std::string("[W & S] Move Camera Forward and Back"),
         5, curYPos, helpTextWidth, mTextHeight + 2);

      // HELP - Player Movement
      curYPos += mTextHeight * 2;
      mHelp15Text = CreateText(std::string("Help15"), mHelpOverlay, std::string("[J & L] Turn Player Left & Right"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp16Text = CreateText(std::string("Help16"), mHelpOverlay, std::string("[I & K] Move Player Forward and Back"),
         5, curYPos, helpTextWidth, mTextHeight + 2);

      // HELP - Idle, Record, and playback
      curYPos += mTextHeight * 2;
      mHelp4Text = CreateText(std::string("Help4"), mHelpOverlay, std::string("[1] Goto IDLE Mode (Ends record & playback)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp5Text = CreateText(std::string("Help5"), mHelpOverlay, std::string("[2] Begin RECORD Mode (From Idle ONLY)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp6Text = CreateText(std::string("Help6"), mHelpOverlay, std::string("[3] Begin PLAYBACK Mode (From Idle ONLY)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp18Text = CreateText(std::string("Help18"), mHelpOverlay, std::string("[< & >] Prev & Next Keyframe (From Playback ONLY)"),
         5, curYPos, helpTextWidth, mTextHeight + 2);

      // HELP - Misc
      curYPos += mTextHeight * 2;
      mHelp8Text = CreateText(std::string("Help8"), mHelpOverlay, std::string("[B] Place Object"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight * 2;
      mHelp19Text = CreateText(std::string("Help19"), mHelpOverlay, std::string("[G] Place Ignorable Object"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp11Text = CreateText(std::string("Help11"), mHelpOverlay, std::string("[F] Insert Keyframe"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp12Text = CreateText(std::string("Help12"), mHelpOverlay, std::string("[T] Insert Tag"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp9Text = CreateText(std::string("Help9"), mHelpOverlay, std::string("[Enter] Toggle Statistics"),
         5, curYPos, helpTextWidth, mTextHeight + 2);
      curYPos += mTextHeight + 2;
      mHelp10Text = CreateText(std::string("Help10"), mHelpOverlay, std::string("[Space] Update Logger Status"),
         5, curYPos, helpTextWidth, mTextHeight + 2);

      // finally, update our state - disable/hide to make it match current state
      UpdateState();

      // Note - don't forget to add the cegui drawable to the scene after this method, or you get nothing.
   }
   catch (CEGUI::Exception& e)
   {
      std::ostringstream oss;
      oss << "CEGUI while setting up AAR GUI: " << e.getMessage().c_str();
      throw dtUtil::Exception(ARRHUDException::INIT_ERROR,oss.str(), __FILE__, __LINE__);
   }

}