I'm trying to learn Direct3D using a tutorial I found on the Net (http://www.experimentsingameprogramming.com/).
I followed the author's instructions to the letter and everything worked great UNTIL he added a class that works with fonts:
Anyway, this and the rest of the code compiles just fine, but the linker saysCode:#include "dxText.h"
dxText::dxText(void)
{
g_font = NULL; //The font object
}
dxText::~dxText(void)
{
if( g_font != NULL)
{
g_font->Release();
g_font = NULL;
}
}
bool dxText::init(DWORD size, LPDIRECT3DDEVICE9 device)
{
// Create a font
D3DXCreateFont(device, //D3D Device
size, //Font height
0, //Font width
FW_NORMAL, //Font Weight
1, //MipLevels
false, //Italic
DEFAULT_CHARSET, //CharSet
OUT_DEFAULT_PRECIS, //OutputPrecision
ANTIALIASED_QUALITY, //Quality
DEFAULT_PITCH|FF_DONTCARE,//PitchAndFamily
"Arial", //pFacename,
&g_font); //ppFont
return true;
}
void dxText::drawText(std::string text, int x, int y, int width, int height)
{
RECT font_rect = {0,0,width,height}; //sets the size of our font surface rect
//set the destination for our text, by moving the font rect.
SetRect(&font_rect, //our font rect
x, //Left
y, //Top
width, //width
height //height
);
//draw our text
g_font->DrawText(NULL, //pSprite
text.c_str(), //pString
-1, //Count
&font_rect, //pRect
DT_LEFT|DT_NOCLIP,//Format,
0xFFFFFFFF); //Color (white)
}
The DirectX libs are included, as are the necessary headers (the directories are set and I added the additional dependencies). I have been checking and double checking the settings all day long but haven't gotten anywhere.Code:dxtext.obj : error LNK2019: unresolved external symbol _D3DXCreateFontA@48 referenced in function "public: bool
__thiscall dxText::init(unsigned long,struct IDirect3DDevice9 *)" (?init@dxText@@QAE_NKPAUIDirect3DDevice9@@@Z)
Debug/dblock.exe : fatal error LNK1120: 1 unresolved externals
Then I downloaded and tried to build the author's own project files, but got the exact same error. :(
Nothing that Google turned up has helped either.
Since I'm all out of ideas, I'd be really greatful if somebody could help.