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 #ifdef __cplusplus
|
nuclear@0
|
17 extern "C" {
|
nuclear@0
|
18 #endif
|
nuclear@0
|
19
|
nuclear@0
|
20 struct dsys_demo *dsys_open(const char *fname);
|
nuclear@0
|
21 struct dsys_demo *dsys_open_stream(FILE *fp);
|
nuclear@0
|
22 void dsys_close(struct dsys_demo *demo);
|
nuclear@0
|
23
|
nuclear@0
|
24 void dsys_update(struct dsys_demo *demo, demotime_t tm);
|
nuclear@0
|
25
|
nuclear@0
|
26
|
nuclear@0
|
27 void dsys_start(struct dsys_demo *demo);
|
nuclear@0
|
28 void dsys_stop(struct dsys_demo *demo);
|
nuclear@0
|
29 int dsys_is_running(struct dsys_demo *demo);
|
nuclear@0
|
30
|
nuclear@0
|
31
|
nuclear@0
|
32 demotime_t dsys_duration(struct dsys_demo *demo);
|
nuclear@0
|
33 demotime_t dsys_time(struct dsys_demo *demo);
|
nuclear@0
|
34 float dsys_progress(struct dsys_demo *demo);
|
nuclear@0
|
35
|
nuclear@0
|
36 /* seek without continuity */
|
nuclear@0
|
37 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
|
nuclear@0
|
38 void dsys_seek_norm(struct dsys_demo *demo, float t);
|
nuclear@0
|
39
|
nuclear@0
|
40 /* seek by accelerating time */
|
nuclear@0
|
41 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
|
nuclear@0
|
42 void dsys_warp_norm(struct dsys_demo *demo, float t);
|
nuclear@0
|
43
|
nuclear@0
|
44
|
nuclear@0
|
45 /* events */
|
nuclear@0
|
46 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
|
nuclear@0
|
47
|
nuclear@0
|
48 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
|
nuclear@0
|
49 float dsys_event_value(struct dsys_event *ev);
|
nuclear@0
|
50
|
nuclear@0
|
51 int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls);
|
nuclear@0
|
52 int dsys_event_link(struct dsys_event *ev, float *link);
|
nuclear@0
|
53
|
nuclear@0
|
54 /* event evaluators */
|
nuclear@0
|
55 float dsys_eval_step(struct dsys_event *ev, demotime_t t);
|
nuclear@0
|
56 float dsys_eval_lerp(struct dsys_event *ev, demotime_t t);
|
nuclear@0
|
57 float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t);
|
nuclear@0
|
58
|
nuclear@0
|
59 /* time conversion */
|
nuclear@0
|
60 demotime_t dsys_sec_to_dtime(float sec);
|
nuclear@0
|
61 demotime_t dsys_msec_to_dtime(unsigned long msec);
|
nuclear@0
|
62
|
nuclear@0
|
63 float dsys_dtime_to_sec(demotime_t tm);
|
nuclear@0
|
64 unsigned long dsys_dtime_to_msec(demotime_t tm);
|
nuclear@0
|
65
|
nuclear@0
|
66 #ifdef __cplusplus
|
nuclear@0
|
67 }
|
nuclear@0
|
68 #endif
|
nuclear@0
|
69
|
nuclear@0
|
70
|
nuclear@0
|
71 #endif /* DSYS2_H_ */
|