Voxvision  1
Creating and manipulating voxel octrees
Data Structures | Macros | Typedefs | Functions
engine.h File Reference

Lua engine. More...

#include "../gcd-stubs.c"
#include "../voxtrees/tree.h"
#include "../voxrnd/camera.h"
#include "../voxrnd/fps-control.h"
#include "../voxrnd/renderer.h"
#include "../voxrnd/cd.h"

Go to the source code of this file.

Data Structures

struct  vox_engine
 Voxengine instance. More...
 

Macros

#define VOX_ENGINE_DEBUG   1
 Tells voxengine to start in debug mode.
 
#define vox_engine_quit_requested(stat)   (!(stat))
 Return true if quit was requested from the control script.
 

Typedefs

typedef int vox_engine_status
 Return type for vox_engine_tick
 

Functions

VOX_EXPORT struct vox_enginevox_create_engine (unsigned int width, unsigned int height, unsigned int flags, const char *script, int nargs, char *const arguments[])
 Create voxengine. More...
 
VOX_EXPORT vox_engine_status vox_engine_tick (struct vox_engine *engine)
 Engine tick function. More...
 
VOX_EXPORT void vox_destroy_engine (struct vox_engine *engine)
 Destroy an engine.
 

Detailed Description

Lua engine.

Function Documentation

◆ vox_create_engine()

VOX_EXPORT struct vox_engine* vox_create_engine ( unsigned int  width,
unsigned int  height,
unsigned int  flags,
const char *  script,
int  nargs,
char *const  arguments[] 
)

Create voxengine.

This function creates a lua engine: initializes SDL, opens a window, initializes lua environment, loads needed modules and lua control script and so on. See the main page of documentation for more informantion. If you wish to pass an array of strings to lua control script, they will be visible in arg table having they indices starting from 1.

Parameters
widthWidth of the window.
heightHeight of the window.
flagsCurrently 0 for normal work or VOX_ENGINE_DEBUG for debug mode.
scriptControl script in lua
nargsNumber of arguments
argumentsAn array of zero terminated strings which you want to pass to lua as arguments. Must be NULL if nargs is zero. As this function returns, the array is no longer needed by the engine.
Returns
Pointer to created engine on success or NULL.

◆ vox_engine_tick()

VOX_EXPORT vox_engine_status vox_engine_tick ( struct vox_engine engine)

Engine tick function.

Do an engine tick. See the main page of documentation for more information. This function is usually called inside an infinite loop in the main program.

Returns
Engine status (e.g. quit requested).