与基于像素的安卓游戏不同分辨率处理

与基于像素的安卓游戏不同分辨率处理

本文介绍了与基于像素的安卓游戏不同分辨率处理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开发的2D平台游戏的游戏在Android平台,所以我真的不关心屏幕的DPI,但更多关于像素的实际分辨率。从我收集到网上,有几个不同分辨率(和纵横比)present。根据我的搜索,这两项决议是目前wides $ P $焊盘小480x320(1.5)和800×480(1.666),是这样吗?我想针对这两项决议将达到大多数客户。现在,我可以通过显示40像素的大显示屏的黑色边框,essentialy它减少了720×480像素的1.5的比例与不同的纵横比的处理。

I am developing a 2D platformer game for the android platform, so I don't really care about the screen DPI, but much more about the actual resolution in pixels. From what I've gathered on the net, there are a couple of different resolutions (and aspect ratios) present. According to my search, the two resolutions that are currently widespread are 480x320 (1.5) and 800x480 (1.666), is that right? I'd like to target these two resolutions to reach most customers.Now, I can deal with the different aspect ratios by showing a black border of 40 pixel for the bigger display, essentialy reducing it to 720x480 pixel and a ratio of 1.5.

与我的游戏的问题是,它是对游戏的玩家看到每个屏幕上的世界相同量至关重要。否则,一些球员将获得不公平的优势。此外,我触发取决于能见度某些事件。例如,敌人只允许当玩家开始看到它开始拍摄。否则,敌人的子弹似乎空穴来风。

The problem with my game is that it is essential for gameplay that the players see the same amount of the world on each screen. Otherwise, some players would get an unfair advantage. Furthermore, I trigger some events depending on the visibility. For example, an enemy is only allowed to start shooting when the player starts seeing it. Otherwise, the enemies' bullets would seem to come from nowhere.

所以我想我需要创建我的图形一项决议并适当调整了其他。或者,我为每个分辨率的单独的图形。是对的吗?不幸的是,这两种方法是次优的像素图形。

So I figured I need to either create my graphics for one resolution and scale them for the other. Or I create separate graphics for each resolution. Is that right? Unfortunately, both ways are suboptimal for pixel graphics.

在另注:我怎样才能限制我的游戏这些决议只(特别是Android市场)?我知道,在清单中的支持屏的标签,但根据有效屏幕尺寸,而不是在像素尺寸的作品,还是我错了?我也有兴趣在其他Android游戏开发者的个人经验,当谈到与分辨率无关。

On another note: How can I restrict my game to these resolutions only (especially for the Android Market)? I know about the "supports-screens" tag in the manifest, but that works depending on the effective screen-size, not the size in pixel, or am I mistaken?I am also interested in personal experiences of other android game developers when it comes to resolution independence.

谢谢!

推荐答案

我的问题是:你觉得会做在电脑上?对于游戏开发,Android的应该看更像是一台PC的目标不是一个控制台。你只本质需要接受会有屏幕一些差异,不能完全predict前期。

My question would be: what do you think would do on a PC? For game development, Android should be looked at much more like a PC target than a console. You just intrinsically need to accept that there will be some diversity of screens that you can't totally predict up-front.

所以,我认为有两个主要的方法来取:

So I think there are two main approaches to take:

(1)使用一个常量显示尺寸,如果你是设置在PC上固定的视频分辨率,让使用它的用户的显示器处理。在课程中,这些设备没有显示器,只有一个固定的展示,所以它没有任何意义修改的核心解决方案。相反,你可以设置SurfaceView展示你的游戏有一个固定的分辨率,并让该平台的合成器需要进行缩放(硬件)的小心,因为复合材料在屏幕上。

(1) Use a constant "display size" as if you were setting a fixed video resolution on the PC and letting the user's monitor deal with it. On these devices of course there is no monitor, just one fixed display, so it doesn't make sense to modify the core resolution. Instead, you can set up the SurfaceView showing your game to have a fixed resolution, and let the platform's compositor take care of scaling it (in hardware) as it composites to the screen.

(2)更加智能地调整你发现自己在运行时屏幕的实际分辨率。放大或缩小图形自己创建所需的比赛场地。也许有一些不同大小的纹理和选择合适的人的屏幕分辨率。

(2) More intelligently adjust to the actual resolution of the screen you find yourself running in. Scale up or down graphics yourself to create the playing area you want. Maybe have some different sizes of textures and select the appropriate ones for the screen resolution.

您很可能也在做这些的组合,你有你挑根据总分辨率可提供该游戏中可以与运行良好的表面观几个固定的大小。在这两种情况下,你可以做函拳适当保持你的长宽比不变不同的屏幕上,如果这是你想要的。

You could probably also do a combination of these, where you have a couple fixed sizes you pick for the surface view depending on the total resolution available which the game can run well with. In either case, you can do letter-boxing as appropriate to keep your aspect ratio constant on different screens, if that is what you want.

这篇关于与基于像素的安卓游戏不同分辨率处理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-02 17:27