Ejemplo n.º 1
0
/* Open function */
TOLUA_API int tolua_tarray_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,1);
 tolua_beginmodule(tolua_S,NULL);
#ifdef __cplusplus
 tolua_cclass(tolua_S,"Point","Point","",tolua_collect_Point);
#else
 tolua_cclass(tolua_S,"Point","Point","",NULL);
#endif
 tolua_beginmodule(tolua_S,"Point");
 tolua_variable(tolua_S,"x",tolua_get_Point_x,tolua_set_Point_x);
 tolua_variable(tolua_S,"y",tolua_get_Point_y,tolua_set_Point_y);
 tolua_endmodule(tolua_S);
 tolua_array(tolua_S,"a",tolua_get_tarray_a,tolua_set_tarray_a);
 tolua_array(tolua_S,"p",tolua_get_tarray_p,NULL);
 tolua_array(tolua_S,"pp",tolua_get_tarray_pp,tolua_set_tarray_pp);
 tolua_module(tolua_S,"M",1);
 tolua_beginmodule(tolua_S,"M");
 tolua_array(tolua_S,"a",tolua_get_tarray_M_ma,tolua_set_tarray_M_ma);
 tolua_array(tolua_S,"p",tolua_get_tarray_M_mp,NULL);
 tolua_array(tolua_S,"pp",tolua_get_tarray_M_mpp,tolua_set_tarray_M_mpp);
 tolua_endmodule(tolua_S);
 tolua_cclass(tolua_S,"Array","Array","",NULL);
 tolua_beginmodule(tolua_S,"Array");
 tolua_array(tolua_S,"a",tolua_get_tarray_Array_a,tolua_set_tarray_Array_a);
 tolua_array(tolua_S,"p",tolua_get_tarray_Array_p,tolua_set_tarray_Array_p);
 tolua_array(tolua_S,"pp",tolua_get_tarray_Array_pp,tolua_set_tarray_Array_pp);
 tolua_endmodule(tolua_S);
 tolua_variable(tolua_S,"array",tolua_get_array,tolua_set_array);
 tolua_variable(tolua_S,"parray",tolua_get_parray_ptr,tolua_set_parray_ptr);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 2
0
/* Open function */
TOLUA_API int tolua_tmodule_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
 tolua_module(tolua_S,"A",1);
 tolua_beginmodule(tolua_S,"A");
 tolua_variable(tolua_S,"a",tolua_get_A_a,tolua_set_A_a);
 tolua_module(tolua_S,"B",1);
 tolua_beginmodule(tolua_S,"B");
 tolua_variable(tolua_S,"b",tolua_get_B_b,tolua_set_B_b);
 tolua_module(tolua_S,"C",1);
 tolua_beginmodule(tolua_S,"C");
 tolua_variable(tolua_S,"c",tolua_get_C_c,tolua_set_C_c);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_module(tolua_S,"A",1);
 tolua_beginmodule(tolua_S,"A");
 tolua_variable(tolua_S,"d",tolua_get_A_d,tolua_set_A_d);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 3
