source: GTP/trunk/App/Demos/Illum/Standalone/explosion [DirectX]/Parameters.h @ 1485

Revision 1485, 1.9 KB checked in by szirmay, 18 years ago (diff)
Line 
1#pragma once
2#include <assert.h>
3
4
5
6typedef enum { bShowHelp, bObjectOn, bPaused, LAST_BOOL } bool_t;
7typedef enum {fFireColor, fFireIntensity, fSmokeIntensity, fDustIntensity, fShimmerAmount, fTexRatio, fMotionBlur, LAST_NUMBER } number_t;
8
9enum { IDC_RESET_BUTTON = -3, IDC_SAVE_BUTTON, IDC_LOAD_BUTTON };
10
11#define CHARBUF 100                             // The max length of a line in the save file
12
13typedef float (*CONVERTER)(float a);
14typedef void (*ONCHANGE_CALLBACK)(void);
15
16
17float noconvert(float a);       // { return a; }
18float convertToMinusOne_One(float a); // { return a*2.0-1.0;}
19void OnChange();                        // {}
20
21
22class Parameters {
23        bool bparam[LAST_BOOL];
24        wchar_t bname[LAST_BOOL][CHARBUF];
25
26        int param[LAST_NUMBER]; // 0..100 (0..num_steps)
27        wchar_t name[LAST_NUMBER][CHARBUF];
28        int numsteps[LAST_NUMBER];
29
30        CONVERTER ffunc[LAST_NUMBER];
31        ONCHANGE_CALLBACK chfunc[LAST_NUMBER+3];
32
33        CDXUTDialog* g_HUD;
34
35        bool bSilent;
36        const static int CHARBUFFER_SIZE = 200;
37        enum { checkboxID0 = 1000, sliderID0 = 2000, staticID0 = 3000, upID0 = 4000, downID0 = 5000 };
38
39public:
40        void Setup( CDXUTDialog* g_HUD );
41        void Setup( CDXUTDialog* g_HUD, ONCHANGE_CALLBACK OnReset, ONCHANGE_CALLBACK OnSave = OnChange, ONCHANGE_CALLBACK OnLoad = OnChange);
42
43        bool Get( bool_t i );
44        float Get( number_t i );
45        int GetInt( number_t i );
46
47        void SetBool( bool_t ID, bool b );
48        void SetFloat( number_t ID, float v );
49        void SetInt( number_t ID, int v );
50
51        void Add( bool_t ID, char* label, char cHotKey = 0 );
52        void Add( number_t ID, char* label, int num_steps);
53
54        void Add( number_t ID, char* label, int num_steps,
55                CONVERTER ff, ONCHANGE_CALLBACK chf = OnChange );
56
57        void Add( number_t ID, char* label, int num_steps, char cKeyDecr, char cKeyIncr,
58                CONVERTER ff = noconvert, ONCHANGE_CALLBACK chf = OnChange );
59
60        void UpdateFromHUD( int controlID );
61
62        void SaveToFile( char* fileName );
63        void LoadFromFile( char* fileName );
64};
Note: See TracBrowser for help on using the repository browser.