Package cc.plural.ecs.engine

Examples of cc.plural.ecs.engine.GameObject


import cc.plural.graphics.Vertex;

public class TankFactory {

    public static GameObject createTank(Engine engine) {
        GameObject tank = engine.createGameObject();
        tank.setName("Tank");

        GameObject tankBody = engine.createGameObject();
        GeometryComponent geometry = new GeometryComponent();

        //geometry.texture = Texture.createTexture("/images/tank_body_1.png");
//        geometry.model = new Model();
//        VertexData v0 = new VertexData();
//        v0.setXYZ(-0.5f, 0.5f, 0);
//        v0.setRGB(1, 0, 0);
//        v0.setST(0, 0);
//        VertexData v1 = new VertexData();
//        v1.setXYZ(-0.5f, -0.5f, 0);
//        v1.setRGB(0, 1, 0);
//        v1.setST(0, 1);
//        VertexData v2 = new VertexData();
//        v2.setXYZ(0.5f, -0.5f, 0);
//        v2.setRGB(0, 0, 1);
//        v2.setST(1, 1);
//        VertexData v3 = new VertexData();
//        v3.setXYZ(0.5f, 0.5f, 0);
//        v3.setRGB(1, 1, 1);
//        v3.setST(1, 0);
//        geometry.model.verticies = new VertexData[] {v0, v1, v2, v3};
//        geometry.model.indices = new short[] {
//            0, 1, 2,
//            2, 3, 0
//        };
//        geometry.model.load();

        //ShaderProgram shader = new ShaderProgram();
        //shader.createDefaultShaderProgram();
        //geometry.shader = shader;

        tankBody.registerComponent(geometry);
        tankBody.setName("TankBody");

        tank.addChild(tankBody);

//    Component playerComponent = new PlayerDriveComponent();   
//    tank.registerComponent(playerComponent);
View Full Code Here


        mat4x4 = renderer.getCamera().get();
        System.out.println(MatrixPrinter.matrix2String(MatrixPrinter.MAJOR.ROW, mat4x4));
       
        engine = new Engine();

        GameObject tank = TankFactory.createTank(engine);
        tank.registerComponent(new ReporterComponent());
        tank.setPosition(20, 20);
        tank.setScale(2);
        tank.updateWorldTransforms();
       
        tank.getWorld().load(mat4x4);
        System.out.println(MatrixPrinter.matrix2String(MatrixPrinter.MAJOR.ROW, mat4x4));

//        Node node1 = engine.createNode("Node 1");
//        Node node2 = engine.createNode("Node 2");
//        Node node3 = engine.createNode("Node 3");
View Full Code Here

TOP

Related Classes of cc.plural.ecs.engine.GameObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.