naev 0.12.5
nlua_bkg.c File Reference

Bindings for modifying the space background. More...

#include "nlua_bkg.h"
#include "background.h"
#include "nlua_colour.h"
#include "nlua_tex.h"
Include dependency graph for nlua_bkg.c:

Go to the source code of this file.

Functions

static int bkgL_clear (lua_State *L)
 Lua bindings to interact with the background.
static int bkgL_image (lua_State *L)
 Adds a background image.
int nlua_loadBackground (nlua_env env)
 Loads the graphics library.

Variables

static const luaL_Reg bkgL_methods []

Detailed Description

Bindings for modifying the space background.

Definition in file nlua_bkg.c.

Function Documentation

◆ bkgL_clear()

int bkgL_clear ( lua_State * L)
static

Lua bindings to interact with the background.

An example would be:

` Lua module: bkg

Clears any backgrounds that may currently be displaying.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: clear

Definition at line 53 of file nlua_bkg.c.

◆ bkgL_image()

int bkgL_image ( lua_State * L)
static

Adds a background image.

If the colour parameter is a boolean it's treated as the foreground parameter instead.

Lua usage parameter: bkg.image( img, 0, 0, 0.1, 1. ) – Adds the image without scaling that moves at 0.1 the player speed Lua usage parameter: bkg.image( img, 0, 0, 0.1, 1., true ) – Now on the foreground Lua usage parameter: bkg.image( img, 0, 0, 0.1, 1., col.new(1,0,0) ) – Now with colour Lua usage parameter: bkg.image( img, 0, 0, 0.1, 1., col.new(1,0,0), true ) – Now with colour and on the foreground

Lua function parameter: Tex image Image to use. Lua function parameter: number x X position. Lua function parameter: number y Y position. Lua function parameter:[opt=0] number move Fraction of a pixel to move when the player moves one pixel. A value of 0 indicates static and centered. Lua function parameter:[opt=1] number scale How much to scale the image. Lua function parameter:[opt=0] Rotation angle, in radians. Lua function parameter:[opt=nil] Colour col Colour to tint image. Lua function parameter:[opt=false] boolean foreground Whether or not it should be rendered above the space dust. Lua return parameter: number ID of the background.

Parameters
LLua State
Returns
Number of variables on the Lua State stack.

Lua function: image

Definition at line 86 of file nlua_bkg.c.

◆ nlua_loadBackground()

int nlua_loadBackground ( nlua_env env)

Loads the graphics library.

Parameters
envEnvironment to load graphics library into.
Returns
0 on success.

Definition at line 33 of file nlua_bkg.c.

Variable Documentation

◆ bkgL_methods

const luaL_Reg bkgL_methods[]
static
Initial value:
= { { "clear", bkgL_clear },
{ "image", bkgL_image },
{ 0, 0 } }
static int bkgL_image(lua_State *L)
Adds a background image.
Definition nlua_bkg.c:86
static int bkgL_clear(lua_State *L)
Lua bindings to interact with the background.
Definition nlua_bkg.c:53

Background methods.

Definition at line 23 of file nlua_bkg.c.