コード例 #1
0
ファイル: Font.cpp プロジェクト: DomDumont/trp
void RegisterFont()
{
    int r;

	if (strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY") == 0)
	{
		///class:Font
		r = ScriptManager::Get().engine->RegisterObjectType("Font", 0, asOBJ_REF);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font",
			asBEHAVE_FACTORY, "Font@ f()", asFUNCTION(Font_Factory), asCALL_CDECL);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font", asBEHAVE_ADDREF,
			"void f()", asMETHOD(Font, AddRef), asCALL_THISCALL);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font",
			asBEHAVE_RELEASE, "void f()", asMETHOD(Font, Release), asCALL_THISCALL);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectMethod("Font",
			"void Load(string &in _name,int _size,int _flags=13)", asMETHOD(Font, Load), asCALL_THISCALL);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectMethod("Font",
			"void UnLoad()", asMETHOD(Font, UnLoad), asCALL_THISCALL);
		SDL_assert(r >= 0);
	}
	else
	{
		r = ScriptManager::Get().engine->RegisterObjectType("Font", 0, asOBJ_REF);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font",
			asBEHAVE_FACTORY, "Font@ f()", WRAP_FN(Font_Factory), asCALL_GENERIC);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font", asBEHAVE_ADDREF,
			"void f()", WRAP_MFN(Font, AddRef), asCALL_GENERIC);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectBehaviour("Font",
			asBEHAVE_RELEASE, "void f()", WRAP_MFN(Font, Release), asCALL_GENERIC);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectMethod("Font",
			"void Load(string &in _name,int _size,int _flags=13)", WRAP_MFN(Font, Load), asCALL_GENERIC);
		SDL_assert(r >= 0);

		r = ScriptManager::Get().engine->RegisterObjectMethod("Font",
			"void UnLoad()", WRAP_MFN(Font, UnLoad), asCALL_GENERIC);
		SDL_assert(r >= 0);
	}

}
コード例 #2
0
ファイル: script_gui.cpp プロジェクト: devnexen/stk-code
        void registerScriptFunctions(asIScriptEngine *engine)
        {
            engine->SetDefaultNamespace("GUI");
            
            bool mp = strstr(asGetLibraryOptions(), "AS_MAX_PORTABILITY");
            asDWORD call_conv = mp ? asCALL_GENERIC : asCALL_CDECL;
            int r; // of type asERetCodes
            
            r = engine->RegisterGlobalFunction("void displayModalMessage(const string &in)", 
                                               mp ? WRAP_FN(displayModalMessage) : asFUNCTION(displayModalMessage), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("void displayOverlayMessage(const string &in)", 
                                               mp ? WRAP_FN(displayOverlayMessage) : asFUNCTION(displayOverlayMessage), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("void clearOverlayMessages()", 
                                               mp ? WRAP_FN(clearOverlayMessages) : asFUNCTION(clearOverlayMessages), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("string getKeyBinding(int input)", 
                                               mp ? WRAP_FN(getKeyBinding) : asFUNCTION(getKeyBinding), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("string translate(const string &in)", 
                                               mp ? WRAP_FN(proxy_translate) : asFUNCTION(proxy_translate), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("string translate(const string &in, const string &in)", 
                                               mp ? WRAP_FN(proxy_translateAndInsertValues1) 
                                                  : asFUNCTION(proxy_translateAndInsertValues1), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("string translate(const string &in, const string &in, const string &in)", 
                                               mp ? WRAP_FN(proxy_translateAndInsertValues2) 
                                                  : asFUNCTION(proxy_translateAndInsertValues2), 
                                               call_conv); assert(r >= 0);
                                               
            r = engine->RegisterGlobalFunction("string translate(const string &in, const string &in, const string &in, const string &in)", 
                                               mp ? WRAP_FN(proxy_translateAndInsertValues3) 
                                                  : asFUNCTION(proxy_translateAndInsertValues3), 
                                               call_conv); assert(r >= 0);

        }
コード例 #3
0
ファイル: View.cpp プロジェクト: galexcode/ParabolaEngine
PARABOLA_NAMESPACE_BEGIN

bool registerView(ASEngine* engine)
{
	engine->getASEngine()->RegisterObjectType("View", sizeof(View), asOBJ_REF);

	if(engine->getPortableMode())
	{
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_FACTORY, "View@ f()", WRAP_FN(genericFactory<View>), asCALL_GENERIC);
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_ADDREF, "void f()", WRAP_MFN(View, addReference), asCALL_GENERIC);
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_RELEASE, "void f()", WRAP_MFN(View, removeReference), asCALL_GENERIC);

		engine->getASEngine()->RegisterObjectMethod("View", "void setRect(float,float,float,float)", WRAP_MFN(View, setRect), asCALL_GENERIC);

		engine->getASEngine()->RegisterObjectMethod("Renderer", "void pushView(View@)", WRAP_MFN(Renderer, pushView), asCALL_GENERIC);
		engine->getASEngine()->RegisterObjectMethod("Renderer", "void popView()", WRAP_MFN(Renderer, popView), asCALL_GENERIC);

		engine->getASEngine()->RegisterObjectMethod("Window", "Vec2f convertCoords(const Vec2i& in, const View@)", WRAP_MFN(Window, convertCoords), asCALL_GENERIC);
		engine->getASEngine()->RegisterObjectMethod("Window", "Vec2i getSize()", WRAP_MFN(Window, getSize), asCALL_GENERIC);



	}
	else
	{
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_FACTORY, "View@ f()", asFUNCTION(genericFactory<View>), asCALL_CDECL);
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_ADDREF, "void f()", asMETHOD(View, addReference), asCALL_THISCALL);
		engine->getASEngine()->RegisterObjectBehaviour("View", asBEHAVE_RELEASE, "void f()", asMETHOD(View, removeReference), asCALL_THISCALL);

		engine->getASEngine()->RegisterObjectMethod("View", "void setRect(float,float,float,float)", asMETHOD(View, setRect), asCALL_THISCALL);

		engine->getASEngine()->RegisterObjectMethod("Renderer", "void pushView(View@)", asMETHOD(Renderer, pushView), asCALL_THISCALL);
		engine->getASEngine()->RegisterObjectMethod("Renderer", "void popView()", asMETHOD(Renderer, popView), asCALL_THISCALL);

		engine->getASEngine()->RegisterObjectMethod("Window", "Vec2f convertCoords(const Vec2i& in, const View@)", asMETHOD(Window, convertCoords), asCALL_THISCALL);
		engine->getASEngine()->RegisterObjectMethod("Window", "Vec2i getSize()", asMETHOD(Window, getSize), asCALL_THISCALL);

	}
	return true;

};