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