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

Author Topic: resized and renderwindow getsize wrong values  (Read 2548 times)

0 Members and 2 Guests are viewing this topic.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
resized and renderwindow getsize wrong values
« 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

Ixrec

  • Hero Member
  • *****
  • Posts: 1241
    • View Profile
    • Email
Re: resized and renderwindow getsize wrong values
« Reply #1 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.

mvl

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • Email
Re: resized and renderwindow getsize wrong values
« Reply #2 on: August 11, 2013, 02:20:13 pm »
it already fixed it it was because sfml's view was resizing at the same time

 

anything