• 大小: 4.7MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-09-15
  • 语言: 其他
  • 标签: DirectX  龙书  

资源简介

是学习DirectX的一本红龙书的原书代码,里边共含有19个章节的代码可供参考。

资源截图

代码片段和文件信息

//////////////////////////////////////////////////////////////////////////////////////////////////
// 
// File: d3dinit.cpp
// 
// Author: Frank Luna (C) All Rights Reserved
//
// System: AMD Athlon 1800+ XP 512 DDR Geforce 3 Windows XP MSVC++ 7.0 
//
// Desc: Demonstrates how to initialize Direct3D how to use the book‘s framework
//       functions and how to clear the screen to black.  Note that the Direct3D
//       initialization code is in the d3dUtility.h/.cpp files.
//          
//////////////////////////////////////////////////////////////////////////////////////////////////

#include “d3dUtility.h“

//
// Globals
//

IDirect3DDevice9* Device = 0; 

//
// framework Functions
//

bool Setup()
{
// Nothing to setup in this sample.

return true;
}

void Cleanup()
{
// Nothing to cleanup in this sample.
}

bool Display(float timeDelta)
{
if( Device ) // Only use Device methods if we have a valid device.
{
// Instruct the device to set each pixel on the back buffer black -
// D3DCLEAR_TARGET: 0x00000000 (black) - and to set each pixel on
// the depth buffer to a value of 1.0 - D3DCLEAR_ZBUFFER: 1.0f.
Device->Clear(0 0 D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER 0x00000000 1.0f 0);

// Swap the back and front buffers.
Device->Present(0 0 0 0);
}
return true;
}

//
// WndProc
//
LRESULT CALLBACK d3d::WndProc(HWND hwnd UINT msg WPARAM wParam LPARAM lParam)
{
switch( msg )
{
case WM_DESTROY:
::PostQuitMessage(0);
break;

case WM_KEYDOWN:
if( wParam == VK_ESCAPE )
::DestroyWindow(hwnd);
break;
}
return ::DefWindowProc(hwnd msg wParam lParam);
}

//
// WinMain
//
int WINAPI WinMain(HINSTANCE hinstance
   HINSTANCE prevInstance 
   PSTR cmdLine
   int showCmd)
{
if(!d3d::InitD3D(hinstance
640 480 true D3DDEVTYPE_HAL &Device))
{
::MessageBox(0 “InitD3D() - FAILED“ 0 0);
return 0;
}

if(!Setup())
{
::MessageBox(0 “Setup() - FAILED“ 0 0);
return 0;
}

d3d::EnterMsgLoop( Display );

Cleanup();

Device->Release();

return 0;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      31823  2003-05-03 15:44  红龙书_源码\Chapter 1\D3D9 Init\chap1_0.jpg

     文件       2148  2003-03-08 10:30  红龙书_源码\Chapter 1\D3D9 Init\d3dInit.cpp

     文件       4197  2003-03-08 10:32  红龙书_源码\Chapter 1\D3D9 Init\d3dUtility.cpp

     文件       1263  2003-03-08 10:16  红龙书_源码\Chapter 1\D3D9 Init\d3dUtility.h

     文件       5523  2002-08-08 12:44  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\brick0.jpg

     文件       4860  2002-08-08 12:44  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\brick1.jpg

     文件      41376  2003-05-03 15:57  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\chap10_0.jpg

     文件      14550  2002-10-09 18:25  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\checker.jpg

     文件       5828  2003-03-08 18:51  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\d3dUtility.cpp

     文件       2530  2003-03-08 18:51  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\d3dUtility.h

     文件      12262  2003-04-22 12:48  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\d3dxcreatemeshfvf.cpp

     文件       2574  2003-05-03 14:02  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\Mesh Dump.txt

     文件         52  2002-08-08 12:54  红龙书_源码\Chapter 10\D3DXCreateMeshFVF\texture credit.txt

     文件     480915  2002-09-20 15:06  红龙书_源码\Chapter 11\Bounding Volumes\bigship1.x

     文件       7705  2003-05-03 15:48  红龙书_源码\Chapter 11\Bounding Volumes\boundingvolumes.cpp

     文件      41567  2003-05-03 15:57  红龙书_源码\Chapter 11\Bounding Volumes\chap11_2.jpg

     文件       6340  2003-03-08 19:22  红龙书_源码\Chapter 11\Bounding Volumes\d3dUtility.cpp

     文件       2985  2003-03-08 19:22  红龙书_源码\Chapter 11\Bounding Volumes\d3dUtility.h

     文件     480915  2002-09-20 15:06  红龙书_源码\Chapter 11\Progressive Mesh\bigship1.x

     文件      59454  2003-05-03 15:57  红龙书_源码\Chapter 11\Progressive Mesh\chap11_1.jpg

     文件       5828  2003-03-08 19:19  红龙书_源码\Chapter 11\Progressive Mesh\d3dUtility.cpp

     文件       2530  2003-03-08 19:19  红龙书_源码\Chapter 11\Progressive Mesh\d3dUtility.h

     文件       7022  2003-05-03 15:48  红龙书_源码\Chapter 11\Progressive Mesh\pmesh.cpp

     文件     480915  2002-09-20 15:06  红龙书_源码\Chapter 11\XFile\bigship1.x

     文件      47023  2003-05-03 15:57  红龙书_源码\Chapter 11\XFile\chap11_0.jpg

     文件       5828  2003-03-08 19:14  红龙书_源码\Chapter 11\XFile\d3dUtility.cpp

     文件       2530  2003-03-08 19:14  红龙书_源码\Chapter 11\XFile\d3dUtility.h

     文件       5239  2003-04-22 12:53  红龙书_源码\Chapter 11\XFile\xfile.cpp

     文件       3822  2003-03-08 20:04  红龙书_源码\Chapter 12\Camera\camera.cpp

     文件       1329  2003-03-08 20:04  红龙书_源码\Chapter 12\Camera\camera.h

............此处省略292个文件信息

评论

共有 条评论