public FontTexture(Font font, String charSetName) throws Exception { this.font = font; this.charSetName = charSetName; charMap = new HashMap<>(); buildTexture(); }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;
FontMetrics fontMetrics = g2D.getFontMetrics(); String allChars = getAllAvailableChars(charSetName); this.width = 0; this.height = 0;
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(0.5f, 0.5f, 0.5f, 10f)); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem}; }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;
FontMetrics fontMetrics = g2D.getFontMetrics(); String allChars = getAllAvailableChars(charSetName); this.width = 0; this.height = 0;
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(0.5f, 0.5f, 0.5f, 10f)); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem}; }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;
public FontTexture(Font font, String charSetName) throws Exception { this.font = font; this.charSetName = charSetName; charMap = new HashMap<>(); buildTexture(); }
FontMetrics fontMetrics = g2D.getFontMetrics(); String allChars = getAllAvailableChars(charSetName); this.width = 0; this.height = 0;
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(0.5f, 0.5f, 0.5f, 10f)); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem}; }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;
public FontTexture(Font font, String charSetName) throws Exception { this.font = font; this.charSetName = charSetName; charMap = new HashMap<>(); buildTexture(); }
FontMetrics fontMetrics = g2D.getFontMetrics(); String allChars = getAllAvailableChars(charSetName); this.width = 0; this.height = 0;
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(0.5f, 0.5f, 0.5f, 10f)); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem}; }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;
public FontTexture(Font font, String charSetName) throws Exception { this.font = font; this.charSetName = charSetName; charMap = new HashMap<>(); buildTexture(); }
FontMetrics fontMetrics = g2D.getFontMetrics(); String allChars = getAllAvailableChars(charSetName); this.width = 0; this.height = 0;
public Hud(String statusText) throws Exception { FontTexture fontTexture = new FontTexture(FONT, CHARSET); this.statusTextItem = new TextItem(statusText, fontTexture); this.statusTextItem.getMesh().getMaterial().setAmbientColour(new Vector4f(0.5f, 0.5f, 0.5f, 10f)); // Create list that holds the items that compose the HUD gameItems = new GameItem[]{statusTextItem}; }
FontTexture.CharInfo charInfo = fontTexture.getCharInfo(characters[i]); textCoords.add( (float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)charInfo.getStartX() / (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 1); positions.add((float)fontTexture.getHeight()); //y textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(1.0f); indices.add(i*VERTICES_PER_QUAD + 2); textCoords.add((float)(charInfo.getStartX() + charInfo.getWidth() )/ (float)fontTexture.getWidth()); textCoords.add(0.0f); indices.add(i*VERTICES_PER_QUAD + 3); int[] indicesArr = indices.stream().mapToInt(i->i).toArray(); Mesh mesh = new Mesh(posArr, textCoordsArr, normals, indicesArr); mesh.setMaterial(new Material(fontTexture.getTexture())); return mesh;