summaryrefslogtreecommitdiffstats
path: root/game/code/contexts/frontendcontext.h
blob: 53957230f209146cedff10a627230689a98dd371 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//=============================================================================
// Copyright (C) 2002 Radical Entertainment Ltd.  All rights reserved.
//
// File:        FrontEndcontext.h
//
// Description: 
//
// History:     + Created -- Darwin Chau
//
//=============================================================================

#ifndef FRONTENDCONTEXT_H
#define FRONTENDCONTEXT_H

//========================================
// System Includes
//========================================

//========================================
// Project Includes
//========================================
#include <contexts/context.h>   // is-a Context

#include <loading/loadingmanager.h>

//========================================
// Forward References
//========================================

//=============================================================================
//
// Synopsis:    
//
//=============================================================================
class FrontEndContext : public Context,
                        public LoadingManager::ProcessRequestsCallback
{
    public:

        // Static Methods for accessing this singleton.
        static FrontEndContext* GetInstance();
        
    protected:

        virtual void OnStart( ContextEnum previousContext );
        virtual void OnStop( ContextEnum nextContext );
        virtual void OnUpdate( unsigned int elapsedTime );
        
        virtual void OnSuspend();
        virtual void OnResume();

        virtual void OnHandleEvent( EventEnum id, void* pEventData );
        virtual void OnProcessRequestsComplete( void* pUserData );   

    private:

        void StartFrontEnd( unsigned int initialScreen );

        // constructor and destructor are protected to force singleton implementation
        FrontEndContext();
        virtual ~FrontEndContext();

        // Declared but not defined to prevent copying and assignment.
        FrontEndContext( const FrontEndContext& );
        FrontEndContext& operator=( const FrontEndContext& );

        // Pointer to the one and only instance of this singleton.
        static FrontEndContext* spInstance;
};

// A little syntactic sugar for getting at this singleton.
inline FrontEndContext* GetFrontEndContext() { return( FrontEndContext::GetInstance() ); }


#endif // FRONTENDCONTEXT_H