Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/session.php on line 1007: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)

Strict Standards: Non-static method utf_normalizer::nfc() should not be called statically in /www/htdocs/w006661d/anddev/includes/utf/utf_tools.php on line 1781
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4362: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4364: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4365: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4366: Cannot modify header information - headers already sent by (output started at /includes/utf/utf_tools.php:1781)
anddev.org • View topic - Rotate a bitmap around a registration point?

Rotate a bitmap around a registration point?

Put your problem here if it does not fit any of the other categories.

Rotate a bitmap around a registration point?

Postby Jorenm » Fri Dec 11, 2009 2:51 am

Right now this is what I'm using:

Code: Select all
       Matrix matrix = new Matrix();
       Float angle = new Double(Math.toDegrees(Math.atan2(targetY - shipY, targetX - shipX))).floatValue();
       matrix.postRotate(angle + 90);
       Bitmap bitmap = Bitmap.createBitmap(loader.getBitmap(mBitmap), 0, 0,
                mWidth, mHeight, matrix, true);
       int width = bitmap.getWidth();
       int height = bitmap.getHeight();       
       canvas.drawBitmap(bitmap, shipX + mX - width/2, shipY + mY - height/2, null);


It's rotating a turret bitmap to target a ship, but the rotation looks weird because it's not rotation based on a registration point that makes sense for the bitmap. Is there anyone who knows how to accomplish what I want?

Also, if anyone knows any way to improve any of the above code, it's very welcome.
Jorenm
Junior Developer
Junior Developer
 
Posts: 22
Joined: Sat Nov 28, 2009 9:16 am

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 11 guests