lk1986
骑士
骑士
  • UID64
  • 注册日期2019-03-04
  • 最后登录2020-08-21
  • 粉丝1
  • 关注0
  • 发帖数81
  • QQ15151515
  • 铜币94枚
  • 威望396点
  • 银元0个
  • 社区居民
  • 原创写手
阅读:620回复:0

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

楼主#
更多 发布于:2019-03-06 09:27
_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 //游戏窗口是否支持最小化
游客

返回顶部