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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - mastermine

Pages: [1]
1
Graphics / Re: Problem with setCenter() and setRotation()
« on: October 27, 2014, 04:10:35 pm »
Thank you, Laurent  :D

I have now changed my code here and there and it's now working fine ^^

~CLOSED

2
Graphics / Problem with setCenter() and setRotation()
« on: October 27, 2014, 03:29:28 pm »
Hi there,

i am just coding a simple model-library and i have some problems with rotating the sprite by it's center.
I think the problem is somewhere by setCenter, it doesn't matter if i set the center to a new position or let it by (0, 0), it always rotates by the point (0, 0).

Here's the code:
bool ModelStatic::setRotation(Rotation rotation){
    if(!this->md_hasRotation[rotation] && this->md_perspective != Perspective::bird){
        cout << "[EIMODEL] Failed to set rotation " << rotation << " for model '" << this->md_name << "', rotation is not set for this model!" << endl;
        return false;
    }
    this->md_rotation = rotation;
       
    this->md_spBirdPerspective.setOrigin(this->md_spBirdPerspective.getGlobalBounds().width  / 2, this->md_spBirdPerspective.getGlobalBounds().height / 2);
    this->md_spBirdPerspective.setRotation((UINT)this->md_rotation * 90.0f);
    this->md_spBirdPerspective.setOrigin(0, 0);
       
    this->setSize(Vector2f(this->md_spBirdPerspective.getGlobalBounds().width, this->md_spBirdPerspective.getGlobalBounds().height));
       
    this->adjustHitbox();        
    return true;
}
 

Thanks in advance  ;)

Pages: [1]
anything