// Path: src/main/java/fontRendering/TextMaster.java
// public class TextMaster {
// 
// 	private static Loader loader;
// 	private static Map<FontType, List<GUIText>> texts = new HashMap<FontType, List<GUIText>>();
// 	private static FontRenderer renderer;
// 
// 	public static void init(Loader theLoader) {
// 		renderer = new FontRenderer();
// 		loader = theLoader;
// 	}
// 
// 	public static void render() {
// 		renderer.render(texts);
// 	}
// 
// 	public static void loadText(GUIText text) {
// 		FontType font = text.getFont();
// 		TextMeshData data = font.loadText(text);
// 		int vao = loader.loadToVAO(data.getVertexPositions(), data.getTextureCoords());
// 		text.setMeshInfo(vao, data.getVertexCount());
// 		List<GUIText> textBatch = texts.get(font);
// 		if (textBatch == null) {
// 			textBatch = new ArrayList<GUIText>();
// 			texts.put(font, textBatch);
// 		}
// 		textBatch.add(text);
// 	}
// 
// 	public static void removeText(GUIText text) {
// 		List<GUIText> textBatch = texts.get(text.getFont());
// 		textBatch.remove(text);
// 		if (textBatch.isEmpty()) {
// 			texts.remove(texts.get(text.getFont()));
// 		}
// 	}
// 
// 	public static void cleanUp() {
// 		renderer.cleanUp();
// 	}
// 
// }


import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import fontRendering.TextMaster;

package fontMeshCreator;



/**
 * Represents a piece of text in the game.
 * 
 * @author Karl
 *
 */
public class GUIText {

	private String textString;
	private float fontSize;

	private int textMeshVao;
	private int vertexCount;
	private Vector3f colour = new Vector3f(0f, 0f, 0f);

	private Vector2f position;
	private float lineMaxSize;
	private int numberOfLines;

	private FontType font;

	private boolean centerText = false;

	private float distanceFieldWidth;
	private float distanceFieldEdge;
	private float borderWidth;
	private float borderEdge;
	private Vector2f offset = new Vector2f(0f, 0f);
	private Vector3f outlineColour = new Vector3f(0f, 0f, 0f);

	/**
	 * Creates a new text, loads the text's quads into a VAO, and adds the text
	 * to the screen.
	 * 
	 * @param text
	 *            - the text.
	 * @param fontSize
	 *            - the font size of the text, where a font size of 1 is the
	 *            default size.
	 * @param font
	 *            - the font that this text should use.
	 * @param position
	 *            - the position on the screen where the top left corner of the
	 *            text should be rendered. The top left corner of the screen is
	 *            (0, 0) and the bottom right is (1, 1).
	 * @param maxLineLength
	 *            - basically the width of the virtual page in terms of screen
	 *            width (1 is full screen width, 0.5 is half the width of the
	 *            screen, etc.) Text cannot go off the edge of the page, so if
	 *            the text is longer than this length it will go onto the next
	 *            line. When text is centered it is centered into the middle of
	 *            the line, based on this line length value.
	 * @param centered
	 *            - whether the text should be centered or not.
	 */
	public GUIText(String text, float fontSize, FontType font, Vector2f position, float maxLineLength,
			boolean centered) {
		this.textString = text;
		this.fontSize = fontSize;
		this.font = font;
		this.position = position;
		this.lineMaxSize = maxLineLength;
		this.centerText = centered;

// Path: src/main/java/fontRendering/TextMaster.java
// public class TextMaster {
// 
// 	private static Loader loader;
// 	private static Map<FontType, List<GUIText>> texts = new HashMap<FontType, List<GUIText>>();
// 	private static FontRenderer renderer;
// 
// 	public static void init(Loader theLoader) {
// 		renderer = new FontRenderer();
// 		loader = theLoader;
// 	}
// 
// 	public static void render() {
// 		renderer.render(texts);
// 	}
// 
// 	public static void loadText(GUIText text) {
// 		FontType font = text.getFont();
// 		TextMeshData data = font.loadText(text);
// 		int vao = loader.loadToVAO(data.getVertexPositions(), data.getTextureCoords());
// 		text.setMeshInfo(vao, data.getVertexCount());
// 		List<GUIText> textBatch = texts.get(font);
// 		if (textBatch == null) {
// 			textBatch = new ArrayList<GUIText>();
// 			texts.put(font, textBatch);
// 		}
// 		textBatch.add(text);
// 	}
// 
// 	public static void removeText(GUIText text) {
// 		List<GUIText> textBatch = texts.get(text.getFont());
// 		textBatch.remove(text);
// 		if (textBatch.isEmpty()) {
// 			texts.remove(texts.get(text.getFont()));
// 		}
// 	}
// 
// 	public static void cleanUp() {
// 		renderer.cleanUp();
// 	}
// 
// }


// Path: src/main/java/fontMeshCreator/GUIText.java
import org.lwjgl.util.vector.Vector2f;
import org.lwjgl.util.vector.Vector3f;
import fontRendering.TextMaster;

package fontMeshCreator;



/**
 * Represents a piece of text in the game.
 * 
 * @author Karl
 *
 */
public class GUIText {

	private String textString;
	private float fontSize;

	private int textMeshVao;
	private int vertexCount;
	private Vector3f colour = new Vector3f(0f, 0f, 0f);

	private Vector2f position;
	private float lineMaxSize;
	private int numberOfLines;

	private FontType font;

	private boolean centerText = false;

	private float distanceFieldWidth;
	private float distanceFieldEdge;
	private float borderWidth;
	private float borderEdge;
	private Vector2f offset = new Vector2f(0f, 0f);
	private Vector3f outlineColour = new Vector3f(0f, 0f, 0f);

	/**
	 * Creates a new text, loads the text's quads into a VAO, and adds the text
	 * to the screen.
	 * 
	 * @param text
	 *            - the text.
	 * @param fontSize
	 *            - the font size of the text, where a font size of 1 is the
	 *            default size.
	 * @param font
	 *            - the font that this text should use.
	 * @param position
	 *            - the position on the screen where the top left corner of the
	 *            text should be rendered. The top left corner of the screen is
	 *            (0, 0) and the bottom right is (1, 1).
	 * @param maxLineLength
	 *            - basically the width of the virtual page in terms of screen
	 *            width (1 is full screen width, 0.5 is half the width of the
	 *            screen, etc.) Text cannot go off the edge of the page, so if
	 *            the text is longer than this length it will go onto the next
	 *            line. When text is centered it is centered into the middle of
	 *            the line, based on this line length value.
	 * @param centered
	 *            - whether the text should be centered or not.
	 */
	public GUIText(String text, float fontSize, FontType font, Vector2f position, float maxLineLength,
			boolean centered) {
		this.textString = text;
		this.fontSize = fontSize;
		this.font = font;
		this.position = position;
		this.lineMaxSize = maxLineLength;
		this.centerText = centered;

		TextMaster.loadText(this);
