source: abuse/branches/pd/abuse/inc/seq.hpp @ 608

Last change on this file since 608 was 49, checked in by Sam Hocevar, 15 years ago
  • Imported original public domain release, for future reference.
File size: 1.2 KB
Line 
1#ifndef __SEQUENCE_HPP_
2#define __SEQUENCE_HPP_
3
4#include "image.hpp"
5#include "items.hpp"
6#include "timage.hpp"
7#include "cache.hpp"
8#include <stdarg.h>
9
10class sequence
11{
12  int total;
13  int *seq;         // array of ids to figures
14public :
15  // takes a varible number of arguments (ints) specifing indexes into image array
16  sequence(int *figures, int total_frames) { total=total_frames; seq=figures; }
17
18  sequence(char *filename, void *pict_list, void *advance_list);
19
20  int next_frame(short &current) { current++; if (current>=total) { current=0; return 0; } return 1; }
21  int last_frame(short &current) { current--; if (current<0) { current=total-1; return 0; } return 1; }
22  trans_image  *get_frame(short current, int direction)
23   { if (direction>0) return cash.fig(seq[current])->forward;
24                 else return cash.fig(seq[current])->backward; }
25  figure *get_figure(short current) { return cash.fig(seq[current]); }
26  int cache_in();
27  int x_center(short current) { return (short) (cash.fig(seq[current])->xcfg); }
28  int length() { return total; }
29  int get_advance(int current) { return cash.fig(seq[current])->advance; }
30  int size();
31  ~sequence();
32};
33
34#endif
35
36
Note: See TracBrowser for help on using the repository browser.