Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Last active December 16, 2015 13:39
Show Gist options
  • Save Mikulas/5443646 to your computer and use it in GitHub Desktop.
Save Mikulas/5443646 to your computer and use it in GitHub Desktop.
GPoint getCenter(int row, int led) {
return GPoint(12 + led * 24, 70 + 27 * row);
}
void color_led(GContext* ctx, int row, int led, bool on) {
graphics_context_set_fill_color(ctx, on ? GColorWhite : GColorBlack);
graphics_fill_circle(ctx, getCenter(row, led), CIRCLE_RADIUS);
}
// ############### for PCB binary
GRect getRect(int row, int led) {
if (row === 0)
return GRect(12 + led * 40, 50, 30 + led * 40 + 20, 50 + 20);
else
return GRect(12 + led * 20, 100, 30 + led * 20 + 20, 100 + 20);
}
void color_led(GContext* ctx, int row, int led, bool on) {
graphics_context_set_fill_color(ctx, on ? GColorWhite : GColorBlack);
graphics_fill_rect(ctx, getRect(row, led), 1, null);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment