diff options
author | madmaxoft <github@xoft.cz> | 2014-01-12 10:04:16 +0100 |
---|---|---|
committer | madmaxoft <github@xoft.cz> | 2014-01-12 10:04:16 +0100 |
commit | 180b9b90993870532a8daa2ee6498005b6c3bf49 (patch) | |
tree | dac846b760b6f5fd294fbd771975dd55b0856c0d /Tools/BiomeVisualiser/BiomeViewWnd.cpp | |
parent | Fixed Linux configuration. (diff) | |
parent | Disabled a useless MSVC warning in Bindings.cpp. (diff) | |
download | cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar.gz cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar.bz2 cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar.lz cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar.xz cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.tar.zst cuberite-180b9b90993870532a8daa2ee6498005b6c3bf49.zip |
Diffstat (limited to 'Tools/BiomeVisualiser/BiomeViewWnd.cpp')
-rw-r--r-- | Tools/BiomeVisualiser/BiomeViewWnd.cpp | 64 |
1 files changed, 55 insertions, 9 deletions
diff --git a/Tools/BiomeVisualiser/BiomeViewWnd.cpp b/Tools/BiomeVisualiser/BiomeViewWnd.cpp index 5c1240bc7..7fb61c062 100644 --- a/Tools/BiomeVisualiser/BiomeViewWnd.cpp +++ b/Tools/BiomeVisualiser/BiomeViewWnd.cpp @@ -67,17 +67,41 @@ void cBiomeViewWnd::InitBiomeView(void) +void cBiomeViewWnd::SetZoom(int a_NewZoom) +{ + m_Renderer.SetZoom(a_NewZoom); + Redraw(); +} + + + + + +void cBiomeViewWnd::Redraw(void) +{ + if (m_Renderer.Render(m_Pixmap)) + { + SetTimer(m_Wnd, TIMER_RERENDER, 200, NULL); + } + InvalidateRect(m_Wnd, NULL, FALSE); +} + + + + + LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lParam) { switch (a_Msg) { - case WM_CLOSE: return OnClose(); - case WM_COMMAND: return OnCommand(wParam, lParam); + case WM_CHAR: return OnChar (wParam, lParam); + case WM_CLOSE: return OnClose (); + case WM_COMMAND: return OnCommand (wParam, lParam); case WM_LBUTTONDOWN: return OnLButtonDown(wParam, lParam); case WM_LBUTTONUP: return OnLButtonUp (wParam, lParam); case WM_MOUSEMOVE: return OnMouseMove (wParam, lParam); - case WM_PAINT: return OnPaint(); - case WM_TIMER: return OnTimer(wParam); + case WM_PAINT: return OnPaint (); + case WM_TIMER: return OnTimer (wParam); } return ::DefWindowProc(a_Wnd, a_Msg, wParam, lParam); } @@ -86,6 +110,32 @@ LRESULT cBiomeViewWnd::WndProc(HWND a_Wnd, UINT a_Msg, WPARAM wParam, LPARAM lPa +LRESULT cBiomeViewWnd::OnChar(WPARAM wParam, LPARAM lParam) +{ + switch (wParam) + { + case '1': SetZoom(1); break; + case '2': SetZoom(2); break; + case '3': SetZoom(3); break; + case '4': SetZoom(4); break; + case '5': SetZoom(5); break; + case '6': SetZoom(6); break; + case '7': SetZoom(7); break; + case '8': SetZoom(8); break; + case 27: + { + // Esc pressed, exit + PostQuitMessage(0); + break; + } + } + return 0; +} + + + + + LRESULT cBiomeViewWnd::OnClose(void) { PostQuitMessage(0); @@ -126,12 +176,8 @@ LRESULT cBiomeViewWnd::OnMouseMove(WPARAM wParam, LPARAM lParam) POINT pnt; GetCursorPos(&pnt); m_Renderer.MoveViewBy(pnt.x - m_MouseDown.x, pnt.y - m_MouseDown.y); - if (m_Renderer.Render(m_Pixmap)) - { - SetTimer(m_Wnd, TIMER_RERENDER, 200, NULL); - } m_MouseDown = pnt; - InvalidateRect(m_Wnd, NULL, FALSE); + Redraw(); return 0; } |