Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    cSilentFont v1.1


    SILENTChris
     Share

    Recommended Posts

    "cSilentFont" is a C++ class coded by silentchris.
    All credits goes to silentchris and the MSDN (Microsoft).
    Please credit silentchris if you use this class.
    
    "cSilentFont" got made to make LPD3DXFONT-using easier and let it render faster.
    It`s recommend to use the PreloadText function to get the highest performance
    out of your LPD3DXFONT. Make sure that you only call it once for each static string.
    
    ################################################
    ## The 3 different drawfunctions:
    ################################################
    1. [DrawText()]
    
      - Is basically left aligned without any extras.
    
      - Flags
          - 1. "T_CENTER" will make the font center aligned.
          - 2. "T_RIGHT"  will make the font right aligned.
          - 3. "T_SHADOW" will add a shadow around the font.
    
      - Examples
          - Left		: pFont->DrawText( 10, 10, 0xFFFFFFFF, NULL				, "Text" );
          - Left (Shadow)	: pFont->DrawText( 10, 10, 0xFFFFFFFF, T_SHADOW			, "Text" );
          - Center		: pFont->DrawText( 10, 10, 0xFFFFFFFF, T_CENTER			, "Text" );
          - Center (Shadow): pFont->DrawText( 10, 10, 0xFFFFFFFF, T_CENTER|T_SHADOW, "Text" );
          - Right		: pFont->DrawText( 10, 10, 0xFFFFFFFF, T_RIGHT			, "Text" );
          - Right (Shadow)	: pFont->DrawText( 10, 10, 0xFFFFFFFF, T_RIGHT|T_SHADOW	, "Text" );
    
    2. [DrawTextMaxLen()]
    
      - Will draw a left aligned text with choosable MAX-LEN.
    
      - Can be shadowed or non-shadowed.
    
      - Examples
          - Normal: pFont->DrawTextMaxLen( 10, 10, 5, 0xFFFFFFFF, FALSE, "Text" );
          - Shadow: pFont->DrawTextMaxLen( 10, 10, 5, 0xFFFFFFFF, TRUE , "Text" );
    
    3. [DrawTextAutoScrolling()]
    
      - Will draw text which will scroll from the right to the left over and over
        again inside the selected field.
    
      - You can set the speed.
    
      - You`ll need to add a buffer as we want it to be different for each call.
    
      - Examples
          - Normal: pFont->DrawTextAutoScrolling( 10, 10, 100, 1, &buf, 0xFFFFFFFF, FALSE, "Text" );
          - Shadow: pFont->DrawTextAutoScrolling( 10, 10, 100, 1, &buf, 0xFFFFFFFF, TRUE , "Text" );
    
    ################################################
    ## How to use:
    ################################################
    1. Add this on the top of any file:
      C_SilentFont *pFont;
    
    2. Call this once inside your Present/Endscene:
      pFont = new C_SilentFont( pDevice, "Arial", 14, FW_SEMIBOLD, FALSE );
    
         Parameter 1: Your D3D Device
         Parameter 2: The name of your font
         Parameter 3: The size of your font
         Parameter 4: The Weight of your font
         Parameter 5: You want your font Italic?!
    
    3. Before your drawing call this every frame:
      pFont->InitVolatileResources( );
    
    4. DRAW!
    
    5. After your drawing call this every frame:
      pFont->FreeVolatileResources( );
    
    6. Thats it 
    
    ################################################
    ## All Functions listed:
    ################################################
    C_SilentFont( LPDIRECT3DDEVICE9 pd3dDevice, TCHAR* strFontName, INT dwFontSize, UINT dwFontFlags, BOOL Italic );
    ~C_SilentFont( );
    LPDIRECT3DDEVICE9 GetDevice( );
    LPD3DXSPRITE GetSprite( );
    LPD3DXFONT GetFont( );
    CHAR *GetName( );
    INT GetTextLenght( CHAR *str );
    INT GetTextHeight( );
    UINT GetFlags( );
    BOOL GetItalic( );
    HRESULT PreloadText( CHAR *dwText );
    HRESULT InitVolatileResources( );
    HRESULT FreeVolatileResources( );
    HRESULT DrawText( INT x, INT y, DWORD dwColor, DWORD dwFlags, const char *fmt, ... );
    HRESULT DrawTextMaxLen( INT x, INT y, INT w, DWORD dwColor, BOOL shadowed, const char *fmt, ... );
    HRESULT DrawTextAutoScrolling( INT x, INT y, INT w, INT speed, INT *pos_buf, DWORD dwColor, BOOL shadowed, const char *fmt, ... );
    
    
    ################################################
    ## Changelog:
    ################################################
    [ v1.1 ] - Code is alot smaller now. Added Multi-Flags.
    [ v1.0 ] - First Version
    

     

    Sharing is caring

     

    Download Header Class File:

    http://forum.ghbsys.net/index.php?/files/file/2120-csilentfont/

    Edited by SILENTChris
    • Upvote 3
    Link to comment
    Share on other sites

    • 2 weeks later...
    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...