|
A canvas on which rendering occurs. More...
Public Member Functions | |
Point2I | clientToScreen (Point2I coordinate) |
Translate a coordinate from canvas window-space to screen-space. | |
void | cursorOff () |
Turns on the mouse off. | |
void | cursorOn () |
Turns on the mouse cursor. | |
int | getContent () |
Get the GuiControl which is being used as the content. | |
Point2I | getCursorPos () |
Get the current position of the cursor. | |
Point2I | getExtent () |
Returns the dimensions of the canvas. | |
string | getMode (int modeId) |
Gets information on the specified mode of this device. | |
int | getModeCount () |
Gets the number of modes available on this device. | |
int | getMouseControl () |
Gets the gui control under the mouse. | |
string | getVideoMode () |
Gets the current screen mode as a string. | |
Point2I | getWindowPosition () |
Get the current position of the platform window associated with the canvas. | |
void | hideCursor () |
Disable rendering of the cursor. | |
bool | isCursorOn () |
Determines if mouse cursor is enabled. | |
bool | isCursorShown () |
Determines if mouse cursor is rendering. | |
bool | isFullscreen () |
Is this canvas currently fullscreen? | |
bool | isMaximized () |
bool | isMinimized () |
void | maximizeWindow () |
maximize this canvas' window. | |
void | minimizeWindow () |
minimize this canvas' window. | |
void | popDialog (GuiControl ctrl) |
Removes a specific dialog control. | |
void | popDialog () |
Removes a dialog at the front most layer. | |
void | popLayer () |
Removes the top most layer of dialogs. | |
void | popLayer (S32 layer) |
Removes a specified layer of dialogs. | |
void | pushDialog (GuiControl ctrl, int layer=0, bool center=false) |
Adds a dialog control onto the stack of dialogs. | |
void | renderFront (bool enable) |
This turns on/off front-buffer rendering. | |
void | repaint (int elapsedMS=0) |
Force canvas to redraw. If the elapsed time is greater than the time since the last paint then the repaint will be skipped. | |
void | reset () |
Reset the update regions for the canvas. | |
void | restoreWindow () |
restore this canvas' window. | |
Point2I | screenToClient (Point2I coordinate) |
Translate a coordinate from screen-space to canvas window-space. | |
void | setContent (GuiControl ctrl) |
Set the content of the canvas to a specified control. | |
void | setCursor (GuiCursor cursor) |
Sets the cursor for the canvas. | |
bool | setCursorPos (Point2I pos) |
Sets the position of the cursor. | |
bool | setCursorPos (F32 posX, F32 posY) |
Sets the position of the cursor. | |
void | setFocus () |
Claim OS input focus for this canvas' window. | |
void | setVideoMode (int width, int height, bool fullscreen,[int bitDepth],[int refreshRate],[int antialiasLevel]) |
Change the video mode of this canvas. This method has the side effect of setting the $pref::Video::mode to the new values. | |
void | setWindowPosition (Point2I position) |
Set the position of the platform window associated with the canvas. | |
void | setWindowTitle (string newTitle) |
Change the title of the OS window. | |
void | showCursor () |
Enable rendering of the cursor. | |
void | toggleFullscreen () |
toggle canvas from fullscreen to windowed mode or back. | |
Public Attributes | |
Mouse Handling | |
bool | alwaysHandleMouseButtons |
Deal with mouse buttons, even if the cursor is hidden. | |
Canvas Rendering | |
int | numFences |
The number of GFX fences to use. |
A canvas on which rendering occurs.
A content control is the top level GuiControl for a screen. This GuiControl will be the parent control for all other GuiControls on that particular screen.
A dialog is essentially another screen, only it gets overlaid on top of the current content control, and all input goes to the dialog. This is most akin to the "Open File" dialog box found in most operating systems. When you choose to open a file, and the "Open File" dialog pops up, you can no longer send input to the application, and must complete or cancel the open file request. Torque keeps track of layers of dialogs. The dialog with the highest layer is on top and will get all the input, unless the dialog is modeless, which is a profile option.
The GuiCanvas is based on dirty regions. Every frame the canvas paints only the areas of the canvas that are 'dirty' or need updating. In most cases, this only is the area under the mouse cursor. This is why if you look in guiCanvas.cc the call to glClear is commented out. What you will see is a black screen, except in the dirty regions, where the screen will be painted normally. If you are making an animated GuiControl you need to add your control to the dirty areas of the canvas.
Point2I GuiCanvas::clientToScreen | ( | Point2I | coordinate | ) |
Translate a coordinate from canvas window-space to screen-space.
coordinate | The coordinate in window-space. |
void GuiCanvas::cursorOff | ( | ) |
Turns on the mouse off.
Canvas.cursorOff();
void GuiCanvas::cursorOn | ( | ) |
Turns on the mouse cursor.
Canvas.cursorOn();
int GuiCanvas::getContent | ( | ) |
Get the GuiControl which is being used as the content.
Canvas.getContent();
Point2I GuiCanvas::getCursorPos | ( | ) |
Get the current position of the cursor.
param | Description |
%cursorPos = Canvas.getCursorPos();
Point2I GuiCanvas::getExtent | ( | ) |
Returns the dimensions of the canvas.
%extent = Canvas.getExtent();
Reimplemented from GuiControl.
string GuiCanvas::getMode | ( | int | modeId | ) |
Gets information on the specified mode of this device.
modeId | Index of the mode to get data from. |
int GuiCanvas::getModeCount | ( | ) |
Gets the number of modes available on this device.
param | Description |
%modeCount = Canvas.getModeCount()
int GuiCanvas::getMouseControl | ( | ) |
Gets the gui control under the mouse.
%underMouse = Canvas.getMouseControl();
string GuiCanvas::getVideoMode | ( | ) |
Gets the current screen mode as a string.
The return string will contain 5 values (width, height, fullscreen, bitdepth, refreshRate). You will need to parse out each one for individual use.
Point2I GuiCanvas::getWindowPosition | ( | ) |
Get the current position of the platform window associated with the canvas.
void GuiCanvas::hideCursor | ( | ) |
Disable rendering of the cursor.
Canvas.hideCursor();
bool GuiCanvas::isCursorOn | ( | ) |
Determines if mouse cursor is enabled.
// Is cursor on? if(Canvas.isCursorOn()) echo("Canvas cursor is on");
bool GuiCanvas::isCursorShown | ( | ) |
Determines if mouse cursor is rendering.
// Is cursor rendering? if(Canvas.isCursorShown()) echo("Canvas cursor is rendering");
bool GuiCanvas::isFullscreen | ( | ) |
Is this canvas currently fullscreen?
bool GuiCanvas::isMaximized | ( | ) |
bool GuiCanvas::isMinimized | ( | ) |
void GuiCanvas::maximizeWindow | ( | ) |
maximize this canvas' window.
void GuiCanvas::minimizeWindow | ( | ) |
minimize this canvas' window.
void GuiCanvas::popDialog | ( | GuiControl | ctrl | ) |
Removes a specific dialog control.
ctrl | Dialog to pop |
Canvas.popDialog(RecordingsDlg);
void GuiCanvas::popDialog | ( | ) |
Removes a dialog at the front most layer.
// Pops whatever is on layer 0
Canvas.popDialog();
void GuiCanvas::popLayer | ( | ) |
Removes the top most layer of dialogs.
Canvas.popLayer();
void GuiCanvas::popLayer | ( | S32 | layer | ) |
Removes a specified layer of dialogs.
layer | Number of the layer to pop |
Canvas.popLayer(1);
void GuiCanvas::pushDialog | ( | GuiControl | ctrl, | |
int | layer = 0 , |
|||
bool | center = false | |||
) |
Adds a dialog control onto the stack of dialogs.
ctrl | Dialog to add | |
layer | Layer to put dialog on (optional) | |
center | True to center dialog on canvas (optional) |
Canvas.pushDialog(RecordingsDlg);
void GuiCanvas::renderFront | ( | bool | enable | ) |
This turns on/off front-buffer rendering.
enable | True if all rendering should be done to the front buffer |
Canvas.renderFront(false);
void GuiCanvas::repaint | ( | int | elapsedMS = 0 |
) |
Force canvas to redraw. If the elapsed time is greater than the time since the last paint then the repaint will be skipped.
elapsedMS | The optional elapsed time in milliseconds. |
Canvas.repaint();
void GuiCanvas::reset | ( | ) |
Reset the update regions for the canvas.
Canvas.reset();
void GuiCanvas::restoreWindow | ( | ) |
restore this canvas' window.
Point2I GuiCanvas::screenToClient | ( | Point2I | coordinate | ) |
Translate a coordinate from screen-space to canvas window-space.
coordinate | The coordinate in screen-space. |
void GuiCanvas::setContent | ( | GuiControl | ctrl | ) |
Set the content of the canvas to a specified control.
ctrl | ID or name of GuiControl to set content to |
Canvas.setContent(PlayGui);
void GuiCanvas::setCursor | ( | GuiCursor | cursor | ) |
Sets the cursor for the canvas.
cursor | Name of the GuiCursor to use |
Canvas.setCursor("DefaultCursor");
bool GuiCanvas::setCursorPos | ( | Point2I | pos | ) |
Sets the position of the cursor.
pos | Point, in screenspace for the cursor. Formatted as ("x y") |
Canvas.setCursorPos("0 0");
bool GuiCanvas::setCursorPos | ( | F32 | posX, | |
F32 | posY | |||
) |
Sets the position of the cursor.
posX | X-coordinate, in screenspace for the cursor. | |
posY | Y-coordinate, in screenspace for the cursor. |
Canvas.setCursorPos(0,0);
void GuiCanvas::setFocus | ( | ) |
Claim OS input focus for this canvas' window.
void GuiCanvas::setVideoMode | ( | int | width, | |
int | height, | |||
bool | fullscreen | |||
) |
Change the video mode of this canvas. This method has the side effect of setting the $pref::Video::mode to the new values.
width | The screen width to set. | |
height | The screen height to set. | |
fullscreen | Specify true to run fullscreen or false to run in a window | |
bitDepth | [optional] The desired bit-depth. Defaults to the current setting. This parameter is ignored if you are running in a window. | |
refreshRate | [optional] The desired refresh rate. Defaults to the current setting. This parameter is ignored if you are running in a window | |
antialiasLevel | [optional] The level of anti-aliasing to apply 0 = none |
void GuiCanvas::setWindowPosition | ( | Point2I | position | ) |
Set the position of the platform window associated with the canvas.
position | The new position of the window in screen-space. |
void GuiCanvas::setWindowTitle | ( | string | newTitle | ) |
Change the title of the OS window.
newTitle | String containing the new name |
Canvas.setWindowTitle("Documentation Rocks!");
void GuiCanvas::showCursor | ( | ) |
Enable rendering of the cursor.
Canvas.showCursor();
void GuiCanvas::toggleFullscreen | ( | ) |
toggle canvas from fullscreen to windowed mode or back.
// If we are in windowed mode, the following will put is in fullscreen
Canvas.toggleFullscreen();
Deal with mouse buttons, even if the cursor is hidden.
The number of GFX fences to use.