mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-05-19 17:06:58 +00:00
Cleaned code
This commit is contained in:
parent
b04fdf7f70
commit
a351030fe4
@ -56,7 +56,6 @@ void VCODroplet::Draw() {
|
|||||||
if(NeedUpdate()) {
|
if(NeedUpdate()) {
|
||||||
wave->AdjustXShift(1);
|
wave->AdjustXShift(1);
|
||||||
}
|
}
|
||||||
//testWave->DrawTile(*Patch(), 0, GetTitleHeight(), 60, GetTitleHeight()+testH);
|
|
||||||
DrawName("VCO");
|
DrawName("VCO");
|
||||||
AnimationInc();
|
AnimationInc();
|
||||||
}
|
}
|
||||||
|
@ -22,10 +22,7 @@ private:
|
|||||||
std::string WaveToString(uint8_t);
|
std::string WaveToString(uint8_t);
|
||||||
void SetWaveState(uint8_t);
|
void SetWaveState(uint8_t);
|
||||||
const double pi = std::acos(-1);
|
const double pi = std::acos(-1);
|
||||||
int sine_width = 21;
|
Wave* wave = new Wave(WaveShape::kTriangle, 21, GetTitleHeight());
|
||||||
Wave* wave = new Wave(WaveShape::kTriangle, sine_width, GetTitleHeight());
|
|
||||||
int testH = 20;
|
|
||||||
//Wave* testWave = new Wave(WaveShape::kSaw, 30, testH);
|
|
||||||
public:
|
public:
|
||||||
VCODroplet(DaisyPatch*, DropletState, float);
|
VCODroplet(DaisyPatch*, DropletState, float);
|
||||||
~VCODroplet();
|
~VCODroplet();
|
||||||
|
@ -54,7 +54,6 @@ int Sprite::GetHeight() {
|
|||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int Sprite::GetWidth() {
|
int Sprite::GetWidth() {
|
||||||
return width;
|
return width;
|
||||||
|
|
||||||
@ -117,7 +116,9 @@ void Sprite::AdjustYShift(int y) {
|
|||||||
y_shift += 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;
|
return (array_size + ((pos + shift) % array_size)) % array_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include "wave.h"
|
#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;
|
wave = m_wave;
|
||||||
DrawShape();
|
DrawShape();
|
||||||
}
|
}
|
||||||
@ -28,7 +30,7 @@ void Wave::DrawShape() {
|
|||||||
case WaveShape::kSine:
|
case WaveShape::kSine:
|
||||||
default:
|
default:
|
||||||
for (int i = 0; i < GetWidth(); i++) {
|
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);
|
AddPixel(i, pixel, true);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user