Thread: Is this even possible....? I am trying to do something that it's not on the book

  1. #1
    left crog... back when? incognito's Avatar
    Join Date
    Oct 2001
    Posts
    1,427

    Is this even possible....? I am trying to do something that it's not on the book

    I am trying to draw a text to a direct draw surface but I can't get it for some reason...........I know I am wrong but I mean the book doens't tell me how to do that......


    Code:
    	//create our first Direct Draw Object
    	HRESULT ErrorCheck=DirectDrawCreateEx(NULL, (void**)&DirectDrawObject, IID_IDirectDraw7, NULL);
    	DirectDrawObject->SetDisplayMode(800,600,16,0,0);
    	DirectDrawObject->SetCooperativeLevel(hWndMain, DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN|DDSCL_ALLOWREBOOT);
        DDSURFACEDESC2	GameTittle;
    	memset(&GameTittle,0, sizeof (DDSURFACEDESC2));
    	GameTittle.dwFlags=DDSD_CAPS;
    	GameTittle.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE;
    	DirectDrawObject->CreateSurface(&GameTittle, &GameTittleSurface, NULL);
    	
    	////////////////////////////////////////////////////
    	/////////////////////////////////////////////////////
    	///fonts
    	//////////////////////////////////////////////////////
    	//////////////////////////////////////////////////////
    	
    	HFONT NewFont;
        HFONT OldFont;
    	HDC dc;
    	GameTittleSurface->GetDC(&dc);
    	AddFontResource( "Dark Crystal Outline.ttf");
    	NewFont=CreateFont(-40, 0,0,0,0,0,0,0,0,0,0,0,0,"Dark Crystal Outline");
    	
    	
    		OldFont=(HFONT)SelectObject(dc, NewFont);
    	SetBkMode(dc, TRANSPARENT);
    	SetTextColor(dc, RGB (0,255,0));
    	RECT rect;
    	GetClientRect (hWndMain, &rect);
    	
    	DrawText(dc, TEXT ("Welcome "),-1,&rect, DT_CENTER|DT_VCENTER|DT_SINGLELINE);
       
    
    
    
    
    Last edited by incognito; 05-25-2002 at 12:51 AM.
    There are some real morons in this world please do not become one of them, do not become a victim of moronitis. PROGRAMMING IS THE FUTURE...THE FUTURE IS NOW!!!!!!!!!

    "...The only real game I thank in the world is baseball..." --Babe Ruth

    "Life is beautiful"-Don Corleone right before he died.

    "The expert on anything was once a beginner" -Baseball poster I own.


    Left cprog on 1-3-2005. Don't know when I am coming back. Thanks to those who helped me over the years.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. URGENT: Help wanted...in C
    By iamjimjohn in forum C Programming
    Replies: 16
    Last Post: 05-18-2007, 05:46 AM
  2. Can't display book and borrower's details.
    By grscot in forum C++ Programming
    Replies: 0
    Last Post: 05-02-2003, 10:18 AM
  3. Books on C and C++
    By kermi3 in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 10-28-2002, 04:18 PM
  4. C++: Reference Book, GUI, Networking & Beyond
    By kuphryn in forum C++ Programming
    Replies: 4
    Last Post: 11-10-2001, 08:03 PM