package com.graphicsengine.charset;

import java.io.IOException;

import com.graphicsengine.assets.AssetManager;
import com.nucleus.renderer.BaseRenderer;
import com.nucleus.texturing.Texture2D;

/**
 * Use to create charmaps from JSON source
 * 
 * @author Richard Sahlin
 *
 */
public class PlayfieldFactory {

    public static Playfield createCharmap(BaseRenderer baseRenderer, PlayfieldSetup constructor) throws IOException {

        Playfield map = new Playfield(constructor.mapWidth * constructor.mapHeight);
        PlayfieldProgram program = new PlayfieldProgram();
        baseRenderer.createProgram(program);
        Texture2D texture = AssetManager.getInstance().getTexture(baseRenderer, constructor.textureSource);
        map.createMesh(program, texture, constructor.tileWidth, constructor.tileHeight, constructor.zpos,
                constructor.textureFramesX, constructor.textureFramesY);
        map.setupPlayfield(constructor.mapWidth, constructor.mapHeight, constructor.xpos, constructor.ypos);
        map.setPlayfieldData(constructor.data, 0, 0, constructor.data.length);
        return map;
    }
}

@@ -302,24 +302,190 @@
 dFactory %7B%0A%0A
+    /**%0A     * Factory method for creating a playfield%0A     * %0A     * @param baseRenderer%0A     * @param constructor%0A     * @return%0A     * @throws IOException%0A     */%0A
     public s
@@ -510,15 +510,8 @@
 eate
-Charmap
 (Bas
@@ -873,21 +873,20 @@
 textureS
-ource
+etup
 );%0A     

Change playfield factory method name to create()