Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: How do I center a Sprite while rotating and scaling Sprite ?  (Read 2096 times)

0 Members and 1 Guest are viewing this topic.

JeZ-l-Lee

  • Jr. Member
  • **
  • Posts: 80
    • ICQ Messenger - 223180991
    • MSN Messenger - JeZLee@Live.com
    • AOL Instant Messenger - SLNTHERO@aol.com
    • View Profile
    • http://www.SilentHeroProductions.com
    • Email
How do I center a Sprite while rotating and scaling Sprite ?
« on: February 07, 2009, 09:39:32 am »
How do I center a Sprite while rotating and scaling Sprite ?

Code: [Select]
void Visuals::DisplaySpriteOntoScreenBuffer(uint16_t spriteIndex, float spriteX, float spriteY, bool centerX, sf::Color color, float scaleX, float scaleY, float rotation)
{
Sprites[spriteIndex].SetScale(scaleX, scaleX);
Sprites[spriteIndex].SetRotation(rotation);
Sprites[spriteIndex].SetCenter( (Sprites[spriteIndex].GetSize().x / 2), (Sprites[spriteIndex].GetSize().y / 2) );

if (centerX == true)
{
Sprites[spriteIndex].SetX(320); // Screen size is 640x640...
}
else  Sprites[spriteIndex].SetX(spriteX);

Sprites[spriteIndex].SetY(spriteY);

Sprites[spriteIndex].SetColor(color);

App.Draw(Sprites[spriteIndex]);
}

Above code compiles and links with zero warnings and zero errors...

Any ideas on how to make this work?
(code is from a C++ Class called "Visuals")
JeZ+Lee
Silent Hero Productions(R)
Video Game Design Studio

http://www.SilentHeroProductions.com

 

anything