original 1.0.1 release
[xwelltris.git] / src / include / wellengine.h
blobbb5de1e0f17bddf3e6a173a7043c887af029cb89
1 #ifndef WELLENGINE_H
2 #define WELLENGINE_H
4 #include "wellobject.h"
5 #include "bilist.h"
6 #include "welldrawing.h"
7 #include "wellimagefont.h"
8 #include "welltopnine.h"
9 #include "wellintro.h"
10 #include "wellkey.h"
11 #include "wellswitch.h"
12 #include "wellinput.h"
14 class WellBase;
16 //Class used in Time queue for delivering time events to objects
17 struct TimeObject
19 WellObject* obj;
20 int ticks_left;
21 int ticks;
22 TimeObject() {ticks=ticks_left=0; obj=0;};
23 TimeObject(WellObject* wo, int t=1) { obj=wo;ticks_left=ticks=t;};
24 void restart_ticks() { ticks_left=ticks; };
25 bool operator == (TimeObject& o2) {return o2.obj==obj;};
28 typedef bilist<TimeObject> TimeList; //List of objects that want timers
29 typedef bilist<WellObject*> ObjectList; //List of all objects that waht events
31 struct WellImage
33 Images id; //Image id
34 int l,h; //Size of image
35 WellImage() { id=imNone; l=h=0;};
38 class WellEngine
40 protected:
42 TimeList timelist;
43 ObjectList objectlist;
45 unsigned int mainl,mainh; // size of main window
46 bool done_loop_var;
48 WellImage images[MAX_IMAGES];
50 virtual void init_mainwindow(int,char**)=0;
51 virtual int wait_for_timers()=0;
52 virtual bool process_time_event();
53 virtual bool process_event_for_all(wEvent);
55 public:
56 WellEngine(int,char**);
57 ~WellEngine();
59 virtual void show_main()=0;
60 virtual void event_loop()=0;
62 virtual bool add_timer(WellObject* wo, int ticks);
63 virtual bool del_timer(WellObject* wo);
64 virtual bool add_object(WellObject* wo);
65 virtual bool del_object(WellObject* wo);
66 virtual void clear_objectlist();
67 virtual void done_loop() { done_loop_var=true;};
69 virtual WellDrawingEngine* new_well_drawing_engine();
70 virtual WellTopNine* new_well_top_nine();
71 virtual WellIntro* new_well_intro();
72 virtual WellKey* new_well_key(char*);
73 virtual WellInput* new_well_input(char*) { return 0;};
74 virtual WellSwitch* new_well_switch(char*);
75 virtual WellImageFont* new_well_image_font(Images id,
76 unsigned int ifl,
77 unsigned int ifh,
78 int idx, int idy) { return 0;};
80 virtual WellBase* new_well_base();
82 virtual bool load_image(Images id, char* name) { return false;};
83 virtual void set_main_background_image(Images id) {};
84 virtual void screen_copy(Geo*) {};
85 virtual void screen_clear(Geo*) {};
86 virtual void load_images();
87 virtual void udelay(int msec) {};
90 extern WellEngine* default_well_engine;
91 extern WellEngine* new_well_engine(int argc, char** argv);
93 #endif