| 195 | |
| 196 | |
| 197 | void DisplayImage() |
| 198 | { |
| 199 | static PAINTSTRUCT ps; |
| 200 | static __int64 CurTime; |
| 201 | static double TimeElapsed; |
| 202 | |
| 203 | // Not created yet. |
| 204 | if (Durations == NULL || BmpInfo == NULL || Bitmaps == NULL) |
| 205 | return; |
| 206 | |
| 207 | if (!IsPaused) { |
| 208 | QueryPerformanceCounter((LARGE_INTEGER*)&CurTime); |
| 209 | TimeElapsed = (CurTime - StartTime) * TimerRes; |
| 210 | if (TimeElapsed * 1000 > Durations[CurImage]) { |
| 211 | StartTime = CurTime; |
| 212 | CurImage++; |
| 213 | if (CurImage >= NumImages) { |
| 214 | CurImage = 0; |
| 215 | } |
| 216 | SelectObject(hMemDC, Bitmaps[CurImage]); |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | hDC = BeginPaint(HWnd, &ps); |
| 221 | BitBlt(hDC, 0, 0, (WORD)BmpInfo[CurImage].biWidth, (WORD)BmpInfo[CurImage].biHeight, |
| 222 | hMemDC, 0, 0, SRCCOPY); |
| 223 | EndPaint(HWnd, &ps); |
| 224 | |
| 225 | return; |
| 226 | } |
| 227 | |
| 228 | |
| 229 | // Window procedure, handles all messages for this program |