1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#include "hMsg.h"
using namespace EEngine;
hMsg::hMsg(OGLAbstr* GL)
{
gl = GL;
stop = true;
}
hMsg::~hMsg()
{
}
LRESULT CALLBACK hMsg::WndProcGame(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY: PostQuitMessage(0); break;
case WM_COMMAND: //app->regPress(hWnd, msg, wParam, lParam);
break;
case WM_SIZE: //app->regSize(hWnd, msg, wParam, lParam);
break;
case WM_RBUTTONUP: //app->regPopup(LOWORD(lParam), HIWORD(lParam));
break;
}
return (DefWindowProc(hWnd, msg, wParam, lParam));
}
LRESULT CALLBACK hMsg::WndProcEditor(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (msg)
{
case WM_DESTROY:
PostQuitMessage(0);
break;
case WM_COMMAND:
MenuProc(hWnd, msg, wParam, lParam);
break;
case WM_SIZE: resize(hWnd, msg, wParam, lParam);
break;
case WM_RBUTTONUP: //app->regPopup(LOWORD(lParam), HIWORD(lParam));
break;
default:
DefWindowProc(hWnd, msg, wParam, lParam);
break;
}
return (DefWindowProc(hWnd, msg, wParam, lParam));
}
LRESULT CALLBACK hMsg::MenuProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch (lParam)
{
//default:
//DefWindowProc(hWnd, msg, wParam, lParam);
}
switch (wParam)
{
case ID_FILE_EXIT:
PostQuitMessage(0);
break;
default:
DefWindowProc(hWnd, msg, wParam, lParam);
}
return (DefWindowProc(hWnd, msg, wParam, lParam));
}
void hMsg::pumpMessage()
{
if(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
if(msg.message == WM_QUIT)
{
stop = false;
}
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
LRESULT CALLBACK hMsg::resize(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
resizeView(); //Here
return(0);
}
void hMsg::resizeView()
{
#ifdef _GAME
RECT rRect; GetClientRect(gl->Window, &rRect);
#endif
#ifdef _EDITOR
RECT rRect; GetClientRect(gl->RenderWindow, &rRect);
#endif
glViewport(0, 0, rRect.right, rRect.bottom);
}
|