#!/usr/bin/env php new('struct tb_event'); $termbox->tb_init(); $y = 0; $termbox->tb_printf(0, $y++, 0x02 | 0x0100, 0x00, 'hello from php'); $termbox->tb_printf(0, $y++, 0x03, 0x00, 'press any key'); $termbox->tb_present(); $termbox->tb_poll_event(FFI::addr($ev)); $termbox->tb_printf(0, $y++, 0x04, 0x00, 'event: type=%d mod=%d key=%d ch=%d w=%d h=%d x=%d y=%d', $ev->type, $ev->mod, $ev->key, $ev->ch, $ev->w, $ev->h, $ev->x, $ev->y); $termbox->tb_present(); $termbox->tb_printf(0, $y++, 0x05, 0x00, 'press any key to quit'); $termbox->tb_present(); $termbox->tb_poll_event(FFI::addr($ev)); $termbox->tb_shutdown();