mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-30 01:35:34 +00:00
DrawName moved to Droplets
This commit is contained in:
parent
bbe0dd00f0
commit
03c87b94c6
3
Makefile
3
Makefile
@ -1,6 +1,7 @@
|
||||
TARGET = cascade
|
||||
|
||||
CPP_SOURCES = src/main.cpp src/util.cpp src/menu.cpp src/droplets/noise_droplet.cpp
|
||||
CPP_SOURCES = src/main.cpp src/util.cpp src/menu.cpp \
|
||||
src/droplets/droplet.cpp src/droplets/noise_droplet.cpp
|
||||
|
||||
LIBDAISY_DIR = ./lib/libDaisy
|
||||
DAISYSP_DIR = ./lib/daisySP
|
||||
|
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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user