OpenBlox
A game engine which provides a simple and easy to learn Lua API.
OB::OBEngine Class Reference

#include <OBEngine.h>

Public Member Functions

 OBEngine ()
 
virtual ~OBEngine ()
 
shared_ptr< TaskSchedulergetTaskScheduler ()
 
shared_ptr< TaskSchedulergetSecondaryTaskScheduler ()
 
shared_ptr< OBSerializergetSerializer ()
 
void init ()
 
void setExitCode (int exitCode)
 
int getExitCode ()
 
void shutdown ()
 
bool isRunning ()
 
void tick ()
 
void render ()
 
lua_State * getGlobalLuaState ()
 
ob_uint64 getStartTime ()
 
bool doesRendering ()
 
void setRendering (bool renders)
 
int getInitWidth ()
 
void setInitWidth (int w)
 
int getInitHeight ()
 
void setInitHeight (int h)
 
bool getUseVsync ()
 
void setUseVsync (bool useVsync)
 
bool getResizable ()
 
void setResizable (bool Resizable)
 
void * getWindowId ()
 
void setWindowId (void *wId)
 
void resized (int width, int height)
 
irr::IrrlichtDevice * getIrrlichtDevice ()
 
post_render_func_t getPostRenderFunc ()
 
void setPostRenderFunc (post_render_func_t prf)
 
shared_ptr< OBRenderUtilsgetRenderUtils ()
 
shared_ptr< Instance::DataModelgetDataModel ()
 
shared_ptr< AssetLocatorgetAssetLocator ()
 
shared_ptr< PluginManagergetPluginManager ()
 
shared_ptr< OBLoggergetLogger ()
 
OBInputEventReceivergetInputEventReceiver ()
 

Detailed Description

This is the main class of the OpenBlox engine. This class is the hierarchical parent of everything else in the engine, including the DataModel, InputManager and SoundManager.

Author
John M. Harris, Jr.
Date
May 2016

Constructor & Destructor Documentation

◆ OBEngine()

OB::OBEngine::OBEngine ( )

◆ ~OBEngine()

virtual OB::OBEngine::~OBEngine ( )
virtual

Member Function Documentation

◆ doesRendering()

bool OB::OBEngine::doesRendering ( )

Returns true if OBEngine is meant to handle rendering.

Returns
true if this instance of OBEngine supports rendering
Author
John M. Harris, Jr.

◆ getAssetLocator()

shared_ptr<AssetLocator> OB::OBEngine::getAssetLocator ( )

Returns the AssetLocator.

Returns
AssetLocator
Author
John M. Harris, Jr.

◆ getDataModel()

shared_ptr<Instance::DataModel> OB::OBEngine::getDataModel ( )

Returns the DataModel.

Returns
DataModel
Author
John M. Harris, Jr.

◆ getExitCode()

int OB::OBEngine::getExitCode ( )

Gets the exit code of the OpenBlox engine.

Returns
Exit code
Author
John M. Harris, Jr.

◆ getGlobalLuaState()

lua_State* OB::OBEngine::getGlobalLuaState ( )

Returns the global Lua state, which all states used by the engine are coroutines of.

Returns
Global Lua state
Author
John M. Harris, Jr.

◆ getInitHeight()

int OB::OBEngine::getInitHeight ( )

Gets the initial height of the render window. Defaults to 480.

Returns
Initial height of render window
Author
John M. Harris, Jr.

◆ getInitWidth()

int OB::OBEngine::getInitWidth ( )

Gets the initial width of the render window. Defaults to 640.

Returns
Initial width of render window
Author
John M. Harris, Jr.

◆ getInputEventReceiver()

OBInputEventReceiver* OB::OBEngine::getInputEventReceiver ( )

Returns the input event receiver.

Returns
OBInputEventReceiver
Author
John M. Harris, Jr.

◆ getIrrlichtDevice()

irr::IrrlichtDevice* OB::OBEngine::getIrrlichtDevice ( )

Returns the currently active Irrlicht device, if any.

Returns
Irrlicht device
Author
John M. Harris, Jr.

◆ getLogger()

shared_ptr<OBLogger> OB::OBEngine::getLogger ( )

Returns the logger.

Returns
OBLogger
Author
John M. Harris, Jr.

◆ getPluginManager()

shared_ptr<PluginManager> OB::OBEngine::getPluginManager ( )

Returns the PluginManager associated with this OBEngine instance.

Returns
PluginManager
Author
John M. Harris, Jr.

◆ getPostRenderFunc()

post_render_func_t OB::OBEngine::getPostRenderFunc ( )

Returns the post-render function.

Author
John M. Harris, Jr.

◆ getRenderUtils()

shared_ptr<OBRenderUtils> OB::OBEngine::getRenderUtils ( )

Returns the OBRenderUtils instance

Returns
OBRenderUtils
Author
John M. Harris, Jr.

◆ getResizable()

bool OB::OBEngine::getResizable ( )

