mirror of
				https://github.com/AquaMorph/Droplets.git
				synced 2025-10-31 08:23:18 +00:00 
			
		
		
		
	Sprite shifting support
This commit is contained in:
		| @@ -57,9 +57,6 @@ void Droplet::AnimationInc() { | ||||
|     count = 0; | ||||
|   } | ||||
|   count++; | ||||
|   //animation_count = animation_count % animation_rate; | ||||
|   WriteCenteredString(*patch, (screen_min + screen_max) / 2, 40, | ||||
| 		      Font_6x8, std::to_string(animation_count)); | ||||
| } | ||||
|  | ||||
| void Droplet::SetAnimationRate(int rate) { | ||||
| @@ -69,3 +66,7 @@ void Droplet::SetAnimationRate(int rate) { | ||||
| int Droplet::GetAnimationCount() { | ||||
|   return animation_count; | ||||
| } | ||||
|  | ||||
| bool Droplet::NeedUpdate() { | ||||
|   return count % animation_rate == 0; | ||||
| } | ||||
|   | ||||
| @@ -43,6 +43,7 @@ public: | ||||
|   void AnimationInc(); | ||||
|   void SetAnimationRate(int); | ||||
|   int GetAnimationCount(); | ||||
|   bool NeedUpdate(); | ||||
| }; | ||||
|  | ||||
| #endif // CASCADE_DROPLETS_DROPLET_H_ | ||||
|   | ||||
| @@ -16,6 +16,12 @@ VCODroplet::VCODroplet(DaisyPatch* m_patch, | ||||
| 		num_waves, Parameter::LINEAR); | ||||
|   ampctrl.Init(Patch()->controls[Patch()->CTRL_4], 0.0, | ||||
| 	       0.5f, Parameter::LINEAR); | ||||
|  | ||||
|   wave->SetBlank(); | ||||
|   for (int i = 0; i < sine_width; i++) { | ||||
|     int pixel = (int) round(std::sin(2*pi*((double)(i%sine_width)/sine_width)) * (GetTitleHeight()/2) + GetTitleHeight()/2); | ||||
|     wave->SetPixel(i, pixel, true); | ||||
|   } | ||||
| } | ||||
|  | ||||
| VCODroplet::~VCODroplet() { | ||||
| @@ -49,15 +55,12 @@ void VCODroplet::Process(float** in, float** out, size_t size) { | ||||
| } | ||||
|  | ||||
| void VCODroplet::Draw() { | ||||
|   wave->SetBlank(); | ||||
|   for (int i = 0; i < sine_width; i++) { | ||||
|     int pixel = (int) round(std::sin(2*pi*((double)(i + GetAnimationCount()%sine_width)/sine_width)) * (GetTitleHeight()/2) + GetTitleHeight()/2); | ||||
|     wave->SetPixel(i, pixel, true); | ||||
|   } | ||||
|    | ||||
|   WriteString(*Patch(), 0, 54, Font_6x8, | ||||
| 	      WaveToString(wavectrl.Process())); | ||||
|   wave->DrawTile(*Patch(), GetScreenMin(), 0, GetScreenMax(), GetTitleHeight()); | ||||
|   if(NeedUpdate()) { | ||||
|     wave->AdjustXShift(1); | ||||
|   } | ||||
|   DrawName("VCO"); | ||||
|   AnimationInc(); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user