我想在android中使用andengine製作16位風格的RPG,但我遇到了一個主要障礙:像素總是顯得變形並且不成比例(不是正方形)。這是文字和精靈的問題。這裏是我的問題論壇的鏈接http://www.andengine.org/forums/post37364.html#p37364,http://www.andengine.org/forums/post35921.html#p35921。我使用Nearest作爲文本和精靈的紋理選項。我的小精靈,通過質地打包機訪問,我的文字是用類似的代碼創建下面Andengine中的變形像素
final ITexture mFontInfoTexture = new BitmapTextureAtlas(pContext.getTextureManager(), 256, 256, TextureOptions.NEAREST);
mFontInfo = FontFactory.createFromAsset(pContext.getFontManager(), mFontInfoTexture, pContext.getAssets() , "LongPixelFont.ttf", 18.0f, false, Color.BLACK);
mFontInfo.load();
我已經試過縮放精靈不同,改變紋理選項線性,換擋精靈位置,但沒有真正的作品。任何有識之士將不勝感激。
UPDATE 1:
這是我使用定義該應用的分辨率的代碼。
// Initializes the Engine and sets the height and width.
MainActivity.mMainCamera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
//Sets the engine options
EngineOptions engineOptions = new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), MainActivity.mMainCamera);
//Forces the screen to go into landscape
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
更新2:
似乎變形被縮放(對於精靈)引起的。當通過int縮放時,我沒有注意到任何變形,但是當縮放一個分數時出現了一些變形。當縮小奇數小數(即2.5)時變形變得更明顯。似乎也有一個像素看起來會變形的範圍。在我的情況下,小於2倍的東西看起來會變形,但是任何大於2的int看起來都不錯。
我試過了,但沒有解決問題。另外,不抗鋸齒減少像素化?如果是這樣,那麼它違背了我要去的風格(16位)。 – eBehbahani 2012-07-25 20:10:36