Ult3D
Implementation of "Ultimate 3D Game Engine Design & Architecture" by Allan Sherrod
Loading...
Searching...
No Matches
Ult::GameMonkey Class Reference

#include <GameMonkey.h>

Public Member Functions

 GameMonkey ()
 
virtual ~GameMonkey ()
 
bool LoadScript (const std::string &script, GmScript *handle)
 
void ExecuteScript (GmScript handle)
 
bool GetScriptFunction (const std::string &name, GameMonkeyFunction &call)
 
void RegisterHostFunction (const std::string &name, gmCFunction func)
 
const char * GetError ()
 

Detailed Description

Wraps a GameMonkey interpreter machine instance to load/run GameMonkey scripts.

Constructor & Destructor Documentation

◆ GameMonkey()

Ult::GameMonkey::GameMonkey ( )
inline

GameMonkey constructor.

◆ ~GameMonkey()

virtual Ult::GameMonkey::~GameMonkey ( )
inlinevirtual

GameMonkey destructor.

Member Function Documentation

◆ ExecuteScript()

void Ult::GameMonkey::ExecuteScript ( GmScript handle)

Execute the loaded script referenced by the input handle.

◆ GetError()

const char * Ult::GameMonkey::GetError ( )
inline

Returns a string of any errors encountered in LoadScript.

◆ GetScriptFunction()

bool Ult::GameMonkey::GetScriptFunction ( const std::string & name,
GameMonkeyFunction & call )

Get a handle to a function contained in a previously loaded script.

Parameters
nameThe function name to find.
callThe result to store the function handle in.
Returns
True if the function with the given name was found, false otherwise.

◆ LoadScript()

bool Ult::GameMonkey::LoadScript ( const std::string & script,
GmScript * handle )

Load a script from file and store a handle to it. If errors, adds to the buffer accessible by GetError().

Parameters
scriptThe filename of the GameMonkey script to load.
handlePointer to the result handle to store.
Returns
True on success, false on failure.

◆ RegisterHostFunction()

void Ult::GameMonkey::RegisterHostFunction ( const std::string & name,
gmCFunction func )

Make a function callable from a GameMonkey script.

Parameters
nameThe name of the function to use within the GM script.
funcFunction pointer to be ran when the GM script calls 'name'.

The documentation for this class was generated from the following files: