-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPI_GUICallbacks.cpp
91 lines (79 loc) · 2.68 KB
/
MPI_GUICallbacks.cpp
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
91
//
// MPI_GUICallbacks.cpp
//
#include "MPI_GUICallbacks.h"
#include "MPI_GUIRootWindow.h"
#include "MPI_ParticleFactory.h"
#include "MPI_Application.h"
#include <stdlib.h>
void MPI_GUICallbacks::displayCallback( void )
{
MPI_Application::getInstance().getGUIRootWindow().displayCallback();
}
void MPI_GUICallbacks::reshapeCallback( int w, int h )
{
MPI_Application::getInstance().getGUIRootWindow().reshapeCallback( w, h );
}
void MPI_GUICallbacks::idleCallback( void )
{
MPI_Application::getInstance().getGUIRootWindow().idleCallback();
}
void MPI_GUICallbacks::mouseCallback( int button, int state, int x, int y )
{
MPI_Application::getInstance().getGUIRootWindow().mouseCallback( button, state, x, y );
}
void MPI_GUICallbacks::motionCallback( int x, int y )
{
MPI_Application::getInstance().getGUIRootWindow().motionCallback( x, y );
}
void MPI_GUICallbacks::keyboardCallback( unsigned char key, int x, int y )
{
// quit the application if you see the q key
if ( key == 'q' ) {
MPI_Application::destroyInstance();
exit(0);
}
else if ( key == '0' ) {
MPI_Application::getInstance().getParticleFactory().setStateParticleStroke();
}
else if ( key == '1' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 0 );
}
else if ( key == '2' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 1 );
}
else if ( key == '3' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 2 );
}
else if ( key == '4' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 3 );
}
else if ( key == '5' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 4 );
}
else if ( key == '6' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 5 );
}
else if ( key == '7' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 6 );
}
else if ( key == '8' ) {
MPI_Application::getInstance().getParticleFactory().setStatePlayheadStroke( 7 );
}
else if ( key == 'r' || key == 'R' ) {
MPI_Application::getInstance().getParticleFactory().setStateRemovalStroke();
}
// FIXME figure out where this should really go -- there should be a layer
// between this and the function that has the keyboard mapping. should be
// able to change it on the fly (not because I'd want to, but more because
// it'd keep things modular).
}
MPI_GUICallbacks::MPI_GUICallbacks()
{
// empty
}
MPI_GUICallbacks::~MPI_GUICallbacks()
{
// empty
}
// vim:sw=4:et:cindent: