使用 LibGDX 顺时针旋转图像

Rotate Image Clockwise using LibGDX(使用 LibGDX 顺时针旋转图像)
本文介绍了使用 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 顺时针旋转图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)