Skip to content

Commit

Permalink
feat: add connect button (logic not implemented yet)
Browse files Browse the repository at this point in the history
Signed-off-by: Aditya Agarwal <[email protected]>
  • Loading branch information
Aditya-A-garwal committed Feb 18, 2024
1 parent 80a82ba commit 50a3c76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 8 additions & 0 deletions include/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ const uint16_t INFO_H = SAVE_H;

const uint16_t INFO_C = CYAN;

const uint16_t CONNECT_X = LOAD_X;
const uint16_t CONNECT_Y = SAVE_Y + 32;

const uint16_t CONNECT_W = 4 + (SAVE_W * 2);
const uint16_t CONNECT_H = SAVE_H;

const uint16_t CONNECT_C = WHITE;


const uint16_t NUM_SLOTS = 6;

Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Button loadButton(LOAD_X, LOAD_Y, LOAD_W, LOAD_H, LOAD_C, "LOAD", &tft);
Button saveButton(SAVE_X, SAVE_Y, SAVE_W, SAVE_H, SAVE_C, "SAVE", &tft);
Button clearButton(CLEAR_X, CLEAR_Y, CLEAR_W, CLEAR_H, CLEAR_C, "CLEAR", &tft);
Button infoButton(INFO_X, INFO_Y, INFO_W, INFO_H, INFO_C, "INFO", &tft);
Button connectButton(CONNECT_X, CONNECT_Y, CONNECT_W, CONNECT_H, CONNECT_C, "CONNECT", &tft);

CanvasClient client(&canvas);

Expand Down Expand Up @@ -207,4 +208,5 @@ void drawLowerWidgets() {
saveButton.draw();
clearButton.draw();
infoButton.draw();
connectButton.draw();
}
4 changes: 2 additions & 2 deletions src/widgets/button.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ void Button::clear() const {
tft->fillRect(x, y, w, h, BLACK);
}

bool Button::update(unsigned touchX, unsigned touchY) {
bool Button::update(unsigned touch_x, unsigned touch_y) {

if (!inRange(touchX, x, x + w) || !inRange(touchY, y, y + h)) {
if (!inRange(touch_x, x, x + w) || !inRange(touch_y, y, y + h)) {
return false;
}

Expand Down

0 comments on commit 50a3c76

Please sign in to comment.