Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
jijinlong edited this page Nov 23, 2016 · 3 revisions

Lang 使用 C++ 定制的扩展

class SceneNpc{
	public:
		int talk(Args *stub,Properties &propies)
		{
			stub->setNumber("index",1000);
			//printf("%s %s\n", "print",propies.getString("value").c_str());
			this->stub = *stub;
			return CodeState::NO;
		}
		void call()
		{
			stub.exec();
		}
	
		SceneNpc()
		{
		
		}
		int a;
};
LANG_SCRIPT(NPCLIB)
{
	BIND_FUNCTION(SceneNpc,talk);
	BIND_FIELD(int,SceneNpc,a);
	BIND_FUNCTION_NAME(SceneNpc,talk,"说话");
}

C++ 调用Lang脚本

 theLang.readFromFile("test.ai");
	 Args args;
	 SceneNpc *npc = new SceneNpc();
	 args.add("o",npc);
 	theLang.exec("start",&args);

Clone this wiki locally

AltStyle によって変換されたページ (->オリジナル) /