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 - Yannbane

Pages: [1]
1
I just found this:
SetCenter is not the center (middle) of the shape, which would have to be calculated from the points.

SetCenter is the center (origin) of all transformations that you apply to it (SetPosition, SetRotation, SetScale), it changes only if you call SetCenter so it is always (0, 0) by default.

It is easy to see that the shape's points and the center are completely unrelated: the formers are defined in sf::Shape while the latter is a generic attribute defined in sf::Drawable (which known nothing about its derived classes).

And yes, "center" is a confusing name, it was renamed to "origin" in SFML 2 ;)

Thanks a lot.

2
Graphics / [SOLVED] Am I setting the position of the center of the sprite?
« on: February 19, 2013, 08:33:08 pm »
After a call to the 'set_image' method of the object class, which acts as an abstraction over sf::Sprite::SetImage, I always set the sprites center to the half of images width and height.

I do this because it seems to be necessary to get Box2D rotation to work.

However, after I've set a different than default (0, 0) sprite center, does that mean that when I call sf::Sprite::SetPosition I'm actually setting the position of the center?

3
Graphics / Re: How can I stop SFML from resizing my sprites?
« on: February 18, 2013, 06:38:21 pm »
I must have messed something up, because it seems to be leaving my sprites alone now.

I'll check out SFML 2.0, thanks.

4
Graphics / How can I stop SFML from resizing my sprites?
« on: February 18, 2013, 06:03:47 pm »
I've just recently started using SFML 1.6 (the current version), for a game project of mine.

I've created a simple image manager, and various other "logic classes", but in general haven't dealt with SFML code that much... I just have a basic render loop.

When I'm creating a new graphics window, in order for my sprites to appear normal (i.e. in their original aspect ratio), I must set both width and height to the same number (I currently use 700x700 with the Close style so it doesn't get messed up when resizing).

How can I have it so that when I set the window to, say 800x600, my sprites still retain their original ratio when rendering?

As an upgrade: how can I make it so that everything contains its original ratio even when the window is being resized? I already have a custom view, but changing its width and height to event.Size.Width/Height doesn't seem to be doing anything (I'm sure I'm not just forgetting to apply the view).

Pages: [1]
anything