How to use TrayManager? Topic is solved

Problems building or running the engine, queries about how to use features etc.
Post Reply
Zemtriz
Gnoblar
Posts: 10
Joined: Fri Jul 13, 2018 8:17 pm

How to use TrayManager?

Post by Zemtriz » Mon Jul 16, 2018 8:00 am

Ogre Version: 1.11.1
Operating System: Linux marek-pc 4.16.18-1-MANJARO #1 SMP PREEMPT Tue Jun 26 15:27:59 UTC 2018 x86_64 GNU/Linux
Render System: OpenGL 3+ Render Subsystem

Hello there,

I've got troubles implementing TrayManager. Followed tutorials on: https://ogrecave.github.io/ogre/api/latest/trays.html
But I can't figure out what exactly to write in place of mWindow or how to use rendersystem.
Trying to modify bootstrap.cpp and add there only traymanager.
I have added only this line into code:
OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", mWindow, this);
and also included ogretrays.h
but how to modify Window?

Error during compiling:

Code: Select all

[marek@marek-pc build]$ make
[ 33%] Built target 2_CamerasAndShadows
[ 50%] Building CXX object CMakeFiles/0_Bootstrap.dir/Bootstrap.cpp.o
/run/media/marek/cd998326-6c5a-4cd3-b3ff-d425a0c06ae4/OgreSDK/Tutorials/Bootstrap.cpp: In member function ‘virtual void MyTestApp::setup()’:
/run/media/marek/cd998326-6c5a-4cd3-b3ff-d425a0c06ae4/OgreSDK/Tutorials/Bootstrap.cpp:72:84: error: ‘mWindow’ was not declared in this scope
     OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", mWindow, this);
                                                                                    ^~~~~~~
/run/media/marek/cd998326-6c5a-4cd3-b3ff-d425a0c06ae4/OgreSDK/Tutorials/Bootstrap.cpp:72:84: note: suggested alternative: ‘mWindows’
     OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", mWindow, this);
                                                                                    ^~~~~~~
                                                                                    mWindows
