Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About SystemFiles

  • Rank
  1. SystemFiles

    Drawing Text - DirectX9

    Eeuhm I am not sure but if you have this: g_Font = NULL; or LPD3DXFONT g_Font = NULL; Well it must be: LPD3DXFONT g_Font = NULL; And also try: "Arial" and not TEXT( "Arial" ) Maybe it change something.
  2. SystemFiles

    Drawing Text - DirectX9

    You can also log in the file to check where it crash: log( "1" ); peace of code log( "2" ); peace of code log( "3" ); peace of code log( "4" ); if your logfile looks like this: 1 2 3 You know where its crashing. Here you got a function: VOID CSettings::WriteLog ( PCHAR cString, ... ) { CHAR cBuffer[512]; va_list valist; va_start( valist, cString ); _vsnprintf( cBuffer, sizeof( cBuffer ) - strlen( cBuffer ), cString, valist ); va_end( valist ); FILE* oLog_File = fopen( "C:\\logfile.log", "a+" ); fprintf( oLog_File, "%s\n", cBuffer ); fclose( oLog_File ); } After you logged it give me your crashing line please.
  3. Omg you guys know to much xD
  4. Oke I need a function to get the color of a pixel I want to get the pixel with X and Y. Something like this: D3DCOLOR CColors::GetPixelColor( FLOAT X, FLOAT Y ) { return PixelColor; } You got some links/msdn/tutorials for me or a complete function :D Thanks!
  5. SystemFiles

    Best Performance for ID3DXFont

    Look at my code I already use a sprite, I will look at the articel.
  6. SystemFiles

    Best Performance for ID3DXFont

    Also what is the best methode to DrawRectangles?
  7. Heey GameDev, I want to know how I can get the best performance for ID3DXFont. The quality is no problem here is my code: D3DXCreateFont( oDevice, 13, 0, FW_NORMAL, 0, FALSE, ANSI_CHARSET, OUT_DEFAULT_PRECIS, DRAFT_QUALITY, DEFAULT_PITCH | FF_DONTCARE, "MS Reference Sans Serif", &oFont ); HRESULT CDraw::DrawText( FLOAT X, FLOAT Y, D3DCOLOR dColor, CONST PCHAR cString, ... ) { CHAR cBuffer[101] = ""; va_list oArgs; va_start( oArgs, cString ); _vsnprintf( ( cBuffer + strlen( cBuffer ) ), ( sizeof( cBuffer ) - strlen( cBuffer ) ), cString, oArgs ); va_end( oArgs ); RECT oRect1 = { X, Y, X + 500, Y + 50 }; if( dColor != dBlack ) { RECT oRect2 = { X - 1, Y, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect2, DT_NOCLIP, dBlack ); RECT oRect3 = { X + 1, Y, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect3, DT_NOCLIP, dBlack ); RECT oRect4 = { X, Y - 1, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect4, DT_NOCLIP, dBlack ); RECT oRect5 = { X, Y + 1, X + 500, Y + 50 }; oFont->DrawText( oSprite, cBuffer, -1, &oRect5, DT_NOCLIP, dBlack ); } oFont->DrawText( oSprite, cBuffer, -1, &oRect1, DT_NOCLIP, dColor ); return D3D_OK; }
  8. SystemFiles


    I Readed somewhere it whas done with Effect->SetMatrix( )
  9. SystemFiles

    Drawing lines with Sprites

    Quote:Original post by Buckeye Sorry. Didn't go back to see your other questions. With regard to "simple" lines, (in Dx9 ) there isn't a D3DXDrawLine(from-here, to there, with-color) function. DrawPrimitive(UP) is pretty much your choice for simple lines. For a more complicated version, you can use ID3DXLine (similar to a sprite). You can use a sprite for drawing a horizontal or vertical line by selecting just a portion of the texture (1 or more pixels wide). RECT srect; srect.left = 0; srect.right = 1; = 0; srect.bottom = 128; sprite->Draw(texture,&srect,NULL,&D3DXVECTOR3(top-end of line),some-color); You can call sprite->Flush() to render what's accumulated before you make other rendering calls to the same area of the screen as the sprite. Then sprite->End() will render what's accumulated since the Flush(). Much people say DrawPrimitive( UP because it is easy ) is better with performance then ID3DXLine.
  10. SystemFiles

    GetViewport needs to call every frame?

    Quote:Original post by Buckeye You should call dev->SetViewport after you change the viewport structure to reflect a change in the size of the window client. Thanks!
  11. SystemFiles

    Drawing lines with Sprites

    Quote:Original post by Buckeye You're getting two lines because the second argument for DrawPrimitiveUp is the number of primitives (i.e., lines), not the number of vertices. You're telling the device to draw 2 lines. Yeah it looks perfect now, somebody got answer on the other questions?
  12. Heey my question is: Is it possible to draw simple lines with a color from X1, Y1 to X2, Y2. Draw a Rectangle whas easy but. I dont actuelly know if it is possible but I am sure you guys know. I also found out that when I use DrawPrimitiveUP and Sprites to draw and when I got the Sprite open ( I did call Begin but not jet End because I call End at the end of my frame ) the DrawPrimitiveUP lines arent drawed, why? Also when I use DrawPrimtiveUP I get and a line at the good position and a ugly lines at the top of my game: This is how I set my vertex list: D3DTLVERTEX VertexList[2]; VertexList[0].X = X; VertexList[0].Y = Y; VertexList[0].Z = 0.0f; VertexList[0].RHW = 1.0f; VertexList[0].dColor = dColor; VertexList[1].X = X2; VertexList[1].Y = Y2; VertexList[1].Z = 0.0f; VertexList[1].RHW = 1.0f; VertexList[1].dColor = dColor; oDevice->DrawPrimitiveUP( D3DPT_LINELIST, 2, VertexList, sizeof( D3DTLVERTEX ) );
  13. My question is if I call dev->GetViewport( &oViewport ), Do I need to call it again after changing the resolution or will the valau of oViewport change to the resolution without calling it.
  14. SystemFiles


    I dont really know, I also need it for my mod but then not a Sphere, but another mesh. I think you use as much info of the game you can. SetTransform and GetTransform wil 100% sure not work. [Edited by - SystemFiles on February 25, 2010 10:15:54 AM]
  15. SystemFiles


    Here it is the 100% perfect GetStringWidth: FLOAT CDraw::GetStringWidth( PCHAR String, LPD3DXFONT oFont ) { if( oFont ) { RECT FONTRECT; FONTRECT.left = 0; = 0; FONTRECT.bottom = 500; FONTRECT.right = 500; oFont->DrawText( NULL, String, -1, &FONTRECT, DT_CALCRECT, dWhite ); FLOAT Size = FONTRECT.right; return Size; } return 0; }
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!