0
//打开baseobject库
int  baseobject_open(lua_State* L)
{
	tolua_open(L);
	baseobject_reg_types(L);
	//tolua_module(L,NULL,0);
	tolua_beginmodule(L,NULL);
	{
		tolua_module(L,"Game",0);
		tolua_beginmodule(L,"Game");
		{
			tolua_cclass(L,"BaseObject","CBaseObject","",collect_baseobject);
			tolua_beginmodule(L,"BaseObject");
			{
				//==类型转换
				tolua_function(L,"change_type",		baseobject_change_type);
				//注册CBaseObject类的函数
				tolua_variable(L,"id",				baseobject_getid,				NULL);
				tolua_variable(L,"type",			baseobject_gettype,				NULL);
				tolua_variable(L,"name",			baseobject_getname,				baseobject_setname);

// 				tolua_function(L,"add_object",				baseobject_add_object);
// 				tolua_function(L,"remove_object",			baseobject_remove_object);
// 				tolua_function(L,"recursive_find_object",	baseobject_recursive_find_object);
			}
			tolua_endmodule(L);
		}
		tolua_endmodule(L);
	}
	tolua_endmodule(L);
	return 1;
}
int register_audioengine_module(lua_State* L)
{
    lua_getglobal(L, "_G");
    if (lua_istable(L,-1))//stack:...,_G,
    {
        register_all_cocos2dx_audioengine(L);
        if (L)
        {
            lua_pushstring(L, "ccexp.AudioProfile");
            lua_rawget(L, LUA_REGISTRYINDEX);
            if (lua_istable(L,-1))
            {
                tolua_variable(L, "name", lua_get_AudioProfile_name, lua_set_AudioProfile_name);
                tolua_variable(L, "maxInstances", lua_get_AudioProfile_maxInstances, lua_set_AudioProfile_maxInstances);
                tolua_variable(L, "minDelay", lua_get_AudioProfile_minDelay, lua_set_AudioProfile_minDelay);
            }
            lua_pop(L, 1);
        
            lua_pushstring(L, "ccexp.AudioEngine");
            lua_rawget(L, LUA_REGISTRYINDEX);
            if (lua_istable(L,-1))
            {
                tolua_function(L, "setFinishCallback", lua_cocos2dx_audioengine_AudioEngine_setFinishCallback);
            }
            lua_pop(L, 1);
        }
    }
    lua_pop(L, 1);
    
    return 1;
}
/* Open function */
TOLUA_API int tolua_DecalScript_open (lua_State* tolua_S)
{
    tolua_open(tolua_S);
    tolua_reg_types(tolua_S);
    tolua_module(tolua_S,NULL,0);
    tolua_beginmodule(tolua_S,NULL);
#ifdef __cplusplus
    tolua_cclass(tolua_S,"ADDDECALSPRITEMESSAGE","ADDDECALSPRITEMESSAGE","",tolua_collect_ADDDECALSPRITEMESSAGE);
#else
    tolua_cclass(tolua_S,"ADDDECALSPRITEMESSAGE","ADDDECALSPRITEMESSAGE","",NULL);
#endif
    tolua_beginmodule(tolua_S,"ADDDECALSPRITEMESSAGE");
    tolua_variable(tolua_S,"m_Size",tolua_get_ADDDECALSPRITEMESSAGE_m_Size,tolua_set_ADDDECALSPRITEMESSAGE_m_Size);
    tolua_variable(tolua_S,"m_Position",tolua_get_ADDDECALSPRITEMESSAGE_m_Position_ptr,tolua_set_ADDDECALSPRITEMESSAGE_m_Position_ptr);
    tolua_variable(tolua_S,"m_Normal",tolua_get_ADDDECALSPRITEMESSAGE_m_Normal_ptr,tolua_set_ADDDECALSPRITEMESSAGE_m_Normal_ptr);
    tolua_variable(tolua_S,"m_TimeLinger",tolua_get_ADDDECALSPRITEMESSAGE_m_TimeLinger,tolua_set_ADDDECALSPRITEMESSAGE_m_TimeLinger);
    tolua_variable(tolua_S,"m_FadeTime",tolua_get_ADDDECALSPRITEMESSAGE_m_FadeTime,tolua_set_ADDDECALSPRITEMESSAGE_m_FadeTime);
    tolua_variable(tolua_S,"m_Color",tolua_get_ADDDECALSPRITEMESSAGE_m_Color,tolua_set_ADDDECALSPRITEMESSAGE_m_Color);
    tolua_variable(tolua_S,"m_Texture",tolua_get_ADDDECALSPRITEMESSAGE_m_Texture_ptr,tolua_set_ADDDECALSPRITEMESSAGE_m_Texture_ptr);
    tolua_variable(tolua_S,"m_Effect",tolua_get_ADDDECALSPRITEMESSAGE_m_Effect_ptr,tolua_set_ADDDECALSPRITEMESSAGE_m_Effect_ptr);
    tolua_variable(tolua_S,"m_hsTextureName",tolua_get_ADDDECALSPRITEMESSAGE_m_hsTextureName_ptr,tolua_set_ADDDECALSPRITEMESSAGE_m_hsTextureName_ptr);
    tolua_function(tolua_S,"new",tolua_DecalScript_ADDDECALSPRITEMESSAGE_new00);
    tolua_function(tolua_S,"new_local",tolua_DecalScript_ADDDECALSPRITEMESSAGE_new00_local);
    tolua_function(tolua_S,".call",tolua_DecalScript_ADDDECALSPRITEMESSAGE_new00_local);
    tolua_function(tolua_S,"delete",tolua_DecalScript_ADDDECALSPRITEMESSAGE_delete00);
    tolua_function(tolua_S,"SIZEOF",tolua_DecalScript_ADDDECALSPRITEMESSAGE_SIZEOF00);
    tolua_endmodule(tolua_S);
    tolua_endmodule(tolua_S);
    return 1;
}
Ejemplo n.º 6
0
/* Open function */
TOLUA_API int tolua_GUID_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  #ifdef __cplusplus
  tolua_cclass(tolua_S,"CGUID","CGUID","",tolua_collect_CGUID);
  #else
  tolua_cclass(tolua_S,"CGUID","CGUID","",NULL);
  #endif
  tolua_beginmodule(tolua_S,"CGUID");
   tolua_function(tolua_S,"new",tolua_GUID_CGUID_new00);
   tolua_function(tolua_S,"new_local",tolua_GUID_CGUID_new00_local);
   tolua_function(tolua_S,".call",tolua_GUID_CGUID_new00_local);
   tolua_function(tolua_S,"delete",tolua_GUID_CGUID_delete00);
   tolua_function(tolua_S,"new",tolua_GUID_CGUID_new01);
   tolua_function(tolua_S,"new_local",tolua_GUID_CGUID_new01_local);
   tolua_function(tolua_S,".call",tolua_GUID_CGUID_new01_local);
   tolua_function(tolua_S,".eq",tolua_GUID_CGUID__eq00);
   tolua_function(tolua_S,"tostring",tolua_GUID_CGUID_tostring00);
   tolua_function(tolua_S,"IsInvalid",tolua_GUID_CGUID_IsInvalid00);
   tolua_function(tolua_S,"CreateGUID",tolua_GUID_CGUID_CreateGUID00);
   tolua_variable(tolua_S,"GUID_INVALID",tolua_get_CGUID_GUID_INVALID,tolua_set_CGUID_GUID_INVALID);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 7
0
/* Open lib function */
LUALIB_API int luaopen_tdirective (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,1);
 tolua_beginmodule(tolua_S,NULL);
 tolua_variable(tolua_S,"a",tolua_get_a,tolua_set_a);
{
 a = 3;
}

 { /* begin embedded lua code */
 static unsigned char B[] = {
  10, 65, 32, 61, 32, 52,32
 };
 luaL_loadbuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code") ||
 lua_pcall(tolua_S,0,LUA_MULTRET,0);
 } /* end of embedded lua code */


 { /* begin embedded lua code */
 static unsigned char B[] = {
  10,100,111,102,105,108,101, 40, 34,109,121, 97,115,115,101,
 114,116, 46,108,117, 97, 34, 41, 10,102,117,110, 99,116,105,
 111,110, 32,102,117,110, 99, 32, 40, 41, 10,114,101,116,117,
 114,110, 32, 53, 10,101,110,100,32
 };
 luaL_loadbuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code") ||
 lua_pcall(tolua_S,0,LUA_MULTRET,0);
 } /* end of embedded lua code */

 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 8
0
/* Open function */
TOLUA_API int tolua_tdirective_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,1);
 tolua_beginmodule(tolua_S,NULL);
 tolua_variable(tolua_S,"a",tolua_get_a,tolua_set_a);
{
 a = 3;
}

 { /* begin embedded lua code */
 static unsigned char B[] = {
  10, 65, 32, 61, 32, 52,32
 };
 lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
 } /* end of embedded lua code */


 { /* begin embedded lua code */
 static unsigned char B[] = {
  10,102,117,110, 99,116,105,111,110, 32,102,117,110, 99, 32,
  40, 41, 10,114,101,116,117,114,110, 32, 53, 10,101,110,100,
 32
 };
 lua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code");
 } /* end of embedded lua code */

 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 9
0
/* Open function */
TOLUA_API int tolua_tvariable_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,1);
 tolua_beginmodule(tolua_S,NULL);
  tolua_variable(tolua_S,"i",tolua_get_i,tolua_set_i);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 10
0
/* Open lib function */
LUALIB_API int luaopen_tnamespace (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
 tolua_module(tolua_S,"A",1);
 tolua_beginmodule(tolua_S,"A");
 tolua_variable(tolua_S,"a",tolua_get_A_a,tolua_set_A_a);
 tolua_module(tolua_S,"B",1);
 tolua_beginmodule(tolua_S,"B");
 tolua_variable(tolua_S,"b",tolua_get_B_b,tolua_set_B_b);
 tolua_module(tolua_S,"C",1);
 tolua_beginmodule(tolua_S,"C");
 tolua_variable(tolua_S,"c",tolua_get_C_c,tolua_set_C_c);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
/* Open function */
TOLUA_API int tolua_FadeUtility_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
 #ifdef __cplusplus
 tolua_cclass(tolua_S,"FADEUTILITYPARAMS","FADEUTILITYPARAMS","",tolua_collect_FADEUTILITYPARAMS);
 #else
 tolua_cclass(tolua_S,"FADEUTILITYPARAMS","FADEUTILITYPARAMS","",NULL);
 #endif
 tolua_beginmodule(tolua_S,"FADEUTILITYPARAMS");
  tolua_variable(tolua_S,"ObjectName",tolua_get_FADEUTILITYPARAMS_ObjectName_ptr,tolua_set_FADEUTILITYPARAMS_ObjectName_ptr);
  tolua_variable(tolua_S,"CallbackEvent",tolua_get_FADEUTILITYPARAMS_CallbackEvent_ptr,tolua_set_FADEUTILITYPARAMS_CallbackEvent_ptr);
  tolua_variable(tolua_S,"FadeTime",tolua_get_FADEUTILITYPARAMS_FadeTime,tolua_set_FADEUTILITYPARAMS_FadeTime);
  tolua_variable(tolua_S,"StartFadeAmount",tolua_get_FADEUTILITYPARAMS_StartFadeAmount,tolua_set_FADEUTILITYPARAMS_StartFadeAmount);
  tolua_variable(tolua_S,"EndFadeAmount",tolua_get_FADEUTILITYPARAMS_EndFadeAmount,tolua_set_FADEUTILITYPARAMS_EndFadeAmount);
  tolua_variable(tolua_S,"bClearOverride",tolua_get_FADEUTILITYPARAMS_bClearOverride,tolua_set_FADEUTILITYPARAMS_bClearOverride);
  tolua_function(tolua_S,"new",tolua_FadeUtility_FADEUTILITYPARAMS_new00);
  tolua_function(tolua_S,"new_local",tolua_FadeUtility_FADEUTILITYPARAMS_new00_local);
  tolua_function(tolua_S,".call",tolua_FadeUtility_FADEUTILITYPARAMS_new00_local);
  tolua_function(tolua_S,"delete",tolua_FadeUtility_FADEUTILITYPARAMS_delete00);
  tolua_function(tolua_S,"SIZEOF",tolua_FadeUtility_FADEUTILITYPARAMS_SIZEOF00);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 12
0
void tolua_building_open(lua_State * L)
{
  /* register user types */
  tolua_usertype(L, TOLUA_CAST "building");

  tolua_module(L, NULL, 0);
  tolua_beginmodule(L, NULL);
  {
    tolua_cclass(L, TOLUA_CAST "building", TOLUA_CAST "building", TOLUA_CAST "",
      NULL);
    tolua_beginmodule(L, TOLUA_CAST "building");
    {
      tolua_function(L, TOLUA_CAST "create", tolua_building_create);
      tolua_function(L, TOLUA_CAST "destroy", tolua_building_destroy);
      tolua_function(L, TOLUA_CAST "__tostring", tolua_building_tostring);

      tolua_variable(L, TOLUA_CAST "id", tolua_building_get_id, NULL);
      tolua_variable(L, TOLUA_CAST "owner", tolua_building_get_owner,
        tolua_building_set_owner);
      tolua_variable(L, TOLUA_CAST "type", tolua_building_get_type, NULL);
      tolua_variable(L, TOLUA_CAST "name", tolua_building_get_name,
        tolua_building_set_name);
      tolua_variable(L, TOLUA_CAST "info", tolua_building_get_info,
        tolua_building_set_info);
      tolua_variable(L, TOLUA_CAST "units", tolua_building_get_units, NULL);
      tolua_variable(L, TOLUA_CAST "region", tolua_building_get_region,
        tolua_building_set_region);
      tolua_variable(L, TOLUA_CAST "size", tolua_building_get_size,
        tolua_building_set_size);
      tolua_function(L, TOLUA_CAST "get_typename", tolua_building_get_typename);
#ifdef TODO
      .property("type", &building_gettype)
        .def_readwrite("size", &building::size)
#endif
      tolua_variable(L, TOLUA_CAST "objects", tolua_building_get_objects, 0);
      tolua_variable(L, TOLUA_CAST "working", tolua_building_get_working, tolua_building_set_working);

    }
    tolua_endmodule(L);
  }
Ejemplo n.º 13
0
void tolua_ship_open(lua_State * L)
{
    /* register user types */
    tolua_usertype(L, TOLUA_CAST "ship");

    tolua_module(L, NULL, 0);
    tolua_beginmodule(L, NULL);
    {
        tolua_cclass(L, TOLUA_CAST "ship", TOLUA_CAST "ship", TOLUA_CAST "", NULL);
        tolua_beginmodule(L, TOLUA_CAST "ship");
        {
            tolua_function(L, TOLUA_CAST "__tostring", tolua_ship_tostring);
            tolua_variable(L, TOLUA_CAST "id", tolua_ship_get_id, NULL);
            tolua_variable(L, TOLUA_CAST "name", tolua_ship_get_name,
                tolua_ship_set_name);
            tolua_variable(L, TOLUA_CAST "info", tolua_ship_get_display,
                tolua_ship_set_display);
            tolua_variable(L, TOLUA_CAST "units", tolua_ship_get_units, NULL);
            tolua_variable(L, TOLUA_CAST "flags", &tolua_ship_get_flags,
                tolua_ship_set_flags);
            tolua_variable(L, TOLUA_CAST "region", tolua_ship_get_region,
                tolua_ship_set_region);
            tolua_variable(L, TOLUA_CAST "coast", tolua_ship_get_coast,
                tolua_ship_set_coast);
            tolua_variable(L, TOLUA_CAST "type", tolua_ship_get_type, 0);
#ifdef TODO
            .property("weight", &ship_getweight)
                .property("capacity", &ship_getcapacity)
                .property("maxsize", &ship_maxsize)
                .def_readwrite("damage", &ship::damage)
                .def_readwrite("size", &ship::size)
#endif
                tolua_variable(L, TOLUA_CAST "objects", tolua_ship_get_objects, 0);

            tolua_function(L, TOLUA_CAST "create", tolua_ship_create);
        }
        tolua_endmodule(L);
    }
Ejemplo n.º 14
0
/* Open function */
TOLUA_API int tolua_PlayerControl_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  tolua_module(tolua_S,"PH",0);
  tolua_beginmodule(tolua_S,"PH");
   tolua_cclass(tolua_S,"PlayerControl","PH::PlayerControl","IObject",NULL);
   tolua_beginmodule(tolua_S,"PlayerControl");
    tolua_function(tolua_S,"getHealth",tolua_PlayerControl_PH_PlayerControl_getHealth00);
    tolua_function(tolua_S,"getMaxHealth",tolua_PlayerControl_PH_PlayerControl_getMaxHealth00);
    tolua_variable(tolua_S,"__CCObject__",tolua_get_PH__PlayerControl___CCObject__,NULL);
   tolua_endmodule(tolua_S);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 15
0
/* Open function */
TOLUA_API int tolua_AIObjectScript_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
 #ifdef __cplusplus
 tolua_cclass(tolua_S,"COMMANDSEQUENCEPARAMS","COMMANDSEQUENCEPARAMS","",tolua_collect_COMMANDSEQUENCEPARAMS);
 #else
 tolua_cclass(tolua_S,"COMMANDSEQUENCEPARAMS","COMMANDSEQUENCEPARAMS","",NULL);
 #endif
 tolua_beginmodule(tolua_S,"COMMANDSEQUENCEPARAMS");
  tolua_variable(tolua_S,"targetName",tolua_get_COMMANDSEQUENCEPARAMS_targetName_ptr,tolua_set_COMMANDSEQUENCEPARAMS_targetName_ptr);
  tolua_function(tolua_S,"new",tolua_AIObjectScript_COMMANDSEQUENCEPARAMS_new00);
  tolua_function(tolua_S,"new_local",tolua_AIObjectScript_COMMANDSEQUENCEPARAMS_new00_local);
  tolua_function(tolua_S,".call",tolua_AIObjectScript_COMMANDSEQUENCEPARAMS_new00_local);
  tolua_function(tolua_S,"delete",tolua_AIObjectScript_COMMANDSEQUENCEPARAMS_delete00);
  tolua_function(tolua_S,"SIZEOF",tolua_AIObjectScript_COMMANDSEQUENCEPARAMS_SIZEOF00);
 tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 16
0
void ScriptManager::registerVariable(const Common::UString &name, lua_CFunction getter, lua_CFunction setter) {
	assert(!name.empty() && getter);
	assert(_luaState && _regNestingLevel > 0);

	tolua_variable(_luaState, name.c_str(), getter, setter);
}
Ejemplo n.º 17
0
/* Open function */
TOLUA_API int tolua_common_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  tolua_constant(tolua_S,"DENSITY_LDPI",DENSITY_LDPI);
  tolua_constant(tolua_S,"DENSITY_MDPI",DENSITY_MDPI);
  tolua_constant(tolua_S,"DENSITY_HDPI",DENSITY_HDPI);
  tolua_constant(tolua_S,"SCALE_MODE_BY_DENSITY",SCALE_MODE_BY_DENSITY);
  tolua_constant(tolua_S,"SCALE_MODE_BASE_SIZE_FIT_XY",SCALE_MODE_BASE_SIZE_FIT_XY);
  tolua_cclass(tolua_S,"wyDevice","wyDevice","",NULL);
  tolua_beginmodule(tolua_S,"wyDevice");
   tolua_variable(tolua_S,"scaleMode",tolua_get_wyDevice_scaleMode,tolua_set_wyDevice_scaleMode);
   tolua_variable(tolua_S,"density",tolua_get_wyDevice_density,tolua_set_wyDevice_density);
   tolua_variable(tolua_S,"scaledDensity",tolua_get_wyDevice_scaledDensity,tolua_set_wyDevice_scaledDensity);
   tolua_variable(tolua_S,"defaultInDensity",tolua_get_wyDevice_defaultInDensity,tolua_set_wyDevice_defaultInDensity);
   tolua_variable(tolua_S,"apiLevel",tolua_get_wyDevice_apiLevel,tolua_set_wyDevice_apiLevel);
   tolua_variable(tolua_S,"maxTextureSize",tolua_get_wyDevice_maxTextureSize,tolua_set_wyDevice_maxTextureSize);
   tolua_variable(tolua_S,"baseWidth",tolua_get_wyDevice_baseWidth,tolua_set_wyDevice_baseWidth);
   tolua_variable(tolua_S,"baseHeight",tolua_get_wyDevice_baseHeight,tolua_set_wyDevice_baseHeight);
   tolua_variable(tolua_S,"baseScaleX",tolua_get_wyDevice_baseScaleX,tolua_set_wyDevice_baseScaleX);
   tolua_variable(tolua_S,"baseScaleY",tolua_get_wyDevice_baseScaleY,tolua_set_wyDevice_baseScaleY);
   tolua_variable(tolua_S,"winWidth",tolua_get_wyDevice_winWidth,tolua_set_wyDevice_winWidth);
   tolua_variable(tolua_S,"winHeight",tolua_get_wyDevice_winHeight,tolua_set_wyDevice_winHeight);
   tolua_variable(tolua_S,"realWidth",tolua_get_wyDevice_realWidth,tolua_set_wyDevice_realWidth);
   tolua_variable(tolua_S,"realHeight",tolua_get_wyDevice_realHeight,tolua_set_wyDevice_realHeight);
   tolua_function(tolua_S,"getLanguage",tolua_common_wyDevice_getLanguage00);
   tolua_function(tolua_S,"getCountry",tolua_common_wyDevice_getCountry00);
   tolua_function(tolua_S,"getDeviceId",tolua_common_wyDevice_getDeviceId00);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 18
0
/* Open function */
TOLUA_API int tolua_bindings_open (lua_State* tolua_S)
{
 tolua_open(tolua_S);
 tolua_reg_types(tolua_S);
 tolua_module(tolua_S,NULL,0);
 tolua_beginmodule(tolua_S,NULL);
  tolua_module(tolua_S,"atlantis",1);
  tolua_beginmodule(tolua_S,"atlantis");
   tolua_cclass(tolua_S,"unit","unit","",NULL);
   tolua_beginmodule(tolua_S,"unit");
    tolua_variable(tolua_S,"id",tolua_get_unit_id,tolua_set_unit_id);
    tolua_variable(tolua_S,"number",tolua_get_unit_number,tolua_set_unit_number);
    tolua_variable(tolua_S,"money",tolua_get_unit_money,tolua_set_unit_money);
    tolua_variable(tolua_S,"faction",tolua_get_unit_faction_ptr,NULL);
    tolua_variable(tolua_S,"region",tolua_get_unit_region_ptr,NULL);
    tolua_variable(tolua_S,"name",tolua_get_unit_name,tolua_set_unit_name);
   tolua_endmodule(tolua_S);
   tolua_cclass(tolua_S,"faction","faction","",NULL);
   tolua_beginmodule(tolua_S,"faction");
    tolua_variable(tolua_S,"id",tolua_get_faction_id,tolua_set_faction_id);
    tolua_variable(tolua_S,"name",tolua_get_faction_name,tolua_set_faction_name);
    tolua_variable(tolua_S,"email",tolua_get_faction_email,tolua_set_faction_email);
   tolua_endmodule(tolua_S);
   tolua_cclass(tolua_S,"region","region","",NULL);
   tolua_beginmodule(tolua_S,"region");
    tolua_variable(tolua_S,"id",tolua_get_region_id,tolua_set_region_id);
    tolua_variable(tolua_S,"x",tolua_get_region_x,tolua_set_region_x);
    tolua_variable(tolua_S,"y",tolua_get_region_y,tolua_set_region_y);
    tolua_variable(tolua_S,"peasants",tolua_get_region_peasants,tolua_set_region_peasants);
    tolua_variable(tolua_S,"money",tolua_get_region_money,tolua_set_region_money);
    tolua_variable(tolua_S,"name",tolua_get_region_name,tolua_set_region_name);
    tolua_variable(tolua_S,"terrain",tolua_get_region_terrain,tolua_set_region_terrain);
   tolua_endmodule(tolua_S);
   tolua_module(tolua_S,"regions",0);
   tolua_beginmodule(tolua_S,"regions");
    tolua_function(tolua_S,"create",tolua_bindings_atlantis_regions_create00);
    tolua_function(tolua_S,"get",tolua_bindings_atlantis_regions_get00);
   tolua_endmodule(tolua_S);
   tolua_module(tolua_S,"factions",0);
   tolua_beginmodule(tolua_S,"factions");
    tolua_function(tolua_S,"create",tolua_bindings_atlantis_factions_create00);
    tolua_function(tolua_S,"get",tolua_bindings_atlantis_factions_get00);
   tolua_endmodule(tolua_S);
   tolua_variable(tolua_S,"turn",tolua_get_atlantis_turn,tolua_set_atlantis_turn);
   tolua_function(tolua_S,"free_game",tolua_bindings_atlantis_free_game00);
   tolua_function(tolua_S,"read_config",tolua_bindings_atlantis_read_config00);
   tolua_function(tolua_S,"read_game",tolua_bindings_atlantis_read_game00);
   tolua_function(tolua_S,"write_game",tolua_bindings_atlantis_write_game00);
   tolua_function(tolua_S,"write_reports",tolua_bindings_atlantis_write_reports00);
   tolua_function(tolua_S,"read_orders",tolua_bindings_atlantis_read_orders00);
   tolua_function(tolua_S,"process",tolua_bindings_atlantis_process00);
  tolua_endmodule(tolua_S);
 tolua_endmodule(tolua_S);
 return 1;
}
Ejemplo n.º 19
0
int tolua_ftk_structs_init(lua_State* L)
{
	tolua_open(L);
	tolua_reg_types(L);
	tolua_module(L, NULL, 0);
	tolua_beginmodule(L, NULL);

	tolua_cclass(L, "FtkEvent", "FtkEvent", "", NULL);
	tolua_beginmodule(L, "FtkEvent");
	tolua_function(L, "Create", lua_ftk_event_create);
	tolua_variable(L, "type",tolua_get_FtkEvent_type, tolua_set_FtkEvent_type);
	tolua_variable(L, "widget",tolua_get_FtkEvent_widget, tolua_set_FtkEvent_widget);
	tolua_variable(L, "time",tolua_get_FtkEvent_time, tolua_set_FtkEvent_time);
	tolua_variable(L, "u_key_code",tolua_get_FtkEvent_u_key_code, tolua_set_FtkEvent_u_key_code);
	tolua_variable(L, "u_mouse_press",tolua_get_FtkEvent_u_mouse_press, tolua_set_FtkEvent_u_mouse_press);
	tolua_variable(L, "u_mouse_button",tolua_get_FtkEvent_u_mouse_button, tolua_set_FtkEvent_u_mouse_button);
	tolua_variable(L, "u_mouse_x",tolua_get_FtkEvent_u_mouse_x, tolua_set_FtkEvent_u_mouse_x);
	tolua_variable(L, "u_mouse_y",tolua_get_FtkEvent_u_mouse_y, tolua_set_FtkEvent_u_mouse_y);
	tolua_endmodule(L);
	
	tolua_cclass(L, "FtkGc", "FtkGc", "", NULL);
	tolua_beginmodule(L, "FtkGc");
	tolua_function(L, "Create", lua_ftk_gc_create);
	tolua_variable(L, "ref",tolua_get_FtkGc_ref, tolua_set_FtkGc_ref);
	tolua_variable(L, "mask",tolua_get_FtkGc_mask, tolua_set_FtkGc_mask);
	tolua_variable(L, "bg",tolua_get_FtkGc_bg, tolua_set_FtkGc_bg);
	tolua_variable(L, "fg",tolua_get_FtkGc_fg, tolua_set_FtkGc_fg);
	tolua_variable(L, "font",tolua_get_FtkGc_font, tolua_set_FtkGc_font);
	tolua_variable(L, "bitmap",tolua_get_FtkGc_bitmap, tolua_set_FtkGc_bitmap);
	tolua_variable(L, "alpha",tolua_get_FtkGc_alpha, tolua_set_FtkGc_alpha);
	tolua_variable(L, "line_mask",tolua_get_FtkGc_line_mask, tolua_set_FtkGc_line_mask);
	tolua_endmodule(L);
	
	tolua_endmodule(L);

	return 1;
}
Ejemplo n.º 20
0
void tolua_region_open(lua_State * L)
{
    /* register user types */
    tolua_usertype(L, TOLUA_CAST "region");
    tolua_usertype(L, TOLUA_CAST "plane");

    tolua_module(L, NULL, 0);
    tolua_beginmodule(L, NULL);
    {
        tolua_function(L, TOLUA_CAST "distance", tolua_distance);

        tolua_cclass(L, TOLUA_CAST "region", TOLUA_CAST "region", TOLUA_CAST "",
            NULL);
        tolua_beginmodule(L, TOLUA_CAST "region");
        {
            tolua_function(L, TOLUA_CAST "create", tolua_region_create);
            tolua_function(L, TOLUA_CAST "destroy", tolua_region_destroy);
            tolua_function(L, TOLUA_CAST "__tostring", tolua_region_tostring);

            /* flags */
            tolua_variable(L, TOLUA_CAST "blocked", tolua_region_get_blocked, tolua_region_set_blocked);

            tolua_variable(L, TOLUA_CAST "id", tolua_region_get_id, NULL);
            tolua_variable(L, TOLUA_CAST "x", tolua_region_get_x, NULL);
            tolua_variable(L, TOLUA_CAST "y", tolua_region_get_y, NULL);
            tolua_variable(L, TOLUA_CAST "plane", tolua_region_get_plane, NULL);
            tolua_variable(L, TOLUA_CAST "name", tolua_region_get_name,
                tolua_region_set_name);
            tolua_variable(L, TOLUA_CAST "morale", tolua_region_get_morale,
                tolua_region_set_morale);
            tolua_variable(L, TOLUA_CAST "is_mourning", tolua_region_get_is_mourning, NULL);
            tolua_variable(L, TOLUA_CAST "info", tolua_region_get_info,
                tolua_region_set_info);
            tolua_variable(L, TOLUA_CAST "units", tolua_region_get_units, NULL);
            tolua_variable(L, TOLUA_CAST "ships", tolua_region_get_ships, NULL);
            tolua_variable(L, TOLUA_CAST "age", tolua_region_get_age, NULL);
            tolua_variable(L, TOLUA_CAST "buildings", tolua_region_get_buildings,
                NULL);
            tolua_variable(L, TOLUA_CAST "terrain", tolua_region_get_terrain,
                tolua_region_set_terrain);
            tolua_function(L, TOLUA_CAST "get_resourcelevel",
                tolua_region_get_resourcelevel);
            tolua_function(L, TOLUA_CAST "get_resource", tolua_region_get_resource);
            tolua_function(L, TOLUA_CAST "set_resource", tolua_region_set_resource);
            tolua_function(L, TOLUA_CAST "get_flag", tolua_region_get_flag);
            tolua_function(L, TOLUA_CAST "set_flag", tolua_region_set_flag);
            tolua_function(L, TOLUA_CAST "next", tolua_region_get_next);
            tolua_variable(L, TOLUA_CAST "adj", tolua_region_get_adj, NULL);

            tolua_variable(L, TOLUA_CAST "luxury", &tolua_region_get_luxury,
                &tolua_region_set_luxury);
            tolua_variable(L, TOLUA_CAST "herb", &tolua_region_get_herb,
                &tolua_region_set_herb);

            tolua_variable(L, TOLUA_CAST "terrain_name",
                &tolua_region_get_terrainname, &tolua_region_set_terrainname);
            tolua_variable(L, TOLUA_CAST "owner", &tolua_region_get_owner,
                &tolua_region_set_owner);

            tolua_function(L, TOLUA_CAST "get_key", tolua_region_getkey);
            tolua_function(L, TOLUA_CAST "set_key", tolua_region_setkey);

            tolua_variable(L, TOLUA_CAST "objects", tolua_region_get_objects, 0);
        }
        tolua_endmodule(L);

        tolua_cclass(L, TOLUA_CAST "plane", TOLUA_CAST "plane", TOLUA_CAST "",
            NULL);
        tolua_beginmodule(L, TOLUA_CAST "plane");
        {
            tolua_function(L, TOLUA_CAST "create", tolua_plane_create);
            tolua_function(L, TOLUA_CAST "get", tolua_plane_get);
            tolua_function(L, TOLUA_CAST "__tostring", tolua_plane_tostring);

            tolua_function(L, TOLUA_CAST "size", tolua_plane_get_size);
            tolua_variable(L, TOLUA_CAST "id", tolua_plane_get_id, NULL);
            tolua_function(L, TOLUA_CAST "normalize", tolua_plane_normalize);
            tolua_variable(L, TOLUA_CAST "name", tolua_plane_get_name,
                tolua_plane_set_name);
        }
        tolua_endmodule(L);
    }
    tolua_endmodule(L);
}
Ejemplo n.º 21
0
void tolua_faction_open(lua_State * L)
{
    /* register user types */
    tolua_usertype(L, TOLUA_CAST "faction");
    tolua_usertype(L, TOLUA_CAST "faction_list");

    tolua_module(L, NULL, 0);
    tolua_beginmodule(L, NULL);
    {
        tolua_function(L, TOLUA_CAST "get_faction", tolua_faction_get);
        tolua_beginmodule(L, TOLUA_CAST "eressea");
        tolua_function(L, TOLUA_CAST "faction", tolua_faction_get);
        tolua_endmodule(L);
        tolua_cclass(L, TOLUA_CAST "faction", TOLUA_CAST "faction", TOLUA_CAST "",
            NULL);
        tolua_beginmodule(L, TOLUA_CAST "faction");
        {
            tolua_function(L, TOLUA_CAST "__tostring", tolua_faction_tostring);

            tolua_variable(L, TOLUA_CAST "id", tolua_faction_get_id,
                tolua_faction_set_id);
            tolua_variable(L, TOLUA_CAST "uid", &tolua_faction_get_uid,
                &tolua_faction_set_uid);
            tolua_variable(L, TOLUA_CAST "name", &tolua_faction_get_name,
                &tolua_faction_set_name);
            tolua_variable(L, TOLUA_CAST "info", &tolua_faction_get_info,
                &tolua_faction_set_info);
            tolua_variable(L, TOLUA_CAST "units", tolua_faction_get_units, NULL);
            tolua_variable(L, TOLUA_CAST "heroes", tolua_faction_get_heroes, NULL);
#ifdef TODO
            tolua_variable(L, TOLUA_CAST "spells", tolua_faction_get_spells, 0);
#endif
            tolua_variable(L, TOLUA_CAST "maxheroes", tolua_faction_get_maxheroes,
                NULL);
            tolua_variable(L, TOLUA_CAST "password", tolua_faction_get_password,
                tolua_faction_set_password);
            tolua_variable(L, TOLUA_CAST "email", tolua_faction_get_email,
                tolua_faction_set_email);
            tolua_variable(L, TOLUA_CAST "locale", tolua_faction_get_locale,
                tolua_faction_set_locale);
            tolua_variable(L, TOLUA_CAST "race", tolua_faction_get_race,
                tolua_faction_set_race);
            tolua_variable(L, TOLUA_CAST "alliance", tolua_faction_get_alliance,
                tolua_faction_set_alliance);
            tolua_variable(L, TOLUA_CAST "score", tolua_faction_get_score, NULL);
            tolua_variable(L, TOLUA_CAST "magic", &tolua_faction_get_magic,
                tolua_faction_set_magic);
            tolua_variable(L, TOLUA_CAST "age", tolua_faction_get_age,
                tolua_faction_set_age);
            tolua_variable(L, TOLUA_CAST "options", tolua_faction_get_options,
                tolua_faction_set_options);
            tolua_variable(L, TOLUA_CAST "flags", tolua_faction_get_flags, tolua_faction_set_flags);
            tolua_variable(L, TOLUA_CAST "lastturn", tolua_faction_get_lastturn,
                tolua_faction_set_lastturn);

            tolua_function(L, TOLUA_CAST "set_policy", &tolua_faction_set_policy);
            tolua_function(L, TOLUA_CAST "get_policy", &tolua_faction_get_policy);
            tolua_function(L, TOLUA_CAST "get_origin", &tolua_faction_get_origin);
            tolua_function(L, TOLUA_CAST "set_origin", &tolua_faction_set_origin);
            tolua_function(L, TOLUA_CAST "normalize", &tolua_faction_normalize);

            tolua_function(L, TOLUA_CAST "add_item", tolua_faction_add_item);
            tolua_variable(L, TOLUA_CAST "items", tolua_faction_get_items, NULL);

            tolua_function(L, TOLUA_CAST "renumber", tolua_faction_renumber);
            tolua_function(L, TOLUA_CAST "create", tolua_faction_create);
            tolua_function(L, TOLUA_CAST "get", tolua_faction_get);
            tolua_function(L, TOLUA_CAST "destroy", tolua_faction_destroy);
            tolua_function(L, TOLUA_CAST "add_notice", &tolua_faction_addnotice);

            tolua_variable(L, TOLUA_CAST "objects", tolua_faction_get_objects,
                NULL);
        }
        tolua_endmodule(L);
    }
    tolua_endmodule(L);
}