source: GTP/trunk/App/Demos/Illum/pathmap/Parameters.h @ 2197

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