HelpDrawing Things in DirectX ?

Posts 1–9 of 9 · Page 1 of 1
Drawing Things in DirectX ?
Ok, so finally i can draw on the CrossFire's Window, the hardest part of my menu is completed...

But currently, i only can draw a simple square...
I looked into Cf Manu sources, to learn how to draw strings, but when i try to draw any string, Cf windows isnt appaer, and after a period of time, it the crossfire process exit...
The code:
Code:
LPD3DXFONT Font;
void WriteText( LPDIRECT3DDEVICE9 pDevice, char* str, int size, int x, int y, DWORD color)
{
    static RECT textbox;
    SetRect(&textbox, x, y, 900, 900);
    D3DXCreateFont(pDevice, size, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &Font);
    if (Font) Font->DrawTextA(NULL, str, strlen(str), &textbox, DT_LEFT | DT_TOP, color);
}
D3DXCreateFont cash,you can use base font in crossfire
Quote Originally Posted by hackerlovely View Post
D3DXCreateFont cash,you can use base font in crossfire
I fixed it, so i can draw the strings...
The second, if i use the pDevie->Clear, it put the recatngle above the font every time...
I cant find any easy tut how to draw an Image or another way to draw rectrangle...
Quote Originally Posted by rabir007 View Post
Ok, so finally i can draw on the CrossFire's Window, the hardest part of my menu is completed...

But currently, i only can draw a simple square...
I looked into Cf Manu sources, to learn how to draw strings, but when i try to draw any string, Cf windows isnt appaer, and after a period of time, it the crossfire process exit...
The code:
Code:
LPD3DXFONT Font;
void WriteText( LPDIRECT3DDEVICE9 pDevice, char* str, int size, int x, int y, DWORD color)
{
    static RECT textbox;
    SetRect(&textbox, x, y, 900, 900);
    D3DXCreateFont(pDevice, size, 0, FW_NORMAL, 1, false, DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, L"Arial", &Font);
    if (Font) Font->DrawTextA(NULL, str, strlen(str), &textbox, DT_LEFT | DT_TOP, color);
}

BTW createFont on every draw it will make lagg , createFont is needed when enter a game or exit one , so just check if you need to create it again :

on startup create it , after joining create it and the whole game you don't need it create it again and again , in this way the lagg will be much smaller.

(hehe nem csak te vagy magyar it :P , vannak masok is )
Quote Originally Posted by bandi12 View Post
BTW createFont on every draw it will make lagg , createFont is needed when enter a game or exit one , so just check if you need to create it again :

on startup create it , after joining create it and the whole game you don't need it create it again and again , in this way the lagg will be much smaller.

(hehe nem csak te vagy magyar it :P , vannak masok is )
Jó tudni
Amúgy azt már megcsináltam rég hogy csak egyszer használja a CreateFont-ot... Viszont amikor kiírom az összes funkciót, még ígyis laggol mint a kurvaisten

Google Translate !!
Yahoo , msn ??
Quote Originally Posted by bandi12 View Post
Yahoo , msn ??
MSN-en fentvagy nekem
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us