-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdistortion_module.cpp
More file actions
60 lines (45 loc) · 1 KB
/
distortion_module.cpp
File metadata and controls
60 lines (45 loc) · 1 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
class DistortionModule
{
public:
int step;
int distortion_amount;
void draw();
void handle_input();
int distort(int frequency);
DistortionModule();
// ~DistortionModule();
};
int distort(int frequency)
{
if (step == 0)
{
step = 1;
return (frequency + distortion_amount);
}
else
{
step = 0;
return (frequency - distortion_amount);
}
}
void DistortionModule::draw()
{
PA_Clear8bitBg(BOTTOM_SCREEN);
// Draw grid border
PA_Draw8bitLine(BOTTOM_SCREEN,7,7,231,7,WHITE);
PA_Draw8bitLine(BOTTOM_SCREEN,7,183,231,183,WHITE);
PA_Draw8bitLine(BOTTOM_SCREEN,7,7,7,183,WHITE);
PA_Draw8bitLine(BOTTOM_SCREEN,231,7,231,183,WHITE);
// Draw white background box on bottom
draw8bitRectEx(7, 168, 225, 15, BOTTOM_SCREEN, WHITE);
PA_8bitText(BOTTOM_SCREEN, 10, 10, 255, 40,(char*)"Distortion",WHITE,1,1,130);
}
void DistortionModule::handle_input()
{
distortion_amount = (185 - Stylus.Y) * 300;
}
DistortionModule::DistortionModule()
{
step = 0;
distortion_amount = 0;
}