please could u give a quick explanation ion names for things

Started by
9 comments, last by PaulCesar 18 years, 6 months ago
im one of those programmers who had a crash course in programming and never picked up the jargon and the names heres my problem HRESULT D3DXCreateFont(LPDIRECT3DDEVICE9 pDevice,HFONT hFont,LPD3DXFONT *ppFont); i understand that the first one in my dx device . . the sencond im not sure and the 3rd is a pointer to my font device in this case ID3DXFont *g_font; so what would i put for the second parameter, i understand the msdn says its "hFont [in] Handle to the font object. " what does that mean? thanks
Advertisement
In windows programming, upper-case type names beginning with "H" tend to indicate a "Handle" to something. That is, the value returned by a function that created them.

In this case, HFONT would be a "handle to a font". Other examples would be HDC (Handle To a Device Context) and HWND (Handle to a WiNDow).

Off the top of my head, I think it'll be CreateFont() from the Win32 API that you need to have a look at. Use that function and feed it's return value into the function you originally posted with [smile]

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

yeah i realise its a handle just like the hWnd is the handle to the window . . could someone create a font here so i can see what the handle is
Here's a tip: Google a function's name, and you'll get the API documentation. Here is the first result for "D3DXCreateFont".
Jooleem. Get addicted.
nice one peregrin

1. this is the first place i went hence my quote from the msdn not very tricky i believe i wrote something like from the msdn it says this : yadda : showing that i have looked for my answr before posting here

2. im not using this function as my dx is either up to date or out of date im not sure but it doesnt take that many arguments
3. Please read my post, im not sure about the damn wording like handles and all that.
4. im learning, maybe ur learning technique isnt the same way i learn, i learn through example. Most people help me through on this site and i become a better programmer with every visit. telling me to search google infuriates me and many others as YES WE/I TRIED THAT ALREADY. its the first thing i do before posting here. i just want dynamic help, help i know has come from a real person who knows. if you dont know please dont post, there are no points on this site for making face. I help with q's all the time and never once EVEN when it is the case have i ever said use google.

The msdn to me is only helpful in making sure that i have the right amount of parameters, im still not sure what those parameters are so in most cases the msdn to me is not as helpful as it would be say in a few months.

everyone else is really helpful on this site and unlike most sites i feel i mcan post any question at any level and not get annoyed with silly replys like that.

thanks to all who try to answer my ustion in the way id like it answered.

so, can someone make an example of what i should put in that second field
I apologize if I somehow offended you, counterrabbit. I can assure you my post was made with good faith in an attempt to be helpful.

I should have read your original post more carefully, to see that you quote the MSDN page. It may surprise you though that many people are not aware of such resources or might not know what exactly it is they should be looking for. I have no way of determining what you already know, and since you have stated in your original post you were "one of those programmers who had a crash course in programming", I assumed (apparently wrongly) you are new to programming and might not know how to look for proper documentation.

If you find people referring you to documentation so annoying, I would suggest that in the future you state that you have already searched for X, Y or Z.

Again, I want to make it clear that my post was NOT in the "Google is your friend" spirit, but rather a helpful suggestion.
Jooleem. Get addicted.
np then, same as for me, i thought you were one of "those programmers" who have too much to say but tell you absolutly nothing, turns out you seen like a nice guy, no offense taken and sorry for sounding like a no0b, which i am and im not if u know what i mean
I'm glad it's sorted out, and good luck with your font creation. :)
Jooleem. Get addicted.
Isnt that D3DXCreateFont you posted more or less obsolete now (using august SDK)? Maybe I'm just ignorant, but I use:

HRESULT WINAPI D3DXCreateFont( LPDIRECT3DDEVICE9 pDevice,
INT Height,
UINT Width,
UINT Weight,
UINT MipLevels,
BOOL Italic,
DWORD CharSet,
DWORD OutputPrecision,
DWORD Quality,
DWORD PitchAndFamily,
LPCTSTR pFacename,
LPD3DXFONT *ppFont
);

in the form of:
D3DXCreateFont( D3D_Device,20,0,0,2,0,DEFAULT_CHARSET,                            OUT_DEFAULT_PRECIS, DEFAULT_QUALITY,                            DEFAULT_PITCH | FF_DONTCARE, "Arial", &lpFont );


to make my fonts, then during rendering I simply call:

int DrawText(
Sprite *sprite,
String *text,
Rectangle rect,
DrawTextFormat format,
Color color
);

in the form of:

RECT rcText;rcText.left = 5;		char *Text= new char[100];rcText.top = 3 + (4 * (fntSize + 5 ));             rcText.bottom = rcText.top + fntSize+5;rcText.right = Present_Parameters.BackBufferWidth;sprintf(Text, "Player: %d", int(intValue));//this is really the most important bit, you can ignore the above!:lpFont->DrawText(NULL,Text,-1,&rcText,DT_TOP|DT_LEFT,D3DCOLOR_XRGB(200,100,50));


where rect is the rectangle containing the text, of course.

When I was using the createfont method that you were using I found it very confusing, and I'm glad they changed the SDK to make it simpler.

I'm afraid that back when I was using that, I didnt really understand it myself, so I cant really tell you what all that meant. However, this new method seems much more self explanatory. I hope I've been of some help.

EDIT: tried to add some clarity to the code I wrote
"You get what you pay for, so pay attention!"
excellent mate. Thanks.

This topic is closed to new replies.

Advertisement