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

Author Topic: I don't understand scaling or drawing.  (Read 2808 times)

0 Members and 1 Guest are viewing this topic.

Sargon

  • Newbie
  • *
  • Posts: 5
    • View Profile
I don't understand scaling or drawing.
« on: October 03, 2011, 08:19:56 pm »
Hi,

I have set up SFML for drawing 2D graphics purposes.
I can draw my sprites in what seem a good position, but when I scale them, they seem misplaced.
The thing is, I developed a game with a graphics module abstraction. So I first developed it with DX9 D3DXSprite underneath the graphics module.
Now I am adding SFML to the module. Everying SEEM to work the same, except for scaled sprites. Sprites which have scaling of 1 SEEM to work ok.
The issue is that I have a life bar by putting a top part, and a bottom part and filling it in the middle. The part in the middle is actually a sprite with some width and a height of 2. I then scale the sprite to fit the amount of life, taking into account the height of the image.
Well, the issue is that in SFML, the scaled sprite doesn't seem to be placed correctly.
I have tried to play with the SetCenter, SetPosition, even Move(which I am not sure what it is doing), but no luck. It just doesn't work.
I looked at the matrix by inheriting sf::Sprite, it looked lake the scaling is correct and the position is where the top of the sprite should be(I think).
Is there any place with documentation of an equation of what SetCenter, SetPosition exactly do?

Thank you

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32498
    • View Profile
    • SFML's website
    • Email
I don't understand scaling or drawing.
« Reply #1 on: October 03, 2011, 08:31:13 pm »
If you're using SFML 1.6, it's a known bug.
Laurent Gomila - SFML developer

Sargon

  • Newbie
  • *
  • Posts: 5
    • View Profile
I don't understand scaling or drawing.
« Reply #2 on: October 03, 2011, 09:20:15 pm »
Yea, I found out your "trick" with 0.375 caused it.
Should I use SFML 2.0?

Groogy

  • Hero Member
  • *****
  • Posts: 1469
    • MSN Messenger - groogy@groogy.se
    • View Profile
    • http://www.groogy.se
    • Email
I don't understand scaling or drawing.
« Reply #3 on: October 03, 2011, 09:40:21 pm »
Yes
Developer and Maker of rbSFML and Programmer at Paradox Development Studio

Sargon

  • Newbie
  • *
  • Posts: 5
    • View Profile
I don't understand scaling or drawing.
« Reply #4 on: October 04, 2011, 12:05:46 am »
Oh I remember why I am not using SFML 2.0.
It doesn't have a solution for VS, and I don't feel like creating one. :/
I don't want to use CMake and the likes of it.
There are no binaries for VS2010 by the developer of SFML 2.0, right?

sbroadfoot90

  • Jr. Member
  • **
  • Posts: 77
    • View Profile
I don't understand scaling or drawing.
« Reply #5 on: October 04, 2011, 01:02:28 am »
Cmake is good, you should give it a go! Solved my problems with installing SFML properly.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11032
    • View Profile
    • development blog
    • Email
I don't understand scaling or drawing.
« Reply #6 on: October 04, 2011, 09:43:24 am »
CMake is really easy to use and creates a project file for VS2010, which then lets you then compile the whole library.

- Just download the GUI & SFML 2.0 from GitHub.
- Set the path to the SFML dir.
- Set a path to an install dir.
- Create the project files by clicking on generate.
- Open the INSTALL project.
- Compile ONLY the INSTALL project und you'll find the dll and lib files in your install dir you define before.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/