

#Ifdef __FB_WIN32__
 #Include once "win/wtypes.bi"
#Else
 Type  Byte   As Ubyte
 Type  Word   As Ushort
 Type  Dword  As Uinteger
 Type  BOOL   As Integer
 #Define TRUE  1
 #Define FALSE 0
 #Define  MAKELONG(a,b) Cint( cushort(a) Or (cuint(cushort(b)) Shl 16) )
#EndIf  

#Define hge_VERSION &h180

#Ifndef  M_PI
 #Define M_PI   3.14159265358979323846f
 #Define M_PI_2 1.57079632679489661923f
 #Define M_PI_4 0.785398163397448309616f
 #Define M_1_PI 0.318309886183790671538f
 #Define M_2_PI 0.636619772367581343076f
#EndIf


Type HTEXTURE As Dword 
Type HTARGET  As Dword 
Type HEFFECT  As Dword 
Type HMUSIC   As Dword 
Type HSTREAM  As Dword 
Type HCHANNEL As Dword 

#Define ARGB(a,r,g,b)  ((cast(dword,a) Shl 24)+(cast(dword,r) Shl 16)+(cast(dword,g) Shl 8)+cast(dword,b))
#Define GETA(col)      ((col) Shr 24)
#Define GETR(col)      (((col) Shr 16) & &hFF)
#Define GETG(col)      (((col) Shr 8) & &hFF)
#Define GETB(col)      ((col) & &hFF)
#Define SETA(col,a)    (((col) & &h00FFFFFF) + (cast(dword,a) Shl 24))
#Define SETR(col,r)    (((col) & &hFF00FFFF) + (cast(dword,r) Shl 16))
#Define SETG(col,g)    (((col) & &hFFFF00FF) + (cast(dword,g) Shl 8))
#Define SETB(col,b)    (((col) & &hFFFFFF00) + cast(dword,b))

#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 or BLEND_ALPHABLEND or BLEND_NOZWRITE)
#Define  BLEND_DEFAULT_Z (BLEND_COLORMUL or BLEND_ALPHABLEND or BLEND_ZWRITE)


Enum hgeBoolState
		hge_WINDOWED		= 1    
		hge_ZBUFFER			= 2    
		hge_TEXTUREFILTER	= 3    
		hge_USESOUND		= 4    
		hge_DONTSUSPEND	= 5    
		hge_HIDEMOUSE		= 6	 
		hge_SHOWSPLASH		= 7	
		HGEBOOLSTATE_FORCE_DWORD = &h7FFFFFFF
End Enum

Enum hgeFuncState        
		hge_FRAMEFUNC		 = 8   
		hge_RENDERFUNC		 = 9    
		hge_FOCUSLOSTFUNC	 = 10   
		hge_FOCUSGAINFUNC	 = 11   
		hge_GFXRESTOREFUNC = 12   
		hge_EXITFUNC		 = 13  
		HGEFUNCSTATE_FORCE_DWORD = &h7FFFFFFF       
End Enum 

Enum  hgeHwndState
       hge_HWND			= 15
	    hge_HWNDPARENT   = 16
       HGEHWNDSTATE_FORCE_DWORD = &h7FFFFFFF
End Enum 

Enum  hgeIntState
        hge_SCREENWIDTH  = 17
        hge_SCREENHEIGHT = 18
        hge_SCREENBPP    = 19
        hge_SAMPLERATE   = 20
        hge_FXVOLUME     = 21
        hge_MUSVOLUME    = 22
        hge_FPS          = 23
        hge_POWERSTATUS	 = 24
        HGEINTSTATE_FORCE_DWORD = &h7FFFFFF
End Enum 

Enum  hgeStringState
        hge_ICON    = 25
        hge_TITLE   = 26
        hge_INIFILE = 27
        hge_LOGFILE = 28
        HGESTRINGSTATE_FORCE_DWORD = &h7FFFFFFF        
End Enum 

#define MAXSTRNAMELENGTH 64

Type NamedString
	As integer 	       name(MAXSTRNAMELENGTH)
	As ZString     Ptr String
	As NamedString	Ptr inext
End Type

Type hgeGUIListboxItem
	As Integer 		text(64)
	As hgeGUIListboxItem	Ptr inext
