Skip to content

Commit

Permalink
Ebb&LFO: Add div/mul to clock sync
Browse files Browse the repository at this point in the history
  • Loading branch information
qiemem committed Sep 1, 2024
1 parent a2038af commit a024262
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 111 deletions.
42 changes: 42 additions & 0 deletions software/src/HemisphereApplet.h
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,37 @@ class HemisphereApplet {
void gfxPrint(int num) {
graphics.print(num);
}

void gfxStartCursor(int x, int y) {
gfxPos(x, y);
gfxStartCursor();
}

void gfxStartCursor() {
cursor_start_x = graphics.getPrintPosX();
cursor_start_y = graphics.getPrintPosY();
}

void gfxEndCursor(bool selected) {
if (selected) {
int16_t w = graphics.getPrintPosX() - cursor_start_x;
int16_t y = graphics.getPrintPosY() + 8;
int h = y - cursor_start_y;
gfxCursor(cursor_start_x, y, w, h);
}
}
// template<typename F, typename... P>
// // void gfxPrintParam(bool selected, std::function<void(const A&, P...)> printfn, P... param) {
// void gfxPrintParam(bool selected, F printfn, P... param) {
// int x = graphics.getPrintPosX();
// int y1 = graphics.getPrintPosY();
// (this->*printfn)(param...);
// int w = graphics.getPrintPosX() - x;
// int y2 = graphics.getPrintPosY() + 8;
// int h = y2 - y1 + 1;
// if (selected) gfxCursor(x, y2, w, h);
// }

void gfxPrint(int x_adv, int num) { // Print number with character padding
for (int c = 0; c < (x_adv / 6); c++) gfxPrint(" ");
gfxPrint(num);
Expand Down Expand Up @@ -388,10 +419,19 @@ class HemisphereApplet {
if (CursorBlink()) gfxBitmap(x, y, w, data);
}

// void gfxIcon(const uint8_t *data) {
// gfxBitmap(graphics.getPrintPosX(), graphics.getPrintPosY(), 8, data);
// }
//
void gfxIcon(int x, int y, const uint8_t *data) {
gfxBitmap(x, y, 8, data);
}

void gfxPrintIcon(const uint8_t *data, int16_t w = 8) {
gfxIcon(graphics.getPrintPosX(), graphics.getPrintPosY(), data);
gfxPos(graphics.getPrintPosX() + w, graphics.getPrintPosY());
}

//////////////// Hemisphere-specific graphics methods
////////////////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -456,6 +496,8 @@ class HemisphereApplet {

private:
bool applet_started; // Allow the app to maintain state during switching
int16_t cursor_start_x;
int16_t cursor_start_y;
};

#endif // _HEM_APPLET_H_
Loading

0 comments on commit a024262

Please sign in to comment.