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.
targetSpobGFX (tex) Sets the Lua spob target GFX.
targetPilotGFX (tex) Sets the Lua pilot target GFX.
mouseClickEnable ([enable=true]) Enables mouse clicking callback.
mouseMoveEnable ([enable]) Enables mouse movement callback.
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.

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.

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).

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.

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.

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.

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.

Parameters:

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

Usage:

    gui.radarRender( 50, 50 )
    
targetSpobGFX (tex)
Sets the Lua spob target GFX.

Parameters:

  • tex Tex Texture to set for the spob targeting.
targetPilotGFX (tex)
Sets the Lua pilot target GFX.

Parameters:

  • tex Tex Texture to set for the pilot 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)
setMapOverlayBounds (top, right, bottom, left)
Sets map boundaries

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.5.0 Last updated 2024-04-23 02:31:34