either way, this is definetly shorter:
function drawCorner(obj, x, y, n) { g.setColor(obj.C.color.primary.base); let s1, s2 = 1; switch (n) { case 0: // Top Left s1 = s2 = -1; break; case 1: // Top Right s2 = -1; break; case 2: // Bottom Left s1 = -1; break; case 3: // Bottom break; } const x1 = x + obj.cornerOffset *s1; const y1 = y + obj.cornerOffset *s2; g.fillRect(x1, y1, x, y - obj.cornerSize*(s1*-1) + obj.cornerOffset*s1); g.fillRect(x1, y1, x - obj.cornerSize*(s2*-1) + obj.cornerOffset*s2, y); } Arwes.prototype.drawFrameNoCorners = function (x1, y1, x2, y2) { g.setColor(this.C.color.primary.dark); g.drawRect(x1, y1, x2, y2); }
@OmegaRogue started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
either way, this is definetly shorter: