Skip to content

Commit

Permalink
hide cursor and process window events
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmind committed Jan 14, 2016
1 parent 978c4b4 commit ea0b7de
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/engine/Engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ void Engine::registerBlob(const std::string &name, const void *buffer)

void Engine::render(int width, int height, const glm::mat4 &viewMatrix, const glm::mat4 &projectionMatrix)
{
// process window events to avoid the window turning unresponsive
MSG msg;
while (PeekMessage(&msg, this->hwnd, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}

ResourceManager::getInstance()->update();

float time = (float)(timeGetTime() - startTime) * 0.001f * 140.0f / 60.0f;
Expand Down
5 changes: 4 additions & 1 deletion src/runner/runner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@ int main()
std::string data = loadFile("data.json");
leaf_load_data(data.c_str());

ShowCursor(FALSE);

while (!GetAsyncKeyState(VK_ESCAPE))
{
leaf_render(1280, 720);
//break;
}

ShowCursor(TRUE);

leaf_shutdown();

for (auto buffer: blobs)
Expand Down

0 comments on commit ea0b7de

Please sign in to comment.