JacksonHoggard / voodoo2d

👹 2D Java Game Engine built in OpenGL
MIT License
131 stars 50 forks source link

Add method to Mesh class #8

Closed JacksonHoggard closed 4 years ago

JacksonHoggard commented 4 years ago

Describe the feature you'd like I want the following code to be added to the Mesh class:

public static Mesh loadMesh(String filename) {
    return new Mesh(
            new float[]{ // positions
                    -0.5f,  0.5f, 0.0f,
                    -0.5f, -0.5f, 0.0f,
                    0.5f, -0.5f, 0.0f,
                    0.5f,  0.5f, 0.0f,
            },
           new float[]{ // text coordinates
                    0.0f, 0.0f,
                    0.0f, 1.0f,
                    1.0f, 1.0f,
                    1.0f, 0.0f,
            },
            new int[]{
                    0, 1, 3, 3, 1, 2,
            },
            new SpriteSheet(filename)
    );
}