1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

Remove more ddraw surfaces

This commit is contained in:
Mathieu Schroeter 2017-02-05 10:06:45 +01:00
parent cbd1348760
commit 44838d8156
2 changed files with 12 additions and 66 deletions

View File

@ -34,10 +34,6 @@ CPixmap::CPixmap()
m_mouseSprite = SPRITE_WAIT;
m_bBackDisplayed = false;
m_lpDD = NULL;
m_lpDDSPrimary = NULL;
m_lpDDSBack = NULL;
for (i = 0; i < MAXCURSORS; i++)
m_lpSDLCursors[i] = nullptr;
@ -59,41 +55,23 @@ CPixmap::~CPixmap()
{
int i;
if ( m_lpDD != NULL )
{
if ( m_lpDDSPrimary != NULL )
{
m_lpDDSPrimary->Release();
m_lpDDSPrimary = NULL;
}
if ( m_lpDDSBack != NULL )
for (i = 0; i < MAXIMAGE; i++)
{
if (m_lpSDLCursors[i])
{
m_lpDDSBack->Release();
m_lpDDSBack = NULL;
SDL_FreeCursor (m_lpSDLCursors[i]);
m_lpSDLCursors[i] = nullptr;
}
}
for (i = 0; i < MAXIMAGE; i++)
for ( i=0 ; i<MAXIMAGE ; i++ )
{
if ( m_lpSDLTexture[i] != NULL )
{
if (m_lpSDLCursors[i])
{
SDL_FreeCursor (m_lpSDLCursors[i]);
m_lpSDLCursors[i] = nullptr;
}
SDL_DestroyTexture (m_lpSDLTexture[i]);
m_lpSDLTexture[i] = NULL;
}
for ( i=0 ; i<MAXIMAGE ; i++ )
{
if ( m_lpSDLTexture[i] != NULL )
{
SDL_DestroyTexture (m_lpSDLTexture[i]);
m_lpSDLTexture[i] = NULL;
}
}
m_lpDD->Release();
m_lpDD = NULL;
}
}
}
@ -110,8 +88,6 @@ void CPixmap::SetDebug(bool bDebug)
bool CPixmap::Create(POINT dim,
bool bFullScreen, int mouseType)
{
HRESULT ddrval;
m_bFullScreen = bFullScreen;
m_mouseType = mouseType;
m_dim = dim;
@ -121,31 +97,6 @@ bool CPixmap::Create(POINT dim,
m_clipRect.right = dim.x;
m_clipRect.bottom = dim.y;
// Create the main DirectDraw object
ddrval = DirectDrawCreate(NULL, &m_lpDD, NULL);
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: DirectDrawCreate\n");
return false;
}
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: SetCooperativeLevel\n");
return false;
}
// Set the video mode to 640x480x8.
if ( m_bFullScreen )
{
ddrval = m_lpDD->SetDisplayMode(dim.x, dim.y, 8);
if ( ddrval != DD_OK )
{
OutputDebug("Fatal error: SetDisplayMode\n");
return false;
}
}
return true;
}

View File

@ -66,11 +66,6 @@ protected:
int m_mouseSprite;
bool m_bBackDisplayed;
LPDIRECTDRAW m_lpDD; // DirectDraw object
LPDIRECTDRAWSURFACE m_lpDDSPrimary; // DirectDraw primary surface
SDL_Surface * m_lpSDLPrimary;
LPDIRECTDRAWSURFACE m_lpDDSBack; // DirectDraw back surface
SDL_Surface * m_lpSDLBack;
SDL_Cursor * m_lpCurrentCursor;
SDL_Cursor * m_lpSDLCursors[MAXCURSORS];
SDL_Surface * m_lpSDLBlupi;