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

Author Topic: Question About Changing Window Size  (Read 1472 times)

0 Members and 1 Guest are viewing this topic.

DuvnjakA

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Question About Changing Window Size
« on: April 19, 2016, 06:04:59 am »
So, essentially, I'm creating a window that is (800,450) in size. Based on a boolean, I set the window equal to the desktop's resolution or keep it its current size. Afterwards, I create a rectangle that is (450,225) in size (1/4 of the window) and place it in the top left corner. However, when I use window.setSize(xxx,yyy), the rectangle shape I create gets resized with the window (even though I resize the window before creating the rectangle shape).

I can provide an example, but I've been looking through the documentation but I can't seem to figure out why resizing the window before the shape is created and/or drawn would resize the shape to still be 1/4 of the window. I've tried it with at least 10 different variations of screen sizes by simply inputting window sizes to the window.setSize() function and each time it results in the rectangleshape being resized with the window.

Any explanations? Or am I missing something that these functions do? The only explanation I can come up with is that setSize() doesn't change the actual number of pixels in the window; rather, it simply enlarges the window to a set size. I tried this with the window created as (0,0) then resized it to (800,450), and the window appeared with no shape at all.

Thanks in advance!

Laurent

  • Administrator
  • Hero Member
  • *****
  • Posts: 32504
    • View Profile
    • SFML's website
    • Email
Laurent Gomila - SFML developer

DuvnjakA

  • Newbie
  • *
  • Posts: 19
    • View Profile
    • Email
Re: Question About Changing Window Size
« Reply #2 on: April 19, 2016, 06:29:49 am »
Ahh, thank you. My mistake. I was looking through http://www.sfml-dev.org/documentation/2.0/classsf_1_1Window.php and the RectangleShape page as well.