-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathengine_swatches.cpp
More file actions
69 lines (54 loc) · 1.74 KB
/
engine_swatches.cpp
File metadata and controls
69 lines (54 loc) · 1.74 KB
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
#define ENGINE_SWATCH_WIDTH 14
#define ENGINE_SWATCH_HEIGHT 23
#define ENGINE_SWATCH_MARGIN 7
#define ENGINE_SWATCHES_X_OFFSET 237
#define ENGINE_SWATCHES_Y_OFFSET 9
class EngineSwatches
{
public:
void draw();
int poll();
void draw_active_button(int engine_number);
int selected_engine;
EngineSwatches();
};
EngineSwatches::EngineSwatches()
{
selected_engine = 0;
}
void EngineSwatches::draw_active_button(int engine_number)
{
draw8bitRectEx(ENGINE_SWATCHES_X_OFFSET+1, ENGINE_SWATCHES_Y_OFFSET+(engine_number*(ENGINE_SWATCH_MARGIN + ENGINE_SWATCH_HEIGHT))+1, ENGINE_SWATCH_WIDTH-2, ENGINE_SWATCH_HEIGHT-2, 0, DARK_GRAY);
}
int EngineSwatches::poll()
{
int i;
int j;
if (Stylus.Newpress)
{
for (i=0; i < NUMBER_OF_ENGINES; i++)
{
if (PA_StylusInZone(ENGINE_SWATCHES_X_OFFSET, ENGINE_SWATCHES_Y_OFFSET+(i*(ENGINE_SWATCH_MARGIN + ENGINE_SWATCH_HEIGHT)), ENGINE_SWATCHES_X_OFFSET + ENGINE_SWATCH_WIDTH, ENGINE_SWATCHES_Y_OFFSET+(i*(ENGINE_SWATCH_MARGIN + ENGINE_SWATCH_HEIGHT)) + ENGINE_SWATCH_HEIGHT))
{
// clear all engine selection buttons
for (j=0; j < NUMBER_OF_ENGINES; j++)
{
draw8bitRectEx(ENGINE_SWATCHES_X_OFFSET, ENGINE_SWATCHES_Y_OFFSET+(j*(ENGINE_SWATCH_MARGIN + ENGINE_SWATCH_HEIGHT)), ENGINE_SWATCH_WIDTH, ENGINE_SWATCH_HEIGHT, 0, WHITE);
}
this->draw_active_button(i);
this->selected_engine = i;
return(1);
}
}
}
return(0);
}
void EngineSwatches::draw()
{
int i;
for(i=0;i<NUMBER_OF_ENGINES;i++)
{
draw8bitRectEx(ENGINE_SWATCHES_X_OFFSET, ENGINE_SWATCHES_Y_OFFSET+(i*(ENGINE_SWATCH_MARGIN + ENGINE_SWATCH_HEIGHT)), ENGINE_SWATCH_WIDTH, ENGINE_SWATCH_HEIGHT, 0, WHITE);
}
this->draw_active_button(this->selected_engine);
}