;;;;; ezxdisp.scm (module ezxdisp (ezx-init ezx-quit ezx-redraw ezx-resize ezx-wipe ezx-wipe-layer ezx-select-layer ezx-set-background ezx-window-name ezx-isclosed ezx-sensebutton ezx-pushbutton ezx-point-2d ezx-line-2d ezx-lines-2d-lolevel ezx-poly-2d-lolevel ezx-str-2d ezx-rect-2d ezx-fillrect-2d ezx-circle-2d ezx-fillcircle-2d ezx-arc-2d ezx-fillarc-2d ezx-c3d-to-2d ezx-line-3d ezx-set-light-3d ezx-set-view-3d ezx-str-3d ezx-poly-3d-lolevel ezx-circle-3d make-ezx-color ezx-next-event ezx-lines-2d ezx-poly-2d ezx-poly-3d ezx:BUTTON-PRESS ezx:BUTTON-RELEASE ezx:KEY-PRESS ezx:KEY-RELEASE ezx:MOTION-NOTIFY ezx:CLOSE ) (import scheme (chicken base) (except (chicken foreign) foreign-declare) srfi-4 bind) (define-record ezx ptr) (bind-type ezxp (c-pointer "ezx_t") ezx-ptr make-ezx) (bind-type ezxcp f64vector) (bind-options export-constants: #t) (bind-rename/pattern "_" "-") (bind-rename/pattern "EZX-" "ezx:") #> #include "ezxdisp.h" static int get_next_event(ezx_t *e, int *x, int *y, unsigned int *state, unsigned int *kb) { ezx_event_t ev; ezx_next_event(e, &ev); switch(ev.type) { case EZX_BUTTON_PRESS: case EZX_BUTTON_RELEASE: *kb = ev.button.b; *x = ev.button.x; *y = ev.button.y; *state = ev.button.state; break; case EZX_KEY_PRESS: case EZX_KEY_RELEASE: *kb = ev.key.k & 0xffff; *x = ev.key.x; *y = ev.key.y; *state = ev.key.state; break; case EZX_MOTION_NOTIFY: *x = ev.motion.x; *y = ev.motion.y; *state = ev.motion.state; break; } return ev.type; } <# (bind #<