dsys2
view src/dsys2.h @ 2:1705e550bd91
foo
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Wed, 31 Aug 2011 05:08:54 +0300 |
parents | |
children | 94ce16dd20c0 |
line source
1 #ifndef DSYS2_H_
2 #define DSYS2_H_
4 #include <stdio.h>
6 struct dsys_demo;
7 struct dsys_event;
9 typedef float demotime_t;
11 enum dsys_evtype {
12 DSYS_SINGLE,
13 DSYS_PERIODIC
14 };
17 struct dsys_demo *dsys_open(const char *fname);
18 struct dsys_demo *dsys_open_stream(FILE *fp);
19 void dsys_close(struct dsys_demo *demo);
21 void dsys_update(struct dsys_demo *demo, demotime_t tm);
24 void dsys_start(struct dsys_demo *demo);
25 void dsys_stop(struct dsys_demo *demo);
26 int dsys_is_running(struct dsys_demo *demo);
29 demotime_t dsys_duration(struct dsys_demo *demo);
30 demotime_t dsys_time(struct dsys_demo *demo);
31 float dsys_progress(struct dsys_demo *demo);
33 /* seek without continuity */
34 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
35 void dsys_seek_norm(struct dsys_demo *demo, float t);
37 /* seek by accelerating time */
38 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
39 void dsys_warp_norm(struct dsys_demo *demo, float t);
42 /* events */
43 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
45 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
46 float dsys_event_value(struct dsys_event *ev);
48 void dsys_event_callback(struct dsys_event *ev, void (*func)(void*), void *cls);
49 void dsys_event_link(struct dsys_event *ev, float *link);
52 /* time conversion */
53 demotime_t dsys_sec_to_dtime(float sec);
54 demotime_t dsys_msec_to_dtime(unsigned long msec);
55 demotime_t dsys_norm_to_dtime(float t);
57 float dsys_dtime_to_sec(demotime_t tm);
58 unsigned long dsys_dtime_to_msec(demotime_t tm);
59 float dsys_dtime_to_norm(demotime_t tm);
62 #endif /* DSYS2_H_ */