diff --git a/GameEngine/src/main/java/gameEngine/entites/gameComponents/TextMesh.java b/GameEngine/src/main/java/gameEngine/entites/gameComponents/TextMesh.java index 4f19b3d..8ffdd74 100644 --- a/GameEngine/src/main/java/gameEngine/entites/gameComponents/TextMesh.java +++ b/GameEngine/src/main/java/gameEngine/entites/gameComponents/TextMesh.java @@ -18,8 +18,8 @@ private Entity parent; // 親のオブジェクトを持つ public String text; - private int spriteWidth = 512; // スプライト幅(今後指定可能にする) - private int spriteHeight = 256; // スプライト高さ(今後指定可能にする) + private int spriteWidth = 1; // サイズとは無関係 + private int spriteHeight = 1; // サイズとは無関係 // コンストラクタ @@ -87,6 +87,10 @@ glTranslatef(-(x + spriteWidth / 2.0f), -(y + spriteHeight / 2.0f), z); glEnable(GL_TEXTURE_2D); + //ここで文字の背景の透明化 + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + //ここまで文字の背景の透明化 glColor4f(1f, 1f, 1f, 1f); // Text drawing logic @@ -141,35 +145,6 @@ } /** - * Gets the width of the specified text. - * - * @param text The text - * @return Width of text - */ - public int getWidth(CharSequence text) { - int width = 0; - int lineWidth = 0; - for (int i = 0; i < text.length(); i++) { - char c = text.charAt(i); - if (c == '\n') { - /* Line end, set width to maximum from line width and stored - * width */ - width = Math.max(width, lineWidth); - lineWidth = 0; - continue; - } - if (c == '\r') { - /* Carriage return, just skip it */ - continue; - } - Glyph g = fontGlyphs.get(c); - lineWidth += g.width; - } - width = Math.max(width, lineWidth); - return width; - } - - /** * Gets the height of the specified text. * * @param text The text