00001
00002
00003
00004
00005
00006 #ifndef RC_PLATFORM_H
00007 #define RC_PLATFORM_H
00008
00009 typedef struct {
00010
00011
00012 bool button[5];
00013 f32 x;
00014 f32 y;
00015
00016
00017 bool key[RC_KEY_LAST];
00018
00019
00020 f32 time;
00021 f32 timeStep;
00022
00023 } DeviceState_t;
00024
00025
00027 void RCInit();
00028
00030 u32 RCUpdate();
00031
00033 void RCDestroy();
00034
00035 class Platform {
00036
00037 public:
00038
00039 static i32 init();
00040 static i32 run();
00041
00042 static bool *getKeyState();
00043 static bool *getMouseButtonState();
00044 static vec2f getMousePosition();
00045
00046 static f32 getCurrentTime();
00047
00048
00049 static f32 getFrameTime();
00050
00051
00052 static f32 getFrameTimeStep();
00053
00054 static i32 initFrame();
00055
00056
00057
00058
00059 static void *getWindowHandle();
00060
00061 static void getDisplaySize(
00062 u32 *width,
00063 u32 *height
00064 );
00065
00066 static void setDisplay(
00067 bool fullscreen,
00068 u32 width,
00069 u32 height
00070 );
00071
00072
00073
00074
00075 static void getTexture(
00076 const char *filename,
00077 bool flip_y,
00078 u8 **pixels,
00079 u32 *width,
00080 u32 *height,
00081 u32 *bytes_per_pixel
00082 );
00083
00084 static void destroyTexture(
00085 unsigned char *pixels
00086 );
00087
00088 private:
00089
00090 static void update_time();
00091
00092 static int update_input();
00093
00094 };
00095
00096
00097
00098 #ifdef RC_WIN32
00099
00100 #else if defined RC_APPLE
00101 extern FILE* iphone_fopen(const char* filename, const char* mode);
00102 #define fopen iphone_fopen
00103 #define min(a, b) (a < b ? a : b)
00104 #endif
00105
00106 #endif
00107
00108