User Tools

Site Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
scripting:gui [2006-08-20 16:17]
Carsten created
— (current)
Line 1: Line 1:
-====== The gui Object ====== 
- 
-The ''​gui''​ object represents the GUI of the current ''​.gui''​ file. 
-It provides methods that affect the entire GUI as a whole, not just a single window of its window hierarchy. 
- 
- 
-===== Methods ===== 
- 
-==== activate(b) ==== 
- 
-Sets whether the GUI is active or not. Active GUIs are drawn and receive device (mouse and keyboard) and clock-tick events, inactive GUIs aren't drawn and don't receive events. (In order for a GUI to receive device events, more requirements must be met, see [[#​setInteractive_b]] for more details.) 
- 
-The default value is ''​true''​. 
- 
- 
-==== close() ==== 
- 
-Same as calling ''​activate(false)''​. 
- 
-<code lua> 
-    -- The next two lines are equivalent: 
-    gui:​close();​ 
-    gui:​activate(false);​ 
-</​code>​ 
- 
- 
-==== setInteractive(b) ==== 
- 
-Sets whether the GUI is interactive or not. Only the top-most, interactive GUI receives device (mouse and keyboard) events. (In order for a GUI to receive events, it must also be active, see [[#​activate_b]] for more details.) 
- 
-A typical example for a non-interactive GUI is the local players HUD, or any static world GUI that just displays some information. 
- 
-The default value is ''​true''​. 
- 
- 
-==== setFullCover(b) ==== 
- 
-Sets whether this GUI is fullscreen and fully opaque, that is, whether this GUI covers everything beneath it. 
- 
-If ''​b''​ is ''​true'',​ the GuiSys saves the rendering of the GUIs "​below"​ this one, otherwise it doesn'​t. 
-This can improve the GUI performance significantly if e.g. the player is at a point in the game where the world rendering FPS is low. In this case, if ''​setFullCover(false)''​ has been called, the world FPS also drags the GUI FPS down. If however ''​setFullCover(true)''​ has been called, the GuiSys omits the slow drawing of the world beneath this GUI, so that the GUIs FPS can be much higher. 
- 
-The default value is ''​false''​. 
- 
- 
-==== setMousePos(x,​ y) ==== 
- 
-Sets the position of the mouse cursor to the point at ''​(x,​ y)''​ (in virtual screen coordinates). 
- 
- 
-==== setMouseMat(s) ==== 
- 
-Sets the name of the MatSys material that is to be used as the mouse cursor. 
- 
-This is not yet implemented. Instead the GuiSys always draws a simple built-in default cursor. 
- 
- 
-==== showMouse(b) ==== 
- 
-Sets whether the mouse cursor is shown at all. 
- 
-Non-interactive GUIs normally don't show a mouse cursor whereas interactive GUIs do, but there also are exceptions, e.g. a GUI in which the user can control a 3D camera with the mouse is interactive but may not need a mouse cursor. (The clients main world rendering is an example for this.) Also fade-out or cinematic sequences can temporarily switch off the mouse-cursor with this method. 
- 
-The default value is ''​true''​. 
- 
- 
-==== setFocus(w) ==== 
- 
-Sets the keyboard input focus (the default receiver for keyboard events) to window ''​w''​. 
- 
-Note that calling this methods does //not// imply calls to ''​w:​OnFocusLose()''​ and ''​w:​OnFocusGain()''​. 
-This is contrary to focus changes due to a mouse click, where the GuiSys implicitly //does// the calls. 
-With ''​setFocus(w)''​ however, the calling Lua code should make these calls itself if so desired. 
- 
-<code lua> 
-    -- Example: 
-    -- previousWin and myWin are some windows of this GUIs window hierarchy. 
-    previousWin:​OnFocusLose();​ 
-    gui:​setFocus(myWin);​ 
-    myWin:​OnFocusGain();​ 
-</​code>​ 
- 
-By default, no window has the keyboard input focus. 
- 
- 
-==== __tostring() ==== 
- 
-Returns a string that briefly describes the GUI. 
  
scripting/gui.1156083436.txt.gz ยท Last modified: 2013-01-07 12:07 (external edit)