私は現在、Codename Oneを使用して小惑星ゲームを作成している学校プロジェクトを行っています。私の現在の機能は、船のイメージを回転させることを除いて、うまくいきます。 Transformクラスの使用は効果がありませんでした。 Transformがどのように適用されているか、画像が描画されていても、画像は回転しません。ここCodename OneのTransformクラスを使用してコマンドでイメージを回転するにはどうすればよいですか?
が有効に使用されるコードのサンプル部分である:
public void turnRight() //Rotates the ship 5 degrees clockwise
{
if (direction==355)
direction = 0;
else
direction+=5;
Transform tmpTransform = Transform.makeIdentity();
theImage.getGraphics().getTransform(tmpTransform);
tmpTransform.rotate((float)Math.toRadians(5), x, y);
theImage.getGraphics().setTransform(tmpTransform);
theImage.getGraphics().drawImage(shipPic, 0, 0);
}
:
- theImage可変画像(100×100)
- shipPicイメージを介して作成された画像です。 createImage(String path)
さらに、draw(Graphics g、Point p)mを試してみました。エジプトを渡してtheImage.getGraphics()を渡し、shipPic.getGraphics()を渡します。 私は紛失しています。この問題に関するCodename Oneのドキュメントは役に立ちません。
私はいくつかの援助を得ることができますか?
必要なものすべてをカバーするかどうかは不明ですが、アニメ時計が作成されたブログの投稿があります。 https://www.codenameone.com/blog/codename-one-graphics-low-level-animations.html –