BlendELF is a engine written by me, an IT student at the University of Jyväskylä. I am coding the engine as my portfolio project, as a proof of my skills in 3d graphics and game logics/systems coding. I release this engine under the assumption that it could be useful for other people in making quck prototypes and small games. I reserve the right to halt the development of this engine at will, at any given time.
Tutorial 8, C++ SDK
This tutorial should give you the basic idea of how to use the BlendELF C++ API. Note that this tutorial is meant for only those that want to use BlendELF with C++. The C++ API for BlendELF is by no means any more complete than the Lua API, so the C++ is by no means to be considered "the advanced API". The APIs are almost identical as you can see from this tutorial.
Step 1: Getting the tutorial resources
Only thing needed is the BlendELF Development Kit. Download it from http://blendelf.com if you haven't already.
Step 2: Setting up Visual Studio Express 2008
Here is a short description how to setup VSE 2008 for BlendELF SDK. Pardon me for the briefness of this part. Might rework it with pictures and all when I find to time to do that ;).
Step 3: Compiling on linux
If you are compiling with linux and using g++ for that, you might want to add the option "-Wl,-rpath,./" to your compile. This way you can just drop libblendelf.so into your projects root folder and the binary will find it. So your command for compiling an application with blendelf would probably become something like this:

g++ main.cpp -Wl,-rpath,./ -L. -lblendelf

Also take into account that you have to tell the compiler where blendelf.h and libblendelf.os are. In the upper example I assumed that both of them are in the same folder that main.cpp is. You can specify separate include paths and library paths with -I and -L flags. The following line: -I/home/myname/blendelf/cppsdk would tell the compiler to search for include files at /home/myname/blendelf/cppsdk .
Step 4: Sample C++ program
The C++ API of BlendELF is almost identical with the Lua API, so the API doc of Lua api is pretty much the API doc of C++ too. There are a few easy to remember differences between the C++ and Lua APIs. Lets take a look at a sample BlendELF C++ program.
#include "blendelf.h" int main() { elfInitWithConfig("config.txt"); elf_handle scn = elfLoadScene("level1.pak"); elf_handle cam = elfGetCameraByName(scn, "Camera"); elfHideMouse(true); while(elfRun()) { if(elfGetKeyState(ELF_KEY_W) == ELF_DOWN) elfMoveActorLocal(cam, 0.0, 0.0, -12.0); if(elfGetKeyState(ELF_KEY_S) == ELF_DOWN) elfMoveActorLocal(cam, 0.0, 0.0, 12.0); if(elfGetKeyState(ELF_KEY_A) == ELF_DOWN) elfMoveActorLocal(cam, -12.0, 0.0, 0.0); if(elfGetKeyState(ELF_KEY_D) == ELF_DOWN) elfMoveActorLocal(cam, 12.0, 0.0, 0.0); elf_vec2i mf = elfGetMouseForce(); elfRotateActor(cam, 0.0, 0.0, -mf.x*10.0); elfRotateActorLocal(cam, -mf.y*10.0, 0.0, 0.0); if(elfGetKeyState(ELF_KEY_ESC) == ELF_PRESSED) elfQuit(); } elfDeinit(); return 0; }
Now the first difference that you notice is probably the first function we call, elfInitWithConfig. In Lua we didn't call any init functions, but in C++ we have to since the init function isn't called for us. The next difference is that there is no dot between elf and the name of the function. So elf.GetFps becomes elfGetFps. Also the flags don't have the dot either, and the elf is capitalised. So elf.KEY_W becomes ELF_KEY_W. The variables in C++ have types, so scn = elf.LoadScene("level1.pak") becomes elf_handle scn = elfLoadScene("level1.pak");. Also mf = elf.GetMouseForce() becomes elf_vec2i mf = elfGetMouseForce();, etc... Finally, in C++ programs we have to call elfDeinit manually at the end of our program, because like with elfInitWithConfig, this function isn't called for us.

Thats it! I hope you enjoyed the tutorial, and if you have any comments about it, please post to the forums.