summaryrefslogtreecommitdiff
path: root/3dc/avp/win95/gadgets/gadget.bak
blob: 22076bd4d3649f903647aaba48eb1995320672f3 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
/*
	
	gadget.h

	Base header file for Dave Malcolm's user interface "gadget" code.

	Note to "C" programmers: look at the bottom of this file

*/

#ifndef _gadget
#define _gadget 1

#ifdef __cplusplus
	extern "C" {
#endif

/* Version settings *****************************************************/
	#define UseGadgets Yes
		/* If this is set to No all gadget code collapses to void macros */

	#define EnableStatusPanels	No

/* Constants  ***********************************************************/
	#define HUD_SPACING 20

/* Macros ***************************************************************/

/* Type definitions *****************************************************/
	#if UseGadgets

		#ifndef _projtext
		#include "projtext.h"
		#endif

	#ifdef __cplusplus

		#ifndef _r2base
		#include "r2base.h"
		#endif

	class Gadget
	{
	public:
		// Pure virtual render method:
		virtual void Render
		(
			const struct r2pos& R2Pos,
			const struct r2rect& R2Rect_Clip,
			int FixP_Alpha
		) = 0;
			// Render yourself at the coordinates given, clipped by the clipping rectangle
			// Note that the position need not be at all related to the clipping rectangle;
			// it's up to the implementation to behave for these cases.
			// Both the coordinate and the clipping rectangle are in absolute screen coordinates
			// The alpha value to use is "absolute"

		virtual ~Gadget();
			// ensure virtual destructor

		#if debug
		char* GetDebugName(void);
		void Render_Report
		(
			const struct r2pos& R2Pos,
			const struct r2rect& R2Rect_Clip,
			int FixP_Alpha			
		);
			// use to textprint useful information about a call to "Render"
		#endif

	protected:
		// Protected constructor since abstract base class
		#if debug
		Gadget
		(
			char* DebugName_New
		) : DebugName( DebugName_New )
		{
			// empty
		}
		#else
		Gadget(){}
		#endif

	private:
		#if debug
		char* DebugName;
		#endif

	}; // end of class Gadget

	// Inline methods:
	#if debug
	inline char* Gadget::GetDebugName(void)
	{
		return DebugName;
	}
	#endif
		
	#if 0
	class GadgetWithSize : public Gadget
	{
	// Friends

	// Protected data:
	protected:
		r2size R2Size_Val;

	// Public methods:
	public:
		r2size GetSize(void) const;

		void SetSize(r2size R2Size);		
		virtual void SetSize_PostProcessing(void) {}

	// Protected methods:
	protected:
		// Protected constructor since abstract class
		// (It's abstract since Render() remains pure virtual )
		GadgetWithSize
		(
			#if debug
			char* DebugName_New,
			#endif
			r2size R2Size_New
		) : Gadget
			(
				#if debug
				DebugName_New
				#endif				
			),
			R2Size_Val( R2Size_New ) {}

	// Private methods:
	private:

	// Private data:
	private:

	// Inline methods:
	public:
		r2size GetSize(void) const
		{
			return R2Size_Val;			
		}
		void SetSize( r2size R2Size_New )
		{
			R2Size_Val = R2Size_New;
			SetSize_PostProcessing();
		}
	protected:
	private:

	}; // end of class GadgetWithSize
	#endif

	#endif /* __cplusplus */
	#endif /* UseGadgets */

/* Exported globals *****************************************************/

/* Function prototypes **************************************************/
	#if UseGadgets

	extern void GADGET_Init(void);
		/* expects to be called at program boot-up time */

	extern void GADGET_UnInit(void);
		/* expects to be called at program shutdown time */

	extern void GADGET_Render(void);
		/* expects to be called within the rendering part of the main loop */

	extern void GADGET_ScreenModeChange_Setup(void);
		/* expects to be called immediately before anything happens to the screen
		mode */

	extern void GADGET_ScreenModeChange_Cleanup(void);
		/* expects to be called immediately after anything happens to the screen
		mode */

	extern void GADGET_NewOnScreenMessage( ProjChar* messagePtr );

	extern void RemoveTheConsolePlease(void);

	#else /* UseGadgets */

		#define GADGET_Init() ((void) 0)
		#define GADGET_UnInit() ((void) 0)
		#define GADGET_Render() ((void) 0)
		#define GADGET_ScreenModeChange_Setup() ((void) 0)
		#define GADGET_ScreenModeChange_Cleanup() ((void) 0)
		#define GADGET_NewOnScreenMessage(x) ((void) 0)

	#endif /* UseGadgets */


/* End of the header ****************************************************/


#ifdef __cplusplus
	};
#endif

#endif