简体   繁体   English

Android(阅读典型设备)的运行速度是否足够快,该游戏需要逐个像素绘制而不是盲点绘制

[英]Is Android (read typical devices) fast enough for a game that requires plotting pixel by pixel rather than blitting

i have an idea for an Android game which is a little different from the typical game that usually moves sprites(bitmaps) around the screen. 我有一个Android游戏的想法,与通常在屏幕上移动精灵(位图)的典型游戏有些不同。 Id want to plot lots of little pixels to create my visuals. 我想绘制很多小像素来创建我的视觉效果。

PROS 优点

  • no bitmaps required 无需位图
  • pixel plotting of stuff like "fire" can react to wind. 像“火”这样的东西的像素绘图会对风产生反应。
  • no need to scale bitmaps, works w/ any screen res (lets pretend device can handle more drawing because its got a bigger screen). 无需缩放位图,可以在任何屏幕分辨率下工作(假装设备可以处理更多绘图,因为其屏幕更大)。

CONS 缺点

  • slower to plot pixels than blit bitmaps 绘制像素的速度比blit位图慢
  • need lot of animation frames. 需要很多动画帧。

WISHES 愿望

  • id like to update my game in real time, more is better 30fps is good but not essential, 15fps is enough. id喜欢实时更新我的​​游戏,多多益善30fps不错,但不是必需的,15fps就足够了。

PERFORMANCE Q... 性能问题...

  • Is the typical Android device fast enough to plot say half a screenful of pixels w/ a default background ? 典型的Android设备是否足够快地绘制带有默认背景的半个屏幕像素?
  • if full screen is not practical what window size should be able to handle such refreshes 如果全屏不可行,那么什么窗口大小应该能够处理此类刷新

You can achieve it in native code using C/C++. 您可以使用C / C ++在本机代码中实现。 You would create offscreen bitmap, get its memory address, draw raw RGB pixels to it, then blit entire offscreen bitmap to screen in View.onDraw method. 您将创建屏幕外位图,获取其内存地址,向其绘制原始RGB像素,然后在View.onDraw方法中将整个屏幕外位图blit到屏幕上。 You can get nice framerates in fullscreen. 您可以在全屏模式下获得不错的帧率。

Btw, Android also manipulates pixels in low level by native code (using Skia library). 顺便说一句,Android还通过本机代码(使用Skia库)来操纵低级像素。 Java classes like Canvas, Bitmap etc just jump to native code to get the work done. Java类(例如Canvas,Bitmap等)仅跳至本机代码即可完成工作。 Using Android's Canvas in Java to paint pixels would be unrealistically slow. 在Java中使用Android的Canvas绘制像素会非常缓慢。

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

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