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

Author Topic: Different sprite width/height behavior in 1.6?  (Read 1898 times)

0 Members and 1 Guest are viewing this topic.


  • Jr. Member
  • **
  • Posts: 83
    • View Profile
    • http://blendogames.com
Different sprite width/height behavior in 1.6?
« on: April 08, 2010, 03:31:46 am »
I'm using the sprite's Width and Height parameters to resize sprites to specific pixel-specific sizes.  I just got the SFML v1.6 release today and I had a question about what seems to be a behavioral difference from v1.5.

In v1.6, a sprite's position seems to be shifting as the sprite is resized.  The larger the sprite is resized, the more the sprite's position is shifted.

Using the code below, here are pictures of the difference I'm seeing between v1.5 and v.6:

In v1.5, I can draw my resized sprite at a given location:

But when I try the same thing in v.16, the resized sprite is shifted right:

The length of the "gap" seems to be determined by how large I resize the red rectangle.

Code: [Select]

//draw little green dot at 500,300
DrawGreenDot(new Vector(500, 300));

//draw the red box
DrawBox(new Vector2(500, 300), new Vector2(400, 60));


void DrawBox(Vector2 position, Vector2 sizeVector)
Sprite s = new Sprite(Assets.sheet0);
s.SubRect = new IntRect(1,1,8,8);
s.Color = new Color(255,0,0,128);
s.Position = position;
s.Width = sizeVector.X;
s.Height = sizeVector.Y;


Am I perhaps using the Width and Height parameters incorrectly?

(I am using the .Net build)[/img]


  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Different sprite width/height behavior in 1.6?
« Reply #1 on: April 08, 2010, 04:46:35 am »
This seems to related to the scale post I made a bit earlier. Hope we get an update.


  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Different sprite width/height behavior in 1.6?
« Reply #2 on: April 08, 2010, 08:10:57 am »
Laurent Gomila - SFML developer