简体   繁体   English

Java:在不影响图像位置的情况下旋转bufferedimage

[英]Java: Rotate bufferedimage without affecting the image's position

g.rotate(1, objSize/2, objSize/2);
g.drawImage(frames[count], (int)x, (int)y, null);
g.rotate(-1, objSize/2, objSize/2);

This is the coding I used to rotate one image which is the Player that you can move, the player rotates fine but it moves like the whole world has rotated (if you know what I mean) so I need to know a way to rotate the player without affecting the movement/position, I searched around google and couldn't find the right answer, any suggestions? 这是我用来旋转一张图像的编码,即您可以移动的播放器,播放器旋转得很好,但它的移动就像整个世界都旋转了一样(如果您知道我的意思),所以我需要知道一种旋转玩家而不影响动作/位置,我在Google周围搜索,找不到正确的答案,有什么建议吗?

Create a method that rotates the player and pass the values which are required to move the player.. (i mean abstact a class out of the code u wrote to rotate and just pass required values to method).. 创建一个旋转播放器并传递移动播放器所需值的方法。(我的意思是从您编写的旋转代码中减去一个类,然后将所需值传递给方法)。

this will not change the values and Do the work.. 这不会更改值并完成工作。

:) :)

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

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