End Type

#Define  HGEFPS_UNLIMITED    0
#Define  HGEFPS_VSYNC       -1

#Define  HGEPWR_AC			   -1
#Define  HGEPWR_UNSUPPORTED	-2

#Define  HGEPRIM_LINES       2
#Define  HGEPRIM_TRIPLES     3
#Define  HGEPRIM_QUADS       4

Type hgeVertex
        x   As Single  
        y   As Single  
        z   As Single  
        col As Dword    
        tx  As Single  
        ty  As Single  
End Type


Type hgeTriple
        v(2)  As hgeVertex
        tex   As Dword   
        blend As Integer    
End Type

Type hgeQuad 
        v(3)  As hgeVertex 
        tex   As Dword 
        blend As Integer   
End Type

Type  hgeRect
	   x1 As Single 
	   y1 As Single
	   x2 As Single
	   y2 As Single
End Type

Type hgeVector
        x   As Single  
        y   As Single   
End Type

Type hgeInputEvent
        As Integer Type 
        As Integer Key 
        As Integer flags
        As Integer Chr 
        As Integer wheel
        As Single  x
        As Single  y
End Type

#Define INPUT_KEYDOWN        1
#Define INPUT_KEYUP          2
#Define INPUT_MBUTTONDOWN    3
#Define INPUT_MBUTTONUP      4
#Define INPUT_MOUSEMOVE      5
#Define INPUT_MOUSEWHEEL     6

#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

#Define HGETEXT_LEFT		   0
#Define HGETEXT_RIGHT		1
#Define HGETEXT_CENTER		2
#Define HGETEXT_HORZMASK	&h03

#Define HGETEXT_TOP			0
#Define HGETEXT_BOTTOM		4
#Define HGETEXT_MIDDLE		8
#Define HGETEXT_VERTMASK	&h0C

#Define HGEK_LBUTTON        &h01
#Define HGEK_RBUTTON        &h02
#Define HGEK_MBUTTON        &h04

#Define HGEK_ESCAPE         &h1B
#Define HGEK_BACKSPACE      &h08
#Define HGEK_TAB            &h09
#Define HGEK_ENTER          &h0D
#Define HGEK_SPACE          &h20
#Define HGEK_SHIFT          &h10
#Define HGEK_CTRL           &h11
#Define HGEK_ALT            &h12
#Define HGEK_LWIN           &h5B
#Define HGEK_RWIN           &h5C
#Define HGEK_APPS           &h5D
#Define HGEK_PAUSE          &h13
#Define HGEK_CAPSLOCK       &h14
#Define HGEK_NUMLOCK        &h90
#Define HGEK_SCROLLLOCK     &h91
#Define HGEK_PGUP           &h21
#Define HGEK_PGDN           &h22
#Define HGEK_HOME           &h24
#Define HGEK_END            &h23
#Define HGEK_INSERT         &h2D
#Define HGEK_DELETE         &h2E
#Define HGEK_LEFT           &h25
#Define HGEK_UP             &h26
#Define HGEK_RIGHT          &h27
#Define HGEK_DOWN           &h28
#Define HGEK_0              &h30
#Define HGEK_1              &h31
#Define HGEK_2              &h32
#Define HGEK_3              &h33
#Define HGEK_4              &h34
#Define HGEK_5              &h35
#Define HGEK_6              &h36
#Define HGEK_7              &h37
#Define HGEK_8              &h38
#Define HGEK_9              &h39
#Define HGEK_A              &h41
#Define HGEK_B              &h42
#Define HGEK_C              &h43
#Define HGEK_D              &h44
#Define HGEK_E              &h45
#Define HGEK_F              &h46
#Define HGEK_G              &h47
#Define HGEK_H              &h48
#Define HGEK_I              &h49
#Define HGEK_J              &h4A
#Define HGEK_K              &h4B
#Define HGEK_L              &h4C
#Define HGEK_M              &h4D
#Define HGEK_N              &h4E
#Define HGEK_O              &h4F
#Define HGEK_P              &h50
#Define HGEK_Q              &h51
#Define HGEK_R              &h52
#Define HGEK_S              &h53
#Define HGEK_T              &h54
#Define HGEK_U              &h55
#Define HGEK_V              &h56
#Define HGEK_W              &h57
#Define HGEK_X              &h58
#Define HGEK_Y              &h59
#Define HGEK_Z              &h5A
#Define HGEK_GRAVE          &hC0
#Define HGEK_MINUS          &hBD
#Define HGEK_EQUALS         &hBB
#Define HGEK_BACKSLASH      &hDC
#Define HGEK_LBRACKET       &hDB
#Define HGEK_RBRACKET       &hDD
#Define HGEK_SEMICOLON      &hBA
#Define HGEK_APOSTROPHE     &hDE
#Define HGEK_COMMA          &hBC
#Define HGEK_PERIOD         &hBE
#Define HGEK_SLASH          &hBF
#Define HGEK_NUMPAD0        &h60
#Define HGEK_NUMPAD1        &h61
#Define HGEK_NUMPAD2        &h62
#Define HGEK_NUMPAD3        &h63
#Define HGEK_NUMPAD4        &h64
#Define HGEK_NUMPAD5        &h65
#Define HGEK_NUMPAD6        &h66
#Define HGEK_NUMPAD7        &h67
#Define HGEK_NUMPAD8        &h68
#Define HGEK_NUMPAD9        &h69
#Define HGEK_MULTIPLY       &h6A
#Define HGEK_DIVIDE         &h6F
#Define HGEK_ADD            &h6B
#Define HGEK_SUBTRACT       &h6D
#Define HGEK_DECIMAL        &h6E
#Define HGEK_F1             &h70
#Define HGEK_F2             &h71
#Define HGEK_F3             &h72
#Define HGEK_F4             &h73
#Define HGEK_F5             &h74
#Define HGEK_F6             &h75
#Define HGEK_F7             &h76
#Define HGEK_F8             &h77
#Define HGEK_F9             &h78
#Define HGEK_F10            &h79
#Define HGEK_F11            &h7A
#Define HGEK_F12            &h7B

