Thread: Text in DirectX

  1. #1
    Registered User FearOfTheDark's Avatar
    Join Date
    Jan 2003
    Posts
    31

    Text in DirectX

    I simply want to know an easy way to get text in DirectX!
    Thanks!
    -We're living in a illusion!
    -Ok, if that's what you think!

  2. #2
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    This is a snippet from my DX game:
    Code:
    //+-----------------------------------------------------------------------------
    //| Renders some text on the screen
    //+-----------------------------------------------------------------------------
    VOID GRAPHICS::RenderText(INT X, INT Y, CONST CHAR* Text)
    {
    	//Data
    	HDC Hdc;
    
    	//Attempt to get a DC
    	if(FAILED(SecondarySurface->GetDC(&Hdc)))
    	{
    		return;
    	}
    
    	//Set data
    	SetTextColor(Hdc, 0x00eeeeee);
    	SetBkColor(Hdc, 0x00000000);
    	SetBkMode(Hdc, TRANSPARENT);
    
    	//Print text
    	TextOut(Hdc, X, Y, Text, strlen(Text));
    
    	//Release the DC
    	SecondarySurface->ReleaseDC(Hdc);
    }
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. DirectSound header issues
    By dxfoo in forum C++ Programming
    Replies: 0
    Last Post: 03-19-2006, 07:16 PM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Replies: 1
    Last Post: 07-13-2002, 05:45 PM
  5. displaying text with DirectX
    By MechanicX in forum Game Programming
    Replies: 4
    Last Post: 09-24-2001, 06:28 PM