在游戏中使用batcher.drawSprite绘制所有图像是否正确?
is it right to use batcher.drawSprite to draw all images in game?
我正在开发一款游戏并使用batcher.drawSprite方法绘制游戏中的所有图像(背景和所有角色)
in assets.java :
charAtlas = new Texture(game, "charAtlas.png");
charEnemy = new TextureRegion(charAtlas, 0,0,250,300);
in worldGame.java :
batcher.beginBatch(Assets.charAtlas); // set atlas
batcher.drawSprite(130, 628, 120,140, Assets.charEnemy);
//assets.charEnemy
在所有情况下都使用此方法是否正确?
我在游戏中有 3 个地图集,我什至使用 2048x2048 大小的地图集,所以我可以在其中包含我所有的图像..
然而,图像在游戏中看起来很模糊(在 galaxy note、tab 和 galaxy young 中测试过)。看看上面的代码,我什至让敌人的字符在我的地图集中占据了 250x300 的大小,它看起来模糊是没有意义的,因为我只在 120x140 中绘制它。
注意:我没有使用布局(我的意思是 res 文件夹中没有布局文件)..我使用 drawsprite 绘制所有图像(字符、菜单、按钮等)..
更新 :
我尝试使用我解压缩的其他游戏中的角色图像文件,当我 运行 该应用程序时,它看起来也很模糊且参差不齐。而在原始游戏中,它是如此流畅和锐利。这是为什么?
检查你的代码,你可能会使用 scaledbitmap ,看看你是否可以这样设置。
Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap source = BitmapFactory.decodeResource(a.getResources(), path, options);
我正在开发一款游戏并使用batcher.drawSprite方法绘制游戏中的所有图像(背景和所有角色)
in assets.java :
charAtlas = new Texture(game, "charAtlas.png");
charEnemy = new TextureRegion(charAtlas, 0,0,250,300);
in worldGame.java :
batcher.beginBatch(Assets.charAtlas); // set atlas
batcher.drawSprite(130, 628, 120,140, Assets.charEnemy);
//assets.charEnemy
在所有情况下都使用此方法是否正确? 我在游戏中有 3 个地图集,我什至使用 2048x2048 大小的地图集,所以我可以在其中包含我所有的图像..
然而,图像在游戏中看起来很模糊(在 galaxy note、tab 和 galaxy young 中测试过)。看看上面的代码,我什至让敌人的字符在我的地图集中占据了 250x300 的大小,它看起来模糊是没有意义的,因为我只在 120x140 中绘制它。
注意:我没有使用布局(我的意思是 res 文件夹中没有布局文件)..我使用 drawsprite 绘制所有图像(字符、菜单、按钮等).. 更新 : 我尝试使用我解压缩的其他游戏中的角色图像文件,当我 运行 该应用程序时,它看起来也很模糊且参差不齐。而在原始游戏中,它是如此流畅和锐利。这是为什么?
检查你的代码,你可能会使用 scaledbitmap ,看看你是否可以这样设置。
Options options = new BitmapFactory.Options();
options.inScaled = false;
Bitmap source = BitmapFactory.decodeResource(a.getResources(), path, options);