Page 1 of 1

I have question about root windows in a .layout file.

Posted: Sat Apr 07, 2012 23:23
by IceThatJaw
Hi everyone.

I am trying to build a HUD for an Ogre3D game by creating my own XML file. I figured out how to make my own imagesets and load them in as static images but I still confused about the Root Window.

Since I want my static images to make up parts of the HUD should I just create a root window and leave it blank and then position my HUD components within it? Will it be transparent in the game so that all you see are the HUD elements?

Also, I was wondering how I should implement the Health and Ammo components since they will not be static. How can I get the Health bars and Ammo counter to be dynamic depending on how much health and ammo the player has? If I was using bars for the health would I just have an image for one bar and then load or unload the bars in the gameplay code?


Thanks.

Re: I have question about root windows in a .layout file.

Posted: Sun Apr 08, 2012 12:37
by Kulik
IceThatJaw wrote:Hi everyone.
Since I want my static images to make up parts of the HUD should I just create a root window and leave it blank and then position my HUD components within it? Will it be transparent in the game so that all you see are the HUD elements?

Exactly. You set MousePassThroughEnabled on the root window and it then acts as just a container for other windows.

IceThatJaw wrote:Also, I was wondering how I should implement the Health and Ammo components since they will not be static. How can I get the Health bars and Ammo counter to be dynamic depending on how much health and ammo the player has? If I was using bars for the health would I just have an image for one bar and then load or unload the bars in the gameplay code?

I would probably do this with a custom looknfeel, you could base it on progress bar and clip the "filler" layer. I believe this is how sumwars does their health "orb".

HTH.