make[2]: *** [CMakeFiles/0_Bootstrap.dir/build.make:63: CMakeFiles/0_Bootstrap.dir/Bootstrap.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/0_Bootstrap.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
[marek@marek-pc build]$ 
Thank you for any suggestions
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 615
Joined: Sun Mar 30, 2014 2:51 pm
x 85
Contact:

Re: How to use TrayManager?

Post by paroj » Mon Jul 16, 2018 11:03 am

you can take a look at the python sample which uses the tray manager:
https://github.com/OGRECave/ogre/blob/v ... _sample.py
0 x

Zemtriz
Gnoblar
Posts: 10
Joined: Fri Jul 13, 2018 8:17 pm

Re: How to use TrayManager?

Post by Zemtriz » Mon Jul 16, 2018 1:31 pm

paroj wrote:
Mon Jul 16, 2018 11:03 am
you can take a look at the python sample which uses the tray manager:
https://github.com/OGRECave/ogre/blob/v ... _sample.py
Thanks for a reply, but still doesn't work :(

Updated it to the following:

Code: Select all

OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", OgreBites::ApplicationContext::getRenderWindow(), this);
0 x

palsofchaos
Gnoblar
Posts: 7
Joined: Wed Feb 21, 2018 4:38 pm
x 1

Re: How to use TrayManager?

Post by palsofchaos » Mon Jul 16, 2018 4:29 pm

Did you initialise your mWindow under your Root node? Just a shot in the dark here.

(Edit) My mistake this suggestion is for an older version of Ogre.
Last edited by palsofchaos on Mon Jul 16, 2018 9:46 pm, edited 1 time in total.
0 x

paroj
OGRE Team Member
OGRE Team Member
Posts: 615
Joined: Sun Mar 30, 2014 2:51 pm
x 85
Contact:

Re: How to use TrayManager?

Post by paroj » Mon Jul 16, 2018 5:17 pm

Zemtriz wrote:
Mon Jul 16, 2018 1:31 pm
paroj wrote:
Mon Jul 16, 2018 11:03 am
you can take a look at the python sample which uses the tray manager:
https://github.com/OGRECave/ogre/blob/v ... _sample.py
Thanks for a reply, but still doesn't work :(

Updated it to the following:

Code: Select all

OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", OgreBites::ApplicationContext::getRenderWindow(), this);
how did you arrive there, given that the sample says this:

Code: Select all

self.trays = OgreBites.TrayManager("Interface", self.getRenderWindow())
0 x

Zemtriz
Gnoblar
Posts: 10
Joined: Fri Jul 13, 2018 8:17 pm

Re: How to use TrayManager?

Post by Zemtriz » Tue Jul 17, 2018 11:39 am

Ok guys, I have figured out what I was doing wrong.
This is how it works:

Code: Select all

OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", getRenderWindow());
As I am new into Ogre, I want to be careful and do everything step by step.
I wanted to initialize trayManager without input listener. Just show something on the screen. And previously I used after getRenderWindow or mWindow ",this)". I had three attributes and the last one "this" was for tray listener that I didn't use and that's why I had errors while compiling.
0 x

Zemtriz
Gnoblar
Posts: 10
Joined: Fri Jul 13, 2018 8:17 pm

Re: How to use TrayManager?

Post by Zemtriz » Tue Jul 17, 2018 10:13 pm

Hello again,

I'm sorry, but my button is not visible and would like to ask for your help till this topic is not closed as solved.

I'm using bootstrap.cpp in samples/tutorials and still want to implement trays.
What I've got so far, is:
+added "#include <OgreTrays.h>" at the top
+added "public OgreBites::TrayListener" into MyTestApp class
+added

Code: Select all

    OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", getRenderWindow(), this);
    OgreBites::Button* b = mTrayMgr->OgreBites::TrayManager::createButton(OgreBites::TrayLocation::TL_TOPLEFT, "MyButton", "Click Me!");
at the bottom of setup function

If I use "OgreBites::TrayLocation::TL_TOPLEFT" or "OgreBites::TL_TOPLEFT" none shows error during compilation but still I do not see a button.

EDIT:
If I use this:

Code: Select all

    OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", OgreBites::ApplicationContext::getRenderWindow(), this);
    //OgreBites::Button* b = mTrayMgr->OgreBites::TrayManager::createButton(OgreBites::TrayLocation::TL_TOPLEFT, "MyButton", "Click Me!");
    OgreBites::TextBox* t = mTrayMgr->OgreBites::TrayManager::createTextBox(OgreBites::TrayLocation::TL_LEFT, "MyTextBox", "TextBox", 120, 100);
or this:

Code: Select all

    OgreBites::TrayManager* mTrayMgr = new OgreBites::TrayManager("InterfaceName", OgreBites::ApplicationContext::getRenderWindow(), this);
    //OgreBites::Button* b = mTrayMgr->OgreBites::TrayManager::createButton(OgreBites::TrayLocation::TL_TOPLEFT, "MyButton", "Click Me!");
    OgreBites::TextBox* t = mTrayMgr->createTextBox(OgreBites::TL_LEFT, "MyTextBox", "TextBox", 120, 100);
both I can compile without errors but doesn't show anything
0 x

Fighter19
Gnoblar
Posts: 2
Joined: Sat Jul 28, 2018 1:40 am
x 1

Re: How to use TrayManager?

Post by Fighter19 » Thu Aug 02, 2018 8:16 pm

Today I stumbled upon the same problem.
After 4 hours of trial and error I found the culprit.
You need to add the Overlay System to the render queue at some point.

Calling this:

Code: Select all

scnMgr->addRenderQueueListener(mOverlaySystem);
After the scene manager has been created, made my button appear.
0 x

Post Reply