dsys2
view src/dsys2.h @ 11:65da828bc218
forgot the dependecy to lib_a for the install target
author | John Tsiombikas <nuclear@siggraph.org> |
---|---|
date | Sun, 04 Sep 2011 18:21:26 +0300 |
parents | 80f86f0f67ec |
children |
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 };
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
20 struct dsys_demo *dsys_open(const char *fname);
21 struct dsys_demo *dsys_open_stream(FILE *fp);
22 void dsys_close(struct dsys_demo *demo);
24 void dsys_update(struct dsys_demo *demo, demotime_t tm);
27 void dsys_start(struct dsys_demo *demo);
28 void dsys_stop(struct dsys_demo *demo);
29 int dsys_is_running(struct dsys_demo *demo);
32 demotime_t dsys_duration(struct dsys_demo *demo);
33 demotime_t dsys_time(struct dsys_demo *demo);
34 float dsys_progress(struct dsys_demo *demo);
36 /* seek without continuity */
37 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
38 void dsys_seek_norm(struct dsys_demo *demo, float t);
40 /* seek by accelerating time */
41 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
42 void dsys_warp_norm(struct dsys_demo *demo, float t);
45 /* events */
46 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
48 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
49 float dsys_event_value(struct dsys_event *ev);
51 int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls);
52 int dsys_event_link(struct dsys_event *ev, float *link);
54 /* event evaluators */
55 float dsys_eval_step(struct dsys_event *ev, demotime_t t);
56 float dsys_eval_lerp(struct dsys_event *ev, demotime_t t);
57 float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t);
59 /* time conversion */
60 demotime_t dsys_sec_to_dtime(float sec);
61 demotime_t dsys_msec_to_dtime(unsigned long msec);
63 float dsys_dtime_to_sec(demotime_t tm);
64 unsigned long dsys_dtime_to_msec(demotime_t tm);
66 #ifdef __cplusplus
67 }
68 #endif
71 #endif /* DSYS2_H_ */