資源簡介
有開發(fā)詳細說明文檔和PPT,當(dāng)然包括源代碼
代碼片段和文件信息
//?CHECK?MARKER
/**************************************************
Core_Graphics.cpp
GameCore?Component
Programming?Role-Playing?Games?with?DirectX?2nd?Edition
by?Jim?Adams?(Jan?2004)
**************************************************/
#include?“Core_Global.h“
#include?“rmxftmpl.h“
#include?“rmxfguid.h“
#include?“dxutil.h“
//#include?“myplus.h“
cGraphics::cGraphics()
{
??m_hWnd?=?NULL;
??
??m_pD3D?=?NULL;
??m_pD3DDevice?=?NULL;
??m_pSprite?=?NULL;
??m_AmbientRed?=?m_AmbientGreen?=?m_AmbientBlue?=?255;
??m_Width??=?0;
??m_Height?=?0;
??m_BPP????=?0;
??m_Windowed?=?TRUE;
??m_ZBuffer??=?FALSE;
??m_HAL??????=?FALSE;
}
cGraphics::~cGraphics()
{
??Shutdown();
}
BOOL?cGraphics::Init()
{
??Shutdown();
??if((m_pD3D?=?Direct3DCreate9(D3D_SDK_VERSION))?==?NULL)
????return?FALSE;
??return?TRUE;
}
BOOL?cGraphics::SetMode(HWND?hWnd?BOOL?Windowed?BOOL?UseZBuffer?long?Width?long?Height?char?BPP)
{
??D3DPRESENT_PARAMETERS?d3dpp;
??D3DFORMAT?????????????Format?AltFormat;
??RECT??????????????????WndRect?ClientRect;
??long??????????????????WndWidth?WndHeight;
??float?????????????????Aspect;
??//?Error?checking
??if((m_hWnd?=?hWnd)?==?NULL)
????return?FALSE;
??if(m_pD3D?==?NULL)
????return?FALSE;
??//?Get?the?current?display?format
??if(FAILED(m_pD3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT?&m_d3ddm)))
????return?FALSE;
??//?Configure?width
??if(!Width)?{
????//?Default?to?screen?width?if?fullscreen
????if(Windowed?==?FALSE)?{
??????m_Width?=?m_d3ddm.Width;
????}?else?{
??????//?Otherwise?grab?from?client?size
??????GetClientRect(m_hWnd?&ClientRect);
??????m_Width?=?ClientRect.right;
????}
??}?else?{
????m_Width?=?Width;
??}
??//?Configure?height
??if(!Height)?{
????//?Default?to?screen?height?if?fullscreen
????if(Windowed?==?FALSE)?{
??????m_Height?=?m_d3ddm.Height;
????}?else?{
??????//?Otherwise?grab?from?client?size
??????GetClientRect(m_hWnd?&ClientRect);
??????m_Height?=?ClientRect.bottom;
????}
??}?else?{
????m_Height?=?Height;
??}
??//?Configure?BPP
??if(!(m_BPP?=?BPP)?||?Windowed?==?TRUE)?{
????if(!(m_BPP?=?GetFormatBPP(m_d3ddm.Format)))
??????return?FALSE;
??}
??//?Resize?client?window?if?using?windowed?mode
??if(Windowed?==?TRUE)?{
????GetWindowRect(m_hWnd?&WndRect);
????GetClientRect(m_hWnd?&ClientRect);
????WndWidth??=?(WndRect.right??-?(ClientRect.right??-?m_Width))??-?WndRect.left;
????WndHeight?=?(WndRect.bottom?-?(ClientRect.bottom?-?m_Height))?-?WndRect.top;
????MoveWindow(m_hWnd?WndRect.left?WndRect.top?WndWidth?WndHeight?TRUE);
??}
??//?Clear?presentation?structure
??ZeroMemory(&d3dpp?sizeof(D3DPRESENT_PARAMETERS));
??
??//?Default?to?no?hardware?acceleration?detected
??m_HAL?=?FALSE;
??//?Setup?Windowed?or?fullscreen?usage
??if((m_Windowed?=?Windowed)?==?TRUE)?{
????d3dpp.Windowed?????????=?TRUE;
????d3dpp.SwapEffect???????=?D3DSWAPEFFECT_DISCARD;
????d3dpp.BackBufferFormat?=?
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2013-06-22?23:16??GameCore\
?????文件?????????763??2007-10-16?16:44??GameCore\Core_Global.h
?????文件???????74409??2008-05-26?11:40??GameCore\Core_Graphics.cpp
?????文件???????26898??2008-05-11?22:28??GameCore\Core_Graphics.h
?????文件???????12818??2007-10-16?16:44??GameCore\Core_Input.cpp
?????文件????????7772??2007-10-16?16:44??GameCore\Core_Input.h
?????文件???????24318??2007-10-16?16:44??GameCore\Core_Network.cpp
?????文件????????6563??2007-10-16?16:44??GameCore\Core_Network.h
?????文件???????31633??2008-05-19?16:55??GameCore\Core_Sound.cpp
?????文件????????6612??2008-05-19?16:59??GameCore\Core_Sound.h
?????文件????????8549??2008-02-17?22:02??GameCore\Core_System.cpp
?????文件????????2970??2008-05-18?21:23??GameCore\Core_System.h
?????目錄???????????0??2013-06-23?21:58??GameCore\Debug\
?????文件???????12533??2008-02-17?16:46??GameCore\SPE.h
?????文件????????2298??2008-02-17?11:27??GameCore\SPEArray.h
?????文件?????????748??2008-02-09?15:15??GameCore\SPEGeometry.h
?????文件?????????537??2008-01-26?11:15??GameCore\SPELib.h
?????文件????????1885??2008-05-06?13:36??GameCore\SPEMesh.h
?????文件????????2176??2008-02-06?11:26??GameCore\SPEPhysics.h
?????文件????????4363??2008-05-11?13:09??GameCore\SPEUtil.h
?????文件????????9397??2008-01-31?17:30??GameCore\SPEVector_Matrix.h
?????文件???????37459??2007-05-10?20:26??GameCore\dxutil.cpp
?????文件????????8243??2008-05-06?18:22??GameCore\dxutil.h
?????文件????????3347??2008-05-06?18:21??GameCore\myplus.h
?????文件?????????685??2008-05-16?22:09??GameCore\resource.h
?????文件???????75265??2008-05-10?00:08??GameCore\復(fù)件?Core_Graphics.cpp
?????文件?????????709??2008-05-20?17:48??Racecar.exe.lnk
?????文件?????????699??2008-05-20?17:48??Server.exe.lnk
?????文件????????1000??2008-05-26?23:10??readme.txt
?????文件??????336384??2008-05-26?15:25??幫助文檔.doc
?????文件???????56320??2008-05-26?16:48??開發(fā)文檔.doc
............此處省略137個文件信息
評論
共有 條評論