Function AMemberFunction;
Function (AMemberFunction);
The preprocessor commands:
#include "Object.lang" // This includes the file Object.lang #includeclass object // This includes the "object" class
The standard language include files used by the compiler for definitions of certain base types are located in RNROLCompiler\lang. The standard types can be extended and extra comands added by creating extra 'lang' files or by including the definitions in 'rol' files. For example:
In a file called MyDatablock.lang
class MyDatablock : std_datablock { MyDatablock(x) _MY_REGISTER_MACRO(x); SetError(x) _MY_REGISTER_MACRO_SETERROR(x); SetDeltaV1(x) _MY_REGISTER_MACRO_SETDELTAV1(x); };
And in an object rol file
object TestExtension { datablock MyDatablock; networking { MyDatablock mPosition.x; } }
To use the compiler with MS VC++ you can use custom build rules per file.
Example:
To build _RO_Object.rol and include this in the project use the custom build rule:
..\RNROLCompiler\bin\RNROLCompiler.exe $(InputName).rol $(InputName).cpp $(InputName).h
Or you could use: ..\RNROLCompiler\bin\RNROLCompiler.exe $(InputPath) $(InputName).cpp $(InputName).h
Or even use: ..\RNROLCompiler\bin\RNROLCompiler.exe $(InputPath)
And for the file output box use:
$(InputName).cpp
$(InputName).h
For MS VC++ 6.0 The carriage return between the cpp and h file is important otherwise MSVC will get confused with build dependency and may rebuild the output files unnecessarily.
Note: This assumes the RNROLCompiler directory is one directory 'below' your project build directory.
The tutorial section shows in much greater how to add these build rules to a ReplicaNet project. ROL Files must end with a blank line and a carriage return.
#include "_RO_Test.h" class Test : _RO_DO_PUBLIC_RO(Test) // Note that we include the definition for the ReplicaNet class { public: Test() {}; virtual ~Test() {}; struct Position { float x,y,z; }; Position mPosition; };
This section should be saved in to a file called "_RO_Test.rol" and compiled with 'RNROLCompiler _RO_Test.rol _RO_Test.cpp _RO_Test.h'
object Test { datablock Predict_Float; networking { Predict_Float mPosition.x; { SetMaxError(0.5f); SetInterpolationFilter(0.1f); } Predict_Float mPosition.y; SetMaxError(2.0f); Predict_Float mPosition.z; } }
application { object Test; }