問題描述
我們如何使用 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 順時針旋轉圖像的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!