473,396 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

No d3dx9.h? -What The Heck?-

Ajm113
161 100+
Ok, I am trying to create a window using this book called "Introduction To 3D Game Programming with DirectX 9.0c A shader Approach." By Frank D Luna. I used that hole script on page 98 to where it starts talking about Direct X debuging on one hole script. I got Visual Studios C++, DirectX, DirectX SDK. So whats going on?

Expand|Select|Wrap|Line Numbers
  1. #include <d3dx8.h>
  2. #include <iostream.h>
  3.  
  4. using namespace std;
  5.  
  6. class HelloD3DApp : public D3DApp
  7. {
  8. public:
  9.     HelloD3DApp(HINSTANCE hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD, requestedVP);
  10.     -HelloD3DApp();
  11.  
  12.     bool checkDeviceCaps();
  13.     void onLostDevice();
  14.     void updateScene(float dt);
  15.     void drawScene();
  16.  
  17. private:
  18.  
  19.     ID3DXFont* mFont;
  20. };
  21.  
  22. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, prevInstance, PSTR cmdLine, int showCmd)
  23. (
  24.     //Enable run-time memory check for debug builds.
  25. #if defined(DEBUG) | DEFINED(_DEBUG) _CrtSetDbgFlag(_CRTDBG_ALLOC_MEMDF |_CRTDBG_LEAK_CHECK_DF );
  26.  
  27. #endif
  28.  
  29. HelloApp app(hInstance);
  30. gd3dApp = &app;
  31.  
  32.  return gd3dApp->run();
  33. }
  34.  
  35. HelloD3DApp::HelloD3DApp(HINSTANCE, hInstance, std::string winCaption, D3DDEVTYPE devType, DWORD requestedVP): D3DApp(hInstance, winCaption, devType, requestedVP)
  36. {
  37.     srand(time_t(0));
  38.  
  39.     //Check the memory and make sure their are no errors other wise then make a error and shutdown.
  40.     if(!checkDeviceCaps())
  41.     {
  42.     MessageBox(0, "CheckDeviceCaps() Failed", 0, 0);
  43.     PostQuitMessage(0);
  44.     }
  45.     D3DXFONT_DESC fontDesc;
  46.     fontDesc.Height = 80;
  47.     fontDesc.Width = 40;
  48.     fontDesc.MipLevels = 0;
  49.     fontDesc.Italic = true;
  50.     fontDesc.CharSet = DEFAULT_CHARSET;
  51.     fontDesc.OutputPrecision = OUT_DEFAULT_PRECIS;
  52.     fontDesc.Quality = DEFAULT_QUALITY;
  53.     fontDesc.PitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
  54.     _tcscpy(fontDesc.FaceName, _T("Times New Roman"));
  55.  
  56.     HR(D3DXCreateFontIndirect(gd3dDevice, &fontDesc, &mFont));
  57. }
  58.  
  59. HelloD3DApp::~HelloD3DApp()
  60. {
  61. releaseCOM(mFont);
  62. }
  63.  
  64. #define ReleaseCOM(x) { if(x){x->Release();x = 0;}}
  65.  
  66. bool HelloD3DApp::checkDeviceCaps()
  67. {
  68.     //Nothing to check
  69.     return true;
  70. }
  71.  
  72. void HelloD3DApp::updateScene(float dt)
  73. {
  74.  
  75. }
  76.  
  77. void HelloD3DApp::onLostDevice()
  78.  
  79. {
  80.     HR(mFont->OnLostDevice());
  81. }
  82.  
  83. void HelloD3DApp::onResetDevice()
  84. {
  85. HR(mFont->OnResetDevice());
  86. }
  87.  
  88. void HelloD3DApp::drawScene()
  89. {
  90.     HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_xRGB(225, 225, 255), 1.0f, 0);
  91.  
  92.     RECT formatRect;
  93.     GetClientRect(mMainWnd, &formatRect);
  94.     HR(gd3dDevice->BeginScene());
  95.  
  96.     mFont->DrawText(0, _T("Hello Direct3D"), -1, &formatRect, DT_CENTER | DT_VCENTER, D3DCOLORXRGB(rand() % 256, rand() % 256));
  97.  
  98.     HR(gd3dDevice->EndScene());
  99.     HR(gd3dDevice->Present(0,0,0,0));
  100. }
  101.  
Jun 16 '07 #1
7 16748
weaknessforcats
9,208 Expert Mod 8TB
What was your question?

If you have trouble with Windows code, start reading "Programming Windows" by Charles Petzold for the background.
Jun 17 '07 #2
Ajm113
161 100+
The compiler is telling me it can't find d3dx9.h. Even the windows.h file. Is there something else I must download to continue my DirectX project? I have been playing around with it, but so far it keeps showing the same error that it can't find it.
Jun 17 '07 #3
The catch is the compiler doesn't necessarily *know* where the Windows and DirectX headers are at. While you didn't specify what compiler you use, there should be a set of options for your current project along the lines of "Additional Include Directories" (VC2005) or similar. Tell it the location of said headers in there. What I prefer to do (and this also makes your code a bit more release-friendly) is copy the main folders of any and all APIs used in my program into my working directory, keeping the dir structure, obviously. Anyhow all you have to do at that point is put the directory your header resides in before the name and you're golden. Even works for libraries too. If you're more visual, here's how my DX9 renderer class works/looks:

Expand|Select|Wrap|Line Numbers
  1. #pragma once
  2.  
  3. #include "Renderer.h"
  4.  
  5. // DirectX stuff
  6. #include "DirectX\d3d9.h"
  7. #pragma comment (lib, "DirectX/libs/d3d9.lib")
  8.  
  9. class CRendererDX9 : public Renderer...
  10. yada yada yada
  11.  
I remember this kind of problem really used to drive me nuts before I started using that little trick.
Jun 17 '07 #4
Ajm113
161 100+
I'm using the 2005 version. I thought there was something I had to download, but then I'll try that and see what happens.
Jun 17 '07 #5
Is there somewhere I can download all the necessary include files (all the ones referenced by d3dx9.h) in a small (not 400mb) package???

Thanks
Oct 18 '10 #6
Your best bet would be the sdks. If you dont want to dl a 400mb file. I dont have anything i cant help with
Oct 19 '10 #7
Samishii23
246 100+
Your best bet is to find the headers and download them directly, and place them in your project folder if you don't want to download a large installer...

But your probably better off doing the installer, and setting up your compiler to look into a SDK header include folder so you don't have to remember to copy/paste a header file into your project every time you need one.

Food for thought.
Oct 19 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Ducati916 | last post by:
hey guys just signed up and i hope to make this forum my second home :) anyways i want to go right into game programing so i installed DX9 SDK and started reading but when it come to testing...
3
by: Edward Mitchell | last post by:
I am converting a project that uses DirectX and worked under VS.NET 2003. Now when I convert the project to .NET 2005, there are linker errors for _Xran and _Xlen as follows: ...
4
by: Alerion | last post by:
Hello everyone, I've been a regular of this forum but this is my first post, generally I can find the answer to my question already, but this time I'm having a somewhat specific problem. For...
3
by: dragonslayer008 | last post by:
I recently added some new code files to a C++/CLI project. The added code is all native. I simply added the code to the project and built it. It compiled fine but I am getting the linker error:...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.