Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem with ID3DXFont

Started by PetrCBR Jan 13, 2005 at 1:15 PM 3 replies 1.3k views
Original Post
PetrCBR
PetrCBR
Hi. I'm have a little problem with ID3DXFont and showing text. In surface i have stored background image for menu. Place this surface into back buffer and show it isn't problem. Image was showed correctly, BUT if i show any text using ID3DXFont, background image is not yet displayed :-O. Allways is showed only background image, or only text. Source of text displaying : SIZE size; GetTExtExtendPoint32 (m_Font->GetDC(), Text, wcslen (Text), &size); RECT rc; SetRect (&rc, X, Y, X + size.cx, Y + size.cy); m_Font->DrawText (NULL, Text, -1, &rc, DT_LEFT | DT_TOP | DT_NOCLIP, color); Background is showed via StretchRect. Both (image and text) is placed between BeginScene and EndScene. In rendered world (with 3D models) is everything OK (but in rendered world isn't any bitmaps from Surface). Is anybody know, how to solve this problem ? PS : sorry for my poor english. Regards, Petr.
WildWest
WildWest
Please post your code from BeginScene() to EndScene().
I think the error could be that you nested your ..->Begin() methods incorrectly.
The Wild Wild West - Desperado!
PetrCBR
PetrCBR
Code isn't in one source. Class CD3D is basic class :

UINT CD3D::Draw ()
{
int res = -1;

if ((Device3D () != NULL) && (m_GamePos != NULL))
{
if (CheckDevice())
{
m_SurfaceFunc->ClearDevice (); // clear device with Clear function of Direct3DDevice.
if (SUCCEEDED (Device3D ()->BeginScene ()))
{
res = m_GamePos->Draw (); // draws menu, ingame render etc.

// functions to show FPS and camera settings
// FPS is able to show/hide with CTRL+F
// Cam stats is able to show/hide with CTRL+S
m_SurfaceFunc->ShowFPS ();

Device3D ()->EndScene ();

m_SurfaceFunc->Swap (); // swaps backbuffer surface into screen ... represented by Present function
}
}
}
return res;
}


Draw function in Menu class :

DWORD CMenuClass::Draw ()
{
d3d->SurfaceFunc()->StretchRect (TEXT ("menu_back"));
}


StretchRect is classic StretchRect function, that draws from surface with defined surface (in this is surface called "menu_back").

d3d->Device3D()->StretchRect (Source, NULL, m_pBackBuffer, NULL, D3DTEXF_NONE);

Source of ShowFPS is written in my prior post.
WildWest
WildWest
Sorry, i do not see any error.
Maybe somebody else will help you?
The Wild Wild West - Desperado!
PetrCBR
PetrCBR
Quote:
Original post by WildWest
Sorry, i do not see any error.
Maybe somebody else will help you?


I'l don't see error too :-/.
I dont know why surface is not showed, but 3D models yes :-/.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.