mirror of
				https://github.com/AquaMorph/Droplets.git
				synced 2025-10-31 16:23:19 +00:00 
			
		
		
		
	DrawName moved to Droplets
This commit is contained in:
		
							
								
								
									
										12
									
								
								src/droplets/droplet.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/droplets/droplet.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| #include "droplet.h" | ||||
|  | ||||
| void Droplet::DrawName(DaisyPatch* patch, std::string name) { | ||||
|   int min = 0; | ||||
|   int max = SSD1309_WIDTH; | ||||
|   if (state == DropletState::kLeft) { | ||||
|     max = SSD1309_WIDTH / 2; | ||||
|   } else if (state == DropletState::kRight) { | ||||
|     min = SSD1309_WIDTH / 2; | ||||
|   } | ||||
|   WriteCenteredString(*patch, (min + max) / 2, 0, Font_6x8, name); | ||||
| } | ||||
| @@ -5,6 +5,10 @@ | ||||
|  | ||||
| #include "daisy_patch.h" | ||||
|  | ||||
| #include <string> | ||||
|  | ||||
| #include "../util.h" | ||||
|  | ||||
| using namespace daisy; | ||||
|  | ||||
| enum class DropletState {kFull, kLeft, kRight}; | ||||
| @@ -16,6 +20,8 @@ class Droplet { | ||||
|   virtual void Control()=0; | ||||
|   virtual void Process(float**, float**, size_t)=0; | ||||
|   virtual void Draw()=0; | ||||
|   void DrawName(daisy::DaisyPatch*, | ||||
| 		std::string); | ||||
| }; | ||||
|  | ||||
| #endif // CASCADE_DROPLETS_DROPLET_H_ | ||||
|   | ||||
| @@ -28,17 +28,5 @@ void NoiseDroplet::Process(float** in, float** out, size_t size) { | ||||
| } | ||||
|  | ||||
| void NoiseDroplet::Draw() { | ||||
|   DrawName(patch); | ||||
| } | ||||
|  | ||||
|  | ||||
| void NoiseDroplet::DrawName(DaisyPatch* patch) { | ||||
|   int min = 0; | ||||
|   int max = SSD1309_WIDTH; | ||||
|   if (state == DropletState::kLeft) { | ||||
|     max = SSD1309_WIDTH / 2; | ||||
|   } else if (state == DropletState::kRight) { | ||||
|     min = SSD1309_WIDTH / 2; | ||||
|   } | ||||
|   WriteCenteredString(*patch, (min + max) / 2, 0, Font_6x8, "Noise"); | ||||
|   DrawName(patch, "Noise"); | ||||
| } | ||||
|   | ||||
| @@ -14,7 +14,6 @@ class NoiseDroplet: public Droplet { | ||||
|   DaisyPatch* patch; | ||||
|   daisysp::WhiteNoise noise; | ||||
|   daisysp::NlFilt filter; | ||||
|   void DrawName(DaisyPatch*); | ||||
|  public: | ||||
|   NoiseDroplet(DaisyPatch*, float, DropletState); | ||||
|   void Control(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user