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

Author Topic: How can I stop SFML from resizing my sprites?  (Read 2424 times)

0 Members and 1 Guest are viewing this topic.

Yannbane

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
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).

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: How can I stop SFML from resizing my sprites?
« Reply #1 on: February 18, 2013, 06:35:05 pm »
I suggest to give this and this a read. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Yannbane

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Email
Re: How can I stop SFML from resizing my sprites?
« Reply #2 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.

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How can I stop SFML from resizing my sprites?
« Reply #3 on: February 18, 2013, 07:31:23 pm »
By the way, please post in the Help section and not in General Discussions.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: