dsys2
view src/dsys2.h @ 7:3258d163cfbc
hurray it seems like working for the most part
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Fri, 02 Sep 2011 08:14:40 +0300 |
parents | 94ce16dd20c0 |
children | 5ba9dd6742a0 |
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 int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls);
49 int dsys_event_link(struct dsys_event *ev, float *link);
51 /* event evaluators */
52 float dsys_eval_step(struct dsys_event *ev, demotime_t t);
53 float dsys_eval_lerp(struct dsys_event *ev, demotime_t t);
54 float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t);
56 /* time conversion */
57 demotime_t dsys_sec_to_dtime(float sec);
58 demotime_t dsys_msec_to_dtime(unsigned long msec);
60 float dsys_dtime_to_sec(demotime_t tm);
61 unsigned long dsys_dtime_to_msec(demotime_t tm);
64 #endif /* DSYS2_H_ */