#cas from math import pi, asin def get_infos(keys): fnop = lambda : None poly_has_color, poly_show = 1, fnop import ti_graphics, ti_system, time screen_w, screen_h, font_w, font_h, screen_y0, poly_pause, poly_get_key, poly_sleep, poly_monotonic, need_clean, show_need_pause_on_exit = 320, 210, 10, 15, 30, ti_system.disp_wait, fnop, time.sleep, time.monotonic, 1, 1 font_num_w = font_w def poly_draw_line(x1, y1, x2, y2, c): ti_graphics.setColor(c) ti_graphics.drawLine(x1, y1 + screen_y0, x2, y2 + screen_y0) def poly_fill_rect(x, y, w, h, c): ti_graphics.setColor(c) ti_graphics.fillRect(x, y + screen_y0, w, h) def poly_get_pixel(x, y): return ti_graphics.getPixel(x, y + screen_y0) def poly_set_pixel(x, y, c): ti_graphics.setPixel(x, y + screen_y0, c) def poly_draw_ellipse(x, y, rx, ry, c): ti_graphics.setColor(c) x0, y0 = x - rx, y - ry for dy in range(1 + (y0 > int(y0))): for dx in range(1 + (x0 > int(x0))): ti_graphics.drawArc(x0 + dx, y0 + dy + screen_y0, 2 * rx, 2 * ry, 0, 3600) def poly_fill_ellipse(x, y, rx, ry, c): ti_graphics.setColor(c) ti_graphics.fillArc(x - rx, y - ry + screen_y0, 2 * rx, 2 * ry, 0, 3600) def poly_draw_circle(x, y, r, c): poly_draw_ellipse(x, y, r, r, c) def poly_fill_circle(x, y, r, c): ti_graphics.setColor(c) ti_graphics.fillCircle(x, y + screen_y0, r) def poly_draw_string(s, x, y, cf, cb): poly_fill_rect(x, y, font_w, font_h, cb) ti_graphics.setColor(cf) ti_graphics.drawString(s, x, y + screen_y0) def poly_clean_screen(): poly_fill_rect(0, 0, screen_w, screen_h, [255, 255, 255]) def poly_show_pause(): poly_show() poly_pause() l = [] for k in keys: if k=="w": l.append(screen_w) if k=="h": l.append(screen_h) if k=="hc": l.append(poly_has_color) if k=="fw": l.append(font_w) if k=="fwn": l.append(font_num_w) if k=="fh": l.append(font_h) if k=="gp": l.append(poly_get_pixel) if k=="sp": l.append(poly_set_pixel) if k=="dl": l.append(poly_draw_line) if k=="fr": l.append(poly_fill_rect) if k=="dc": l.append(poly_draw_circle) if k=="fc": l.append(poly_fill_circle) if k=="de": l.append(poly_draw_ellipse) if k=="fe": l.append(poly_fill_ellipse) if k=="ds": l.append(poly_draw_string) if k=="sh": l.append(poly_show) if k=="p": l.append(poly_pause) if k=="m": l.append(poly_monotonic) if k=="s": l.append(poly_sleep) if k=="gk": l.append(poly_get_key) if k=="tk": l.append(poly_test_key) return l