1. Download our Official Android App: Forums for Android!

Apps Rotating Drawables

Discussion in 'Android Development' started by rock_on2109, Jan 25, 2010.

  1. rock_on2109

    rock_on2109 Lurker
    Thread Starter
    25

    Jan 10, 2010
    4
    0
    25
    A simple question:
    I am working on a game in which I have many Drawables that are drawn to a canvas. What is the easiest/most efficient way to rotate my drawables in the onDraw method.

    I have been trying this code and have achieved undesired results:

    canvas.save();
    drawableX.setBounds(x,y,x2,y2);
    drawableX.draw(canvas);
    canvas.rotate(rotation,x,y);
    canvas.restore();

    this is repeated many times with different drawables and x,y,and rotation values.

    Any help would be appreciated. Thanks in advance!
     

    Advertisement

Share This Page

Loading...