简体   繁体   English

在Android上全屏显示不同分辨率的2D游戏

[英]Full screen on Android with different Resolutions for 2D Game

Here's my issue. 这是我的问题。 If I program a game to take up the screen size, for example, 640x480 it will work fine on a 640x480 device. 如果我对游戏进行编程以占用屏幕尺寸,例如640x480,它将在640x480设备上正常工作。 However when it's played on a larger device (ex: tablet) 1280x960 the game will only be in the top left corner. 但是,当它在更大的设备(例如平板电脑)1280x960上播放时,游戏只会在左上角。

I know I could make the game check the screen size and then use different DPI sprites using a switch statement and have tons of multiplications applied to the x,y coordinates of the sprites, however there has to be a better way. 我知道我可以使游戏检查屏幕尺寸,然后使用switch语句使用不同的DPI Sprite,并将大量的乘法应用于Sprite的x,y坐标,但是必须有更好的方法。 I'm already dedicating a large amount of power to sprite plotting which is ridiculous. 我已经在花大量精力在精灵绘图上了,这太荒谬了。

How do I account for this to ensure my game will work on a veriety of Android Devices? 如何解决这个问题,以确保我的游戏可以在多种Android设备上运行?

I'm not quite sure with this one but you could try. 我对此不太确定,但您可以尝试。 Add this in your manifest just after the /> tag. 在/>标记后的清单中添加此代码。

   <support-screens
       android:xlargeScreens="true"
       android:largeScreens="true"
       android:normalScreens="true"
       android:smallScreens="true"
   />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM