使用 LibGDX 顺时针旋转图像 [英] Rotate Image Clockwise using LibGDX

查看:40
本文介绍了使用 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.

这篇关于使用 LibGDX 顺时针旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