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_SYSTEM_H
00033 #define BENG_SYSTEM_H
00034
00035 #include <cstdio>
00036 #include <ctime>
00037 #include <list>
00038 #include <vector>
00039
00040 #include "BengInterface.h"
00041 #include "BengVersion.h"
00042 #include "CString.h"
00043 #include "Resource.h"
00044 #include "Scene.h"
00045
00046 class BengSystem {
00047 friend class BengScene;
00048 friend class BengIGfx;
00049 friend class BengInterface;
00050
00051 private:
00052
00053 FILE *logFile;
00054
00055 char gameIdent_[16];
00056 BengCString gameName_;
00057 int windowW_;
00058 int windowH_;
00059 short int framerate_;
00060 short int frameskip_;
00061 short int maxFrametime_;
00062 void *palette_;
00063 char *defaultScenefile_;
00064 char *titleScenefile_;
00065
00066 int exitLoop_;
00067
00068 public:
00069
00070 BengScene *scene;
00071 BengResourceList<BengISprite> *spriteResourceList;
00072 BengResourceList<BengISample> *sampleResourceList;
00073
00074
00075
00076 void consprint(const char *message);
00077 void consprintf(const char *format, ...);
00078
00079 BengInterface *interface;
00080
00081 BengSystem(void)
00082 {
00083
00084 struct tm *local;
00085 time_t t;
00086
00087 this->interface = new BengInterface(this);
00088 this->spriteResourceList = new BengResourceList<BengISprite>(this);
00089 this->sampleResourceList = new BengResourceList<BengISample>(this);
00090
00091 t = time(NULL);
00092
00093 local = localtime(&t);
00094
00095 logFile = fopen("log.txt", "wt");
00096
00097 this->consprintf("\nBlitzzEngine %s"
00098 "\n\nA Framework for 2D Games"
00099 "\nDeveloped by Cirrus Creative"
00100 "\n\nThird Party Library Credits:"
00101 "\n- Fixed Point Math Routines by Markus Trenkwalder"
00102 "\n Thanks for that! You rule!"
00103 "\n----------------------------------------\n"
00104 "Log time: %s----------------------------------------\n\n", BENG_VERSION_STRING,
00105 asctime(local));
00106
00107 this->scene = NULL;
00108 this->exitLoop_ = 0;
00109
00110
00111
00112
00113 this->windowW_ = 640;
00114 this->windowH_ = 480;
00115 this->framerate_ = 60;
00116 this->frameskip_ = 9;
00117 this->gameName_.set("BlitzzEngine Game");
00118 }
00119 ~BengSystem(void);
00120
00121 void giveError(int severity, const char *format, ...);
00122
00123 const char *getName(void);
00124 void setName(const char *name);
00125
00126 int newScene(const char *scenename);
00127
00128 int mainLoop(void);
00129
00130 };
00131
00132 #endif