• 大小: 1.46MB
    文件类型: .zip
    金币: 2
    下载: 1 次
    发布日期: 2023-08-30
  • 语言: 其他
  • 标签: direct  x  3D  坦克大战  d3d  

资源简介

directx 3D 坦克大战 源码 包括坦克模型 材质 声音 等 适合看过几遍书的人,并且需要进一步提高来 阅读的代码。 非常不错

资源截图

代码片段和文件信息

#include “d3dbase.h“
#include “errorwindow.h“
#include “debugmsg.h“

cd3dbase::cd3dbase(HINSTANCE Instance int Windowstyle char *caption int dx int dy)
:cwindow(Instance Windowstyle caption dx dy)
{
cdebugmsg(DBG_HW DBGCMD_CLEAR);
cdebugmsg(DBG_HW “cd3dbase::cd3dbase()...“);
fsxres = dx;
fsyres = dy;
this->Windowstyle = Windowstyle;
/* if(Windowstyle == SW_SHOWMAXIMIZED)
fullscreen = true;
else*/
if(Windowstyle == SW_SHOWMAXIMIZED)
{
xres = fsxres;
yres = fsyres;
}
else
{
xres = clientdx;
yres = clientdy;
}
fullscreen = false;
cdebugmsg(DBG_HW “cd3dbase::cd3dbase(): calling initd3d()“);
initd3d();
}

cd3dbase::onmessage(int msg int wparam int lparam)
{
cwindow::onmessage(msg wparam lparam);
}

cd3dbase::onminimax(int Windowstyle)
{
cdebugmsg(DBG_HW “cd3dbase::onminimax()“);
bool oldfullscr = (this->Windowstyle == SW_SHOWMAXIMIZED);
bool newfullscr = (Windowstyle == SW_SHOWMAXIMIZED);
cdebugmsg(DBG_HW oldfullscr?“old mode: fullscreen“:“old mode: windowed“);
cdebugmsg(DBG_HW newfullscr?“new mode: fullscreen“:“new mode: windowed“);
cwindow::onminimax(Windowstyle);
if(Windowstyle == SW_SHOWMAXIMIZED)
{
xres = fsxres;
yres = fsyres;
}
else
{
xres = clientdx;
yres = clientdy;
}
if(oldfullscr ^ newfullscr)
{
cdebugmsg(DBG_HW “onminimax: calling reinitd3d...“);
reinitd3d();
}
}

cd3dbase::onactivate()
{
cdebugmsg(DBG_HW “cd3dbase::onactivate()“);
cwindow::onactivate();
/* if(fullscreen && Windowstyle == SW_SHOWMINIMIZED)
{
// restore fullscreen window
ShowWindow(hwnd SW_SHOWMAXIMIZED);
fullscreen = false;
}*/
}

cd3dbase::ondeactivate()
{
cdebugmsg(DBG_HW “cd3dbase::ondeactivate()“);
cwindow::ondeactivate();
if(Windowstyle == SW_SHOWMAXIMIZED)
{
// remember that the window was fullscreen
fullscreen = true;
// render to window
Windowstyle = SW_SHOWMINIMIZED;
reinitd3d();
// minimize
ShowWindow(hwnd SW_SHOWMINNOACTIVE);
}
/* if(Windowstyle == SW_SHOWMAXIMIZED)
{
// Windowstyle = SW_SHOWNORMAL;
// reinitd3d();
ShowWindow(hwnd SW_SHOWNORMAL);
}*/
}

cd3dbase::onsize(int dx int dy)
{
cdebugmsg(DBG_HW “cd3dbase::onsize()...“);
cwindow::onsize(dx dy);
if(Windowstyle != SW_SHOWMAXIMIZED)
{
xres = dx;
yres = dy;
}
}

cd3dbase::reinitd3d()
{
/* destroyd3d();
initd3d();*/
cdebugmsg(DBG_HW “cd3dbase::reinitd3d()...“);
if(Windowstyle == SW_SHOWMAXIMIZED)
{
cdebugmsg(DBG_HW “mode: fullscreen“);
  d3dpp.Windowed = FALSE;
  d3dpp.BackBufferWidth   = fsxres;
  d3dpp.BackBufferHeight  = fsyres;
  d3dpp.BackBufferFormat  = D3DFMT_A8R8G8B8;
  }
else
{
cdebugmsg(DBG_HW “mode: windowed“);
d3dpp.Windowed = TRUE;
D3DDISPLAYMODE d3ddm;
d3d->GetAdapterDisplayMode(D3DADAPTER_DEFAULT &d3ddm);
d3dpp.BackBufferFormat = d3ddm.Format;
}
d3dpp.AutoDepthStencilFormat = D3DFMT_D32;
cdebugmsg(DBG_HW “mode zbuffer

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     文件      176128  2004-06-25 14:30  Tank3.1\Tank3.exe
     文件        6417  2004-03-01 02:19  Tank3.1\Tank3.vcproj
     文件         563  2002-03-28 18:03  Tank3.1\Tank3.dsw
     文件        1218  2002-03-28 17:57  Tank3.1\window.h
     文件          72  2002-03-28 17:56  Tank3.1\tank31.h
     文件       31877  2002-06-21 23:26  Tank3.1\terra.cpp
     文件         802  2004-06-25 13:33  Tank3.1\tank31.cpp
     文件         766  2002-03-01 13:50  Tank3.1\Tank31.ico
     文件       20008  2002-07-15 14:58  Tank3.1\render.cpp
     文件        2421  2004-02-15 03:44  Tank3.1\Tank3.plg
     文件        9188  2004-06-25 14:31  Tank3.1\debughw.txt
     文件         484  2002-07-06 19:39  Tank3.1\todo.txt
     文件        6425  2002-06-15 18:45  Tank3.1\Tank3.dsp
     文件        1645  2002-03-29 17:32  Tank3.1\xFile.cpp
     文件          92  2002-03-02 17:21  Tank3.1\Rsrc.rc
     文件        2791  2002-08-18 15:01  Tank3.1\gs.cpp
     文件        4583  2002-07-14 14:52  Tank3.1\window.cpp
     文件         603  2002-05-21 21:44  Tank3.1\t3math.h
     文件         613  2002-04-30 21:37  Tank3.1\sound.h
     文件          98  2002-04-29 17:09  Tank3.1\render.h
     文件       21102  2002-04-30 21:48  Tank3.1\omil.cpp
     文件           4  2004-06-25 14:31  Tank3.1\status.txt
     文件          87  2004-06-25 14:31  Tank3.1\hardware.txt
     文件       16337  2002-08-09 16:03  Tank3.1\overlay.cpp
     文件       70609  2004-06-25 13:57  Tank3.1\tank31fct.cpp
     文件       13247  2002-08-19 14:33  Tank3.1\input.cpp
     文件         433  2004-06-25 14:30  Tank3.1\gs.h
     文件        3201  2002-04-29 23:59  Tank3.1\mission.h
     文件        5512  2002-05-01 01:29  Tank3.1\sound.cpp
     文件         850  2002-05-21 21:44  Tank3.1\t3math.cpp
     文件       30109  2002-04-29 19:23  Tank3.1\mission.cpp
............此处省略164个文件信息

评论

共有 条评论