Annchienta::Engine Class Reference

List of all members.

Public Member Functions

void delay (int ms) const
 Engine (const char *writeDirectory=".")
bool evaluatePythonBoolean (const char *code, const char *conditional)
unsigned int getTicks () const
const char * getWriteDirectory () const
bool isValidFile (const char *filename) const
void runPythonCode (const char *code) const
void runPythonScript (const char *filename) const
void setPythonBoolean (bool b)
void setWindowTitle (const char *title) const
void setWriteDirectory (const char *directory)
void toPythonCode (char **code)
void write (const char *text) const
 ~Engine ()

Private Attributes

AudioManageraudioManager
CacheManagercacheManager
InputManagerinputManager
LogManagerlogManager
MapManagermapManager
MathManagermathManager
bool pythonBoolean
VideoManagervideoManager
char writeDirectory [DEFAULT_STRING_SIZE]


Detailed Description

This is a class that holds most other classes and some general engine functionality. To obtain it, use getEngine()

Constructor & Destructor Documentation

Annchienta::Engine::Engine ( const char *  writeDirectory = "."  ) 

Write directory is the directory where files such as save files and logs will be placed.

Annchienta::Engine::~Engine (  ) 


Member Function Documentation

void Annchienta::Engine::delay ( int  ms  )  const

Waits a time and then returns.

Parameters:
ms Number of milliseconds to wait.

bool Annchienta::Engine::evaluatePythonBoolean ( const char *  code,
const char *  conditional 
)

Returns the value of a Python boolean expression. an example could be

 engine->evaluatePythonBoolean( "a=3", "a>1" ); 
Parameters:
code Code to be executed before checking the boolean value.
conditional The boolean expression.
Note:
Not available in Python.

unsigned int Annchienta::Engine::getTicks (  )  const

Get the time since the engine was initted.

Returns:
The number of milliseconds passed since initting.

const char* Annchienta::Engine::getWriteDirectory (  )  const

Finds out the writing directory. This should be used if you want to know where to place save files etc.

bool Annchienta::Engine::isValidFile ( const char *  filename  )  const

Checks if the given file exists and can be read.

Parameters:
filename File to be checked.
Returns:
If the file can be accessed.

void Annchienta::Engine::runPythonCode ( const char *  code  )  const

Safe method for running Python code.

Parameters:
code Code to be executed.
Note:
Not available in Python.

void Annchienta::Engine::runPythonScript ( const char *  filename  )  const

Safe method for running Python scripts.

Parameters:
filename The script to be ran.
Note:
Not available in Python.

void Annchienta::Engine::setPythonBoolean ( bool  b  ) 

Used internally by evaluatePythonBoolean(). I can't imagine this is needed in any other situation, so please don't use it.

void Annchienta::Engine::setWindowTitle ( const char *  title  )  const

Sets the window caption.

Parameters:
title The new window caption.

void Annchienta::Engine::setWriteDirectory ( const char *  directory  ) 

This changes the write directory, which is the directory where log and save files should be placed. Use this with care, and preferably never as it is better to specify the writing directory when calling the Annchienta::init() function.

Parameters:
directory Path to the new writing directory.

void Annchienta::Engine::toPythonCode ( char **  code  ) 

Converts a string to proper Python code. For now, this means removing extra spaces at the end.

Parameters:
code Code to be converted.
Note:
Not available in Python.

void Annchienta::Engine::write ( const char *  text  )  const

This simply writes some text to stdout. This is preferred to the default Python "print" function because that might be unsafe on certain operating systems. (Meaning: windows.)

Parameters:
text The string to write.


Member Data Documentation

char Annchienta::Engine::writeDirectory[DEFAULT_STRING_SIZE] [private]


Generated on Wed Feb 4 16:31:47 2009 for Annchienta by  doxygen 1.5.7.1