00001
00002 #ifndef _H_MAIN_H_
00003 #define _H_MAIN_H_
00004
00005 namespace std {}
00006 using namespace std;
00007
00008 #include <vector>
00009 #include <string>
00010 #include <iostream>
00011 #include "H_Keys.h"
00012 #include "H_Standard.h"
00013
00014 #define BH_DEFAULT_X 100
00015 #define BH_DEFAULT_Y 100
00016
00017
00018 class HJoystick
00019 {
00020 public:
00021 virtual ~HJoystick();
00022 virtual bool IsValid() = 0;
00023 virtual const char *GetDescription() = 0;
00024 virtual int GetNumAxis() = 0;
00025 virtual int GetNumButtons() = 0;
00026 virtual void UpdateState() = 0;
00027 virtual REAL GetAxisPos(int i) = 0;
00028 virtual bool GetButtonPos(int i) = 0;
00029 virtual bool SetForceFeedback(REAL x,REAL y) =0;
00030 };
00031
00032
00033
00034
00035
00036 class HWindow
00037 {
00038 public:
00039 virtual ~HWindow();
00040
00041 virtual const char* GetKeyboardDescription() = 0;
00042 virtual bool IsPressed(SDLKey k) = 0;
00043 virtual HJoystick* GetJoystick() = 0;
00044
00045 virtual void MakeCurrent() = 0;
00046 virtual void SwapBuffers() = 0;
00047
00048
00049 virtual void SetAttrib(int width, int height, bool fullscreen) = 0;
00050 public:
00051 int m_width, m_height;
00052 bool m_fullscreen;
00053 };
00054
00055 class HAppData;
00056
00057
00058 class HApplication
00059 {
00060 public:
00061 HApplication();
00062 virtual ~HApplication();
00063
00064 static int TimeRefreshRate();
00065
00066 virtual const char *name() = 0;
00067
00068 virtual void on_idle(unsigned int elapsed_time) = 0;
00069 public:
00070
00071 HAppData *m_data;
00072 };
00073
00074
00075
00076 class HglApplication : public HApplication
00077 {
00078 public:
00079 HglApplication();
00080 virtual ~HglApplication();
00081
00082
00083 unsigned int GetScreenMode();
00084 bool SetScreenMode(unsigned int ScreenMode, ostream &out);
00085 void PrintScreenMode(unsigned int ScreenMode, ostream &out);
00086 void PrintAllScreenModes(ostream &out);
00087
00088 virtual void draw_init() = 0;
00089 virtual void draw() = 0;
00090 virtual void key_down(SDLKey AHKey, char c) = 0;
00091 virtual void resize(unsigned int width, unsigned int height) = 0;
00092 public:
00093
00094 HWindow *m_window;
00095 };
00096
00097 const char *ConfigurationFileName();
00098 void HErrorExit(const char *E);
00099
00100 void Add(HglApplication *app);
00101
00102 #endif //_H_MAIN_H_