-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodelerapp.h
90 lines (70 loc) · 2.3 KB
/
modelerapp.h
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
// DO NOT mess with this file. If you do, animator will not work with
// your model, and you'll have to write a new one. If you really really
// really need to do something here (unlikely) then don't complain if and
// when animator doesn't work. -- Eugene
#ifndef MODELERAPP_H
#define MODELERAPP_H
#include "modelerview.h"
struct ModelerControl
{
ModelerControl();
ModelerControl(const char* name, float minimum, float maximum, float stepsize, float value);
ModelerControl(const ModelerControl &o);
ModelerControl& operator=(const ModelerControl &o);
void SetVals(const char* name, float minimum, float maximum, float stepsize, float value);
char m_name[128];
float m_minimum;
float m_maximum;
float m_stepsize;
float m_value;
};
// Forward declarations for ModelerApplication
class ModelerView;
class ModelerUI;
class Fl_Box;
class Fl_Slider;
class Fl_Value_Slider;
class ParticleSystem;
// The ModelerApplication is implemented as a "singleton" design pattern,
// the purpose of which is to only allow one instance of it.
class ModelerApplication
{
public:
~ModelerApplication();
// Fetch the global ModelerApplication instance
static ModelerApplication* Instance();
// Initialize the application; see sample models for usage
void Init(ModelerViewCreator_f createView,
const ModelerControl controls[],
unsigned numControls);
// Starts the application, returns when application is closed
int Run();
// Get and set slider values.
double GetControlValue(int controlNumber);
void SetControlValue(int controlNumber, double value);
// Get and set particle system
ParticleSystem *GetParticleSystem();
void SetParticleSystem(ParticleSystem *s);
// Return the current time
float GetTime();
// Return the current fps
int GetFps();
// Returns animating flag
bool Animating();
private:
// Private for singleton
ModelerApplication() : m_numControls(-1) { ps = 0; }
ModelerApplication(const ModelerApplication&) {}
ModelerApplication& operator=(const ModelerApplication&) {}
// The instance
static ModelerApplication *m_instance;
ModelerUI *m_ui;
int m_numControls;
static void ValueChangedCallback();
static void RedrawLoop(void*);
// Just a flag for updates
bool m_animating;
// Particle System variables
ParticleSystem *ps;
};
#endif