/********************************************************************
*
* Created: 24/3/2014 14:57
*
* File: fsCSplashScreenGui.h
*
* Author: Mick Waites
*
* Purpose: Displays copyright screens before the main Guis are
* presented.
*
*********************************************************************/
#ifndef fsCSplashScreenGuihdr
#define fsCSplashScreenGuihdr
#include <vector>
#include <fsCore/src/fsCUniqueId.h>
#include <fsCore/fsStr.h>
#include "fsIMessageListenerGuiComponent.h"
class fsCEntity;
class fsINode;
class fsISpriteComponent;
class fsCSplashScreenGui : public fsIMessageListenerGuiComponent
{
friend class fsCComponentFactory;
public:
static const fsCUniqueId mTypeId;
protected:
void initialiseFromVariableTableDo(const fsCVariableTable& pVars) override;
void updateDo(fsS32 pDeltaMs) override;
void listenersRegisterDo() override;
void listenersDeregisterDo() override;
fsBool messageProcessDo(const fsCUniqueId& pMessageType,
const fsIMessageDispatcher::sMessageParameters& pParam) override;
static fsIComponent* create(fsCEntity* pParent);
fsCSplashScreenGui(fsCEntity* pParent);
virtual ~fsCSplashScreenGui();<--- Destructor in derived class
private:
void nextScreenPrepare();
void nextScreenPresent();
void nextGuiLoad();
void variablesRead(const fsCVariableTable& pVars);
void screenFileNamesRead(const fsCVariableTable& pVars);
void firstScreenDisplay();
std::vector<fsStr> mScreens;
fsStr mNextGui;
fsISpriteComponent* mSprComp;
fsS32 mCurrentScreenIndex;
fsS32 mMinDurationMs;
fsS32 mMaxDurationMs;
fsS32 mTimeOnCurrentScreen;
// Guards against nextGuiLoad() firing more than once. With zero
// configured screens, firstScreenDisplay() calls nextGuiLoad()
// straight away without ever advancing mCurrentScreenIndex, so
// updateDo()'s "mCurrentScreenIndex == 0" check kept re-entering it
// every single frame - each call created another main-menu instance
// and re-destroyed the (already-destroyed) parent entity.
fsBool mNextGuiLoaded;
};
#endif