From 1f019981e437ff4c92c183d9bcbb3907915ab3ff Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 22 Jul 2004 07:47:56 +0000 Subject: 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 --- uisimulator/win32/uisw32.c | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) (limited to 'uisimulator') 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 ( static HBITMAP hBkgnd; static HDC hMemDc; + static LARGE_INTEGER persec, tick1, ticknow; + switch (uMsg) { case WM_TIMER: - current_tick++; + QueryPerformanceCounter(&ticknow); + current_tick = ((ticknow.QuadPart-tick1.QuadPart)*HZ)/persec.QuadPart; return TRUE; case WM_ACTIVATE: if (LOWORD(wParam) == WA_ACTIVE || LOWORD(wParam) == WA_CLICKACTIVE) @@ -72,7 +75,10 @@ LRESULT CALLBACK GUIWndProc ( bActive = false; return TRUE; case WM_CREATE: - SetTimer (hWnd, TIMER_EVENT, 50, NULL); + QueryPerformanceFrequency(&persec); + QueryPerformanceCounter(&tick1); + SetTimer (hWnd, TIMER_EVENT, 1, NULL); + // load background image hBkgnd = (HBITMAP)LoadImage (GetModuleHandle (NULL), MAKEINTRESOURCE(IDB_UI), IMAGE_BITMAP, 0, 0, LR_VGACOLOR); @@ -190,14 +196,15 @@ LRESULT CALLBACK GUIWndProc ( GetClientRect (hWnd, &r); // draw lcd screen - StretchDIBits (hDc, - UI_LCD_POSX * r.right / UI_WIDTH, - UI_LCD_POSY * r.bottom / UI_HEIGHT, - UI_LCD_WIDTH * r.right / UI_WIDTH, - UI_LCD_HEIGHT * r.bottom / UI_HEIGHT, - 0, 0, LCD_WIDTH, LCD_HEIGHT, - bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, SRCCOPY); - + StretchDIBits (hDc, + UI_LCD_POSX * r.right / UI_WIDTH, + UI_LCD_POSY * r.bottom / UI_HEIGHT, + UI_LCD_WIDTH * r.right / UI_WIDTH, + UI_LCD_HEIGHT * r.bottom / UI_HEIGHT, + 0, 0, LCD_WIDTH, LCD_HEIGHT, + bitmap, (BITMAPINFO *) &bmi, DIB_RGB_COLORS, + SRCCOPY); + EndPaint (hWnd, &ps); return TRUE; } @@ -243,12 +250,13 @@ BOOL GUIStartup () // create window hGUIWnd = CreateWindowEx ( - WS_EX_TOOLWINDOW | WS_EX_OVERLAPPEDWINDOW, + WS_EX_OVERLAPPEDWINDOW, "RockBoxUISimulator", "ARCHOS JukeBox", WS_VISIBLE | WS_SYSMENU | WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, UI_WIDTH + GetSystemMetrics (SM_CXSIZEFRAME) * 2 +4, - UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + GetSystemMetrics (SM_CYSMCAPTION) +4, + UI_HEIGHT + GetSystemMetrics (SM_CYSIZEFRAME) * 2 + + GetSystemMetrics (SM_CYSMCAPTION) +4, NULL, NULL, GetModuleHandle (NULL), NULL); if (hGUIWnd == NULL) -- cgit v1.2.3