OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 #include <tchar.h> | 9 #include <tchar.h> |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 MSG msg = { 0 }; | 65 MSG msg = { 0 }; |
66 | 66 |
67 double currentTime = 0.0; | 67 double currentTime = 0.0; |
68 double previousTime = 0.0; | 68 double previousTime = 0.0; |
69 | 69 |
70 // Main message loop | 70 // Main message loop |
71 while (WM_QUIT != msg.message) { | 71 while (WM_QUIT != msg.message) { |
72 if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { | 72 if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) { |
73 TranslateMessage(&msg); | 73 TranslateMessage(&msg); |
74 DispatchMessage(&msg); | 74 DispatchMessage(&msg); |
75 } | 75 } else { |
76 | 76 previousTime = currentTime; |
77 previousTime = currentTime; | 77 currentTime = now_ms(); |
78 currentTime = now_ms(); | 78 app->onIdle(currentTime - previousTime); |
79 app->onIdle(currentTime - previousTime); | 79 } |
80 } | 80 } |
81 | 81 |
82 delete app; | 82 delete app; |
83 | 83 |
84 return (int)msg.wParam; | 84 return (int)msg.wParam; |
85 } | 85 } |
OLD | NEW |