00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #ifndef BENG_INTERFACE_H
00033 #define BENG_INTERFACE_H
00034
00035 #define BENG_END_OF_MAIN END_OF_MAIN()
00036
00037 #define BENG_INTERFACE_UNLOADED 0
00038 #define BENG_INTERFACE_LOADED_TEXT 1
00039 #define BENG_INTERFACE_LOADED_VIDEO 2
00040
00041 #define BENG_INTERFACE_TIMER_PROCESS 0
00042 #define BENG_INTERFACE_TIMER_DRAW 1
00043
00044 #include <bitset>
00045
00046 class BengSystem;
00047
00048 class BengInterface {
00049 friend class BengSystem;
00050 friend class BengIGfx;
00051 friend class BengISfx;
00052
00053 private:
00054
00055 char isGUI_;
00056 char isInit_;
00057
00058 volatile int ticQueue_;
00059 volatile int tics_;
00060 int ticsCurrent_;
00061
00062 volatile int fpsTics_;
00063 volatile int fpsLast_;
00064 volatile int fpsTotalTics_;
00065 volatile int fpsIndex_;
00066 volatile char fpsUpdate_;
00067
00068 void displayError_(int severity, char *errorstring);
00069 BengSystem *system_;
00070
00071 void updateName_(void);
00072
00073 struct cpuMap_ {
00074 int id;
00075 const char *text;
00076 };
00077
00078 static void incrementTics_(void *param);
00079 static void incrementFpsTics_(void *param);
00080
00081 public:
00082
00083 BengIGfx *iGfx;
00084 BengISfx *iSfx;
00085
00086 BengInterface(BengSystem *system)
00087 {
00088 this->iGfx = new BengIGfx(this);
00089 this->iSfx = new BengISfx(this);
00090 this->system_ = system;
00091
00092 this->isGUI_ = BENG_INTERFACE_UNLOADED;
00093 this->isInit_ = this-> ticQueue_ = this-> ticsCurrent_ = this-> tics_
00094 = this->fpsIndex_ = this->fpsLast_ = this->fpsTics_ = this->fpsTotalTics_
00095 = this->fpsUpdate_ = 0;
00096 }
00097 ~BengInterface(void);
00098
00099 int init(void);
00100 void deinit(void);
00101
00102 void startLoop(std::bitset<2> &result);
00103
00104 int getTics(void);
00105
00106 };
00107
00108 #endif