SFML community forums

Help => Window => Topic started by: mvl on July 30, 2013, 09:23:17 pm

Title: resized and renderwindow getsize wrong values
Post by: mvl on July 30, 2013, 09:23:17 pm
hello I have 2 problems

1. when i first tried to make my map editor I used a render window with videomode getdesktopmode and that was okay but afterwards when i needed the screen resolution i used getsize on the render window and get a wrong with I don't know about the height I didn't need it. here is a code snippet.

sf::RenderWindow window(sf::VideoMode().getDesktopMode(), "SFML works!");
std::cout << sf::VideoMode().getDesktopMode().width << std::endl;
...

size.x = wind.getSize().x;
size.y = 32;
std::cout << size.x << " : " << size.y << std::endl;
...
 

the results on the 2 cout don't match I also see it on my drawing

2.then i tried to set a standard resolution for the program (800,600) and when the user resize's change the drawing
like this.
sf::RenderWindow window(sf::VideoMode(800,600), "SFML works!");
...
if(event.type == sf::Event::Resized)
{
        System::resized(event.size.width,event.size.height);
        std::cout << event.size.width << std::endl;
}
...
at system resized

size.x = x;
 


please help
Title: Re: resized and renderwindow getsize wrong values
Post by: Ixrec on August 04, 2013, 07:52:49 pm
Well for one, in the first snippet you're calling getSize on "wind", which hasn't been defined before.  Was that just a typo for "window" which gets initialized on the first line?

In the second snippet I have no idea what "System::resized" is, and I don't see it in the API documentation.  Is that from something outside SFML?  Also, you didn't explain what you want the second snippet to actually do.
Title: Re: resized and renderwindow getsize wrong values
Post by: mvl on August 11, 2013, 02:20:13 pm
it already fixed it it was because sfml's view was resizing at the same time