dsys2
diff src/dsys.h @ 13:6bab2c0b0e4b
- added a shared library rule
- changed all the names from dsys2 to dsys
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Mon, 05 Sep 2011 04:08:40 +0300 |
parents | src/dsys2.h@5ba9dd6742a0 |
children | 26e3e0359f5b |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/dsys.h Mon Sep 05 04:08:40 2011 +0300 1.3 @@ -0,0 +1,71 @@ 1.4 +#ifndef DSYS2_H_ 1.5 +#define DSYS2_H_ 1.6 + 1.7 +#include <stdio.h> 1.8 + 1.9 +struct dsys_demo; 1.10 +struct dsys_event; 1.11 + 1.12 +typedef float demotime_t; 1.13 + 1.14 +enum dsys_evtype { 1.15 + DSYS_SINGLE, 1.16 + DSYS_PERIODIC 1.17 +}; 1.18 + 1.19 +#ifdef __cplusplus 1.20 +extern "C" { 1.21 +#endif 1.22 + 1.23 +struct dsys_demo *dsys_open(const char *fname); 1.24 +struct dsys_demo *dsys_open_stream(FILE *fp); 1.25 +void dsys_close(struct dsys_demo *demo); 1.26 + 1.27 +void dsys_update(struct dsys_demo *demo, demotime_t tm); 1.28 + 1.29 + 1.30 +void dsys_start(struct dsys_demo *demo); 1.31 +void dsys_stop(struct dsys_demo *demo); 1.32 +int dsys_is_running(struct dsys_demo *demo); 1.33 + 1.34 + 1.35 +demotime_t dsys_duration(struct dsys_demo *demo); 1.36 +demotime_t dsys_time(struct dsys_demo *demo); 1.37 +float dsys_progress(struct dsys_demo *demo); 1.38 + 1.39 +/* seek without continuity */ 1.40 +void dsys_seek(struct dsys_demo *demo, demotime_t tm); 1.41 +void dsys_seek_norm(struct dsys_demo *demo, float t); 1.42 + 1.43 +/* seek by accelerating time */ 1.44 +void dsys_warp(struct dsys_demo *demo, demotime_t tm); 1.45 +void dsys_warp_norm(struct dsys_demo *demo, float t); 1.46 + 1.47 + 1.48 +/* events */ 1.49 +struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name); 1.50 + 1.51 +enum dsys_evtype dsys_event_type(struct dsys_event *ev); 1.52 +float dsys_event_value(struct dsys_event *ev); 1.53 + 1.54 +int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls); 1.55 +int dsys_event_link(struct dsys_event *ev, float *link); 1.56 + 1.57 +/* event evaluators */ 1.58 +float dsys_eval_step(struct dsys_event *ev, demotime_t t); 1.59 +float dsys_eval_lerp(struct dsys_event *ev, demotime_t t); 1.60 +float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t); 1.61 + 1.62 +/* time conversion */ 1.63 +demotime_t dsys_sec_to_dtime(float sec); 1.64 +demotime_t dsys_msec_to_dtime(unsigned long msec); 1.65 + 1.66 +float dsys_dtime_to_sec(demotime_t tm); 1.67 +unsigned long dsys_dtime_to_msec(demotime_t tm); 1.68 + 1.69 +#ifdef __cplusplus 1.70 +} 1.71 +#endif 1.72 + 1.73 + 1.74 +#endif /* DSYS2_H_ */