SFML community forums
Help => Window => Topic started by: DuvnjakA 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!
-
http://www.sfml-dev.org/tutorials/2.3/graphics-view.php#showing-more-when-the-window-is-resized
-
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.