admin
管理员
管理员
  • UID1
  • 注册日期2011-05-18
  • 最后登录2022-08-22
  • 粉丝94
  • 关注0
  • 发帖数1061
  • QQ
  • 铜币1232枚
  • 威望8点
  • 银元1218个
阅读:1394回复:0

【源码编辑】给飞飞添加最小化

楼主#
更多 发布于:2012-10-07 12:52

没有最小化的窗口的确很蛋疼- -

这个简单,只需要改1-2个文件就行了

_DirectX文件夹d3dapp.cpp文件

------------------------------------------------------------------------------------------------------------

***************************

d3dapp.cpp

**************************

搜索:

!g_Option.m_bStartFullScreen

修改如下:

if( !g_Option.m_bStartFullScreen )
  {
#ifdef __ZHICHIZUIXIAOHUA
   m_dwWindowStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
    WS_MINIMIZEBOX | WS_VISIBLE;
#else

#ifdef __CSC_VER9_4
   m_dwWindowStyle = WS_OVERLAPPEDWINDOW;
#else //__CSC_VER9_4
   m_dwWindowStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
#endif //__CSC_VER9_4
   m_dwWindowStyle &= ~WS_MAXIMIZEBOX;
   m_dwWindowStyle &= ~WS_MINIMIZEBOX;
   m_dwWindowStyle &= ~WS_SYSMENU;
#endif //__ZHICHIZUIXIAOHUA
  }

 ------------------------------------------------------------------------------------------------------------

搜索:

if( m_bClipCursorWhenFullscreen && !m_bWindowed )

修改如下:

                if( m_bClipCursorWhenFullscreen && !m_bWindowed )
                    ::ClipCursor( NULL );
#else
    ClipCursor();
#endif
                //if( m_bClipCursorWhenFullscreen && !m_bWindowed )
                  //  ClipCursor( NULL );
#ifdef __ZHICHIZUIXIAOHUA
    Pause( true ); // Pause while we're minimized - xuzhu啊 绊魔
#endif //__ZHICHIZUIXIAOHUA
                m_bMinimized = true;
                m_bMaximized = false;
            }
            else if( SIZE_MAXIMIZED == wParam )

 -------------------------------------------------------------------------------------------------------------------

搜索:

if( m_bActive && m_pd3dDevice != NULL )

添加如下:

            if( m_bActive && m_pd3dDevice != NULL )
            {
                POINT ptCursor;
                GetCursorPos( &ptCursor );
                if( !m_bWindowed )
                    ScreenToClient( m_hWnd, &ptCursor );
                m_pd3dDevice->SetCursorPosition( ptCursor.x, ptCursor.y, 0 );
            }
            break;
#ifdef __ZHICHIZUIXIAOHUA
   case WM_NCMOUSEMOVE:
   //标题栏移动鼠标
    SetCursor(LoadCursor(NULL,IDC_ARROW));
    break;
#endif //__ZHICHIZUIXIAOHUA
         case WM_ENTERMENULOOP:
            // Pause the app when menus are displayed
            Pause(true);
            break;
---------------------------------------------------------------------------------------------------------

搜索:

                case SC_MONITORPOWER:
                    if( false == m_bWindowed )
                        return 1;
                    break;

添加如下:

                case SC_MONITORPOWER:
                    if( false == m_bWindowed )
                        return 1;
                    break;
#ifdef __ZHICHIZUIXIAOHUA
    case SC_CLOSE:
     //如果各种任务栏都没打开,那么没有进入游戏呢,直接关闭
     if(!g_WndMng.IsOpenWnd(APP_LOGIN) && !g_WndMng.IsOpenWnd(APP_SELECT_CHANNEL) && !g_WndMng.IsOpenWnd(APP_SELECT_SERVER)
      && !g_WndMng.IsOpenWnd(APP_SELECT_CHAR) && !g_WndMng.IsOpenWnd(APP_CREATE_CHAR))
     /*
      if(!g_WndMng.IsOpenWnd(APP_TASKBAR1024) && !g_WndMng.IsOpenWnd(APP_TASKBAR800) && !g_WndMng.IsOpenWnd(APP_TASKBAR1280)
      && !g_WndMng.IsOpenWnd(APP_TASKBAR1360W) && !g_WndMng.IsOpenWnd(APP_TASKBAR1400) && !g_WndMng.IsOpenWnd(APP_TASKBAR1440W)
      && !g_WndMng.IsOpenWnd(APP_TASKBAR1600) && !g_WndMng.IsOpenWnd(APP_TASKBAR1680W))
     {
     }
     */
     {
      if (!g_WndMng.IsOpenWnd(APP_MESSAGE_TEXT))
      {      
      g_WndMng.OpenCustomBox(NULL,new CWndQuit);
      //OpenCustomBox( NULL, new CWndQuit );
      return 1;
      }else{
       return 1;
      }
     }
     break;
#endif //__ZHICHIZUIXIAOHUA
            }
            break;

-----------------------------------------------------------------------------------------------------------------------

搜索:

HRESULT CD3DApplication::AdjustWindowForChange()

添加如下:

HRESULT CD3DApplication::AdjustWindowForChange()
{
 if( m_bFakeFullMode )
 {
  DWORD dwStyle = 0;

  if( g_Option.m_bStartFullScreen )
  {
   dwStyle = WS_POPUP|WS_VISIBLE;
  }
  else
  {
#ifndef __ZHICHIZUIXIAOHUA
  
   dwStyle = WS_OVERLAPPEDWINDOW | WS_VISIBLE;
   dwStyle &= ~WS_MAXIMIZEBOX;
   dwStyle &= ~WS_MINIMIZEBOX;
   dwStyle &= ~WS_SYSMENU;
   dwStyle &= ~WS_SIZEBOX;
#else
   dwStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME |
    WS_MINIMIZEBOX | WS_VISIBLE;
#endif //__ZHICHIZUIXIAOHUA
  }

---------------------------------------------------------------------------------------------------------------------------

搜索:

bGotMsg = ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) != 0 );

修改如下:

  if( m_bActive )
  {
            bGotMsg = ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) != 0 );
  }
        else
  {
#ifndef __ZHICHIZUIXIAOHUA
            bGotMsg = ( GetMessage( &msg, NULL, 0U, 0U ) != 0 );
#else
   bGotMsg = ( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) != 0 );
   g_dpLoginClient.Ping();
   g_dpCertified.Ping();
   g_DPlay.ReceiveMessage();
   g_dpLoginClient.ReceiveMessage();
   g_dpCertified.ReceiveMessage();
   Sleep(1);
#endif //__ZHICHIZUIXIAOHUA
  }


-------------------------------------------------------------------------------------------------------------------------

Neuz文件夹

****************************

VersionCommon.h

****************************

添加这么个东西:

#define __ZHICHIZUIXIAOHUA //游戏窗口是否支持最小化
哎...今天够累的,签到来了3...
游客

返回顶部