This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Rotated sprite question


Rotated sprite question

Postby Justt » Sep 20, 2003 @ 6:28am

I'm coding a game where I need to blit a time arrow, that is, an arrow sprite that is rotated to display a little clock.

For it to work, the center of the rotation needs to be the bottom edge of the arrow, but I can't get it to work... could anyone give me some help on this simple problem?

Here is the sprite I'm using so you can get a better view of the question:

Image

I've tried looking at the GapiDraw docs but I doesn't give much information on that...
User avatar
Justt
pm Member
 
Posts: 23
Joined: Mar 23, 2003 @ 10:00pm


Postby ppcStudios » Sep 20, 2003 @ 11:27am

Since rotation is easiest if you rotate about the center, make your clock hand sprite twice the current length, with the new half a transparent color. Now the sprite will rotate about the center, and only the non-transparent portion will be visible.
G.R. Moore
President/CEO
Pocket PC Studios
www.ppcstudios.com

Image
User avatar
ppcStudios
pm Insider
 
Posts: 744
Joined: Aug 23, 2002 @ 3:53pm
Location: Canfield, Ohio


Postby Justt » Sep 20, 2003 @ 5:06pm

That's what I'm currently doing.
I just thought there may be some better way to do it...
User avatar
Justt
pm Member
 
Posts: 23
Joined: Mar 23, 2003 @ 10:00pm


Postby okku » Sep 21, 2003 @ 10:55am

One method that might work is if you rotate it in the middle and then offset the sprite. The offset is a simple trigonometric formula. Probably something like dx = cos(a)*arrow_length/2, dy = sin(a)*arrow_length/2

/Okku
okku
pm Member
 
Posts: 58
Joined: Nov 11, 2002 @ 8:51am
Location: Sweden


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum