dbf-udg

view libs/dsys2/dsys.h @ 12:1abbed71e9c9

cleanup, copyright statements and notices, readme files
author John Tsiombikas <nuclear@member.fsf.org>
date Wed, 20 Feb 2013 05:45:27 +0200
parents 5f99c4c7a9fe
children
line source
1 /*
2 New demosystem by Nuclear / Mindlapse
3 Copyright (C) 2011-2013 John Tsiombikas <nuclear@member.fsf.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef DSYS2_H_
19 #define DSYS2_H_
21 #include <stdio.h>
23 struct dsys_demo;
24 struct dsys_event;
26 typedef float demotime_t;
28 enum dsys_evtype {
29 DSYS_SINGLE,
30 DSYS_PERIODIC
31 };
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
37 struct dsys_demo *dsys_open(const char *fname);
38 struct dsys_demo *dsys_open_stream(FILE *fp);
39 void dsys_close(struct dsys_demo *demo);
41 void dsys_update(struct dsys_demo *demo, demotime_t tm);
44 void dsys_start(struct dsys_demo *demo);
45 void dsys_stop(struct dsys_demo *demo);
46 int dsys_is_running(struct dsys_demo *demo);
49 demotime_t dsys_duration(struct dsys_demo *demo);
50 demotime_t dsys_time(struct dsys_demo *demo);
51 float dsys_progress(struct dsys_demo *demo);
53 /* seek without continuity */
54 void dsys_seek(struct dsys_demo *demo, demotime_t tm);
55 void dsys_seek_norm(struct dsys_demo *demo, float t);
57 /* seek by accelerating time */
58 void dsys_warp(struct dsys_demo *demo, demotime_t tm);
59 void dsys_warp_norm(struct dsys_demo *demo, float t);
62 /* events */
63 struct dsys_event *dsys_event(struct dsys_demo *demo, const char *name);
65 void dsys_set_event_eval(struct dsys_event *ev, float (*eval)(struct dsys_event*, demotime_t));
67 enum dsys_evtype dsys_event_type(struct dsys_event *ev);
68 float dsys_event_value(struct dsys_event *ev);
70 int dsys_event_callback(struct dsys_event *ev, void (*func)(struct dsys_event*, void*), void *cls);
71 int dsys_event_link(struct dsys_event *ev, float *link);
73 /* event evaluators */
74 float dsys_eval_step(struct dsys_event *ev, demotime_t t);
75 float dsys_eval_lerp(struct dsys_event *ev, demotime_t t);
76 float dsys_eval_sigmoid(struct dsys_event *ev, demotime_t t);
78 /* time conversion */
79 demotime_t dsys_sec_to_dtime(float sec);
80 demotime_t dsys_msec_to_dtime(unsigned long msec);
82 float dsys_dtime_to_sec(demotime_t tm);
83 unsigned long dsys_dtime_to_msec(demotime_t tm);
85 #ifdef __cplusplus
86 }
87 #endif
90 #endif /* DSYS2_H_ */