void input(parg_event evt, float x, float y, float z) { char key = (char) x; switch (evt) { case PARG_EVENT_KEYPRESS: if (key == ' ') { mode_highp = !mode_highp; printf("Precision %s.\n", mode_highp ? "on" : "off"); parg_zcam_touch(); } else if (key == 'G') { showgrid = 1 - showgrid; parg_zcam_touch(); } else if (key == 'D') { if (!mode_demo_start) { mode_demo_start = current_time; mode_demo_direction = 1 - mode_demo_direction; } } break; case PARG_EVENT_DOWN: parg_zcam_grab_begin(x, y); break; case PARG_EVENT_UP: parg_zcam_grab_update(x, y, z); parg_zcam_grab_end(); break; case PARG_EVENT_MOVE: parg_zcam_grab_update(x, y, z); break; default: break; } }
void input(parg_event evt, float x, float y, float z) { switch (evt) { case PARG_EVENT_DOWN: parg_zcam_grab_begin(x, y); break; case PARG_EVENT_UP: parg_zcam_grab_update(x, y, z); parg_zcam_grab_end(); break; case PARG_EVENT_MOVE: parg_zcam_grab_update(x, y, z); break; default: break; } }
int tick(float winwidth, float winheight, float pixratio, float seconds) { current_time = seconds; fbsize.x = winwidth * pixratio; fbsize.y = winheight * pixratio; parg_zcam_tick(winwidth / winheight, seconds); if (mode_demo_start) { double t = (current_time - mode_demo_start) / DEMO_DURATION; if (t >= 1) { mode_demo_start = 0; } float scrolldelta = mode_demo_direction ? -3 : 3; parg_zcam_grab_update(TARGETPOS.x, TARGETPOS.y, scrolldelta); } return parg_zcam_has_moved(); }