简体   繁体   English

如何用Java制作图像对象?

[英]How to make images objects in Java?

I'm working on a game where I want to replace all these white blocks and the ball (which uses a RectF collider) with images, but still keep the characteristics of the game. 我正在开发一款游戏,希望将所有这些白色方块和球(使用RectF对撞机)替换为图像,但仍要保留游戏的特征。 超级突破

How can I import an image like this: 如何导入这样的图像: 桨 into the game but still keep the game mechanics? 进入游戏,但仍然保持游戏机制? (Colliding and such). (碰撞等)。

Let me know if I should post some code I already have in order to help or anything else. 让我知道是否应该发布一些我已经拥有的代码以提供帮助或其他。 Thank you! 谢谢!

You can use the method : 您可以使用以下方法

drawBitmap(Bitmap bitmap, Rect src, RectF dst, Paint paint)

dst have to be rectF you currently been using. dst必须rectF您目前使用了。

For a bitmap like the sample one you have shown, scr can be null since you want to draw the entire image. 对于您所显示的示例之类的位图,由于要绘制整个图像,因此scr可以为null

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

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