简体   繁体   English

在哪里可以找到“使用DirectX 9.0c进行3D游戏编程简介”的源代码示例?

[英]Where can I find the source code examples for “Introduction to 3D game programming with DirectX 9.0c”?

I have a book : "Introduction to 3D game programming with DirectX 9.0c– a shader approach" by Frank Luna. 我有一本书:“使用DirectX 9.0c进行3D游戏编程的介绍 - 一种着色器方法”,由Frank Luna提供。

The official site is dead and I can't seem to find 3 main files used for all the projects. 官方网站已经死了,我似乎无法找到用于所有项目的3个主要文件。

  • d3dApp.h d3dApp.h
  • d3dApp.cpp d3dApp.cpp
  • d3dUtil.h d3dUtil.h

Does someone know where can I get them? 有人知道我在哪里可以得到它们吗?

All I have found was this : 我发现的只有这个:

But there is no source there. 但那里没有消息来源。 Also I've found some fragments 我也发现了一些碎片

//A sample directX demo outputting some flashing color text

#include "d3dApp.h"
#include <tchar.h>
#include <crtdbg.h>

//Our application is derived from the D3DAPP class, making setup for a game 
//or other program easier in the long run
class HelloD3DApp : public D3DApp
{
public:
    HelloD3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP);
    ~HelloD3DApp();

    bool checkDeviceCaps();
    void onLostDevice();
    void onresetDevice();
    void updateScene(float dt);
    void drawScene();

private:

    ID3DXFont* mFont;
};

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE prevInstance,
                   PSTR cmdLine, int showCmd)
{
    // Enable run-time memory check for debug builds.
    #if defined(DEBUG) | defined(_DEBUG)
        _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
    #endif


    HelloD3DApp app(hInstance, "Hello Direct3D", D3DDEVTYPE_HAL, D3DCREATE_HARDWARE_VERTEXPROCESSING);
    gd3dApp = &app;

    return gd3dApp->run();
}

HelloD3DApp::HelloD3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP)
: D3DApp(hInstance, winCaption, devType, requestedVP)
{
    srand(time_t(0));

    if(!checkDeviceCaps())
    {
        MessageBox(0, "checkDeviceCaps() Failed", 0, 0);
        PostQuitMessage(0);
    }

    LOGFONTA font;
    font.lfHeight          = 80;
                font.lfWidth            = 40;
    font.lfEscapement       = 0;
    font.lfOrientation      = 0;
                font.lfWeight          = FW_BOLD;
                font.lfItalic          = true;
    font.lfUnderline        = false;
    font.lfStrikeOut        = false;
                font.lfCharSet        = DEFAULT_CHARSET;
                font.lfOutPrecision  = OUT_DEFAULT_PRECIS;
    font.lfClipPrecision    = CLIP_CHARACTER_PRECIS;
                font.lfQuality        = DEFAULT_QUALITY;
                font.lfPitchAndFamily   = DEFAULT_PITCH | FF_DONTCARE;
               _tcscpy(font.lfFaceName, _T("Times New Roman"));

    HR(D3DXCreateFontIndirect(gd3dDevice, &font, &mFont));
}

HelloD3DApp::~HelloD3DApp()
{
    ReleaseCOM(mFont);
}

bool HelloD3DApp::checkDeviceCaps()
{
    // Nothing to check.
    return true;
}

void HelloD3DApp::onLostDevice()
{
    HR(mFont->OnLostDevice());
}

void HelloD3DApp::onresetDevice()
{
    HR(mFont->onresetDevice());
}

void HelloD3DApp::updateScene(float dt)
{
}

void HelloD3DApp::drawScene()
{
    HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255, 255, 255), 1.0f, 0));

    RECT formatRect;
    GetClientRect(mhMainWnd, &formatRect);

    HR(gd3dDevice->BeginScene());

    mFont->DrawText(TEXT("Hello </DIC>!"), -1, 
        &formatRect, DT_CENTER | DT_VCENTER, 
        D3DCOLOR_XRGB(rand() % 256, rand() % 256, rand() % 256));

    HR(gd3dDevice->EndScene());
    HR(gd3dDevice->Present(0, 0, 0, 0));
}

But these does not help me either. 但这些对我也没有帮助。

d3dApp.h d3dApp.h

d3dApp.cpp d3dApp.cpp

d3dUtil.h d3dUtil.h

These are the same files as in the zip file. 这些文件与zip文件中的文件相同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在“使用DirectX 11进行3D游戏编程介绍”一书的示例代码中 - In an example code of the book “introduction to 3d game programming with directx 11” 弗兰克·卢纳 (Frank Luna) 在其著作《使用 DirectX12 进行 3D 游戏编程》的介绍中的方框示例问题 - Problems with the box example in Frank Luna's introduction to his book '3D game programming with DirectX12' 最低DirectX 9.0c版本以及如何检查 - Minimum DirectX 9.0c version and how to check for it 在哪里可以找到C ++中一些简单的递归代码示例? - Where can I find some simple code examples of recursion in C++? 在哪里可以找到可以打开常见 3D 文件格式的 C++ 3D 建模库? - Where can I find a C++ 3D modeling library which can open common 3D file formats? 找不到用于DirectX编程的d3dcompiler_43.dll - Can't find d3dcompiler_43.dll for DirectX programming 使用Direct 3D(C ++)的DIrectX 11 2D游戏引擎 - DIrectX 11 2D Game Engine using Direct 3D (C++) 在Direct X 9.0c中获得LPDIRECT3DTEXTURE9的尺寸? - Getting the Dimensions of an LPDIRECT3DTEXTURE9 in Direct X 9.0c? 使用C ++和DirectX从零开始在3D游戏中创建效果 - Creating effects in 3D game from scratch, using c++ and DirectX 针对March09SDK编译DX 9.0c应用程序=&gt;无法与较早的DX 9.0c DLLs一起运行=&gt;问题:) - Compiling DX 9.0c app against March09SDK => Cannot run with older DX 9.0c DLLs => Problem :)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM