GameTools javaLink
Eases the pain of working with Java scripting inside a C++ environment. Create a class JavaLink object for each script, passing in the file name and path to the Java source code. Remember that the filename of the Java script must be the same as the name of the object inside it.
class JavaLink { JavaLink ( const char *_fname, const char *_path ) ; void callConstructor () ; ~JavaLink () ; static void *makeParameterArray ( int numElements ) ; static void freeParameterArray ( void *parameterArray ) ; static void setParameter ( void *parameterArray, int which, bool value ) ; static void setParameter ( void *parameterArray, int which, char value ) ; static void setParameter ( void *parameterArray, int which, unsigned char value ) ; static void setParameter ( void *parameterArray, int which, short value ) ; static void setParameter ( void *parameterArray, int which, int value ) ; static void setParameter ( void *parameterArray, int which, long value ) ; static void setParameter ( void *parameterArray, int which, float value ) ; static void setParameter ( void *parameterArray, int which, double value ) ; void *getMethod ( const char *name, const char *signature ) ; void callMethod ( void *methodID, void *parameterArray ) ; void *getVoidMethod ( const char *name ) void callVoidMethod ( void *methodID ) ; } ;
The JavaLink::callConstructor() function calls the Java code for the object's constructor function. Each method (class member function) within the Java code may then be found using 'getMethod' to return a method identification 'handle' (a void* pointer in reality) - which is subsequently passed to callMethod with an array of parameters.
In our games, all Java script functions take no parameters and return no results - so getVoidMethod and callVoidMethod suffice for our needs.
Wikiid Pages relating to gameTools (edit) |
gameTools - Main page |
gameTools - Support Tools : |
gameTools - File Formats : |
gameTools - Source Code :
|
Wikiid Pages relating to Lemur of Lima (edit) |
Lemur of Lima - Main page |
Lemur of Lima - Controls |
Lemur of Lima - Levels : |
Lemur of Lima - Java Plugins : |
Lemur of Lima - Source Code Documentation : |