Thread: DirectX surface question

  1. #1
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    DirectX surface question

    How do you fill a surface (LPDIRECTDRAWSURFACE7) with only one color? It seems like a waste of memory to create a 640x480 bitmap containing one color
    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.

  2. #2
    S­énior Member
    Join Date
    Jan 2002
    Posts
    982
    Code:
    DDBLTFX ddbltfx;
        ZeroMemory( &ddbltfx, sizeof(ddbltfx) );
        ddbltfx.dwSize      = sizeof(ddbltfx);
        ddbltfx.dwFillColor = dwColor;
    
     m_pddsBackBuffer->Blt( NULL, NULL, NULL, DDBLT_COLORFILL, &ddbltfx );
    Taken directly from the MS helper classes and assumes you're using DirectDraw. dwColor is the colour (suprise, suprise). Just flip your backbuffer (m_pddsBackBuffer).

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    It works, thanks
    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. Question about binary trees and files
    By satory in forum C Programming
    Replies: 9
    Last Post: 03-06-2006, 06:28 AM
  2. DirectX 8 with Borland
    By Tommaso in forum Game Programming
    Replies: 11
    Last Post: 08-12-2003, 09:30 AM
  3. Very simple question, problem in my Code.
    By Vber in forum C Programming
    Replies: 7
    Last Post: 11-16-2002, 03:57 PM
  4. DirectX question, please read!
    By Crossbow in forum Game Programming
    Replies: 2
    Last Post: 12-12-2001, 07:18 PM
  5. Simple DirectX question
    By Crossbow in forum Windows Programming
    Replies: 1
    Last Post: 12-12-2001, 12:44 AM