使用 LibGDX 顺时针旋转图像
我们如何使用 LibGDX 顺时针旋转图像?我正在寻找的是当加载图像时,假设一个星,我需要将它从屏幕的开头水平旋转到屏幕的结尾,随着星的旋转,我该如何在 libgdx 中做到这一点?
How can we rotate a Image Clockwise using LibGDX? what i am looking is when a image is loaded,suppose a star, i need to rotate it from beginning of screen to end of the screen horizontally, with star rotating,how can i do that in libgdx?
推荐答案
使用 SpriteBatch 绘制纹理时,可以使用包含旋转的绘制函数之一.此 javadoc 具有所有绘图功能:SpriteBatch
When you draw the Texture with your SpriteBatch, you can use one of the draw functions that includes rotation. This javadoc has all the draw functions: SpriteBatch
可以为位置和旋转保留一个变量,并在每次渲染时增加位置的旋转和x分量,使其在水平移动的同时旋转.
You can keep a variable for position and rotation, and increase the rotation and x component of the position each time you render to make it rotate while moving horizontally.
相关文章