Search in sources :

Example 1 with LuanColor

use of net.schattenkind.androidLove.luan.module.LuanRenderer.LuanColor in project love-android by hagish.

the class LuanObjParticleSystem method CreateMetaTable.

public static LuaTable CreateMetaTable(final LuanGraphics g) {
    LuaTable mt = LuaValue.tableOf();
    LuaTable t = LuaValue.tableOf();
    mt.set("__index", t);
    // TODO: not yet implemented
    t.set("setSpinVariation", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            g.vm.NotImplemented("ParticleSystem:" + "setSpinVariation");
            return LuaValue.NONE;
        }
    });
    // TODO: not yet implemented
    t.set("setSizeVariation", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            g.vm.NotImplemented("ParticleSystem:" + "setSizeVariation");
            return LuaValue.NONE;
        }
    });
    // TODO: not yet implemented
    t.set("setBufferSize", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            g.vm.NotImplemented("ParticleSystem:" + "setBufferSize");
            return LuaValue.NONE;
        }
    });
    // TODO: not yet implemented
    t.set("setSprite", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            g.vm.NotImplemented("ParticleSystem:" + "setSprite");
            return LuaValue.NONE;
        }
    });
    // TODO: not yet implemented
    t.set("count", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).miParticlesAlive);
        }
    });
    t.set("getDirection", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).fDirection);
        }
    });
    t.set("getOffsetX", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).fOX);
        }
    });
    t.set("getOffsetY", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).fOY);
        }
    });
    t.set("getSpread", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).fSpread);
        }
    });
    t.set("isActive", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).bEmitterActive);
        }
    });
    t.set("isEmpty", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).miParticlesAlive == 0);
        }
    });
    t.set("isFull", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).miParticlesAlive >= self(args).iMaxParticles);
        }
    });
    t.set("setOffset", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fOX = (float) args.checkdouble(2);
            self(args).fOY = (float) args.checkdouble(3);
            return LuaValue.NONE;
        }
    });
    t.set("setColor", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).col_start = new LuanColor(args, 2);
            self(args).col_end = new LuanColor(args, 6);
            return LuaValue.NONE;
        }
    });
    t.set("setGravity", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fGravityX = (float) args.checkdouble(2);
            self(args).fGravityY = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fGravityX;
            return LuaValue.NONE;
        }
    });
    t.set("setRotation", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fRotationMin = (float) args.checkdouble(2);
            self(args).fRotationMax = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fRotationMin;
            return LuaValue.NONE;
        }
    });
    t.set("setSpin", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fSpinStart = (float) args.checkdouble(2);
            self(args).fSpinEnd = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fSpinStart;
            self(args).fSpinVar = LuanBase.IsArgSet(args, 4) ? (float) args.checkdouble(4) : 1f;
            return LuaValue.NONE;
        }
    });
    t.set("setRadialAcceleration", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fRadialAccelerationMin = (float) args.checkdouble(2);
            self(args).fRadialAccelerationMax = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fRadialAccelerationMin;
            return LuaValue.NONE;
        }
    });
    t.set("setTangentialAcceleration", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fTangentialAccelerationMin = (float) args.checkdouble(2);
            self(args).fTangentialAccelerationMax = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fTangentialAccelerationMin;
            return LuaValue.NONE;
        }
    });
    t.set("setDirection", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fDirection = (float) args.checkdouble(2);
            return LuaValue.NONE;
        }
    });
    t.set("setSpread", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fSpread = (float) args.checkdouble(2);
            return LuaValue.NONE;
        }
    });
    t.set("setSpeed", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).fSpeed_Min = (float) args.checkdouble(2);
            self(args).fSpeed_Max = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : self(args).fSpeed_Min;
            return LuaValue.NONE;
        }
    });
    t.set("setEmissionRate", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).setEmissionRate((float) args.checkdouble(2));
            return LuaValue.NONE;
        }
    });
    t.set("setParticleLife", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            float fMin = (float) args.checkdouble(2);
            float fMax = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : fMin;
            self(args).setParticleLife(fMin, fMax);
            return LuaValue.NONE;
        }
    });
    t.set("setSize", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            float fStart = (float) args.checkdouble(2);
            float fEnd = LuanBase.IsArgSet(args, 3) ? (float) args.checkdouble(3) : fStart;
            float fVar = LuanBase.IsArgSet(args, 4) ? (float) args.checkdouble(4) : 1f;
            self(args).setSize(fStart, fEnd, fVar);
            return LuaValue.NONE;
        }
    });
    t.set("setLifetime", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).setLifetime((float) args.checkdouble(2));
            return LuaValue.NONE;
        }
    });
    t.set("setPosition", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).setPosition((float) args.checkdouble(2), (float) args.checkdouble(3));
            return LuaValue.NONE;
        }
    });
    t.set("getX", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).x_emit);
        }
    });
    t.set("getY", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            return LuaValue.valueOf(self(args).y_emit);
        }
    });
    t.set("pause", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).pause();
            return LuaValue.NONE;
        }
    });
    t.set("reset", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).reset();
            return LuaValue.NONE;
        }
    });
    t.set("start", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).start();
            return LuaValue.NONE;
        }
    });
    t.set("stop", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).stop();
            return LuaValue.NONE;
        }
    });
    // / ParticleSystem:update( dt )
    // / Updates the particle system; moving, creating and killing particles.
    // TODO: not yet implemented
    t.set("update", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            self(args).update((float) args.checkdouble(2));
            return LuaValue.NONE;
        }
    });
    // / b = Object:typeOf( name )
    t.set("typeOf", new VarArgFunction() {

        @Override
        public Varargs invoke(Varargs args) {
            String s = args.checkjstring(2);
            return LuaValue.valueOf(s.equals("Object") || s.equals("Drawable") || s.equals("ParticleSystem"));
        }
    });
    return mt;
}
Also used : LuaTable(org.luaj.vm2.LuaTable) Varargs(org.luaj.vm2.Varargs) VarArgFunction(org.luaj.vm2.lib.VarArgFunction) LuanColor(net.schattenkind.androidLove.luan.module.LuanRenderer.LuanColor)

Aggregations

LuanColor (net.schattenkind.androidLove.luan.module.LuanRenderer.LuanColor)1 LuaTable (org.luaj.vm2.LuaTable)1 Varargs (org.luaj.vm2.Varargs)1 VarArgFunction (org.luaj.vm2.lib.VarArgFunction)1