diff options
author | Chris Xiong <chirs241097@gmail.com> | 2015-11-01 23:32:22 +0800 |
---|---|---|
committer | Chris Xiong <chirs241097@gmail.com> | 2015-11-01 23:32:22 +0800 |
commit | f68cc9034a576b6f91cf0db0344ece971944c973 (patch) | |
tree | 123744e85445f51d058b74d9c9fb2174f6abefd7 /archive/include | |
parent | 1981e9bc81e92f479c725e6ac60ff3bd419cefd0 (diff) | |
download | bullet-lab-remix-f68cc9034a576b6f91cf0db0344ece971944c973.tar.xz |
Move hge to an archive.
Finish the main part of smPath.
This is a C++ project, add C++ tags to all source code that
could be identified as C source files.
Diffstat (limited to 'archive/include')
-rw-r--r-- | archive/include/hge.h | 570 | ||||
-rw-r--r-- | archive/include/hgeanim.h | 69 | ||||
-rw-r--r-- | archive/include/hgecolor.h | 80 | ||||
-rw-r--r-- | archive/include/hgedistort.h | 66 | ||||
-rw-r--r-- | archive/include/hgefont.h | 94 | ||||
-rw-r--r-- | archive/include/hgegui.h | 126 | ||||
-rw-r--r-- | archive/include/hgeguictrls.h | 150 | ||||
-rw-r--r-- | archive/include/hgeparticle.h | 168 | ||||
-rw-r--r-- | archive/include/hgerect.h | 35 | ||||
-rw-r--r-- | archive/include/hgeresource.h | 85 | ||||
-rw-r--r-- | archive/include/hgesprite.h | 67 | ||||
-rw-r--r-- | archive/include/hgestrings.h | 48 | ||||
-rw-r--r-- | archive/include/hgevector.h | 54 | ||||
-rw-r--r-- | archive/include/unix_compat.h | 165 |
14 files changed, 0 insertions, 1777 deletions
diff --git a/archive/include/hge.h b/archive/include/hge.h deleted file mode 100644 index 18d57b9..0000000 --- a/archive/include/hge.h +++ /dev/null @@ -1,570 +0,0 @@ -/* -** Haaf's Game Engine 1.8 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** System layer API -*/ - - -#ifndef HGE_H -#define HGE_H - -#ifdef WIN32 -#include <windows.h> -#include <cstddef> -#else -#include "unix_compat.h" -#endif - -#define HGE_VERSION 0x181 - -#ifndef EXPORT -# ifdef HGEDLL -# ifdef _WINDOWS -# define EXPORT __declspec(dllexport) -# elif (__GNUC__ >= 3) -# define EXPORT __attribute__((visibility("default"))) -# else -# define EXPORT -# endif -# else -# define EXPORT -# endif -#endif - -#ifdef _WINDOWS -#define CALL __stdcall -#else -#define CALL -#endif - -#ifdef __BORLANDC__ - #define floorf (float)floor - #define sqrtf (float)sqrt - #define acosf (float)acos - #define atan2f (float)atan2 - #define cosf (float)cos - #define sinf (float)sin - #define powf (float)pow - #define fabsf (float)fabs - #define min(x,y) ((x) < (y)? (x) : (y)) - #define max(x,y) ((x) > (y)? (x) : (y)) -#endif - - - -/* -** Common data types -*/ -#ifdef _WINDOWS -#ifndef DWORD -typedef unsigned long DWORD; -typedef unsigned short WORD; -typedef unsigned char BYTE; -#endif -#endif - -/* -** Common math constants -*/ -#ifndef M_PI -#define M_PI 3.14159265358979323846f -#endif -#ifndef M_PI_2 -#define M_PI_2 1.57079632679489661923f -#endif -#ifndef M_PI_4 -#define M_PI_4 0.785398163397448309616f -#endif -#ifndef M_1_PI -#define M_1_PI 0.318309886183790671538f -#endif -#ifndef M_2_PI -#define M_2_PI 0.636619772367581343076f -#endif - - -/* -** HGE Handle types -*/ -typedef size_t HTEXTURE; -typedef size_t HTARGET; -typedef size_t HEFFECT; -typedef size_t HMUSIC; -typedef size_t HSTREAM; -typedef size_t HCHANNEL; - - -/* -** Hardware color macros -*/ -#define ARGB(a,r,g,b) ((DWORD(a)<<24) + (DWORD(r)<<16) + (DWORD(g)<<8) + DWORD(b)) -#define GETA(col) ((col)>>24) -#define GETR(col) (((col)>>16) & 0xFF) -#define GETG(col) (((col)>>8) & 0xFF) -#define GETB(col) ((col) & 0xFF) -#define SETA(col,a) (((col) & 0x00FFFFFF) + (DWORD(a)<<24)) -#define SETR(col,r) (((col) & 0xFF00FFFF) + (DWORD(r)<<16)) -#define SETG(col,g) (((col) & 0xFFFF00FF) + (DWORD(g)<<8)) -#define SETB(col,b) (((col) & 0xFFFFFF00) + DWORD(b)) - - -/* -** HGE Blending constants -*/ -#define BLEND_COLORADD 1 -#define BLEND_COLORMUL 0 -#define BLEND_ALPHABLEND 2 -#define BLEND_ALPHAADD 0 -#define BLEND_ZWRITE 4 -#define BLEND_NOZWRITE 0 - -#define BLEND_DEFAULT (BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_NOZWRITE) -#define BLEND_DEFAULT_Z (BLEND_COLORMUL | BLEND_ALPHABLEND | BLEND_ZWRITE) - - -/* -** HGE System state constants -*/ -enum hgeBoolState -{ - HGE_WINDOWED = 1, // bool run in window? (default: false) - HGE_ZBUFFER = 2, // bool use z-buffer? (default: false) - HGE_TEXTUREFILTER = 3, // bool texture filtering? (default: true) - - HGE_USESOUND = 4, // bool use BASS for sound? (default: true) - - HGE_DONTSUSPEND = 5, // bool focus lost:suspend? (default: false) - HGE_HIDEMOUSE = 6, // bool hide system cursor? (default: true) - - HGE_SHOWSPLASH = 7, // bool hide system cursor? (default: true) - - HGEBOOLSTATE_FORCE_DWORD = 0x7FFFFFFF -}; - -enum hgeFuncState -{ - HGE_FRAMEFUNC = 8, // bool*() frame function (default: NULL) (you MUST set this) - HGE_RENDERFUNC = 9, // bool*() render function (default: NULL) - HGE_FOCUSLOSTFUNC = 10, // bool*() focus lost function (default: NULL) - HGE_FOCUSGAINFUNC = 11, // bool*() focus gain function (default: NULL) - HGE_GFXRESTOREFUNC = 12, // bool*() exit function (default: NULL) - HGE_EXITFUNC = 13, // bool*() exit function (default: NULL) - - HGEFUNCSTATE_FORCE_DWORD = 0x7FFFFFFF -}; - -enum hgeHwndState -{ - HGE_HWND = 15, // int window handle: read only - HGE_HWNDPARENT = 16, // int parent win handle (default: 0) - - HGEHWNDSTATE_FORCE_DWORD = 0x7FFFFFFF -}; - -enum hgeIntState -{ - HGE_SCREENWIDTH = 17, // int screen width (default: 800) - HGE_SCREENHEIGHT = 18, // int screen height (default: 600) - HGE_SCREENBPP = 19, // int screen bitdepth (default: 32) (desktop bpp in windowed mode) - - HGE_SAMPLERATE = 20, // int sample rate (default: 44100) - HGE_FXVOLUME = 21, // int global fx volume (default: 100) - HGE_MUSVOLUME = 22, // int global music volume (default: 100) - HGE_STREAMVOLUME = 23, // int global music volume (default: 100) - - HGE_FPS = 24, // int fixed fps (default: HGEFPS_UNLIMITED) - - HGE_POWERSTATUS = 25, // int battery life percent + status - - HGE_ORIGSCREENWIDTH = 30, // int original screen width (default: 800 ... not valid until hge->System_Initiate()!) - HGE_ORIGSCREENHEIGHT = 31, // int original screen height (default: 600 ... not valid until hge->System_Initiate()!)) - - HGEINTSTATE_FORCE_DWORD = 0x7FFFFFF -}; - -enum hgeStringState -{ - HGE_ICON = 26, // char* icon resource (default: NULL) - HGE_TITLE = 27, // char* window title (default: "HGE") - - HGE_INIFILE = 28, // char* ini file (default: NULL) (meaning no file) - HGE_LOGFILE = 29, // char* log file (default: NULL) (meaning no file) - - HGESTRINGSTATE_FORCE_DWORD = 0x7FFFFFFF -}; - -/* -** Callback protoype used by HGE -*/ -typedef bool (*hgeCallback)(); - - -/* -** HGE_FPS system state special constants -*/ -#define HGEFPS_UNLIMITED 0 -#define HGEFPS_VSYNC -1 - - -/* -** HGE_POWERSTATUS system state special constants -*/ -#define HGEPWR_AC -1 -#define HGEPWR_UNSUPPORTED -2 - - -/* -** HGE Primitive type constants -*/ -#define HGEPRIM_LINES 2 -#define HGEPRIM_TRIPLES 3 -#define HGEPRIM_QUADS 4 - - -/* -** HGE Vertex structure -*/ -struct hgeVertex -{ - float x, y; // screen position - float z; // Z-buffer depth 0..1 - DWORD col; // color - float tx, ty; // texture coordinates -}; - - -/* -** HGE Triple structure -*/ -struct hgeTriple -{ - hgeVertex v[3]; - HTEXTURE tex; - int blend; -}; - - -/* -** HGE Quad structure -*/ -struct hgeQuad -{ - hgeVertex v[4]; - HTEXTURE tex; - int blend; -}; - - -/* -** HGE Input Event structure -*/ -struct hgeInputEvent -{ - int type; // event type - int key; // key code - int flags; // event flags - int chr; // character code - int wheel; // wheel shift - float x; // mouse cursor x-coordinate - float y; // mouse cursor y-coordinate -}; - - -/* -** HGE Input Event type constants -*/ -#define INPUT_KEYDOWN 1 -#define INPUT_KEYUP 2 -#define INPUT_MBUTTONDOWN 3 -#define INPUT_MBUTTONUP 4 -#define INPUT_MOUSEMOVE 5 -#define INPUT_MOUSEWHEEL 6 - - -/* -** HGE Input Event flags -*/ -#define HGEINP_SHIFT 1 -#define HGEINP_CTRL 2 -#define HGEINP_ALT 4 -#define HGEINP_CAPSLOCK 8 -#define HGEINP_SCROLLLOCK 16 -#define HGEINP_NUMLOCK 32 -#define HGEINP_REPEAT 64 - - -/* -** HGE Interface class -*/ -class HGE -{ -public: - HGE() {} - virtual ~HGE() {}; - - virtual void CALL Release() = 0; - - virtual bool CALL System_Initiate() = 0; - virtual void CALL System_Shutdown() = 0; - virtual bool CALL System_Start() = 0; - virtual const char* CALL System_GetErrorMessage() = 0; - virtual void CALL System_Log(const char *format, ...) = 0; - virtual bool CALL System_Launch(const char *url) = 0; - virtual void CALL System_Snapshot(const char *filename=0) = 0; - -private: - virtual void CALL System_SetStateBool (hgeBoolState state, bool value) = 0; - virtual void CALL System_SetStateFunc (hgeFuncState state, hgeCallback value) = 0; - virtual void CALL System_SetStateHwnd (hgeHwndState state, HWND value) = 0; - virtual void CALL System_SetStateInt (hgeIntState state, int value) = 0; - virtual void CALL System_SetStateString(hgeStringState state, const char *value) = 0; - virtual bool CALL System_GetStateBool (hgeBoolState state) = 0; - virtual hgeCallback CALL System_GetStateFunc (hgeFuncState state) = 0; - virtual HWND CALL System_GetStateHwnd (hgeHwndState state) = 0; - virtual int CALL System_GetStateInt (hgeIntState state) = 0; - virtual const char* CALL System_GetStateString(hgeStringState state) = 0; - -public: - inline void System_SetState(hgeBoolState state, bool value) { System_SetStateBool (state, value); } - inline void System_SetState(hgeFuncState state, hgeCallback value) { System_SetStateFunc (state, value); } - inline void System_SetState(hgeHwndState state, HWND value) { System_SetStateHwnd (state, value); } - inline void System_SetState(hgeIntState state, int value) { System_SetStateInt (state, value); } - inline void System_SetState(hgeStringState state, const char *value) { System_SetStateString(state, value); } - inline bool System_GetState(hgeBoolState state) { return System_GetStateBool (state); } - inline hgeCallback System_GetState(hgeFuncState state) { return System_GetStateFunc (state); } - inline HWND System_GetState(hgeHwndState state) { return System_GetStateHwnd (state); } - inline int System_GetState(hgeIntState state) { return System_GetStateInt (state); } - inline const char* System_GetState(hgeStringState state) { return System_GetStateString(state); } - - virtual void* CALL Resource_Load(const char *filename, DWORD *size=0) = 0; - virtual void CALL Resource_Free(void *res) = 0; - virtual bool CALL Resource_AttachPack(const char *filename, const char *password=0) = 0; - virtual void CALL Resource_RemovePack(const char *filename) = 0; - virtual void CALL Resource_RemoveAllPacks() = 0; - virtual char* CALL Resource_MakePath(const char *filename=0) = 0; - virtual char* CALL Resource_EnumFiles(const char *wildcard=0) = 0; - virtual char* CALL Resource_EnumFolders(const char *wildcard=0) = 0; - - virtual void CALL Ini_SetInt(const char *section, const char *name, int value) = 0; - virtual int CALL Ini_GetInt(const char *section, const char *name, int def_val) = 0; - virtual void CALL Ini_SetFloat(const char *section, const char *name, float value) = 0; - virtual float CALL Ini_GetFloat(const char *section, const char *name, float def_val) = 0; - virtual void CALL Ini_SetString(const char *section, const char *name, const char *value) = 0; - virtual char* CALL Ini_GetString(const char *section, const char *name, const char *def_val) = 0; - - virtual void CALL Random_Seed(int seed=0) = 0; - virtual int CALL Random_Int(int min, int max) = 0; - virtual float CALL Random_Float(float min, float max) = 0; - - virtual float CALL Timer_GetTime() = 0; - virtual float CALL Timer_GetDelta() = 0; - virtual int CALL Timer_GetFPS() = 0; - virtual float CALL Timer_GetFPSf() = 0; - - virtual HEFFECT CALL Effect_Load(const char *filename, DWORD size=0) = 0; - virtual void CALL Effect_Free(HEFFECT eff) = 0; - virtual HCHANNEL CALL Effect_Play(HEFFECT eff) = 0; - virtual HCHANNEL CALL Effect_PlayEx(HEFFECT eff, float volume=1.0, float pan=0.0, float pitch=1.0f, bool loop=false) = 0; - - virtual HMUSIC CALL Music_Load(const char *filename, DWORD size=0) = 0; - virtual void CALL Music_Free(HMUSIC mus) = 0; - virtual HCHANNEL CALL Music_Play(HMUSIC mus, bool loop, int volume = 100, int order = -1, int row = -1) = 0; - virtual void CALL Music_SetAmplification(HMUSIC music, int ampl) = 0; - virtual int CALL Music_GetAmplification(HMUSIC music) = 0; - virtual int CALL Music_GetLength(HMUSIC music) = 0; - virtual void CALL Music_SetPos(HMUSIC music, int order, int row) = 0; - virtual bool CALL Music_GetPos(HMUSIC music, int *order, int *row) = 0; - virtual void CALL Music_SetInstrVolume(HMUSIC music, int instr, int volume) = 0; - virtual int CALL Music_GetInstrVolume(HMUSIC music, int instr) = 0; - virtual void CALL Music_SetChannelVolume(HMUSIC music, int channel, int volume) = 0; - virtual int CALL Music_GetChannelVolume(HMUSIC music, int channel) = 0; - - virtual HSTREAM CALL Stream_Load(const char *filename, DWORD size=0) = 0; - virtual void CALL Stream_Free(HSTREAM stream) = 0; - virtual HCHANNEL CALL Stream_Play(HSTREAM stream, bool loop, int volume = 100) = 0; - - virtual void CALL Channel_SetPanning(HCHANNEL chn, float pan) = 0; - virtual void CALL Channel_SetVolume(HCHANNEL chn, float volume) = 0; - virtual void CALL Channel_SetPitch(HCHANNEL chn, float pitch) = 0; - virtual void CALL Channel_Pause(HCHANNEL chn) = 0; - virtual void CALL Channel_Resume(HCHANNEL chn) = 0; - virtual void CALL Channel_Stop(HCHANNEL chn) = 0; - virtual void CALL Channel_PauseAll() = 0; - virtual void CALL Channel_ResumeAll() = 0; - virtual void CALL Channel_StopAll() = 0; - virtual bool CALL Channel_IsPlaying(HCHANNEL chn) = 0; - virtual float CALL Channel_GetLength(HCHANNEL chn) = 0; - virtual float CALL Channel_GetPos(HCHANNEL chn) = 0; - virtual void CALL Channel_SetPos(HCHANNEL chn, float fSeconds) = 0; - virtual int CALL Channel_GetPos_BySample(HCHANNEL chn) = 0; - virtual void CALL Channel_SetPos_BySample(HCHANNEL chn, int iSample) = 0; - virtual void CALL Channel_SlideTo(HCHANNEL channel, float time, int volume, int pan = -101, float pitch = -1) = 0; - virtual bool CALL Channel_IsSliding(HCHANNEL channel) = 0; - - virtual void CALL Input_GetMousePos(float *x, float *y) = 0; - virtual void CALL Input_SetMousePos(float x, float y) = 0; - virtual int CALL Input_GetMouseWheel() = 0; - virtual bool CALL Input_IsMouseOver() = 0; - virtual bool CALL Input_KeyDown(int key) = 0; - virtual bool CALL Input_KeyUp(int key) = 0; - virtual bool CALL Input_GetKeyState(int key) = 0; - virtual int CALL Input_GetKeyStateEx(int key) = 0; - virtual const char* CALL Input_GetKeyName(int key) = 0; - virtual int CALL Input_GetKey() = 0; - virtual int CALL Input_GetChar() = 0; - virtual bool CALL Input_GetEvent(hgeInputEvent *event) = 0; - - virtual bool CALL Gfx_BeginScene(HTARGET target=0) = 0; - virtual void CALL Gfx_EndScene() = 0; - virtual void CALL Gfx_Clear(DWORD color) = 0; - virtual void CALL Gfx_RenderLine(float x1, float y1, float x2, float y2, DWORD color=0xFFFFFFFF, float z=0.5f) = 0; - virtual void CALL Gfx_RenderTriple(const hgeTriple *triple) = 0; - virtual void CALL Gfx_RenderQuad(const hgeQuad *quad) = 0; - virtual hgeVertex* CALL Gfx_StartBatch(int prim_type, HTEXTURE tex, int blend, int *max_prim) = 0; - virtual void CALL Gfx_FinishBatch(int nprim) = 0; - virtual void CALL Gfx_SetClipping(int x=0, int y=0, int w=0, int h=0) = 0; - virtual void CALL Gfx_SetTransform(float x=0, float y=0, float dx=0, float dy=0, float rot=0, float hscale=0, float vscale=0) = 0; - - virtual HTARGET CALL Target_Create(int width, int height, bool zbuffer) = 0; - virtual void CALL Target_Free(HTARGET target) = 0; - virtual HTEXTURE CALL Target_GetTexture(HTARGET target) = 0; - - virtual HTEXTURE CALL Texture_Create(int width, int height) = 0; - virtual HTEXTURE CALL Texture_Load(const char *filename, DWORD size=0, bool bMipmap=false) = 0; - virtual void CALL Texture_Free(HTEXTURE tex) = 0; - virtual int CALL Texture_GetWidth(HTEXTURE tex, bool bOriginal=false) = 0; - virtual int CALL Texture_GetHeight(HTEXTURE tex, bool bOriginal=false) = 0; - virtual DWORD* CALL Texture_Lock(HTEXTURE tex, bool bReadOnly=true, int left=0, int top=0, int width=0, int height=0) = 0; - virtual void CALL Texture_Unlock(HTEXTURE tex) = 0; -}; - -extern "C" { EXPORT HGE * CALL hgeCreate(int ver); } - - -/* -** HGE Virtual-key codes -*/ -#define HGEK_LBUTTON 0x01 -#define HGEK_RBUTTON 0x02 -#define HGEK_MBUTTON 0x04 - -#define HGEK_ESCAPE 0x1B -#define HGEK_BACKSPACE 0x08 -#define HGEK_TAB 0x09 -#define HGEK_ENTER 0x0D -#define HGEK_SPACE 0x20 - -#define HGEK_SHIFT 0x10 -#define HGEK_CTRL 0x11 -#define HGEK_ALT 0x12 - -#define HGEK_LWIN 0x5B -#define HGEK_RWIN 0x5C -#define HGEK_APPS 0x5D - -#define HGEK_PAUSE 0x13 -#define HGEK_CAPSLOCK 0x14 -#define HGEK_NUMLOCK 0x90 -#define HGEK_SCROLLLOCK 0x91 - -#define HGEK_PGUP 0x21 -#define HGEK_PGDN 0x22 -#define HGEK_HOME 0x24 -#define HGEK_END 0x23 -#define HGEK_INSERT 0x2D -#define HGEK_DELETE 0x2E - -#define HGEK_LEFT 0x25 -#define HGEK_UP 0x26 -#define HGEK_RIGHT 0x27 -#define HGEK_DOWN 0x28 - -#define HGEK_0 0x30 -#define HGEK_1 0x31 -#define HGEK_2 0x32 -#define HGEK_3 0x33 -#define HGEK_4 0x34 -#define HGEK_5 0x35 -#define HGEK_6 0x36 -#define HGEK_7 0x37 -#define HGEK_8 0x38 -#define HGEK_9 0x39 - -#define HGEK_A 0x41 -#define HGEK_B 0x42 -#define HGEK_C 0x43 -#define HGEK_D 0x44 -#define HGEK_E 0x45 -#define HGEK_F 0x46 -#define HGEK_G 0x47 -#define HGEK_H 0x48 -#define HGEK_I 0x49 -#define HGEK_J 0x4A -#define HGEK_K 0x4B -#define HGEK_L 0x4C -#define HGEK_M 0x4D -#define HGEK_N 0x4E -#define HGEK_O 0x4F -#define HGEK_P 0x50 -#define HGEK_Q 0x51 -#define HGEK_R 0x52 -#define HGEK_S 0x53 -#define HGEK_T 0x54 -#define HGEK_U 0x55 -#define HGEK_V 0x56 -#define HGEK_W 0x57 -#define HGEK_X 0x58 -#define HGEK_Y 0x59 -#define HGEK_Z 0x5A - -#define HGEK_GRAVE 0xC0 -#define HGEK_MINUS 0xBD -#define HGEK_EQUALS 0xBB -#define HGEK_BACKSLASH 0xDC -#define HGEK_LBRACKET 0xDB -#define HGEK_RBRACKET 0xDD -#define HGEK_SEMICOLON 0xBA -#define HGEK_APOSTROPHE 0xDE -#define HGEK_COMMA 0xBC -#define HGEK_PERIOD 0xBE -#define HGEK_SLASH 0xBF - -#define HGEK_NUMPAD0 0x60 -#define HGEK_NUMPAD1 0x61 -#define HGEK_NUMPAD2 0x62 -#define HGEK_NUMPAD3 0x63 -#define HGEK_NUMPAD4 0x64 -#define HGEK_NUMPAD5 0x65 -#define HGEK_NUMPAD6 0x66 -#define HGEK_NUMPAD7 0x67 -#define HGEK_NUMPAD8 0x68 -#define HGEK_NUMPAD9 0x69 - -#define HGEK_MULTIPLY 0x6A -#define HGEK_DIVIDE 0x6F -#define HGEK_ADD 0x6B -#define HGEK_SUBTRACT 0x6D -#define HGEK_DECIMAL 0x6E - -#define HGEK_F1 0x70 -#define HGEK_F2 0x71 -#define HGEK_F3 0x72 -#define HGEK_F4 0x73 -#define HGEK_F5 0x74 -#define HGEK_F6 0x75 -#define HGEK_F7 0x76 -#define HGEK_F8 0x77 -#define HGEK_F9 0x78 -#define HGEK_F10 0x79 -#define HGEK_F11 0x7A -#define HGEK_F12 0x7B - -#define HGEKST_NONE 0 -#define HGEKST_HIT 1 -#define HGEKST_KEEP 2 -#define HGEKST_RELEASE 3 - -#endif - diff --git a/archive/include/hgeanim.h b/archive/include/hgeanim.h deleted file mode 100644 index 7c5f237..0000000 --- a/archive/include/hgeanim.h +++ /dev/null @@ -1,69 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeAnimation helper class header -*/ - - -#ifndef HGEANIM_H -#define HGEANIM_H - - -#include "hgesprite.h" - - -#define HGEANIM_FWD 0 -#define HGEANIM_REV 1 -#define HGEANIM_PINGPONG 2 -#define HGEANIM_NOPINGPONG 0 -#define HGEANIM_LOOP 4 -#define HGEANIM_NOLOOP 0 - - -/* -** HGE Animation class -*/ -class hgeAnimation : public hgeSprite -{ -public: - hgeAnimation(HTEXTURE tex, int nframes, float FPS, float x, float y, float w, float h); - hgeAnimation(const hgeAnimation &anim); - - void Play(); - void Stop() { bPlaying=false; } - void Resume() { bPlaying=true; } - void Update(float fDeltaTime); - bool IsPlaying() const { return bPlaying; } - - void SetTexture(HTEXTURE tex) { hgeSprite::SetTexture(tex); orig_width = hge->Texture_GetWidth(tex, true); } - void SetTextureRect(float x1, float y1, float x2, float y2) { hgeSprite::SetTextureRect(x1,y1,x2,y2); SetFrame(nCurFrame); } - void SetMode(int mode); - void SetSpeed(float FPS) { fSpeed=1.0f/FPS; } - void SetFrame(int n); - void SetFrames(int n) { nFrames=n; } - - int GetMode() const { return Mode; } - float GetSpeed() const { return 1.0f/fSpeed; } - int GetFrame() const { return nCurFrame; } - int GetFrames() const { return nFrames; } - -private: - hgeAnimation(); - - int orig_width; - - bool bPlaying; - - float fSpeed; - float fSinceLastFrame; - - int Mode; - int nDelta; - int nFrames; - int nCurFrame; -}; - - -#endif diff --git a/archive/include/hgecolor.h b/archive/include/hgecolor.h deleted file mode 100644 index 7cd4d82..0000000 --- a/archive/include/hgecolor.h +++ /dev/null @@ -1,80 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeColor*** helper classes -*/ - - -#ifndef HGECOLOR_H -#define HGECOLOR_H - - -#include "hge.h" - - -#define hgeColor hgeColorRGB - -inline void ColorClamp(float &x) { if(x<0.0f) x=0.0f; if(x>1.0f) x=1.0f; } - - -class hgeColorRGB -{ -public: - float r,g,b,a; - - hgeColorRGB(float _r, float _g, float _b, float _a) { r=_r; g=_g; b=_b; a=_a; } - hgeColorRGB(DWORD col) { SetHWColor(col); } - hgeColorRGB() { r=g=b=a=0; } - - hgeColorRGB operator- (const hgeColorRGB &c) const { return hgeColorRGB(r-c.r, g-c.g, b-c.b, a-c.a); } - hgeColorRGB operator+ (const hgeColorRGB &c) const { return hgeColorRGB(r+c.r, g+c.g, b+c.b, a+c.a); } - hgeColorRGB operator* (const hgeColorRGB &c) const { return hgeColorRGB(r*c.r, g*c.g, b*c.b, a*c.a); } - hgeColorRGB& operator-= (const hgeColorRGB &c) { r-=c.r; g-=c.g; b-=c.b; a-=c.a; return *this; } - hgeColorRGB& operator+= (const hgeColorRGB &c) { r+=c.r; g+=c.g; b+=c.b; a+=c.a; return *this; } - bool operator== (const hgeColorRGB &c) const { return (r==c.r && g==c.g && b==c.b && a==c.a); } - bool operator!= (const hgeColorRGB &c) const { return (r!=c.r || g!=c.g || b!=c.b || a!=c.a); } - - hgeColorRGB operator/ (const float scalar) const { return hgeColorRGB(r/scalar, g/scalar, b/scalar, a/scalar); } - hgeColorRGB operator* (const float scalar) const { return hgeColorRGB(r*scalar, g*scalar, b*scalar, a*scalar); } - hgeColorRGB& operator*= (const float scalar) { r*=scalar; g*=scalar; b*=scalar; a*=scalar; return *this; } - - void Clamp() { ColorClamp(r); ColorClamp(g); ColorClamp(b); ColorClamp(a); } - void SetHWColor(DWORD col) { a = (col>>24)/255.0f; r = ((col>>16) & 0xFF)/255.0f; g = ((col>>8) & 0xFF)/255.0f; b = (col & 0xFF)/255.0f; } - DWORD GetHWColor() const { return (DWORD(a*255.0f)<<24) + (DWORD(r*255.0f)<<16) + (DWORD(g*255.0f)<<8) + DWORD(b*255.0f); } -}; - -inline hgeColorRGB operator* (const float sc, const hgeColorRGB &c) { return c*sc; } - - -class hgeColorHSV -{ -public: - float h,s,v,a; - - hgeColorHSV(float _h, float _s, float _v, float _a) { h=_h; s=_s; v=_v; a=_a; } - hgeColorHSV(DWORD col) { SetHWColor(col); } - hgeColorHSV() { h=s=v=a=0; } - - hgeColorHSV operator- (const hgeColorHSV &c) const { return hgeColorHSV(h-c.h, s-c.s, v-c.v, a-c.a); } - hgeColorHSV operator+ (const hgeColorHSV &c) const { return hgeColorHSV(h+c.h, s+c.s, v+c.v, a+c.a); } - hgeColorHSV operator* (const hgeColorHSV &c) const { return hgeColorHSV(h*c.h, s*c.s, v*c.v, a*c.a); } - hgeColorHSV& operator-= (const hgeColorHSV &c) { h-=c.h; s-=c.s; v-=c.v; a-=c.a; return *this; } - hgeColorHSV& operator+= (const hgeColorHSV &c) { h+=c.h; s+=c.s; v+=c.v; a+=c.a; return *this; } - bool operator== (const hgeColorHSV &c) const { return (h==c.h && s==c.s && v==c.v && a==c.a); } - bool operator!= (const hgeColorHSV &c) const { return (h!=c.h || s!=c.s || v!=c.v || a!=c.a); } - - hgeColorHSV operator/ (const float scalar) const { return hgeColorHSV(h/scalar, s/scalar, v/scalar, a/scalar); } - hgeColorHSV operator* (const float scalar) const { return hgeColorHSV(h*scalar, s*scalar, v*scalar, a*scalar); } - hgeColorHSV& operator*= (const float scalar) { h*=scalar; s*=scalar; v*=scalar; a*=scalar; return *this; } - - void Clamp() { ColorClamp(h); ColorClamp(s); ColorClamp(v); ColorClamp(a); } - void SetHWColor(DWORD col); - DWORD GetHWColor() const; -}; - -inline hgeColorHSV operator* (const float sc, const hgeColorHSV &c) { return c*sc; } - - -#endif diff --git a/archive/include/hgedistort.h b/archive/include/hgedistort.h deleted file mode 100644 index 3c8f449..0000000 --- a/archive/include/hgedistort.h +++ /dev/null @@ -1,66 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeDistortionMesh helper class header -*/ - - -#ifndef HGEDISTORT_H -#define HGEDISTORT_H - - -#include "hge.h" - - -#define HGEDISP_NODE 0 -#define HGEDISP_TOPLEFT 1 -#define HGEDISP_CENTER 2 - -/* -** HGE Distortion mesh class -*/ -class hgeDistortionMesh -{ -public: - hgeDistortionMesh(int cols, int rows); - hgeDistortionMesh(const hgeDistortionMesh &dm); - ~hgeDistortionMesh(); - - hgeDistortionMesh& operator= (const hgeDistortionMesh &dm); - - void Render(float x, float y); - void Clear(DWORD col=0xFFFFFFFF, float z=0.5f); - - void SetTexture(HTEXTURE tex); - void SetTextureRect(float x, float y, float w, float h); - void SetBlendMode(int blend); - void SetZ(int col, int row, float z); - void SetColor(int col, int row, DWORD color); - void SetDisplacement(int col, int row, float dx, float dy, int ref); - - HTEXTURE GetTexture() const {return quad.tex;} - void GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; } - int GetBlendMode() const { return quad.blend; } - float GetZ(int col, int row) const; - DWORD GetColor(int col, int row) const; - void GetDisplacement(int col, int row, float *dx, float *dy, int ref) const; - - int GetRows() { return nRows; } - int GetCols() { return nCols; } - -private: - hgeDistortionMesh(); - - static HGE *hge; - - hgeVertex *disp_array; - int nRows, nCols; - float cellw,cellh; - float tx,ty,width,height; - hgeQuad quad; -}; - - -#endif diff --git a/archive/include/hgefont.h b/archive/include/hgefont.h deleted file mode 100644 index 403d307..0000000 --- a/archive/include/hgefont.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeFont helper class header -*/ - - -#ifndef HGEFONT_H -#define HGEFONT_H - - -#include "hge.h" -#include "hgesprite.h" - - -#define HGETEXT_LEFT 0 -#define HGETEXT_RIGHT 1 -#define HGETEXT_CENTER 2 -#define HGETEXT_HORZMASK 0x03 - -#define HGETEXT_TOP 0 -#define HGETEXT_BOTTOM 4 -#define HGETEXT_MIDDLE 8 -#define HGETEXT_VERTMASK 0x0C - -/* -** HGE Font class -*/ -class hgeFont -{ -public: - hgeFont(const char *filename, bool bMipmap=false); - ~hgeFont(); - - void Render(float x, float y, int align, const char *string); - void printf(float x, float y, int align, const char *format, ...); - void printfb(float x, float y, float w, float h, int align, const char *format, ...); - - void SetColor(DWORD col); - void SetZ(float z); - void SetBlendMode(int blend); - void SetScale(float scale) {fScale=scale;} - void SetProportion(float prop) { fProportion=prop; } - void SetRotation(float rot) {fRot=rot;} - void SetTracking(float tracking) {fTracking=tracking;} - void SetSpacing(float spacing) {fSpacing=spacing;} - - DWORD GetColor() const {return dwCol;} - float GetZ() const {return fZ;} - int GetBlendMode() const {return nBlend;} - float GetScale() const {return fScale;} - float GetProportion() const { return fProportion; } - float GetRotation() const {return fRot;} - float GetTracking() const {return fTracking;} - float GetSpacing() const {return fSpacing;} - - hgeSprite* GetSprite(char chr) const { return letters[(unsigned char)chr]; } - float GetPreWidth(char chr) const { return pre[(unsigned char)chr]; } - float GetPostWidth(char chr) const { return post[(unsigned char)chr]; } - float GetHeight() const { return fHeight; } - float GetStringWidth(const char *string, bool bMultiline=true) const; - - HTEXTURE GetTexture(){return hTexture;} -private: - hgeFont(); - hgeFont(const hgeFont &fnt); - hgeFont& operator= (const hgeFont &fnt); - - char* _get_line(char *file, char *line); - - static HGE *hge; - - static char buffer[1024]; - - HTEXTURE hTexture; - hgeSprite* letters[256]; - float pre[256]; - float post[256]; - float fHeight; - float fScale; - float fProportion; - float fRot; - float fTracking; - float fSpacing; - - DWORD dwCol; - float fZ; - int nBlend; -}; - - -#endif diff --git a/archive/include/hgegui.h b/archive/include/hgegui.h deleted file mode 100644 index 7e2144b..0000000 --- a/archive/include/hgegui.h +++ /dev/null @@ -1,126 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeGUI helper classes header -*/ - - -#ifndef HGEGUI_H -#define HGEGUI_H - - -#include "hge.h" -#include "hgesprite.h" -#include "hgerect.h" - - -#define HGEGUI_NONAVKEYS 0 -#define HGEGUI_LEFTRIGHT 1 -#define HGEGUI_UPDOWN 2 -#define HGEGUI_CYCLED 4 - -class hgeGUI; - -/* -** hgeGUIObject -*/ -class hgeGUIObject -{ -public: - hgeGUIObject() { hge=hgeCreate(HGE_VERSION); color=0xFFFFFFFF; } - virtual ~hgeGUIObject() { hge->Release(); } - - virtual void Render() = 0; - virtual void Update(float dt) {} - - virtual void Enter() {} - virtual void Leave() {} - virtual void Reset() {} - virtual bool IsDone() { return true; } - virtual void Focus(bool bFocused) {} - virtual void MouseOver(bool bOver) {} - - virtual bool MouseMove(float x, float y) { return false; } - virtual bool MouseLButton(bool bDown) { return false; } - virtual bool MouseRButton(bool bDown) { return false; } - virtual bool MouseWheel(int nNotches) { return false; } - virtual bool KeyClick(int key, int chr) { return false; } - - virtual void SetColor(DWORD _color) { color=_color; } - - int id; - bool bStatic; - bool bVisible; - bool bEnabled; - hgeRect rect; - DWORD color; - - hgeGUI *gui; - hgeGUIObject *next; - hgeGUIObject *prev; - -protected: - hgeGUIObject(const hgeGUIObject &go); - hgeGUIObject& operator= (const hgeGUIObject &go); - - static HGE *hge; -}; - - -/* -** hgeGUI -*/ -class hgeGUI -{ -public: - hgeGUI(); - ~hgeGUI(); - - void AddCtrl(hgeGUIObject *ctrl); - void DelCtrl(int id); - hgeGUIObject* GetCtrl(int id) const; - - void MoveCtrl(int id, float x, float y); - void ShowCtrl(int id, bool bVisible); - void EnableCtrl(int id, bool bEnabled); - - void SetNavMode(int mode); - void SetCursor(hgeSprite *spr); - void SetColor(DWORD color); - void SetFocus(int id); - int GetFocus() const; - - void Enter(); - void Leave(); - void Reset(); - void Move(float dx, float dy); - - int Update(float dt); - void Render(); - -private: - hgeGUI(const hgeGUI &); - hgeGUI& operator= (const hgeGUI&); - bool ProcessCtrl(hgeGUIObject *ctrl); - - static HGE *hge; - - hgeGUIObject *ctrls; - hgeGUIObject *ctrlLock; - hgeGUIObject *ctrlFocus; - hgeGUIObject *ctrlOver; - - int navmode; - int nEnterLeave; - hgeSprite *sprCursor; - - float mx,my; - int nWheel; - bool bLPressed, bLReleased; - bool bRPressed, bRReleased; -}; - - -#endif diff --git a/archive/include/hgeguictrls.h b/archive/include/hgeguictrls.h deleted file mode 100644 index 8a1addd..0000000 --- a/archive/include/hgeguictrls.h +++ /dev/null @@ -1,150 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeGUI default controls header -*/ - - -#ifndef HGEGUICTRLS_H -#define HGEGUICTRLS_H - - -#include "hge.h" -#include "hgesprite.h" -#include "hgefont.h" -#include "hgerect.h" -#include "hgegui.h" - - -#define hgeButtonGetState(gui,id) ((hgeGUIButton*)gui->GetCtrl(id))->GetState() -#define hgeButtonSetState(gui,id,b) ((hgeGUIButton*)gui->GetCtrl(id))->SetState(b) -#define hgeSliderGetValue(gui,id) ((hgeGUISlider*)gui->GetCtrl(id))->GetValue() -#define hgeSliderSetValue(gui,id,f) ((hgeGUISlider*)gui->GetCtrl(id))->SetValue(f) -#define hgeGetTextCtrl(gui,id) ((hgeGUIText*)gui->GetCtrl(id)) -#define hgeGetListboxCtrl(gui,id) ((hgeGUIListbox*)gui->GetCtrl(id)) - - -/* -** hgeGUIText -*/ -class hgeGUIText : public hgeGUIObject -{ -public: - hgeGUIText(int id, float x, float y, float w, float h, hgeFont *fnt); - - void SetMode(int _align); - void SetText(const char *_text); - void printf(const char *format, ...); - - virtual void Render(); - -private: - hgeFont* font; - float tx, ty; - int align; - char text[256]; -}; - - -/* -** hgeGUIButton -*/ -class hgeGUIButton : public hgeGUIObject -{ -public: - hgeGUIButton(int id, float x, float y, float w, float h, HTEXTURE tex, float tx, float ty); - virtual ~hgeGUIButton(); - - void SetMode(bool _bTrigger) { bTrigger=_bTrigger; } - void SetState(bool _bPressed) { bPressed=_bPressed; } - bool GetState() const { return bPressed; } - - virtual void Render(); - virtual bool MouseLButton(bool bDown); - -private: - bool bTrigger; - bool bPressed; - bool bOldState; - hgeSprite *sprUp, *sprDown; -}; - - -/* -** hgeGUISlider -*/ -#define HGESLIDER_BAR 0 -#define HGESLIDER_BARRELATIVE 1 -#define HGESLIDER_SLIDER 2 - -class hgeGUISlider : public hgeGUIObject -{ -public: - hgeGUISlider(int id, float x, float y, float w, float h, HTEXTURE tex, float tx, float ty, float sw, float sh, bool vertical=false); - virtual ~hgeGUISlider(); - - void SetMode(float _fMin, float _fMax, int _mode) { fMin=_fMin; fMax=_fMax; mode=_mode; } - void SetValue(float _fVal); - float GetValue() const { return fVal; } - - virtual void Render(); - virtual bool MouseMove(float x, float y); - virtual bool MouseLButton(bool bDown); - -private: - bool bPressed; - bool bVertical; - int mode; - float fMin, fMax, fVal; - float sl_w, sl_h; - hgeSprite *sprSlider; -}; - - -/* -** hgeGUIListbox -*/ -struct hgeGUIListboxItem -{ - char text[64]; - hgeGUIListboxItem *next; -}; - -class hgeGUIListbox : public hgeGUIObject -{ -public: - hgeGUIListbox(int id, float x, float y, float w, float h, hgeFont *fnt, DWORD tColor, DWORD thColor, DWORD hColor); - virtual ~hgeGUIListbox(); - - int AddItem(char *item); - void DeleteItem(int n); - int GetSelectedItem() { return nSelectedItem; } - void SetSelectedItem(int n) { if(n>=0 && n<GetNumItems()) nSelectedItem=n; } - int GetTopItem() { return nTopItem; } - void SetTopItem(int n) { if(n>=0 && n<=GetNumItems()-GetNumRows()) nTopItem=n; } - - char *GetItemText(int n); - int GetNumItems() { return nItems; } - int GetNumRows() { return int((rect.y2-rect.y1)/font->GetHeight()); } - void Clear(); - - virtual void Render(); - virtual bool MouseMove(float x, float y) { mx=x; my=y; return false; } - virtual bool MouseLButton(bool bDown); - virtual bool MouseWheel(int nNotches); - virtual bool KeyClick(int key, int chr); - -private: - hgeSprite *sprHighlight; - hgeFont *font; - DWORD textColor, texthilColor; - - int nItems, nSelectedItem, nTopItem; - float mx, my; - hgeGUIListboxItem *pItems; -}; - - -#endif diff --git a/archive/include/hgeparticle.h b/archive/include/hgeparticle.h deleted file mode 100644 index fd1e622..0000000 --- a/archive/include/hgeparticle.h +++ /dev/null @@ -1,168 +0,0 @@ -// PLEASE NOTE that this is not the 1.81 version of hgeparticle.h ... -// the game I'm working on used an older HGE that breaks with the 1.81 -// particle system. If you want 1.81, add the "bRelative" stuff to it. --ryan. - -/* -** Haaf's Game Engine 1.61 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeParticleSystem helper class header -*/ - - -#ifndef HGEPARTICLE_H -#define HGEPARTICLE_H - - -#include "hge.h" -#include "hgesprite.h" -#include "hgevector.h" -#include "hgecolor.h" -#include "hgerect.h" - - -#define MAX_PARTICLES 500 -#define MAX_PSYSTEMS 100 - -struct hgeParticle -{ - hgeVector vecLocation; - hgeVector vecVelocity; - - float fGravity; - float fRadialAccel; - float fTangentialAccel; - - float fSpin; - float fSpinDelta; - - float fSize; - float fSizeDelta; - - hgeColor colColor; // + alpha - hgeColor colColorDelta; - - float fAge; - float fTerminalAge; -}; - -struct hgeParticleSystemInfo -{ - hgeSprite* sprite; // texture + blend mode - int nEmission; // particles per sec - float fLifetime; - - float fParticleLifeMin; - float fParticleLifeMax; - - float fDirection; - float fSpread; - BYTE bRelative; // was "bool", but that's 4 bytes on PowerPC instead of 1, and it broke loading from disk... - - float fSpeedMin; - float fSpeedMax; - - float fGravityMin; - float fGravityMax; - - float fRadialAccelMin; - float fRadialAccelMax; - - float fTangentialAccelMin; - float fTangentialAccelMax; - - float fSizeStart; - float fSizeEnd; - float fSizeVar; - - float fSpinStart; - float fSpinEnd; - float fSpinVar; - - hgeColor colColorStart; // + alpha - hgeColor colColorEnd; - float fColorVar; - float fAlphaVar; -}; - -class hgeParticleSystem -{ -public: - hgeParticleSystemInfo info; - - hgeParticleSystem(const char *filename, hgeSprite *sprite, float fps=0.0f); - hgeParticleSystem(hgeParticleSystemInfo *psi, float fps=0.0f); - hgeParticleSystem(const hgeParticleSystem &ps); - ~hgeParticleSystem() { hge->Release(); } - - hgeParticleSystem& operator= (const hgeParticleSystem &ps); - - - void Render(); - void FireAt(float x, float y); - void Fire(); - void Stop(bool bKillParticles=false); - void Update(float fDeltaTime); - void MoveTo(float x, float y, bool bMoveParticles=false); - void Transpose(float x, float y) { fTx=x; fTy=y; } - void TrackBoundingBox(bool bTrack) { bUpdateBoundingBox=bTrack; } - - int GetParticlesAlive() const { return nParticlesAlive; } - float GetAge() const { return fAge; } - void GetPosition(float *x, float *y) const { *x=vecLocation.x; *y=vecLocation.y; } - void GetTransposition(float *x, float *y) const { *x=fTx; *y=fTy; } - hgeRect* GetBoundingBox(hgeRect *rect) const { memcpy(rect, &rectBoundingBox, sizeof(hgeRect)); return rect; } - -private: - hgeParticleSystem(); - void _update(float fDeltaTime); - - static HGE *hge; - - float fUpdSpeed; - float fResidue; - - float fAge; - float fEmissionResidue; - - hgeVector vecPrevLocation; - hgeVector vecLocation; - float fTx, fTy; - - int nParticlesAlive; - hgeRect rectBoundingBox; - bool bUpdateBoundingBox; - - hgeParticle particles[MAX_PARTICLES]; -}; - -class hgeParticleManager -{ -public: - hgeParticleManager(float fps=0.0f); - ~hgeParticleManager(); - - void Update(float dt); - void Render(); - - hgeParticleSystem* SpawnPS(hgeParticleSystemInfo *psi, float x, float y); - bool IsPSAlive(hgeParticleSystem *ps) const; - void Transpose(float x, float y); - void GetTransposition(float *dx, float *dy) const {*dx=tX; *dy=tY;} - void KillPS(hgeParticleSystem *ps); - void KillAll(); - -private: - hgeParticleManager(const hgeParticleManager &); - hgeParticleManager& operator= (const hgeParticleManager &); - - float fFPS; - int nPS; - float tX; - float tY; - hgeParticleSystem* psList[MAX_PSYSTEMS]; -}; - - -#endif diff --git a/archive/include/hgerect.h b/archive/include/hgerect.h deleted file mode 100644 index 9e26907..0000000 --- a/archive/include/hgerect.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeRect helper class -*/ - - -#ifndef HGERECT_H -#define HGERECT_H - - -class hgeRect -{ -public: - float x1, y1, x2, y2; - - hgeRect(float _x1, float _y1, float _x2, float _y2) {x1=_x1; y1=_y1; x2=_x2; y2=_y2; bClean=false; } - hgeRect() {bClean=true;} - - void Clear() {bClean=true;} - bool IsClean() const {return bClean;} - void Set(float _x1, float _y1, float _x2, float _y2) { x1=_x1; x2=_x2; y1=_y1; y2=_y2; bClean=false; } - void SetRadius(float x, float y, float r) { x1=x-r; x2=x+r; y1=y-r; y2=y+r; bClean=false; } - void Encapsulate(float x, float y); - bool TestPoint(float x, float y) const; - bool Intersect(const hgeRect *rect) const; - -private: - bool bClean; -}; - - -#endif diff --git a/archive/include/hgeresource.h b/archive/include/hgeresource.h deleted file mode 100644 index ace8f21..0000000 --- a/archive/include/hgeresource.h +++ /dev/null @@ -1,85 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeResourceManager helper class header -*/ - - -#ifndef HGERESOURCE_H -#define HGERESOURCE_H - - -#include "hge.h" -#include "hgesprite.h" -#include "hgeanim.h" -#include "hgefont.h" -#include "hgeparticle.h" -#include "hgedistort.h" -#include "hgestrings.h" - - -#define RESTYPES 13 -#define MAXRESCHARS 128 - - -class hgeResourceManager; - -struct ResDesc -{ - char name[MAXRESCHARS]; - int resgroup; - size_t handle; - ResDesc* next; - - ResDesc() { hge=hgeCreate(HGE_VERSION); } - ~ResDesc() { hge->Release(); } - - virtual DWORD Get(hgeResourceManager *rm) = 0; - virtual void Free() = 0; - -protected: - static HGE *hge; -}; - -/* -** HGE Resource manager class -*/ -class hgeResourceManager -{ -public: - hgeResourceManager(const char *scriptname=0); - ~hgeResourceManager(); - - void ChangeScript(const char *scriptname=0); - bool Precache(int groupid=0); - void Purge(int groupid=0); - - void* GetResource(const char *name, int resgroup=0); - HTEXTURE GetTexture(const char *name, int resgroup=0); - HEFFECT GetEffect(const char *name, int resgroup=0); - HMUSIC GetMusic(const char *name, int resgroup=0); - HSTREAM GetStream(const char *name, int resgroup=0); - HTARGET GetTarget(const char *name); - - hgeSprite* GetSprite(const char *name); - hgeAnimation* GetAnimation(const char *name); - hgeFont* GetFont(const char *name); - hgeParticleSystem* GetParticleSystem(const char *name); - hgeDistortionMesh* GetDistortionMesh(const char *name); - hgeStringTable* GetStringTable(const char *name, int resgroup=0); - - ResDesc* res[RESTYPES]; - -private: - hgeResourceManager(const hgeResourceManager &); - hgeResourceManager& operator= (const hgeResourceManager&); - void _remove_all(); - void _parse_script(const char *scriptname=0); - - static HGE *hge; -}; - - -#endif diff --git a/archive/include/hgesprite.h b/archive/include/hgesprite.h deleted file mode 100644 index e414c02..0000000 --- a/archive/include/hgesprite.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeSprite helper class header -*/ - - -#ifndef HGESPRITE_H -#define HGESPRITE_H - - -#include "hge.h" -#include "hgerect.h" - - -/* -** HGE Sprite class -*/ -class hgeSprite -{ -public: - hgeSprite(HTEXTURE tex, float x, float y, float w, float h); - hgeSprite(const hgeSprite &spr); - ~hgeSprite() { hge->Release(); } - - - void Render(float x, float y); - void RenderEx(float x, float y, float rot, float hscale=1.0f, float vscale=0.0f); - void RenderStretch(float x1, float y1, float x2, float y2); - void Render4V(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3); - - void SetTexture(HTEXTURE tex); - void SetTextureRect(float x, float y, float w, float h, bool adjSize = true); - void SetColor(DWORD col, int i=-1); - void SetZ(float z, int i=-1); - void SetBlendMode(int blend) { quad.blend=blend; } - void SetHotSpot(float x, float y) { hotX=x; hotY=y; } - void SetFlip(bool bX, bool bY, bool bHotSpot = false); - - HTEXTURE GetTexture() const { return quad.tex; } - void GetTextureRect(float *x, float *y, float *w, float *h) const { *x=tx; *y=ty; *w=width; *h=height; } - DWORD GetColor(int i=0) const { return quad.v[i].col; } - float GetZ(int i=0) const { return quad.v[i].z; } - int GetBlendMode() const { return quad.blend; } - void GetHotSpot(float *x, float *y) const { *x=hotX; *y=hotY; } - void GetFlip(bool *bX, bool *bY) const { *bX=bXFlip; *bY=bYFlip; } - - float GetWidth() const { return width; } - float GetHeight() const { return height; } - hgeRect* GetBoundingBox(float x, float y, hgeRect *rect) const { rect->Set(x-hotX, y-hotY, x-hotX+width, y-hotY+height); return rect; } - hgeRect* GetBoundingBoxEx(float x, float y, float rot, float hscale, float vscale, hgeRect *rect) const; - -protected: - hgeSprite(); - static HGE *hge; - - hgeQuad quad; - float tx, ty, width, height; - float tex_width, tex_height; - float hotX, hotY; - bool bXFlip, bYFlip, bHSFlip; -}; - - -#endif diff --git a/archive/include/hgestrings.h b/archive/include/hgestrings.h deleted file mode 100644 index e02cbe9..0000000 --- a/archive/include/hgestrings.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeStringTable helper class header -*/ - - -#ifndef HGESTRINGS_H -#define HGESTRINGS_H - - -#include "hge.h" - - -#define MAXSTRNAMELENGTH 64 - - -struct NamedString -{ - char name[MAXSTRNAMELENGTH]; - char *string; - NamedString *next; -}; - -/* -** HGE String table class -*/ -class hgeStringTable -{ -public: - hgeStringTable(const char *filename); - ~hgeStringTable(); - - char *GetString(const char *name); - -private: - hgeStringTable(const hgeStringTable &); - hgeStringTable& operator= (const hgeStringTable &); - - NamedString *strings; - - static HGE *hge; -}; - - -#endif diff --git a/archive/include/hgevector.h b/archive/include/hgevector.h deleted file mode 100644 index b86bd01..0000000 --- a/archive/include/hgevector.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -** Haaf's Game Engine 1.7 -** Copyright (C) 2003-2007, Relish Games -** hge.relishgames.com -** -** hgeVector helper class -*/ - - -#ifndef HGEVECTOR_H -#define HGEVECTOR_H - -#include <math.h> - -/* -** Fast 1.0/sqrtf(float) routine -*/ -float InvSqrt(float x); - -class hgeVector -{ -public: - float x,y; - - hgeVector(float _x, float _y) { x=_x; y=_y; } - hgeVector() { x=0; y=0; } - - hgeVector operator- () const { return hgeVector(-x, -y); } - hgeVector operator- (const hgeVector &v) const { return hgeVector(x-v.x, y-v.y); } - hgeVector operator+ (const hgeVector &v) const { return hgeVector(x+v.x, y+v.y); } - hgeVector& operator-= (const hgeVector &v) { x-=v.x; y-=v.y; return *this; } - hgeVector& operator+= (const hgeVector &v) { x+=v.x; y+=v.y; return *this; } - bool operator== (const hgeVector &v) const { return (x==v.x && y==v.y); } - bool operator!= (const hgeVector &v) const { return (x!=v.x || y!=v.y); } - - hgeVector operator/ (const float scalar) const { return hgeVector(x/scalar, y/scalar); } - hgeVector operator* (const float scalar) const { return hgeVector(x*scalar, y*scalar); } - hgeVector& operator*= (const float scalar) { x*=scalar; y*=scalar; return *this; } - - float Dot(const hgeVector *v) const { return x*v->x + y*v->y; } - float Length() const { return sqrtf(Dot(this)); } - float Angle(const hgeVector *v = 0) const; - - void Clamp(const float max) { if(Length() > max) { Normalize(); x *= max; y *= max; } } - hgeVector* Normalize() { float rc=InvSqrt(Dot(this)); x*=rc; y*=rc; return this; } - hgeVector* Rotate(float a); -}; - -inline hgeVector operator* (const float s, const hgeVector &v) { return v*s; } -inline float operator^ (const hgeVector &v, const hgeVector &u) { return v.Angle(&u); } -inline float operator% (const hgeVector &v, const hgeVector &u) { return v.Dot(&u); } - - -#endif diff --git a/archive/include/unix_compat.h b/archive/include/unix_compat.h deleted file mode 100644 index 56ec4b3..0000000 --- a/archive/include/unix_compat.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef _INCL_UNIX_COMPAT_H_ -#define _INCL_UNIX_COMPAT_H_ - -#if (defined(__APPLE__) && defined(__MACH__)) -#define PLATFORM_MACOSX 1 -#endif - -#if ( defined(unix) || PLATFORM_MACOSX ) -#define PLATFORM_UNIX 1 -#endif - -// Useful to sprinkle around the codebase without a bunch of #ifdefs... -#ifdef _WINDOWS -#define BYTESWAP(x) -#define STUBBED(x) -#endif - -// don't want rest of this header on Windows, etc. -#if (PLATFORM_UNIX) - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdint.h> -#include <unistd.h> -#include <assert.h> -#include <errno.h> -#include <limits.h> -#include <sys/stat.h> -#include <sys/time.h> -#include <time.h> - -#include "/usr/include/SDL/SDL.h" - -#define _MAX_PATH PATH_MAX -#define MAX_PATH PATH_MAX - -typedef int64_t __int64; -typedef uint32_t DWORD; -typedef uint64_t UINT64; -typedef uint8_t BYTE; -typedef void *HANDLE; -typedef HANDLE HWND; -typedef int32_t BOOL; - -static inline DWORD timeGetTime(void) -{ - return SDL_GetTicks(); -} // timeGetTime - - -// macro so I know what is still on the TODO list... -#if 1 -#define STUBBED(x) -#else -void CalledSTUBBED(void); // you can set a breakpoint on this. -#define STUBBED(x) \ -do { \ - static bool seen_this = false; \ - if (!seen_this) { \ - seen_this = true; \ - fprintf(stderr, "STUBBED: %s at %s (%s:%d)\n", x, __FUNCTION__, __FILE__, __LINE__); \ - fflush(stderr); \ - CalledSTUBBED(); \ - } \ -} while (false) -#endif - -static inline char *itoa(const int i, char *s, const int radix) -{ - assert(radix == 10); - sprintf(s, "%d", i); - return s; -} - -static inline char *_i64toa(const __int64 i, char *s, const int radix) -{ - assert(radix == 10); - assert(sizeof (long long) == sizeof (__int64)); - sprintf(s, "%lld", (long long) i); - return s; -} - -static inline __int64 _atoi64(const char *str) -{ - return (__int64) strtoll(str, NULL, 10); -} - -static inline void Sleep(const int ms) -{ - usleep(ms * 1000); -} - -static inline char *_gcvt(const double value, const int digits, char *buffer) -{ - char fmt[32]; - snprintf(fmt, sizeof (fmt), "%%.%dg", digits); - sprintf(buffer, fmt, value); - return buffer; -} - -#define ZeroMemory(a,b) memset(a, '\0', b) - -#ifdef __cplusplus -#ifdef max -#undef max -#endif -template <class T> inline const T &max(const T &a, const T &b) { return (a > b) ? a : b; } -#ifdef min -#undef min -#endif -template <class T> inline const T &min(const T &a, const T &b) { return (a < b) ? a : b; } -#endif - -// Byteswap magic... - -#if SDL_BYTEORDER == SDL_BIG_ENDIAN -#define PLATFORM_BIGENDIAN 1 -#define PLATFORM_LITTLEENDIAN 0 -#else -#define PLATFORM_BIGENDIAN 0 -#define PLATFORM_LITTLEENDIAN 1 -#endif - -#if PLATFORM_BIGENDIAN - #define SWAPPER64(t) \ - inline void BYTESWAP(t &x) { \ - union { t orig; Uint64 ui; } swapper; \ - swapper.orig = x; \ - swapper.ui = SDL_SwapLE64(swapper.ui); \ - x = swapper.orig; \ - } - #define SWAPPER32(t) \ - inline void BYTESWAP(t &x) { \ - union { t orig; Uint32 ui; } swapper; \ - swapper.orig = x; \ - swapper.ui = SDL_SwapLE32(swapper.ui); \ - x = swapper.orig; \ - } - #define SWAPPER16(t) \ - inline void BYTESWAP(t &x) { \ - union { t orig; Uint16 ui; } swapper; \ - swapper.orig = x; \ - swapper.ui = SDL_SwapLE16(swapper.ui); \ - x = swapper.orig; \ - } - #define SWAPPER8(t) inline void BYTESWAP(t &_x) {} - SWAPPER64(double) - SWAPPER32(size_t) // !!! FIXME: this will fail on gnuc/amd64. - SWAPPER32(int) - SWAPPER32(float) - SWAPPER32(DWORD) - SWAPPER16(WORD) - SWAPPER16(short) - SWAPPER8(BYTE) - #undef SWAPPER32 - #undef SWAPPER16 - #undef SWAPPER8 -#else - #define BYTESWAP(x) -#endif - -#endif // PLATFORM_UNIX - -#endif // include-once blocker. |