Skip to content

Commit ea0b7de

Browse files
committed
hide cursor and process window events
1 parent 978c4b4 commit ea0b7de

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/engine/Engine.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ void Engine::registerBlob(const std::string &name, const void *buffer)
119119

120120
void Engine::render(int width, int height, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)
121121
{
122+
// process window events to avoid the window turning unresponsive
123+
MSG msg;
124+
while (PeekMessage(&msg, this->hwnd, 0, 0, PM_REMOVE))
125+
{
126+
TranslateMessage(&msg);
127+
DispatchMessage(&msg);
128+
}
129+
122130
ResourceManager::getInstance()->update();
123131

124132
float time = (float)(timeGetTime() - startTime) * 0.001f * 140.0f / 60.0f;

src/runner/runner.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ int main()
7272
std::string data = loadFile("data.json");
7373
leaf_load_data(data.c_str());
7474

75+
ShowCursor(FALSE);
76+
7577
while (!GetAsyncKeyState(VK_ESCAPE))
7678
{
7779
leaf_render(1280, 720);
78-
//break;
7980
}
8081

82+
ShowCursor(TRUE);
83+
8184
leaf_shutdown();
8285

8386
for (auto buffer: blobs)

0 commit comments

Comments
 (0)