Home

Module gui

Lua bindings to interact with the GUI elements. An example would be:
 gui.radarRender( 0, 0 ) -- Renders the radar in the bottom left.
 

Functions

gui.fpsPos (x, y) Sets the position for the fps stuff.
gui.menuInfo (window) Opens the info menu window.
gui.menuSmall () Opens the small menu window.
gui.mesgInit (width, x, y) Sets up the message box from which the player receives input.
gui.mouseClickEnable (enable) Enables mouse clicking callback.
gui.mouseMoveEnable (enable) Enables mouse movement callback.
gui.omsgInit (width, x, y) Sets the center of the omsg messages and width.
gui.osdInit (x, y, w, h) Initializes the mission OSD (on-screen display).
gui.radarInit (circle, width, height) Initializes the radar.
gui.radarRender (x, y) Renders the radar.
gui.targetPlanetGFX (tex) Sets the Lua planet target GFX.
gui.targetPlanetGFX (tex) Sets the Lua planet target GFX.
gui.viewport (x, y, w, h) Sets the gui viewport.


Functions

gui.fpsPos (x, y)
Sets the position for the fps stuff. It can display the FPS and the current speed mod.

Parameters

  • x: X position for the fps stuff.
  • y: Y position for the fps stuff.
gui.menuInfo (window)
Opens the info menu window. Possible window targets are:
- "main" : Main window.
- "ship" : Ship info window.
- "weapons" : Weapon configuration window.
- "cargo" : Cargo view window.
- "missions" : Mission view window.
- "standings" : Standings view window.

Parameters

  • window: Optional window parameter indicating the tab to open at.

Usage:

gui.menuInfo( "ship" ) -- Opens ship tab
gui.menuSmall ()
Opens the small menu window.

Usage:

gui.menuSmall()
gui.mesgInit (width, x, y)
Sets up the message box from which the player receives input.

Parameters

  • width: Width of the message box.
  • x: X position of message box.
  • y: Y position of message box.
gui.mouseClickEnable (enable)
Enables mouse clicking callback. It enables receiving mouse clicks with a callback function like:
function mouse_click( button, x, y, state )
With button being the ID of the button, x/y being the position clicked and state being true if pressed, false if lifted. It should return true if it used the mouse event or false if it let it through.

Parameters

  • enable: Whether or not to enable the mouse click callback.
gui.mouseMoveEnable (enable)
Enables mouse movement callback. It enables receiving mouse movements with a callback function like:
function mouse_move( x, y )
With x/y being the position of the mouse.

Parameters

  • enable: Whether or not to enable the mouse movement callback.
gui.omsgInit (width, x, y)
Sets the center of the omsg messages and width.

Parameters

  • width: Width of the omsg messages.
  • x: X center of the omsg messages.
  • y: Y center of the omsg messages.
gui.osdInit (x, y, w, h)
Initializes the mission OSD (on-screen display).

Parameters

  • x: X position of the OSD display.
  • y: Y position of the OSD display.
  • w: Width of the OSD display.
  • h: Height of the OSD display.
gui.radarInit (circle, width, height)
Initializes the radar.

Parameters

  • circle: Whether or not it should be a circle.
  • width: Width if it's not a circle or radius if it is a circle.
  • height: Only needed if not a circle.

Usage:

gui.radarInit( true, 82 ) -- Circular radar with 82 radius.
gui.radarRender (x, y)
Renders the radar.

Parameters

  • x: X position to render at.
  • y: Y position to render at.

Usage:

gui.radarRender( 50, 50 )
gui.targetPlanetGFX (tex)
Sets the Lua planet target GFX.

Parameters

  • tex: Texture to set for the planet targeting.
gui.targetPlanetGFX (tex)
Sets the Lua planet target GFX.

Parameters

  • tex: Texture to set for the planet targeting.
gui.viewport (x, y, w, h)
Sets the gui viewport. Basically this limits what the rest of the game considers as the screen. Careful when using this or you can make the game look ugly and unplayable. So use common sense and try to avoid windows smaller than 800x600 if possible.

Parameters

  • x: X position to start clipping (bottom left is 0.)
  • y: Y position to start clipping (bottom left is 0.)
  • w: Width of the clipping (width of the screen is default).
  • h: Height of the clipping (height of the screen is default).

Usage

  • gui.viewport( 0, 0, screen_w, screen_h ) -- Resets viewport.
  • gui.viewport( 0, 20, screen_w, screen_h-20 ) -- Gives 20 pixels for a bottom bar.

Valid XHTML 1.0!