Renderer ignores window resized messages
This commit is contained in:
parent
471b6983cd
commit
97526a67b5
|
|
@ -668,7 +668,7 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
|
|||
if (is_fullscreen_)
|
||||
{
|
||||
// TODO restore to fullscreen mode
|
||||
// Renderer::GetInstance().SetResolution();
|
||||
// SetResolution();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -705,7 +705,17 @@ LRESULT WindowWin32Impl::MessageProc(HWND hwnd, UINT32 msg, WPARAM wparam, LPARA
|
|||
{
|
||||
KGE_SYS_LOG("The display resolution has changed");
|
||||
|
||||
::InvalidateRect(hwnd, NULL, FALSE);
|
||||
// Check fullscreen state
|
||||
auto d3d_res = graphics::directx::GetD3DDeviceResources();
|
||||
auto swap_chain = d3d_res->GetDXGISwapChain();
|
||||
if (swap_chain)
|
||||
{
|
||||
BOOL is_fullscreen = FALSE;
|
||||
if (SUCCEEDED(swap_chain->GetFullscreenState(&is_fullscreen, nullptr)))
|
||||
{
|
||||
is_fullscreen_ = !!is_fullscreen;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,11 +44,7 @@ void Renderer::DestroyModule()
|
|||
|
||||
void Renderer::HandleEvent(Event* evt)
|
||||
{
|
||||
if (evt->IsType<WindowResizedEvent>())
|
||||
{
|
||||
auto window_evt = dynamic_cast<WindowResizedEvent*>(evt);
|
||||
Resize(window_evt->width, window_evt->height);
|
||||
}
|
||||
// DO NOTHING
|
||||
}
|
||||
|
||||
void Renderer::BeginDraw()
|
||||
|
|
|
|||
|
|
@ -55,6 +55,18 @@ public:
|
|||
/// @brief 获取清屏颜色
|
||||
virtual Color GetClearColor() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取渲染输出大小
|
||||
Size GetOutputSize() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取渲染上下文
|
||||
RenderContext& GetContext();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 重设渲染输出大小
|
||||
virtual void Resize(uint32_t width, uint32_t height) = 0;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 设置清屏颜色
|
||||
virtual void SetClearColor(const Color& clear_color);
|
||||
|
|
@ -206,14 +218,6 @@ public:
|
|||
virtual RenderContextPtr CreateTextureRenderContext(Texture& texture, const Size* desired_size = nullptr) = 0;
|
||||
|
||||
public:
|
||||
/// \~chinese
|
||||
/// @brief 获取渲染上下文
|
||||
RenderContext& GetContext();
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 获取渲染输出大小
|
||||
Size GetOutputSize() const;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 开始渲染
|
||||
virtual void BeginDraw();
|
||||
|
|
@ -231,10 +235,6 @@ public:
|
|||
/// @throw kiwano::SystemError 呈现失败时抛出
|
||||
virtual void Present() = 0;
|
||||
|
||||
/// \~chinese
|
||||
/// @brief 重设渲染输出大小
|
||||
virtual void Resize(uint32_t width, uint32_t height) = 0;
|
||||
|
||||
public:
|
||||
void SetupModule() override;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue