mirror of
https://github.com/AquaMorph/Droplets.git
synced 2025-04-30 01:35:34 +00:00
Working modular code
This commit is contained in:
parent
6ce1007ba9
commit
f2162db95c
@ -13,7 +13,7 @@ using namespace daisysp;
|
|||||||
|
|
||||||
DaisyPatch patch;
|
DaisyPatch patch;
|
||||||
Util util(&patch);
|
Util util(&patch);
|
||||||
Menu menu(&patch);
|
Menu menu(&patch, &util);
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
patch.Init();
|
patch.Init();
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#include "menu.h"
|
#include "menu.h"
|
||||||
|
|
||||||
Menu::Menu(DaisyPatch* m_patch) {
|
Menu::Menu(DaisyPatch* m_patch,
|
||||||
|
Util* m_util) {
|
||||||
patch = m_patch;
|
patch = m_patch;
|
||||||
|
util = m_util;
|
||||||
}
|
}
|
||||||
const std::string MENU_ITEMS[] = {"VCO",
|
const std::string MENU_ITEMS[] = {"VCO",
|
||||||
"VCA",
|
"VCA",
|
||||||
@ -49,7 +51,7 @@ void Menu::CreateMenuItem(std::string text, int position, bool highlighted) {
|
|||||||
text.insert(text.end(), MAX_CHAR_LENGTH-text.size(), ' ');
|
text.insert(text.end(), MAX_CHAR_LENGTH-text.size(), ' ');
|
||||||
patch->display.SetCursor(MENU_X[position-1], MENU_Y[position-1]);
|
patch->display.SetCursor(MENU_X[position-1], MENU_Y[position-1]);
|
||||||
if (highlighted) {
|
if (highlighted) {
|
||||||
//util.DrawSolidRect(0, MENU_Y[2], SSD1309_WIDTH, MENU_Y[2]+17, true);
|
util->DrawSolidRect(0, MENU_Y[2], SSD1309_WIDTH, MENU_Y[2]+17, true);
|
||||||
patch->display.WriteString(cstr, Font_11x18, !highlighted);
|
patch->display.WriteString(cstr, Font_11x18, !highlighted);
|
||||||
} else {
|
} else {
|
||||||
patch->display.WriteString(cstr, Font_7x10, !highlighted);
|
patch->display.WriteString(cstr, Font_7x10, !highlighted);
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include "daisy_patch.h"
|
#include "daisy_patch.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -7,8 +10,9 @@ using namespace daisy;
|
|||||||
class Menu {
|
class Menu {
|
||||||
private:
|
private:
|
||||||
DaisyPatch* patch;
|
DaisyPatch* patch;
|
||||||
|
Util* util;
|
||||||
public:
|
public:
|
||||||
Menu(DaisyPatch*);
|
Menu(DaisyPatch*, Util*);
|
||||||
bool InMenu();
|
bool InMenu();
|
||||||
void SetInMenu(bool);
|
void SetInMenu(bool);
|
||||||
void FilterMenuSelection();
|
void FilterMenuSelection();
|
||||||
|
18
src/util.h
18
src/util.h
@ -1,3 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
#include "daisy_patch.h"
|
#include "daisy_patch.h"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -10,13 +12,13 @@ class Util {
|
|||||||
public:
|
public:
|
||||||
Util(DaisyPatch*);
|
Util(DaisyPatch*);
|
||||||
|
|
||||||
void DrawSolidRect(uint8_t x1,
|
void DrawSolidRect(uint8_t,
|
||||||
uint8_t y1,
|
uint8_t,
|
||||||
uint8_t x2,
|
uint8_t,
|
||||||
uint8_t y2,
|
uint8_t,
|
||||||
bool on);
|
bool);
|
||||||
|
|
||||||
void WriteString(int x,
|
void WriteString(int,
|
||||||
int y,
|
int,
|
||||||
std::string text);
|
std::string);
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user