Type hgeColorRGB
	As Single r
   As Single g
   As Single b
   As Single a
End Type

Type hgeParticle

	As long	      vecLocation 'hgeVector
	As long	      vecVelocity 'hgeVector

	As Single		fGravity
	As	Single	   fRadialAccel
	As Single		fTangentialAccel

	As Single		fSpin
	As Single		fSpinDelta

	As Single		fSize
	As Single		fSizeDelta

	As hgeColorRGB	colColor
	As hgeColorRGB	colColorDelta

	As Single		   fAge
	As Single		   fTerminalAge
	
End Type

Type hgeParticleSystemInfo

	As Integer ptr  sprite    'texture + blend mode
	As Integer  nEmission  'particles per sec
	As Single  fLifetime

	As Single  fParticleLifeMin
	As Single  fParticleLifeMax

	As Single  fDirection
	As Single  fSpread
	As Integer bRelative

	As Single  fSpeedMin
	As Single  fSpeedMax

	As Single  fGravityMin
	As Single  fGravityMax

	As Single  fRadialAccelMin
	As Single  fRadialAccelMax

	As Single  fTangentialAccelMin
	As Single  fTangentialAccelMax

	As Single  fSizeStart
	As Single  fSizeEnd
	As Single  fSizeVar

	As Single  fSpinStart
	As Single  fSpinEnd
	As Single  fSpinVar

	As hgeColorRGB	  colColorStart
	As hgeColorRGB	  colColorEnd
	
	As Single  fColorVar
	As Single  fAlphaVar
	
End Type 

#define HGEANIM_FWD			0
#define HGEANIM_REV			1
#define HGEANIM_PINGPONG	2
#define HGEANIM_NOPINGPONG	0
#define HGEANIM_LOOP		   4
#define HGEANIM_NOLOOP		0

#define HGEDISP_NODE		   0
#define HGEDISP_TOPLEFT		1
#define HGEDISP_CENTER		2

#define HGESLIDER_BAR			0
#define HGESLIDER_BARRELATIVE	1
#define HGESLIDER_SLIDER		2

#define HGEGUI_NONAVKEYS		0
#define HGEGUI_LEFTRIGHT		1
#define HGEGUI_UPDOWN			2
#define HGEGUI_CYCLED			4