Returns true if the OpenBlox engine window will be resizable.

Returns
true if OpenBlox is supposed to be resizable
Author
Tochigi

◆ getSecondaryTaskScheduler()

shared_ptr<TaskScheduler> OB::OBEngine::getSecondaryTaskScheduler ( )

Returns secondary TaskScheduler.

Returns
Instance of TaskScheduler
Author
John M. Harris, Jr.

◆ getSerializer()

shared_ptr<OBSerializer> OB::OBEngine::getSerializer ( )

Returns the serializer.

Returns
Instance of OBSerializer
Author
John M. Harris, Jr.

◆ getStartTime()

ob_uint64 OB::OBEngine::getStartTime ( )

Returns the time the OpenBlox engine was started, in milliseconds.

Returns
Start time started in milliseconds
Author
John M. Harris, Jr.

◆ getTaskScheduler()

shared_ptr<TaskScheduler> OB::OBEngine::getTaskScheduler ( )

Returns primary TaskScheduler.

Returns
Instance of TaskScheduler
Author
John M. Harris, Jr.

◆ getUseVsync()

bool OB::OBEngine::getUseVsync ( )

Returns true if the OpenBlox engine will use vertical synchronization, otherwise false.

Returns
true if OpenBlox is supposed to use vsync
Author
John M. Harris, Jr.

◆ getWindowId()

void* OB::OBEngine::getWindowId ( )

Gets the current underlying window ID. With X this is a Window handle (A.K.A. XID A.K.A. unsigned long int), on Windows this is an HWND, their equivalent of a window handle.

Defaults to NULL.

Returns
System-dependent window ID
Author
John M. Harris, Jr.

◆ init()

void OB::OBEngine::init ( )

Initializes the OpenBlox engine.

You must have set all initialization parameters before calling this, otherwise you will not be able to change many of them.

Author
John M. Harris, Jr.

◆ isRunning()

bool OB::OBEngine::isRunning ( )

Returns true if OpenBlox is still running.

Returns
bool isRunning
Author
John M. Harris, Jr.

◆ render()

void OB::OBEngine::render ( )

Renders one frame of the DataModel.

This is normally called after OBEngine::tick

Author
John M. Harris, Jr.

◆ resized()

void OB::OBEngine::resized ( int  width,
int  height 
)

Used to inform the engine that a resize has occurred, this is only necessary (and should only be used) when OpenBlox is embedded in an external window.

Parameters
widthWidth
heightHeight
Author
John M. Harris, Jr.

◆ setExitCode()

void OB::OBEngine::setExitCode ( int  exitCode)

Sets the exit code of the OpenBlox engine.

Parameters
exitCodeExit code
Author
John M. Harris, Jr.

◆ setInitHeight()

void OB::OBEngine::setInitHeight ( int  h)

Sets the initial height of the render window.

Parameters
hInitial height of render window
Author
John M. Harris, Jr.

◆ setInitWidth()

void OB::OBEngine::setInitWidth ( int  w)

Sets the initial width of the render window.

Parameters
wInitial width of render window
Author
John M. Harris, Jr.

◆ setPostRenderFunc()

void OB::OBEngine::setPostRenderFunc ( post_render_func_t  prf)

Sets the post-render function.

As the name would suggest, this function will run after rendering is complete, but not before the buffer is swapped.

Author
John M. Harris, Jr.

◆ setRendering()

void OB::OBEngine::setRendering ( bool  renders)

Sets whether or not OBEngine is meant to handle rendering.

Parameters
renderstrue if this instance of OBEngine is supposed to support rendering, otherwise false
Author
John M. Harris, Jr.

◆ setResizable()

void OB::OBEngine::setResizable ( bool  Resizable)

Sets wether or not the OpenBlox engine window will be resizable.

Parameters
Resizabletrue if the Openblox window is supposed to be resizable, otherwise false
Author
Tochigi

◆ setUseVsync()

void OB::OBEngine::setUseVsync ( bool  useVsync)

Sets whether or not the OpenBlox engine will use vertical synchronization.

Parameters
useVsynctrue if OpenBlox is supposed to use vsync, otherwise false
Author
John M. Harris, Jr.

◆ setWindowId()

void OB::OBEngine::setWindowId ( void *  wId)

Sets the current underlying window ID. The same types apply as used with OBEngine::getWindowId

Setting this to NULL will mean that the engine will create a window for itself.

Parameters
wIdSystem-dependent window ID
Author
John M. Harris, Jr.

◆ shutdown()

void OB::OBEngine::shutdown ( )

Starts the shutdown process of the OpenBlox engine.

Author
John M. Harris, Jr.

◆ tick()

void OB::OBEngine::tick ( )

Runs the logic of the OpenBlox engine.

This runs a single "tick" of the logic thread, including running physics and the Lua task scheduler.

When running with rendering enabled, this also processes messages from the operating system and input.

Author
John M. Harris, Jr.

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