SFML community forums
Help => Window => Topic started by: nitram_cero on May 21, 2009, 08:38:00 pm
-
I think it has something to do with
GetClientRect(myHandle, &ActualRect);
in
WindowImplWin32::WindowImplWin32()
Maybe the Window is not completly constructed and this function returns (0,0) width/height?
It doesn't happen all the time, so it's not easily reproduced
(I think it happens because of a debug breakpoint or load times)
The sequence is:
* I create the main RenderWindow (with params).
* I then use it's dimensions (GetWidth()/GetHeight()) to create a View.
* I then get float-NaN results on RenderWindow::ConvertCoords() as the View's half size is (0, 0).
Again, this happens sometimes, so it's probably a Windows thingy
-MartÃn
-
Did you try the latest sources?
-
I am using .GetWidth/.GetHeigh with latest SVN (SFML2) and it works like it should.
-
I did, SVN updated before posting (trunk)
This happens in counted occasions, it's not common, so it's not easy traceable (thou I'm doing my best to try to solve this)
It's probably a race condition (inherent to Windows) as most of the times due to debug-step delays or heavy CPU load.
Perhaps I'm querying GetWidth/Height after window creation but before the first WM_SIZE message (that resizes it from the default (1,1) w/h)?
Is there a reason to not set myWidth/myHeight in priv::WindowImpl from parameters?
Thanks
-
Is there a reason to not set myWidth/myHeight in priv::WindowImpl from parameters?
The last 2 lines of the constructor do it. It doesn't wait for the first WM_SIZE message.
Have you tried the sfml2 branch in SVN?
-
Can't do it right away; I have a hacked Audio lib (Music & SoundBuffer) so I would need to port that to SFML2.
I'll try to port it some other time, for now I just don't set the view on frames that have window width or height = 0.
One question that has nothing to do with this: Can I deploy my app with a static hacked SFML according to the licence? Thanks.
-
Can I deploy my app with a static hacked SFML according to the licence?
Sure :)