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