using Toybox.Graphics as Gfx; using Toybox.Math as Math; using C as C; class Letter { var width; var height; var stroke; var color; var deg; var vert; public function initialize(l, off_y, width, height, stroke, color) { off_y -= 6; me.width = (l == 'W') ? width : (width * 0.7); me.height = height; me.stroke = stroke; me.color = color; var w2 = me.width/2; var h2 = me.height/2; vert = []; switch (l) { case 'N': point(-w2, -off_y); point(-w2, -off_y + height); point( w2, -off_y); point( w2, -off_y + height); me.deg = 0; break; case 'E': point(-w2, -off_y); point( w2, -off_y); point( w2, -off_y + h2); point(-w2, -off_y + h2); point( w2, -off_y + h2); point( w2, -off_y + height); point(-w2, -off_y + height); me.deg = 90; break; case 'S': point( w2, -off_y + height); point(-w2, -off_y + height); point(-w2, -off_y + h2); point( w2, -off_y + h2); point( w2, -off_y); point(-w2, -off_y); me.deg = 180; break; case 'W': var w4 = me.width / 4; point( -w2, -off_y); point( -w4, -off_y + height); point( 0, -off_y); point( w4, -off_y + height); point( w2, -off_y); me.deg = 270; break; } } private function point(x, y) { vert.add([x, y]); return; } public function show(dc, off) { var v = C.translate(vert, C.cx, C.cy, deg + off); C.draw_lines(dc, v, stroke); } }