Пример #1
0
	object GetFeaturesAt(lua_State* L, const float3& pos, float radius)
	{
		vector<CFeature*> ft = qf->GetFeaturesExact (pos, radius);
	
		object o = newtable(L);

		int count = 1;
		for (int a=0;a<ft.size();a++)
		{
			CFeature *f = ft[a];
			o[count++] = new CObject_pointer<CFeature>(f);
		}

		return o;
	}
void Shape_GetCenter(avm *vm)
{
    word w;
    long off = newtable(vm, ZEN_INITIALTABLESIZE);
    long tindex = TOTinsert(vm, off);
    ctable* tbl = (ctable*)getdata(vm->hp.heap, off);
    word index, source;
    sets(&index, newstring(vm, "X"));
    setf(&source, sfShape_GetCenterX(getint(vm, 0)));
    IA(vm, tbl, tindex, &index, &source);
    sets(&index, newstring(vm, "Y"));
    setf(&source, sfShape_GetCenterY(getint(vm, 0)));
    IA(vm, tbl, tindex, &index, &source);
    sett(&w, tindex);
    returnv(vm, &w);
}
Пример #3
0
    LUABIND_API object get_class_names(lua_State* L)
    {
        detail::class_registry* reg = detail::class_registry::get_registry(L);

        std::map<type_id, detail::class_rep*> const& classes = reg->get_classes();

        object result = newtable(L);
        std::size_t index = 1;

        for (std::map<type_id, detail::class_rep*>::const_iterator iter = classes.begin();
            iter != classes.end(); ++iter)
        {
            result[index++] = iter->second->name();
        }

        return result;
    }
void Shape_GetPointPosition(avm *vm)
{
    float X, Y;
    sfShape_GetPointPosition(getint(vm, 0), getint(vm, 1), &X, &Y);
    word w;
    long off = newtable(vm, ZEN_INITIALTABLESIZE);
    long tindex = TOTinsert(vm, off);
    ctable* tbl = (ctable*)getdata(vm->hp.heap, off);
    word index, source;
    sets(&index, newstring(vm, "X"));
    setf(&source, X);
    IA(vm, tbl, tindex, &index, &source);
    sets(&index, newstring(vm, "Y"));
    setf(&source, Y);
    IA(vm, tbl, tindex, &index, &source);
    sett(&w, tindex);
    returnv(vm, &w);
}
void Shape_GetPointOutlineColor(avm *vm)
{
    word w;
    long off = newtable(vm, ZEN_INITIALTABLESIZE);
    long tindex = TOTinsert(vm, off);
    ctable* tbl = (ctable*)getdata(vm->hp.heap, off);
    word index, source;
    sfColor col = sfShape_GetPointOutlineColor(getint(vm, 0), getint(vm, 1));
    sets(&index, newstring(vm, "R"));
    seti(&source, col.r);
    IA(vm, tbl, tindex, &index, &source);
    sets(&index, newstring(vm, "G"));
    seti(&source, col.g);
    IA(vm, tbl, tindex, &index, &source);
    sets(&index, newstring(vm, "B"));
    seti(&source, col.b);
    IA(vm, tbl, tindex, &index, &source);
    sets(&index, newstring(vm, "A"));
    seti(&source, col.a);
    IA(vm, tbl, tindex, &index, &source);
    sett(&w, tindex);
    returnv(vm, &w);
}
void string_getrect(avm *vm)
{
     word w;
     long off = newtable(vm, ZEN_INITIALTABLESIZE);
     long tindex = TOTinsert(vm, off);
     ctable* tbl = (ctable*)getdata(vm->hp.heap, off);
     word index, source;
     sfFloatRect col = sfString_GetRect(getstring(vm, 0));
     sets(&index, newstring(vm, "Left"));
     seti(&source, col.Left);
     IA(vm, tbl, tindex, &index, &source);
     sets(&index, newstring(vm, "Top"));
     seti(&source, col.Top);
     IA(vm, tbl, tindex, &index, &source);
     sets(&index, newstring(vm, "Right"));
     seti(&source, col.Right);
     IA(vm, tbl, tindex, &index, &source);
     sets(&index, newstring(vm, "Bottom"));
     seti(&source, col.Bottom);
     IA(vm, tbl, tindex, &index, &source);
     sett(&w, tindex);
     returnv(vm, &w);
}