@@ -233,6 +233,13 @@ bool ContextImpl::GetSize(uint32_t& widthOut, uint32_t& heightOut) const {
233233 heightOut = rect.bottom - rect.top ;
234234 return true ;
235235}
236+ bool ContextImpl::GetSizeInPixels (uint32_t & widthOut, uint32_t & heightOut) const {
237+ RECT rect;
238+ ::GetWindowRect (mWindow , &rect);
239+ widthOut = rect.right - rect.left ;
240+ heightOut = rect.bottom - rect.top ;
241+ return true ;
242+ }
236243bool ContextImpl::SetSizeDirectly (uint32_t width, uint32_t height, bool resizable) {
237244 // TODO: resizable
238245 return ::SetWindowPos (mWindow , nullptr , 0 , 0 , width, height,
@@ -339,7 +346,7 @@ void ContextImpl::RunSingleFrame() {
339346
340347 // draw
341348 uint32_t width = 0 , height = 0 ;
342- instance->GetSize (width, height);
349+ instance->GetSizeInPixels (width, height);
343350 GL::defaultFramebuffer.setViewport ({{}, {static_cast <int >(width), static_cast <int >(height)}});
344351 GL::defaultFramebuffer.clearColor (instance->mClearColor );
345352 GL::defaultFramebuffer.clear (GL::FramebufferClear::Color | GL::FramebufferClear::Depth);
@@ -431,4 +438,4 @@ void ContextImpl::DestroyWglContext() {
431438 mWglContext = nullptr ;
432439 mDeviceContext = nullptr ;
433440}
434- } // namespace kitgui::win32
441+ } // namespace kitgui::win32
0 commit comments