Ejemplo n.º 1
0
   LRESULT CALLBACK Splitter::ProcessMessage(UINT message, WPARAM wParam, LPARAM lParam)
   {
      switch(message) {
      case WM_SIZE:
         Size(LOWORD(lParam), HIWORD(lParam));
         return 0;
      case WM_PAINT:
         Paint();
         return 0;
      case WM_LBUTTONDOWN:
         LButtonDown(MAKEPOINTS(lParam));
         return 0;
      case WM_LBUTTONUP:
         LButtonUp(MAKEPOINTS(lParam));
         return 0;
      case WM_MOUSEMOVE:
         if(wParam & MK_LBUTTON)
            LButtonDrag(MAKEPOINTS(lParam));
         return 0;
      case WM_CAPTURECHANGED:
         CaptureChanged();
         return 0;
      }

      return Window::ProcessMessage(message, wParam, lParam);
   }
Ejemplo n.º 2
0
//
//  FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM)
//
//  PURPOSE:  Processes messages for the main window.
//
//  WM_PAINT    - Paint the main window
//  WM_DESTROY  - post a quit message and return
//
//
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	switch (message)
	{
		case WM_CREATE:
			//初始化
			Init(hWnd, wParam, lParam);
			break;
		case WM_PAINT:
			//绘制
			Render(hWnd);
			break;
		case WM_KEYDOWN:
			//键盘按下事件
			if (GameStart) KeyDown(hWnd, wParam, lParam);
			break;
		case WM_KEYUP:
			//键盘松开事件
			if (GameStart && m_hero.alive) KeyUp(hWnd, wParam, lParam);
			break;
		case WM_MOUSEMOVE:
			//鼠标移动事件
			MouseMove(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONDOWN:
			//左鼠标事件
			LeftKeyDown = TRUE;
			LButtonDown(hWnd, wParam, lParam);
			break;
		case WM_LBUTTONUP:
			LeftKeyDown = FALSE;
			LButtonUp(hWnd, wParam, lParam);
			break;
		case WM_TIMER:
			//定时器事件
			TimerUpdate(hWnd, wParam, lParam);
			break;
		case WM_DESTROY:
			PostQuitMessage(0);
			break;
		default:
			return DefWindowProc(hWnd, message, wParam, lParam);
			break;
	}
	return 0;
}
Ejemplo n.º 3
0
WMSG_RESULT CUIBase::MouseMessage(MSG* pMsg)
{
    WMSG_RESULT ret = WMSG_FAIL;

    UINT16 x = LOWORD(pMsg->lParam);
    UINT16 y = HIWORD(pMsg->lParam);

    // 포커스가 있다면 먼저 처리하자
    CUIBase* pUI = CUIFocus::getSingleton()->getUI();

    switch (pMsg->message)
    {
    case WM_LBUTTONDOWN:
        {
            if (pUI)
                ret = pUI->LButtonDown(x, y);

            if (ret == WMSG_FAIL)
                ret = LButtonDown(x, y);
        }
        break;

    case WM_LBUTTONUP:
        {
            if (pUI)
                ret = pUI->LButtonUp(x, y);

            if (ret == WMSG_FAIL)
                ret = LButtonUp(x, y);
        }
        break;

    case WM_LBUTTONDBLCLK:
        {
            if (pUI)
                ret = pUI->LButtonDBLClick(x, y);

            if (ret == WMSG_FAIL)
                ret = LButtonDBLClick(x, y);
        }
        break;

    case WM_RBUTTONDOWN:
        {
            if (pUI)
                ret = pUI->RButtonDown(x, y);

            if (ret == WMSG_FAIL)
                ret = RButtonDown(x, y);
        }
        break;

    case WM_RBUTTONUP:
        {
            if (pUI)
                ret = pUI->RButtonUp(x, y);

            if (ret == WMSG_FAIL)
                ret = RButtonUp(x, y);
        }
        break;

    case WM_RBUTTONDBLCLK:
        {
            if (pUI)
                ret = pUI->RButtonDBLClick(x, y);

            if (ret == WMSG_FAIL)
                ret = RButtonDBLClick(x, y);
        }
        break;

    case WM_MOUSEMOVE:
        {
            if (pUI)
                ret = pUI->MouseMove(x, y, pMsg);

            if (ret == WMSG_FAIL)
                ret = MouseMove(x, y, pMsg);
        }
        break;

    case WM_MOUSEWHEEL:
        {
            int wheel = (short)HIWORD(pMsg->wParam);

            if (pUI)
                ret = pUI->MouseWheel(x, y, wheel);

            if (ret == WMSG_FAIL)
                ret = MouseWheel(x, y, wheel);
        }
        break;
    }

    return ret;
}