diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2004-07-22 07:47:56 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2004-07-22 07:47:56 +0000 |
commit | 1f019981e437ff4c92c183d9bcbb3907915ab3ff (patch) | |
tree | 36c14488c1278085b3d6981495bfb4c2b1dd9974 /uisimulator | |
parent | d0877aff895d7984a7eeab010e8fdf4968a26215 (diff) | |
download | rockbox-1f019981e437ff4c92c183d9bcbb3907915ab3ff.tar.gz rockbox-1f019981e437ff4c92c183d9bcbb3907915ab3ff.zip |
The win32 simulator window is now shown in the task bar, and the tick resolution is more correct, thanks to BlueChip
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4915 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'uisimulator')
-rw-r--r-- | uisimulator/win32/uisw32.c | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/uisimulator/win32/uisw32.c b/uisimulator/win32/uisw32.c index 7ccec5f42c..d2274bdc16 100644 --- a/uisimulator/win32/uisw32.c +++ b/uisimulator/win32/uisw32.c | |||
@@ -60,10 +60,13 @@ LRESULT CALLBACK GUIWndProc ( | |||
60 | static HBITMAP hBkgnd; | 60 | static HBITMAP hBkgnd; |
61 | static HDC hMemDc; | 61 | static HDC hMemDc; |
62 | 62 | ||
63 | static LARGE_INTEGER persec, tick1, ticknow; | ||
64 | |||
63 | switch (uMsg) | 65 | switch (uMsg) |
64 | { | 66 | { |
65 | case WM_TIMER: | 67 | case WM_TIMER: |
66 | current_tick++; | 68 | QueryPerformanceCounter(&ticknow); |
69 | current_tick = ((ticknow.QuadPart-tick1.QuadPart)*HZ)/persec.QuadPart; | ||
67 | return TRUE; | 70 | return TRUE; |
68 | case WM_ACTIVATE: | 71 | case WM_ACTIVATE: |
69 | if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) | 72 | if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) |
@@ -72,7 +75,10 @@ LRESULT CALLBACK GUIWndProc ( | |||
72 | bActive = false; | 75 | bActive = false; |
73 | return TRUE; | 76 | return TRUE; |
74 | case WM_CREATE: | 77 | case WM_CREATE: |
75 | SetTimer (hWnd, TIMER_EVENT, 50, NULL); | 78 | QueryPerformanceFrequency(&persec); |
79 | QueryPerformanceCounter(&tick1); | ||
80 | SetTimer (hWnd, TIMER_EVENT, 1, NULL); | ||
81 | |||
76 | // load background image | 82 | // load background image |
77 | hBkgnd = (HBITMAP)LoadImage (GetModuleHandle (NULL), MAKEINTRESOURCE(IDB_UI), | 83 | hBkgnd = (HBITMAP)LoadImage (GetModuleHandle (NULL), MAKEINTRESOURCE(IDB_UI), |
78 | IMAGE_BITMAP, 0, 0, LR_VGACOLOR); | 84 | IMAGE_BITMAP, 0, 0, LR_VGACOLOR); |
@@ -190,14 +196,15 @@ LRESULT CALLBACK GUIWndProc ( | |||
190 | 196 | ||
191 | GetClientRect (hWnd, &r); | 197 | GetClientRect (hWnd, &r); |
192 | // draw lcd screen | 198 | // draw lcd screen |
193 | StretchDIBits (hDc, | 199 | StretchDIBits (hDc, |
194 | UI_LCD_POSX * r.right / UI_WIDTH, | 200 | UI_LCD_POSX * r.right / UI_WIDTH, |
195 | UI_LCD_POSY * r.bottom / UI_HEIGHT, | 201 | UI_LCD_POSY * r.bottom / UI_HEIGHT, |
196 | UI_LCD_WIDTH * r.right / UI_WIDTH, | 202 | UI_LCD_WIDTH * r.right / UI_WIDTH, |
197 | UI_LCD_HEIGHT * r.bottom / UI_HEIGHT, | 203 | UI_LCD_HEIGHT * r.bottom / UI_HEIGHT, |
198 | 0, 0, LCD_WIDTH, LCD_HEIGHT, | 204 | 0, 0, LCD_WIDTH, LCD_HEIGHT, |
199 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, SRCCOPY); | 205 | bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, |
200 | 206 | SRCCOPY); | |
207 | |||
201 | EndPaint (hWnd, &ps); | 208 | EndPaint (hWnd, &ps); |
202 | return TRUE; | 209 | return TRUE; |
203 | } | 210 | } |
@@ -243,12 +250,13 @@ BOOL GUIStartup () | |||
243 | 250 | ||
244 | // create window | 251 | // create window |
245 | hGUIWnd = CreateWindowEx ( | 252 | hGUIWnd = CreateWindowEx ( |
246 | WS_EX_TOOLWINDOW | WS_EX_OVERLAPPEDWINDOW, | 253 | WS_EX_OVERLAPPEDWINDOW, |
247 | "RockBoxUISimulator", "ARCHOS JukeBox", | 254 | "RockBoxUISimulator", "ARCHOS JukeBox", |
248 | WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPEDWINDOW, | 255 | WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPEDWINDOW, |
249 | CW_USEDEFAULT, CW_USEDEFAULT, | 256 | CW_USEDEFAULT, CW_USEDEFAULT, |
250 | UI_WIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2 +4, | 257 | UI_WIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2 +4, |
251 | UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION) +4, | 258 | UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + |
259 | GetSystemMetrics (SM_CYSMCAPTION) +4, | ||
252 | NULL, NULL, GetModuleHandle (NULL), NULL); | 260 | NULL, NULL, GetModuleHandle (NULL), NULL); |
253 | 261 | ||
254 | if (hGUIWnd == NULL) | 262 | if (hGUIWnd == NULL) |