飞飞迷 > 源码修改 > 给《飞飞》添加最小化功能

给《飞飞》添加最小化功能

来源:飞飞迷 发布时间:2015-07-04 浏览:

_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 //游戏窗口是否支持最小化

历史版本

  • V19.飞你莫属
  • 11-11-24V18.翱翔重生
  • 11-04-13V17.龙的逆袭
  • 10-12-13V16.神采飞扬
  • 10-04-16V15.羽化飞天
  • 09-11-04V14.翼之降临