So....GUI isn't just for HUDs....?
by Charlie Talley · in Torque X 2D · 06/15/2009 (9:16 am) · 4 replies
Read somewhere that in order to display ANYTHING, whether HUD, splash screen, menu screen, or game, you need to create some GUI objects. Is this true? What do I need to create in the code, and how do I go about doing it?
#2
A necessary object to have in this rendering tree is one or more GUISceneview objects. Basically, the Sceneview represents a rectangular region of the screen onto which a camera's view will be projected. No sceneview, nothing will be rendered. Also, a camera needs to be assigned to this view, or also nothing will render.
Fortunately, a basic setup is created automatically:
When a TorqueGame (or descendant) is created, it creates the Canvas and sets up a default Sceneview, using the camera that was defined in TXB. So, if you're using the standard setup of a Torque starter game project and set your scene up in TXB, you will be all set to have the scene rendered when the game is launched.
You can, of course, define your own Sceneview's and T2DSceneCamera's (or T3DCameraComponent's) for doing things like mini-maps or split screens. There is a sample project in the TX install folder "Demos" called "SplitScreen" that shows one way to use the Sceneview's for split-screening.
But if you don't want to do anything fancy like that, you really don't need to manually do anything with any GUI classes.
06/15/2009 (10:01 am)
That's essentially correct, though you don't necessarily need to create them manually. Assuming your game class is inheriting from TorqueGame, then the rendering is controlled by an object called a GUICanvas. It is a child of the root of the torque object database hierarchy and the Canvas itself serves as the root of the rendering tree.A necessary object to have in this rendering tree is one or more GUISceneview objects. Basically, the Sceneview represents a rectangular region of the screen onto which a camera's view will be projected. No sceneview, nothing will be rendered. Also, a camera needs to be assigned to this view, or also nothing will render.
Fortunately, a basic setup is created automatically:
When a TorqueGame (or descendant) is created, it creates the Canvas and sets up a default Sceneview, using the camera that was defined in TXB. So, if you're using the standard setup of a Torque starter game project and set your scene up in TXB, you will be all set to have the scene rendered when the game is launched.
You can, of course, define your own Sceneview's and T2DSceneCamera's (or T3DCameraComponent's) for doing things like mini-maps or split screens. There is a sample project in the TX install folder "Demos" called "SplitScreen" that shows one way to use the Sceneview's for split-screening.
But if you don't want to do anything fancy like that, you really don't need to manually do anything with any GUI classes.
#3
06/16/2009 (7:54 am)
Doh! My project still doesn't work :( . Are there any docs that go into detail about the GUI system in Torque X? Seems like a very important part of the engine...and yet there is barely any documentation on it.
Torque 3D Owner Gavin Beard
Byte Logic
http://www.garagegames.com/community/forums/viewthread/94053