The NEW Example Framework

Sample 1 : Scripting test "Hello, world!"

This complete sample configures the application to the Lua based scripting plugin. Then it continues to test the scripting system by executing a small script which prints some text to the console.

#include <yapp/raf/yakeRaf.h>
 
using namespace yake;
 
/** Configuration of the application */
struct TheConfiguration : public raf::ApplicationConfiguration
{
	virtual StringVector getLibraries()
	{ return MakeStringVector() << "scriptingLua"; }
 
	virtual StringVector getScriptingSystems()
	{ return MakeStringVector() << "lua"; }
};
 
/** The mighty application itself! */
class TheApp : public raf::ExampleApplication<TheConfiguration>
{
public:
	TheApp() {}
protected:
	virtual bool onInitialise()
	{
		scripting::IVM* pVM = getScriptingSystem("lua")->createVM();
		pVM->execute("print('Hello from script!')");
		delete pVM;
		return true;
	}
};
 
int main( int argc, char** argv )
{
	return (raf::runApplication( TheApp() )) ? 0 : 1;
}

Sample 2 : Loading configuration settings from a file

 
codesnippets/raf.txt · Last modified: 2008/02/21 21:54 (external edit)
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki