problems in changing the Palette in DDSCL_NORMAL mode
1 reply to this topic
Members - Reputation: 122
Posted 24 August 2001 - 03:04 AM
Hello from a beginner in directdraw programming I''m writing a program that changes the palette of an image in windowed mode but it doesn''t want to work!! How can I modify my code to perform a SetPalette operation on the primary surface in order to chenge the pixel color on the screen? Thanks for the help Luca LPDIRECTDRAW lpDD; LPDIRECTDRAWSURFACE lpDDSPrimary; // DirectDraw primary surface LPDIRECTDRAWSURFACE lpDDSOne; // Offscreen surface 1 LPDIRECTDRAWCLIPPER lpClipper; // clipper for primary LPDIRECTDRAWPALETTE lpDDPal; // DirectDraw palette HRESULT ddrval; ddrval = DirectDrawCreate( NULL, &lpDD, NULL ); ddrval = lpDD->SetCooperativeLevel( m_hWnd, DDSCL_NORMAL ); // Create the primary surface DDSURFACEDESC ddsd; ZeroMemory(&ddsd,sizeof(ddsd)); ddsd.dwSize = sizeof( ddsd ); ddsd.dwFlags = DDSD_CAPS; ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; ddrval = lpDD->CreateSurface( &ddsd, &lpDDSPrimary, NULL ); // create a clipper for the primary surface ddrval = lpDD->CreateClipper( 0, &lpClipper, NULL ); ddrval = lpClipper->SetHWnd( 0, m_hWnd ); ddrval = lpDDSPrimary->SetClipper( lpClipper ); lpDDPal = DDLoadPalette(lpDD, m_BitmapPath.c_str()); lpDDSOne = DDLoadBitmap(lpDD, m_BitmapPath.c_str(), 0, 0); //** modifying the palette entries... ///.... ddrval = lpDDSPrimary->SetPalette(lpDDPal); // !!! Error ????
Members - Reputation: 166
Posted 24 August 2001 - 03:11 AM
The problem with windowed mode is that you don''t get to select the screen''s resolution and depth on game startup. This is all determined by what ever your current desktop setting happens to be. So trying to rotate a palette while your desktop is in 16,24, or 32bit color isn''t going to work...Make sure your in 8bit mode, that should solve your problem.