[Irrlicht] Rotate a window [RESOLVED]

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

radical1976
Just popping in
Just popping in
Posts: 2
Joined: Sat Mar 16, 2013 10:56

[Irrlicht] Rotate a window [RESOLVED]

Postby radical1976 » Sat Mar 16, 2013 11:10

Hi all,

i've a problem with rendering a rotated window. First the CEGUI log essential:

Code: Select all

16/03/2013 11:40:31 (Std)    ********************************************************************************
16/03/2013 11:40:31 (Std)    * -------- START OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM       -------- *
16/03/2013 11:40:31 (Std)    ********************************************************************************
16/03/2013 11:40:31 (Std)    ---- Version 0.7.9 (Build: Jan 27 2013 Debug Microsoft Windows MSVC++ 10.0 32 bit) ----
16/03/2013 11:40:31 (Std)    ---- Renderer module is: CEGUI::IrrlichtRenderer - Official Irrlicht based 2nd generation renderer module.  RenderTarget support is enabled. ----
16/03/2013 11:40:31 (Std)    ---- XML Parser module is: CEGUI::ExpatParser - Official expat based parser module for CEGUI ----
16/03/2013 11:40:31 (Std)    ---- Image Codec module is: IrrlichtImageCodec - Integrated ImageCodec using the Irrlicht engine. ----
16/03/2013 11:40:31 (Std)    ---- Scripting module is: None ----
16/03/2013 11:40:31 (Std)    ********************************************************************************
16/03/2013 11:40:31 (Std)    * -------- END OF ESSENTIAL SECTION TO BE POSTED ON THE FORUM         -------- *
16/03/2013 11:40:31 (Std)    ********************************************************************************


I've build CEGUI against Irrlicht 1.8 - so far no problems at initialisation and rendering, but rotation doesn't seem to work. So here some snippets:

CEGUI init:

Code: Select all

   try
   {
      /* Bootstrap CEGUI and save pointers */
      LogWrite(MT_INFO, "Bootstrapping CEGUI...");
      m_GUIRenderer = &CEGUI::IrrlichtRenderer::bootstrapSystem(*m_RenderDevice);
      m_GUISystem = CEGUI::System::getSingletonPtr();

      /* Set CEGUI logging level (if activated) */
      CEGUI::Logger::getSingleton().setLoggingLevel(CEGUI::LoggingLevel::Insane);

      /* Set resource provider and paths */
      CEGUI::DefaultResourceProvider* res = static_cast<CEGUI::DefaultResourceProvider*>(m_GUISystem->getResourceProvider());
      res->setResourceGroupDirectory("gui", "data/gui/");
      CEGUI::Imageset::setDefaultResourceGroup("gui");
      CEGUI::Font::setDefaultResourceGroup("gui");
      CEGUI::Scheme::setDefaultResourceGroup("gui");
      CEGUI::WidgetLookManager::setDefaultResourceGroup("gui");
      CEGUI::WindowManager::setDefaultResourceGroup("gui");
      CEGUI::ScriptModule::setDefaultResourceGroup("gui");
   }


Window Layout

Code: Select all

<GUILayout>
    <Window Name="DefaultWindow" Type="DefaultWindow">
        <Property Name="UnifiedAreaRect" Value="{{0,0},{0,0},{1,0},{1,0}}" />
        <Property Name="UnifiedMaxSize" Value="{{1,0},{1,0}}" />
        <Window Name="DefaultWindow/FrameWindow" Type="WindowsLook/FrameWindow">
            <Property Name="UnifiedAreaRect" Value="{{0,230},{0,129},{0,972},{0,649}}" />
            <Property Name="Rotation" Value="w:0.991445 x:-0.130526 y:0 z:0" />
            <Window Name="DefaultWindow/FrameWindow/Button" Type="WindowsLook/Button">
                <Property Name="UnifiedAreaRect" Value="{{0,177},{0,87},{0,563},{0,137}}" />
                <Property Name="Text" Value="New Game" />
                <Property Name="AutoRenderingSurface" Value="True" />
            </Window>
            <Window Name="DefaultWindow/FrameWindow/Button2" Type="WindowsLook/Button">
                <Property Name="UnifiedAreaRect" Value="{{0,181},{0,198},{0,505},{0,248}}" />
                <Property Name="Text" Value="Quit" />
            </Window>
        </Window>
    </Window>
</GUILayout>


Initialisiation of layout:

Code: Select all

   try
   {
      LogWrite(MT_INFO, "Loading menu GUI template...");
      m_GUIScheme = &CEGUI::SchemeManager::getSingletonPtr()->create(MENU_SCHEME);
      LogWrite(MT_INFO, "Loading menu window layout...");
      m_MenuLayout = CEGUI::WindowManager::getSingletonPtr()->loadWindowLayout("menu.layout");
      m_GUISystem->setGUISheet(m_MenuLayout);
      CEGUI::Window* button1 = CEGUI::WindowManager::getSingletonPtr()->getWindow("DefaultWindow/FrameWindow");
   }


Updating (coded for some test):

Code: Select all

void CMenuState::Update(void)
{
   CEGUI::Window* button1 = CEGUI::WindowManager::getSingletonPtr()->getWindow("DefaultWindow/FrameWindow");
   CEGUI::Vector3 currot = button1->getRotation();
   currot.d_x += 0.01;
   if (currot.d_x == 0.99)
   {
      currot.d_x = 0;
   }
   button1->setRotation(currot);
}


Rendering:

Code: Select all

void CMenuState::Draw()
{
   m_VideoDriver->beginScene(true, true, SColor(255,100,101,140));
      m_GUISystem->renderGUI();
   m_VideoDriver->endScene();
}


OnEvent:

Code: Select all

bool CMenuState::OnEvent(const SEvent& GameEvent)
{
   /* Check if it is a mouse event */
   if (GameEvent.EventType == EET_MOUSE_INPUT_EVENT)
   {
      switch (GameEvent.MouseInput.Event)
      {
      /* Left mouse clicked? */
      case EMIE_LMOUSE_LEFT_UP:
         {
            /* Yes: switch to menu */
            CGameManager::Quit();
         }
         break;
      }
   }
   return m_GUIRenderer->injectEvent(GameEvent);
}


The scene renders correctly - despite of the rotation. Am i missing something?

Greetings

radical

EDIT: Rotation is expressed in degrees - if somebody else is as dumb as me :)

Return to “Help”

Who is online

Users browsing this forum: No registered users and 10 guests