Naev

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

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


Functions

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. ( x, y, w, h )

Parameters:

  • x number X position to start clipping (bottom left is 0.)
  • y number Y position to start clipping (bottom left is 0.)
  • w number Width of the clipping (width of the screen is default).
  • h number 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.
fpsPos (x, y)
Sets the position for the fps stuff.

It can display the FPS and the current speed mod. ( x, y )

Parameters:

  • x X position for the fps stuff.
  • y Y position for the fps stuff.
osdInit (x, y, w, h)
Initializes the mission OSD (on-screen display). ( x, y, w, h )

Parameters:

  • x number X position of the OSD display.
  • y number Y position of the OSD display.
  • w number Width of the OSD display.
  • h number Height of the OSD display.
mesgInit (width, x, y)
Sets up the message box from which the player receives input. ( width, x, y )

Parameters:

  • width number Width of the message box.
  • x number X position of message box.
  • y number Y position of message box.
omsgInit (width, x, y)
Sets the center of the omsg messages and width. ( width, x, y )

Parameters:

  • width number Width of the omsg messages.
  • x number X center of the omsg messages.
  • y number Y center of the omsg messages.
radarInit (circle, width, height)
Initializes the radar. ( circle, width, height )

Parameters:

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

Usage:

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

Parameters:

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

Usage:

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

Parameters:

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

Parameters:

  • tex Tex Texture to set for the planet targeting.
mouseClickEnable ([enable=true])
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 boolean Whether or not to enable the mouse click callback. (default true)
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 boolean Whether or not to enable the mouse movement callback. (optional)
menuInfo ([window="main"])
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.
( window )

Parameters:

  • window string parameter indicating the tab to open at. (default "main")

Usage:

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

Usage:

    gui.menuSmall()
setMapOverlayBounds (top, right, bottom, left)
Sets map boundaries ( top, right, bottom, left )

Parameters:

  • top number Top boundary in pixels
  • right number Right boundary in pixels
  • bottom number Bottom boundary in pixels
  • left number Left boundary in pixels
generated by LDoc 1.4.6 Last updated 2020-11-29 22:13:27