Прежде чем углубиться в серьезную низкоуровневую отладку, мне было просто интересно, возникла ли проблема с концепцией рисования текста на спрайте.
Просматривая примеры API, я заметил, что нигде это не делается. Все текстовые спрайты предварительно отображаются в pngs
Я почти вижу, что что-то пытается нарисовать, но появляются только белые пятна или линии
Любой совет будет принят во внимание
Приветствия
public class Tile extends Sprite {
private static BitmapTextureAtlas mBitmapTextureAtlas;
private static TextureRegion mBoxTextureRegion;
private static BitmapTextureAtlas mFontTexture;
private static Font mFont;
String letter;
private Text mText;
public int score;
public Tile(String letter, int score, float x, float y, float width, float height) {
super(x, y, width, height, mBoxTextureRegion);
this.letter = letter;
this.score = score;
}
public static void loadResources(Context context, Engine mEngine) {
Tile.mFontTexture = new BitmapTextureAtlas(512, 512, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
Tile.mFont = FontFactory.createFromAsset(Tile.mFontTexture, context, "Arial Rounded MT.ttf", 64, true, Color.WHITE);
mEngine.getTextureManager().loadTexture(Tile.mFontTexture);
mEngine.getFontManager().loadFont(Tile.mFont);
Tile.mBitmapTextureAtlas = new BitmapTextureAtlas(128, 128, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
Tile.mBoxTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(Tile.mBitmapTextureAtlas, context, "rect3761.png", 0, 0);
mEngine.getTextureManager().loadTexture(Tile.mBitmapTextureAtlas);
}
public void draw(GraphicScene scene) {
if (letter != null) {
this.mText = new Text(50, 50, Tile.mFont, letter, HorizontalAlign.CENTER);
// this.mText.setBlendFunction(GL10.GL_SRC_ALPHA,
// GL10.GL_ONE_MINUS_SRC_ALPHA);
// this.mText.setAlpha(0.5f);
this.attachChild(this.mText);
scene.attachChild(this);
}
}
}