summaryrefslogtreecommitdiff
path: root/game/client/particle_prototype.h
blob: ff4d690ade8e0f6cbd183d63a080b9f56da9b48b (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
//========= Copyright Valve Corporation, All rights reserved. ============//
//
// Purpose: 
//
// $NoKeywords: $
//
//=============================================================================//

// This defines things that allow particle effects to hook into the particle app.
#ifndef PARTICLE_PROTOTYPE_H
#define PARTICLE_PROTOTYPE_H


class CParticleMgr;
class RecvTable;


// Command-line args can be passed in to set state or options in the effects.
class IPrototypeArgAccess
{
public:
	virtual const char*	FindArg(const char *pName, const char *pDefault=0)=0;
};



// You must implement this interface for the prototype app to be able to run your effect.
class IPrototypeAppEffect
{
public:
	virtual				~IPrototypeAppEffect()	{}
	
	// Start the effect. You can get command-line args with pArgs.
	virtual void		Start(CParticleMgr *pParticleMgr, IPrototypeArgAccess *pArgs)=0;
	
	// Return false if you don't allow properties to be edited in the prototype app.
	virtual bool		GetPropEditInfo(RecvTable **ppTable, void **ppObj) {return false;}
};



// Used internally.
typedef IPrototypeAppEffect* (*PrototypeEffectCreateFn)();
class PrototypeEffectLink
{
public:
							PrototypeEffectLink(PrototypeEffectCreateFn fn, const char *pName);								

	PrototypeEffectCreateFn	m_CreateFn;
	const char				*m_pEffectName;
	PrototypeEffectLink		*m_pNext;
};


#ifdef PARTICLEPROTOTYPE_APP
	extern PrototypeEffectLink *g_pPrototypeEffects;	// The list of prototype effects..


	// Expose your effect with this macro.
	#define EXPOSE_PROTOTYPE_EFFECT(effectName, className)								\
		static IPrototypeAppEffect* ___Create##effectName##() {return new className;}	\
		static PrototypeEffectLink ___effectlink_##effectName##(___Create##effectName##, #effectName);
#else
	#define EXPOSE_PROTOTYPE_EFFECT(effectName, className)
#endif


#endif