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

Author Topic: Rectangle size 1/2 = 2/4?  (Read 1427 times)

0 Members and 1 Guest are viewing this topic.

terabin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Rectangle size 1/2 = 2/4?
« on: May 23, 2018, 06:37:13 pm »
I trying to create a rectangle of size 1 width 2 height, but in the screen appears a 2 width 4 height.

Here is the code:
      sf::RectangleShape *rectangle = new sf::RectangleShape;

      rectangle->setSize(sf::Vector2f(width, height));
      rectangle->setFillColor(sf::Color(color[0], color[1], color[2], color[3]));

      rectangle->setPosition(x, y);
      rectangle->move(offx * -1, offy * -1);
      rectangle->setFillColor(sf::Color(oColor.r, oColor.g, oColor.b, opacity));



eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Rectangle size 1/2 = 2/4?
« Reply #1 on: May 23, 2018, 08:03:10 pm »
Not sure what you mean, do you have a screenshot?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

terabin

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Rectangle size 1/2 = 2/4?
« Reply #2 on: May 23, 2018, 10:11:43 pm »
I have created 7 rectangles of 1 width and 2 height to create a rain effect.

Look the result:


Each rectangle is 2/4 and not 1/2

Hapax

  • Hero Member
  • *****
  • Posts: 3379
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: Rectangle size 1/2 = 2/4?
« Reply #3 on: May 24, 2018, 05:07:18 pm »
Is your view zoomed or resized?

Might need a bit more (preferably minimal and complete example) code.
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything