Added accelerator support
This commit is contained in:
parent
694b0b21e5
commit
a50c6752fa
@ -282,6 +282,7 @@ LRESULT CALLBACK WndProc(HWND window, UINT message, WPARAM wParam, LPARAM lParam
|
|||||||
{
|
{
|
||||||
Editor_menuEvent(EDITOR_MENU_OPEN);
|
Editor_menuEvent(EDITOR_MENU_OPEN);
|
||||||
Editor_update();
|
Editor_update();
|
||||||
|
s_modifier = 0;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -330,6 +331,7 @@ static void CALLBACK timedCallback(HWND hwnd, UINT id, UINT_PTR ptr, DWORD meh)
|
|||||||
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmndLine, int show)
|
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmndLine, int show)
|
||||||
{
|
{
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
HACCEL accel;
|
||||||
bool done = false;
|
bool done = false;
|
||||||
|
|
||||||
memset(&msg, 0, sizeof(MSG));
|
memset(&msg, 0, sizeof(MSG));
|
||||||
@ -337,6 +339,8 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmndLine, i
|
|||||||
if (!createWindow("RocketEditor", 800, 600))
|
if (!createWindow("RocketEditor", 800, 600))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
accel = LoadAccelerators(instance, MAKEINTRESOURCE(IDR_ACCELERATOR));
|
||||||
|
|
||||||
// Update timed function every 16 ms
|
// Update timed function every 16 ms
|
||||||
|
|
||||||
SetTimer(s_window, 1, 16, timedCallback);
|
SetTimer(s_window, 1, 16, timedCallback);
|
||||||
@ -345,14 +349,12 @@ int WINAPI WinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmndLine, i
|
|||||||
{
|
{
|
||||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
|
||||||
{
|
{
|
||||||
if (msg.message == WM_QUIT)
|
if (!TranslateAccelerator(s_window, accel, &msg))
|
||||||
{
|
|
||||||
done = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
|
if (WM_QUIT == msg.message)
|
||||||
|
done = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user