void genprim_pointer_methods(compile_t* c, reach_type_t* t) { ast_t* typeargs = ast_childidx(t->ast, 2); ast_t* typearg = ast_child(typeargs); reach_type_t* t_elem = reach_type(c->reach, typearg); pointer_create(c, t); pointer_alloc(c, t, t_elem); pointer_realloc(c, t, t_elem); pointer_unsafe(c, t); pointer_apply(c, t, t_elem); pointer_update(c, t, t_elem); pointer_offset(c, t, t_elem); pointer_insert(c, t, t_elem); pointer_delete(c, t, t_elem); pointer_copy_to(c, t, t_elem); pointer_usize(c, t); }
void main (void) { // Connect to our drivers for the TFT, touch sensor. tft_touch = touchscreen_open(TOUCHSCREEN_1); ptr = pointer_open(POINTER_1); display = graphics_open(GRAPHICS_1); canvas = graphics_get_visible_canvas(display); leds = led_open(DRV_LED_1); led_turn_all_off(leds); // Clear screen graphics_fill_canvas(canvas, BLACK); graphics_set_visible_canvas(display, canvas); // Update display and turn off LEDs while(!graphics_visible_canvas_is_set(display)); // Set up and calibrate touch screen. touchscreen_set_callback(tft_touch, draw_mark, canvas); while(!touchscreen_calibrate(tft_touch, 320, 240)) { set_all_leds(0xFF0000); // If Touchscreen can't calibrate RED ALERT! } led_turn_all_off(leds); // Put colormap on TFT graphics_draw_bitmap(canvas, bmp, 0, 0, 320, 240, 0); graphics_set_visible_canvas(display, canvas); // Start picking colors! while(1) { if (pointer_update(ptr, pointer_state)) { set_all_leds(graphics_get_pixel(canvas, pointer_state->x, pointer_state->y)); } } }