nuclear@0: #ifndef DSYS2_H_ nuclear@0: #define DSYS2_H_ nuclear@0: nuclear@0: #include nuclear@0: nuclear@0: struct dsys_demo; nuclear@0: struct dsys_event; nuclear@0: nuclear@0: typedef float demotime_t; nuclear@0: nuclear@0: enum dsys_evtype { nuclear@0: DSYS_SINGLE, nuclear@0: DSYS_PERIODIC nuclear@0: }; nuclear@0: nuclear@0: nuclear@0: struct dsys_demo *dsys_open(const char *fname); nuclear@0: struct dsys_demo *dsys_open_stream(FILE *fp); nuclear@0: void dsys_close(struct dsys_demo *demo); nuclear@0: nuclear@0: void dsys_update(struct dsys_demo *demo, demotime_t tm); nuclear@0: nuclear@0: nuclear@0: void dsys_start(struct dsys_demo *demo); nuclear@0: void dsys_stop(struct dsys_demo *demo); nuclear@0: int dsys_is_running(struct dsys_demo *demo); nuclear@0: nuclear@0: nuclear@0: demotime_t dsys_duration(struct dsys_demo *demo); nuclear@0: demotime_t dsys_time(struct dsys_demo *demo); nuclear@0: float dsys_progress(struct dsys_demo *demo); nuclear@0: nuclear@0: /* seek without continuity */ nuclear@0: void dsys_seek(struct dsys_demo *demo, demotime_t tm); nuclear@0: void dsys_seek_norm(struct dsys_demo *demo, float t); nuclear@0: nuclear@0: /* seek by accelerating time */ nuclear@0: void dsys_warp(struct dsys_demo *demo, demotime_t tm); nuclear@0: void dsys_warp_norm(struct dsys_demo *demo, float t); nuclear@0: nuclear@0: nuclear@0: /* events */ nuclear@0: struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name); nuclear@0: nuclear@0: enum dsys_evtype dsys_event_type(struct dsys_event *ev); nuclear@0: float dsys_event_value(struct dsys_event *ev); nuclear@0: nuclear@6: int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls); nuclear@6: int dsys_event_link(struct dsys_event *ev, float *link); nuclear@0: nuclear@5: /* event evaluators */ nuclear@5: float dsys_eval_step(struct dsys_event *ev, demotime_t t); nuclear@5: float dsys_eval_lerp(struct dsys_event *ev, demotime_t t); nuclear@5: float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t); nuclear@0: nuclear@0: /* time conversion */ nuclear@0: demotime_t dsys_sec_to_dtime(float sec); nuclear@0: demotime_t dsys_msec_to_dtime(unsigned long msec); nuclear@0: nuclear@0: float dsys_dtime_to_sec(demotime_t tm); nuclear@0: unsigned long dsys_dtime_to_msec(demotime_t tm); nuclear@0: nuclear@0: nuclear@0: #endif /* DSYS2_H_ */