SoftPixel Forum

Official community of the SoftPixel Engine and the SoftPixel Sandbox (REGISTRATION only with consultation with the Admin)
It is currently Wed Dec 13, 2017 10:23 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Dec 29, 2012 7:05 pm 
Offline

Joined: Sat Dec 29, 2012 10:47 am
Posts: 8
hi I think there is a bug with the way the winow size is calculated on windows

i made a small test starting from the drawing2d example

commented everything

and just draw a single rectangle
Code:
u32 startX = 50;
u32 startY = 12;

spRenderer->draw2DRectangle(dim::rect2di(startX, startY, ScrWidth-startX, ScrHeight/2),video::color::black);

where ScrWidth is 800 and ScrHeight is 600

and it looks like this

Image

apperantly the system metrics are not that reliable
check out this link
http://stackoverflow.com/questions/431470/window-border-width-and-height-in-win32-how-do-i-get-it
now i applied this in
Code:
DesktopRenderContext::createWindow

and now it looks like this

Image

i would attach a patch but i didn't see any way

Cheers
Mihai.


Top
 Profile  
 
PostPosted: Sat Dec 29, 2012 8:26 pm 
Offline
Site Admin
User avatar

Joined: Sat Jul 07, 2012 5:58 pm
Posts: 540
Location: Germany
Why are you using "DesktopRenderContext::createWindow"? It's a protected function.

And have you already looked at "DesktopRenderContext::getWindowDimension"?

When you create a graphics window with size 800x600 this is the exact size of the drawable area.
The window itself is a little bit larger because of border and caption.

_________________
My latest project:
- The XièXiè Programming Language

My hardware:
- GIGABYTE GeForce GTX 670
- Intel Core i7 (Ivy-Bridge)
- 16 GB DDR3


Top
 Profile  
 
PostPosted: Sun Dec 30, 2012 8:14 am 
Offline

Joined: Sat Dec 29, 2012 10:47 am
Posts: 8
Quote:
Why are you using "DesktopRenderContext::createWindow"? It's a protected function.

I'm not using this function directly ...i'm Saying I MODIFIED this function with the code from the link like this
Code:
        if (!isFullscreen_)
   {
      RECT rcClient, rcWind;
      POINT ptDiff;
   
      GetClientRect(Window_, &rcClient);
      GetWindowRect(Window_, &rcWind);
      ptDiff.x = (rcWind.right - rcWind.left) - rcClient.right;
      ptDiff.y = (rcWind.bottom - rcWind.top) - rcClient.bottom;
   
      MoveWindow(Window_,rcWind.left, rcWind.top, gSharedObjects.ScreenWidth + ptDiff.x,  gSharedObjects.ScreenHeight + ptDiff.y, TRUE);
   }


And yes ..i have noticed the getWindowDimension function ...
and I think that there is where the problem is ...

as the link says the system metrics are NOT RELIABLE
the size of the border or the caption or whatever windows decided to add to the window is not correct
and the better way is to resize the ClientRect to the dimension that you need .

Cheers
Mihai.


Top
 Profile  
 
PostPosted: Sun Dec 30, 2012 12:05 pm 
Offline
Site Admin
User avatar

Joined: Sat Jul 07, 2012 5:58 pm
Posts: 540
Location: Germany
Mh ok. For me it worked all the time but maybe I'll take a closer look at this before the next release.

_________________
My latest project:
- The XièXiè Programming Language

My hardware:
- GIGABYTE GeForce GTX 670
- Intel Core i7 (Ivy-Bridge)
- 16 GB DDR3


Top
 Profile  
 
PostPosted: Mon Jan 13, 2014 12:48 pm 
Offline

Joined: Mon Jan 13, 2014 12:44 pm
Posts: 1
And have you already looked at "DesktopRenderContext::getWindowDimension"?

_________________
http://www.cisco.com/
pass4sure.org
http://www.harvard.edu/
http://en.wikipedia.org/wiki/Cisco_Systems


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group