Cleaned code

This commit is contained in:
Christian Colglazier 2020-09-26 15:33:02 -04:00
parent b04fdf7f70
commit a351030fe4
4 changed files with 8 additions and 9 deletions

View File

@ -56,7 +56,6 @@ void VCODroplet::Draw() {
if(NeedUpdate()) {
wave->AdjustXShift(1);
}
//testWave->DrawTile(*Patch(), 0, GetTitleHeight(), 60, GetTitleHeight()+testH);
DrawName("VCO");
AnimationInc();
}

View File

@ -22,10 +22,7 @@ private:
std::string WaveToString(uint8_t);
void SetWaveState(uint8_t);
const double pi = std::acos(-1);
int sine_width = 21;
Wave* wave = new Wave(WaveShape::kTriangle, sine_width, GetTitleHeight());
int testH = 20;
//Wave* testWave = new Wave(WaveShape::kSaw, 30, testH);
Wave* wave = new Wave(WaveShape::kTriangle, 21, GetTitleHeight());
public:
VCODroplet(DaisyPatch*, DropletState, float);
~VCODroplet();

View File

@ -54,7 +54,6 @@ int Sprite::GetHeight() {
return height;
}
int Sprite::GetWidth() {
return width;
@ -117,7 +116,9 @@ void Sprite::AdjustYShift(int y) {
y_shift += y;
}
int Sprite::GetShiftArray(int pos, int shift, int array_size) {
int Sprite::GetShiftArray(int pos,
int shift,
int array_size) {
return (array_size + ((pos + shift) % array_size)) % array_size;
}

View File

@ -1,6 +1,8 @@
#include "wave.h"
Wave::Wave(WaveShape m_wave, int width, int height) : Sprite(width, height) {
Wave::Wave(WaveShape m_wave,
int width,
int height) : Sprite(width, height) {
wave = m_wave;
DrawShape();
}
@ -28,7 +30,7 @@ void Wave::DrawShape() {
case WaveShape::kSine:
default:
for (int i = 0; i < GetWidth(); i++) {
int pixel = (int) round(std::sin(2*pi*((double)(i%GetWidth())/GetWidth())) * (GetHeight()/2) + GetHeight()/2);
int pixel = (int) round(std::sin(2*pi*((double)(i%x_max)/x_max)) * (y_max/2) + y_max/2);
AddPixel(i, pixel, true);
}
return;