mirror of
				https://github.com/AquaMorph/Droplets.git
				synced 2025-10-31 16:23:19 +00:00 
			
		
		
		
	Cleaned code
This commit is contained in:
		| @@ -56,7 +56,6 @@ void VCODroplet::Draw() { | ||||
|   if(NeedUpdate()) { | ||||
|     wave->AdjustXShift(1); | ||||
|   } | ||||
|   //testWave->DrawTile(*Patch(), 0, GetTitleHeight(), 60, GetTitleHeight()+testH); | ||||
|   DrawName("VCO"); | ||||
|   AnimationInc(); | ||||
| } | ||||
|   | ||||
| @@ -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(); | ||||
|   | ||||
| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user