资源简介

用DirectX实现一个美貌的女子在仙剑道院空中飘飘起舞,人见人爱!按方向键在可以在场景中行走! 开发工具和开发语言: C++ Microsoft Visual Studio 2005 Microsoft DirectX 9.0 SDK

资源截图

代码片段和文件信息

//////////////////////////////////////////////////////////////////////////////////////////////////
// 
// File: d3dUtility.cpp
// 
// Author: Frank Luna (C) All Rights Reserved
//
// System: AMD Athlon 1800+ XP 512 DDR Geforce 3 Windows XP MSVC++ 7.0 
//
// Desc: Provides utility functions for simplifying common tasks.
//          
//////////////////////////////////////////////////////////////////////////////////////////////////

#include “d3dUtility.h“

bool d3d::InitD3D(
HINSTANCE hInstance
int width int height
bool windowed
D3DDEVTYPE deviceType
IDirect3DDevice9** device)
{
//
// Create the main application window.
//

WNDCLASS wc;

wc.style         = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc   = (WNDPROC)d3d::WndProc; 
wc.cbClsExtra    = 0;
wc.cbWndExtra    = 0;
wc.hInstance     = hInstance;
wc.hIcon         = LoadIcon(0 IDI_APPLICATION);
wc.hCursor       = LoadCursor(0 IDC_ARROW);
wc.hbrBackground = (HBRUSH)GetStockobject(WHITE_BRUSH);
wc.lpszMenuName  = 0;
wc.lpszClassName = “Direct3D9App“;

if( !RegisterClass(&wc) ) 
{
::MessageBox(0 “RegisterClass() - FAILED“ 0 0);
return false;
}

HWND hwnd = 0;
hwnd = ::CreateWindow(“Direct3D9App“ “Direct3D9App“ 
WS_OVERLAPPEDWINDOW
0 0 width height
0 /*parent hwnd*/ 0 /* menu */ hInstance 0 /*extra*/); 

if( !hwnd )
{
::MessageBox(0 “CreateWindow() - FAILED“ 0 0);
return false;
}

::ShowWindow(hwnd SW_SHOW);
::UpdateWindow(hwnd);

//
// Init D3D: 
//

HRESULT hr = 0;

// Step 1: Create the IDirect3D9 object.

IDirect3D9* d3d9 = 0;
    d3d9 = Direct3DCreate9(D3D_SDK_VERSION);

    if( !d3d9 )
{
::MessageBox(0 “Direct3DCreate9() - FAILED“ 0 0);
return false;
}

// Step 2: Check for hardware vp.

D3DCAPS9 caps;
d3d9->GetDeviceCaps(D3DADAPTER_DEFAULT deviceType &caps);

int vp = 0;
if( caps.DevCaps & D3DDEVCAPS_HWTRANSFORMANDLIGHT )
vp = D3DCREATE_HARDWARE_VERTEXPROCESSING;
else
vp = D3DCREATE_SOFTWARE_VERTEXPROCESSING;

// Step 3: Fill out the D3DPRESENT_PARAMETERS structure.
 
D3DPRESENT_PARAMETERS d3dpp;
d3dpp.BackBufferWidth            = width;
d3dpp.BackBufferHeight           = height;
d3dpp.BackBufferFormat           = D3DFMT_A8R8G8B8;
d3dpp.BackBufferCount            = 1;
d3dpp.MultiSampleType            = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality         = 0;
d3dpp.SwapEffect                 = D3DSWAPEFFECT_DISCARD; 
d3dpp.hDeviceWindow              = hwnd;
d3dpp.Windowed                   = false;
d3dpp.EnableAutoDepthStencil     = true; 
d3dpp.AutoDepthStencilFormat     = D3DFMT_D24S8;
d3dpp.Flags                      = 0;
d3dpp.FullScreen_RefreshRateInHz = D3DPRESENT_RATE_DEFAULT;
d3dpp.PresentationInterval       = D3DPRESENT_INTERVAL_IMMEDIATE;

// Step 4: Create the device.

hr = d3d9->CreateDevice(
D3DADAPTER_DEFAULT // primary adapter
deviceType         // devi

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

     文件     350447  2008-02-18 21:18  xfile\aaa.X

     文件     832204  2008-02-18 21:17  xfile\body.tga

     文件        151  2008-02-07 20:32  xfile\client-224940.png

     文件     258934  2008-02-07 20:32  xfile\client-22fc20.png

     文件      35779  2008-02-07 20:32  xfile\client-23f960.png

     文件      47885  2008-02-07 20:32  xfile\client-23fb60.png

     文件     698027  2008-02-07 20:32  xfile\client-23fd40.png

     文件     113038  2008-02-07 20:32  xfile\client-23ff40.png

     文件      15305  2008-02-07 20:32  xfile\client-5dc0b20.png

     文件      23502  2008-02-07 20:32  xfile\client-5dc0ce0.png

     文件     113313  2008-02-07 20:32  xfile\client-5e21a80.png

     文件      34891  2008-02-07 20:32  xfile\client-5f12060.png

     文件      27160  2008-02-07 20:32  xfile\client-5f122a0.png

     文件      30480  2008-02-07 20:32  xfile\client-5f12480.png

     文件      51414  2008-02-07 20:32  xfile\client-6928140.png

     文件      34021  2008-02-07 20:32  xfile\client-6928e80.png

     文件      55057  2008-02-07 20:32  xfile\client-692a860.png

     文件      33704  2008-02-07 20:32  xfile\client-692b8c0.png

     文件      25018  2008-02-07 20:32  xfile\client-692ba60.png

     文件      31924  2008-02-07 20:32  xfile\client-692be40.png

     文件      37317  2008-02-07 20:32  xfile\client-692c020.png

     文件       5899  2008-02-19 02:46  xfile\d3dUtility.cpp

     文件       2530  2003-03-08 19:14  xfile\d3dUtility.h

     文件     222151  2008-02-18 19:22  xfile\Element Client-10f1d8b0.tga

     文件     241390  2008-02-18 19:22  xfile\Element Client-110e8db0.tga

     文件      56055  2008-02-18 19:22  xfile\Element Client-110f9bf0.tga

     文件      28046  2008-02-18 19:22  xfile\Element Client-112a4f30.tga

     文件     221975  2008-02-18 19:22  xfile\Element Client-113814b0.tga

     文件      30146  2008-02-18 19:22  xfile\Element Client-11545590.tga

     文件     117153  2008-02-18 19:22  xfile\Element Client-115d0dd0.tga

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

评论

共有 条评论