Game Development Community

GUICanvas and Canvas?

by Malik Gray · in iTorque 2D · 05/16/2011 (12:39 am) · 1 replies

I found the following in main.cs I was wondering why does it say Canvas.setContent instead of GUICanvas.setcontent? I was looking in the TGB References and it seems like it should be GUICanvas. I can't seem to find Canvas anywhere at all in the documentation except when it is used in code. Where is this Class coming from?

Canvas.setContent(mainScreenGui);


#1
05/16/2011 (8:21 am)
@Malik - Canvas is a special object. It is declared in C++ and exposed to TorqueScript as the "master" GUICanvas object:

Canvas = new GuiCanvas();
Canvas->registerObject("Canvas"); // automatically adds to GuiGroup
You can create multiple GUICanvas objects, but Canvas is the main one used for the game.