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

Pass the event manager to pixmap

This commit is contained in:
Mathieu Schroeter 2018-06-13 23:10:24 +02:00
parent 34869f1736
commit daf70260de
3 changed files with 17 additions and 11 deletions

View File

@ -779,8 +779,16 @@ DoInit (int argc, char * argv[], bool & exit)
info.max_texture_height);
}
// Create the event manager.
g_pEvent = new CEvent;
if (g_pEvent == nullptr)
{
InitFail ("New event");
return EXIT_FAILURE;
}
// Create the main pixmap.
g_pPixmap = new CPixmap;
g_pPixmap = new CPixmap (g_pEvent);
if (g_pPixmap == nullptr)
{
InitFail ("New pixmap");
@ -981,14 +989,6 @@ DoInit (int argc, char * argv[], bool & exit)
g_pDecor->Create (g_pSound, g_pPixmap);
g_pDecor->MapInitColors ();
// Create the event manager.
g_pEvent = new CEvent;
if (g_pEvent == nullptr)
{
InitFail ("New event");
return EXIT_FAILURE;
}
const bool zoom = g_zoom;
g_pEvent->Create (g_pPixmap, g_pDecor, g_pSound, g_pMovie);

View File

@ -33,6 +33,7 @@
#include "blupi.h"
#include "def.h"
#include "event.h"
#include "misc.h"
#include "pixmap.h"
@ -40,7 +41,7 @@
// Constructeur.
CPixmap::CPixmap ()
CPixmap::CPixmap (CEvent * event)
{
Sint32 i;
@ -56,6 +57,7 @@ CPixmap::CPixmap ()
m_lpSDLCursors[i] = nullptr;
m_lpCurrentCursor = nullptr;
this->event = event;
}
// Destructeur.

View File

@ -47,10 +47,12 @@ struct TextureInfo {
}
};
class CEvent;
class CPixmap
{
public:
CPixmap ();
CPixmap (CEvent * event);
~CPixmap ();
bool Create (Point dim);
@ -104,6 +106,8 @@ protected:
MouseSprites m_mouseSprite;
bool m_bBackDisplayed;
CEvent * event;
SDL_Cursor * m_lpCurrentCursor;
SDL_Cursor * m_lpSDLCursors[MAXCURSORS];
SDL_Surface * m_lpSDLBlupi;