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

Revision 760, 1.9 KB checked in by szirmay, 19 years ago (diff)

Added a folder remotely

Line 
1#pragma once
2#include <assert.h>
3
4
5
6typedef enum { bShowHelp,/* bDisplacementOn,*/ LAST_BOOL } bool_t;
7typedef enum {fFocalDistance, fDisplacementScale, 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;}
19float convertToZeroTo30(float a); // { return a*2.0-1.0;}
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.