Hey,
I just got my nice new laptop a few weeks ago, and setup MSVC++ 2005 (I don't like the .net base, but I like the IDE) and MS Platform SDK Server 2003, plus DirectX 9 December SDK. Everything works. No liker errors, no sintax problems (well, not any detected anyway).
When I try to call Direct3DCreate9, it decides to return null.
Now, I am pretty damn sure that I have installed the SDK right. I'm thinking that it might have something to do with my OOP. (Honestly, why didn't microsoft just make nice objects to encapsulate the whole DirectX thing?) In anycase, my Windows Encapsulator works just fine, reducing about a hundred lines of code to just 3. I'll just post my code. (There is alot, so I am going to skip the windows stuff, since I know that it works.)
Here's the call:
#include "stdafx.h"
#include "Foundation.h"
#include "DirectX.h"
#include <d3dx9.h>
bool Graphics::DirectX::DirectXLayer::Aquire()
{
m_D3D = Direct3DCreate9(D3D_SDK_VERSION);
return (m_D3D == NULL);
}
Looks alright to me.
Here are the headers (probably should have lead with them)
#ifndef _DIRECT_X_H_
#define _DIRECT_X_H_
#include "stdafx.h"
#include "Foundation.h"
#include <d3dx9.h>
namespace Graphics{
namespace DirectX{
class DirectXLayer;
class FormatBlock;
//The directX layer provides a reference to directX systems
//It's basically the foundation of directX
class DirectXLayer
{
protected:
IDirect3D9* m_D3D;
IDirect3DDevice9* m_Device;
public:
D3DCAPS9 m_caps; // system capabilities
bool Aquire();
void GetCapsHal() { m_D3D->GetDeviceCaps(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, &m_caps); }
bool CreateDevice(FormatBlock fmt);
bool DefCreateDevice(HWND hWnd);
bool CreateDevice_S(HWND hWnd);
bool Present();
bool GetAdapterFormat(FormatBlock fmt);
};
I am currently linking to these files:
d3d9.lib d3dx9.lib winmm.lib
Am I forgetting something essential?
Thanks for your help. This has been annoying for quite sometime, especially with the site down and all (who would hack it? Or was it just the RAID system? I have heard both)
___________________________________________________Optimists see the glass as Half FullPessimists See the glass as Half EmptyEngineers See the glass as Twice as big as it needs to be