텍스트의 색상 및 크기를 변경하고 싶습니다. 나는 그 글꼴을 하나만 사용하고 싶다. 가능한가? 여기 텍스트 변경 크기 및 색상
내 코드입니다 : 정의 글꼴 & 텍스트// for red color font
redFont = FontFactory.createFromAsset(activity.getFontManager(),
fontTexture, activity.getAssets(), "YIKES__.TTF", 30, true,
Color.parseColor("#EF522A"));
redFont.prepareLetters("Score:1234567890 Sec Cash/Level"
.toCharArray());
redFont.load();
// for white color font
ITexture whiteFontTexture = new BitmapTextureAtlas(
activity.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
whiteFont = FontFactory.createFromAsset(activity.getFontManager(),
whiteFontTexture, activity.getAssets(), "YIKES__.TTF", 30, true,
Color.WHITE);
whiteFont.prepareLetters("Score:1234567890 Sec Cash/Level"
.toCharArray());
whiteFont.load();
다음 텍스트와 같은 크기 변경 초기화 :
gameOverText = new Text(0, 0,
ResourcesManager.getInstance().whiteFont,
"ABCDEFHIJKLMNOPQRSTUVWXYZ",
ResourcesManager.getInstance().vbom);
gameOverText.setPosition(45, 72);
// gameOverText.setSize(490, 115);
gameOverText.setText(gameOver);
과 같은 색상을 변경 :
// define the color
pColor = new org.andengine.util.color.Color(255, 102, 51);
gameOverText.setColor(pColor);
하지만, 나는 성공하지 못한다. 그래서 아래에 가까운.
이 방법으로 문제가 있었지만 해결책을 기억하지 못했습니다. 그것은 알파 채널과 관련이 있습니다 - 내 코드를보고 흰색이 아닌 다른 색상을 얻으려면이 Color.argb (int 알파, int 빨강, int 녹색, int 파랑)를 사용하여 알파 채널을 설정해야했습니다. 대신 parseColor 호출 – jmroyalty