#define __VICON_H__
#include "arraylist.h"
+#include "bccmodels.h"
#include "bcpopup.h"
#include "bcwindowbase.h"
#include "thread.h"
~ViewPopup();
};
+class VIFrame {
+ unsigned char *img_data;
+ VFrame *vfrm;
+public:
+ VIFrame(int ww, int hh, int vcmdl) {
+ int size = BC_CModels::calculate_datasize(ww, hh, -1, vcmdl);
+ img_data = new unsigned char[size];
+ vfrm = new VFrame(img_data, -1, ww, hh, vcmdl, -1);
+ }
+ ~VIFrame() { delete vfrm; delete [] img_data; }
+
+ operator VFrame *() { return vfrm; }
+};
+
class VIcon
{
public:
- int vw, vh, vcmdl, in_use;
- ArrayList<VFrame *> images;
+ int vw, vh, in_use;
+ ArrayList<VIFrame *> images;
int64_t seq_no;
- double age, period;
+ double cycle_start, age, frame_rate;
- double frame_rate() { return 1000/period; }
- void frame_rate(double r) { period = 1000/r; }
int64_t vframes() { return images.size(); }
+ void reset() { seq_no = 0; cycle_start = 0; age = 0; }
void clear_images() { images.remove_all_objects(); }
- virtual VFrame *frame() { return images[seq_no]; }
- virtual int64_t next_frame(int n) {
- age += n * period;
- if( (seq_no+=n) >= images.size() ) seq_no = 0;
- return seq_no;
- }
+ virtual int64_t set_seq_no(int64_t no) { return seq_no = no; }
+ virtual VFrame *frame() { return *images[seq_no]; }
virtual int get_vx() { return 0; }
virtual int get_vy() { return 0; }
void draw_vframe(BC_WindowBase *wdw, int x, int y);
void dump(const char *dir);
- VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=24);
+ VIcon(int vw=VICON_WIDTH, int vh=VICON_HEIGHT, double rate=VICON_RATE);
virtual ~VIcon();
};
VIcon *viewing, *vicon;
int view_w, view_h;
int img_dirty, win_dirty;
- int64_t draw_flash;
+ double refresh_rate;
ArrayList<VIcon *>t_heap;
VIcon *low_vicon();
- void add_vicon(VIcon *vicon, double age=0);
+ void add_vicon(VIcon *vicon);
int del_vicon(VIcon *&vicon);
void run();
void flash();