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


- 如何指定 CORS 的响应标头? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 转换 ldap 日期 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 获取数字的最后一位 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01