summaryrefslogtreecommitdiff
path: root/osframework/source/demos/Demo5/TitleScreen.h
blob: c55776de57caa733228a33d42fff00405db1b17a (plain)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef __TITLE_SCREEN_H__
#define __TITLE_SCREEN_H__

#include "SexyAppFramework/Widget.h"
#include "SexyAppFramework/ButtonListener.h"

namespace Sexy
{

class GameApp;
class Graphics;
class WidgetManager;
class HyperlinkWidget;


// If you forgot about the ButtonListener class, you should review Demo3.
// The hyperlink widget is essentially the same thing as a button widget,
// and emits the same messages that a button does. Thus, to act on its
// messages we derive from the ButtonListener class.
class TitleScreen : public Widget, public ButtonListener
{

private:

	GameApp*			mApp;
	HyperlinkWidget*	mContinueLink;		

public:

	//////////////////////////////////////////////////////////////////////////
	//	Function: TitleScreen
	//	Parameters:
	//		theApp	- Pointer to the main application class
	//	
	//	Returns: none
	//////////////////////////////////////////////////////////////////////////
	TitleScreen(GameApp* pApp);

	virtual ~TitleScreen();

	//////////////////////////////////////////////////////////////////////////
	//	Function: Init
	//	Parameters: none
	//	Returns: none
	//
	//	Purpose: Called BEFORE the title screen is added to the widget manager
	//	by GameApp. This initializes some things like the images used for
	//	our hyperlink widget.
	//////////////////////////////////////////////////////////////////////////	
	void Init(void);

	//////////////////////////////////////////////////////////////////////////
	//	Function: AddedToManager
	//	Parameters:
	//		theWidgetManager	- Pointer to the main widget manager from
	//								GameApp.
	//
	//	Returns: none
	//
	//	Purpose: This function is automatically called by the widget manager
	//	which also passes a pointer to itself, when the TitleScreen class is
	//	added to its list of widgets. Every widget gets this function
	//	called when it is first added. It useful to use this function to
	//	set up any other widgets that the class might contain, such as buttons.
	//////////////////////////////////////////////////////////////////////////	
	void AddedToManager(WidgetManager* theWidgetManager);

	//////////////////////////////////////////////////////////////////////////
	//	Function: RemovedFromManager
	//	Parameters:
	//		theWidgetManager	- Pointer to the main widget manager from
	//								GameApp.
	//
	//	Returns: none
	//
	//	Purpose: This function is automatically called by the widget manager
	//	which also passes a pointer to itself, when the TitleScreen class is
	//	removed from its list of widgets. Every widget gets this function
	//	called when it is finally removed. It useful to use this function to
	//	also remove any widgets that were added and created in AddedToManager.
	//////////////////////////////////////////////////////////////////////////
	void RemovedFromManager(WidgetManager* theWidgetManager);

	//////////////////////////////////////////////////////////////////////////
	//	Function: ButtonDepress
	//	Parameters:
	//		theId	- Integer ID of the button that was clicked
	//
	//	Returns: none
	//
	//	Purpose: This method is called by the WidgetManager when a button widget
	//	is first pressed and THEN released. You can use ButtonPress if you want
	//	to know when the button is first pressed (before it is released).
	//	theId is the integer ID that was assigned to the button when it was
	//	first created. 
	//////////////////////////////////////////////////////////////////////////		
	virtual void ButtonDepress(int theId);

	//////////////////////////////////////////////////////////////////////////
	//	Function: Draw
	//	Parameters:
	//		g	- Graphics object used to draw all images and fonts to the screen.
	//	
	//	Returns: none
	//
	//	Purpose: Called automatically by GameApp's WidgetManager. This is where
	//	we'll do all our display routines for the loading screen.
	//////////////////////////////////////////////////////////////////////////
	void Draw(Graphics* g);

	//////////////////////////////////////////////////////////////////////////
	//	Function: LoadingComplete
	//	Parameters: none
	//	Returns: none
	//
	//	Purpose: Called manually by GameApp when we are done loading all
	//	resources, to let the title screen know that it should unhide and
	//	enable the continue link, so the user can start playing the game.
	//////////////////////////////////////////////////////////////////////////
	void LoadingComplete();
};

} 

#endif //__TITLE_SCREEN_H__