dsys2

annotate src/dsys2.h @ 0:34d90cd9ef9b

starting a new demosystem
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 20 Aug 2011 07:48:16 +0300
parents
children 94ce16dd20c0
rev   line source
nuclear@0 1 #ifndef DSYS2_H_
nuclear@0 2 #define DSYS2_H_
nuclear@0 3
nuclear@0 4 #include <stdio.h>
nuclear@0 5
nuclear@0 6 struct dsys_demo;
nuclear@0 7 struct dsys_event;
nuclear@0 8
nuclear@0 9 typedef float demotime_t;
nuclear@0 10
nuclear@0 11 enum dsys_evtype {
nuclear@0 12 DSYS_SINGLE,
nuclear@0 13 DSYS_PERIODIC
nuclear@0 14 };
nuclear@0 15
nuclear@0 16
nuclear@0 17 struct dsys_demo *dsys_open(const char *fname);
nuclear@0 18 struct dsys_demo *dsys_open_stream(FILE *fp);
nuclear@0 19 void dsys_close(struct dsys_demo *demo);
nuclear@0 20
nuclear@0 21 void dsys_update(struct dsys_demo *demo, demotime_t tm);
nuclear@0 22
nuclear@0 23
nuclear@0 24 void dsys_start(struct dsys_demo *demo);
nuclear@0 25 void dsys_stop(struct dsys_demo *demo);
nuclear@0 26 int dsys_is_running(struct dsys_demo *demo);
nuclear@0 27
nuclear@0 28
nuclear@0 29 demotime_t dsys_duration(struct dsys_demo *demo);
nuclear@0 30 demotime_t dsys_time(struct dsys_demo *demo);
nuclear@0 31 float dsys_progress(struct dsys_demo *demo);
nuclear@0 32
nuclear@0 33 /* seek without continuity */
nuclear@0 34 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
nuclear@0 35 void dsys_seek_norm(struct dsys_demo *demo, float t);
nuclear@0 36
nuclear@0 37 /* seek by accelerating time */
nuclear@0 38 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
nuclear@0 39 void dsys_warp_norm(struct dsys_demo *demo, float t);
nuclear@0 40
nuclear@0 41
nuclear@0 42 /* events */
nuclear@0 43 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
nuclear@0 44
nuclear@0 45 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
nuclear@0 46 float dsys_event_value(struct dsys_event *ev);
nuclear@0 47
nuclear@0 48 void dsys_event_callback(struct dsys_event *ev, void (*func)(void*), void *cls);
nuclear@0 49 void dsys_event_link(struct dsys_event *ev, float *link);
nuclear@0 50
nuclear@0 51
nuclear@0 52 /* time conversion */
nuclear@0 53 demotime_t dsys_sec_to_dtime(float sec);
nuclear@0 54 demotime_t dsys_msec_to_dtime(unsigned long msec);
nuclear@0 55 demotime_t dsys_norm_to_dtime(float t);
nuclear@0 56
nuclear@0 57 float dsys_dtime_to_sec(demotime_t tm);
nuclear@0 58 unsigned long dsys_dtime_to_msec(demotime_t tm);
nuclear@0 59 float dsys_dtime_to_norm(demotime_t tm);
nuclear@0 60
nuclear@0 61
nuclear@0 62 #endif /* DSYS2_H_ */