CD3DFont is not working why???need help...

Started by
1 comment, last by farhanx 19 years, 11 months ago
I have included CD3DFont.h file in my project but its giving me compling errors nresolved external symbol "public: long __thiscall CD3DFont::DrawTextA(float,float,unsigned long,char *,unsigned long)" (?DrawTextA@CD3DFont@@QAEJMMKPADK@Z) mycam.obj : error LNK2001: unresolved external symbol "public: __thiscall CD3DFont::CD3DFont(char *,unsigned long,unsigned long)" (??0CD3DFont@@QAE@PADKK@Z) while i am doing everything as how i read in tutorial please guide me thanks. farhan
Things has been changed but the just the way it is....
Advertisement
You must also add cd3dfont.cpp to your project.
thanks, now i got my error and now text is displaying as well but now i am facing another problem that when i close the application it doesnt close as how it should have to, but it is closing in abnormal way....seems like doesnt letting go all the resources but i am confuse what am i missing?????????

here is my code

Init_D3D();

My_Font = new CD3DFont( _T("Arial"), 12, D3DFONT_BOLD );

My_Font->InitDeviceObjects(dDevice);

My_Font->RestoreDeviceObjects();


while (TRUE)
{


if(FAILED(dDevice->Clear(0,0,D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,D3DCOLOR_XRGB(0,0,0),1.0f,0)))
{MessageBox(hwnd,"Clearing buffer CLASS HAS PROBLEM","WARN",MB_OK);
return 0;}

if(SUCCEEDED(dDevice->BeginScene()))
{

D3DXMatrixLookAtLH(&view,&D3DXVECTOR3(Cam_UPX,0.0f,Cam_UPZ2),
&D3DXVECTOR3(Cam_UPX,Cam_UPY,0.0f),
&D3DXVECTOR3(0.0f,1.0f,0.0f));


dDevice->SetTransform(D3DTS_VIEW,&view);




dDevice->SetTexture(0,texture);
//Put Some texture from my texture interface pointer
dDevice->SetVertexShader(D3DFVF_XYZ|D3DFVF_TEX1 | D3DFVF_NORMAL| D3DFVF_DIFFUSE );
//TEXTURE: When we use texture then we should tell it by Tex1
dDevice->SetStreamSource(0,verbuff, sizeof(farhan_World));



dDevice->SetTexture(0,texture);

RotateY(1.0f,10.0f,1.0f);
//D3DXMatrixTranslation(&world,0.0,0.0f,0.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 4);

RotateY(10.0f,6.0f,10.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 4);


D3DXMatrixTranslation(&world,2.0,0.0f,0.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLEFAN, 0, 4);


D3DXMatrixTranslation(&world,5.0,0.0f,3.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


dDevice->SetTexture(0,texturehome);
D3DXMatrixTranslation(&world,5.0,0.0f,3.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,-2.0,0.0f,7.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,3.0,0.0f,10.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,9.0,0.0f,1.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,-6.0,0.0f,-10.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);




D3DXMatrixTranslation(&world,-12.0,0.0f,7.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,-9.0,0.0f,-10.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,4.0,0.0f,13.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);


D3DXMatrixTranslation(&world,10.0,0.0f,-10.0f);
dDevice->SetTransform(D3DTS_WORLD,&world);
dDevice->DrawPrimitive(D3DPT_TRIANGLELIST, 6, 12);




My_Font->DrawText(2,0, D3DCOLOR_ARGB(255,255,255,0),"Farhanhbk");

dDevice->EndScene();
}

///////////////////////in end iam cleaning the stuff like below

My_Font->DeleteDeviceObjects();
SAFE_DELETE( My_Font );

thanks in advance



[edited by - farhanx on April 23, 2004 11:37:46 AM]
Things has been changed but the just the way it is....

This topic is closed to new replies.

Advertisement