Jump to content

Windowed Programs Are Incorrect Size


gamecreator
 Share

Recommended Posts

I believe Windowed programs are short several pixels in each direction. The below is an illustration showing just the Y axis but this applies to X as well.

 

dqk7mb.gif

 

This is created with the default code:

window = Window::Create("App");
context = Context::Create(window);

 

And the following displays the above:

context->DrawText("window->GetHeight(): " + String(window->GetHeight()),5,10);
context->DrawText("window->GetMousePosition().y: " + String(window->GetMousePosition().y),5,40);

 

This matters because if you try to draw, say, a health bar at the bottom, the code would have to detect and compensate for the difference between windowed and full screen (and also from Windows and Android and probably iOS as well as the above code creates a windowed app in Windows but full-screen on mobile). I believe GetHeight/GetWidth, the maximum mouse position on screen and the maximum touch position on screen should be the same no matter what (excepting maybe a pixel for starting at 0).

Link to comment
Share on other sites

This is a difficult situation because with Aero Microsoft broke the functionality of the Windows API to create a window of a specific size. Really. There's a bug report somewhere on this forum with a link to their actual documentation explaining this.

  • Upvote 1

 

 

Link to comment
Share on other sites

Thanks but I think I may have accidentally stumbled on at least a temporary workaround. I was looking through all functions and came across window->GetClientHeight(). So now...

 

Windows

GetHeight(): 768

GetClientHeight(): 740

 

Android

GetHeight(): 736

GetClientHeight(): 736

 

Any idea how GetClientHeight/Width relate to all this? I know they're undocumented so I need to use with caution but it helps me debug on Windows without testing on Android (saving me time).

Link to comment
Share on other sites

ClientWidth/Height should return the size of the window client...the size inside the window. Which should be the same as the context width/height, but since it is a command that relies on the Win32 API, who knows what it returns.

 

Context::GetWidth()/Height() will return the exact size of the renderable area. I think that is what you are after.

  • Upvote 1

 

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...