Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
Classes | Macros | Typedefs | Enumerations
HFDataTypes.h File Reference

Framework data types, defines, typedef's, enum and structs. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  HF_Window
 Window handle struct. More...
 
struct  HF_DisplayMode
 Display mode struct. More...
 
struct  HF_ThreadInfo
 Thread info struct used for HFCore::ThreadListener callbacks. More...
 

Macros

#define HF_PI   (3.141593f)
 The number PI is a mathematical constant, the ratio of a circle's circumference to its diameter.
 
#define NULL   0
 Convenient define for 0.
 
#define HF_SAFE_DELETE(p)   { if(p) { delete (p); (p)=NULL; } }
 Check if not NULL, delete and set to NULL.
 
#define HF_SAFE_DELETE_ARR(p)   { if(p) { delete [] (p); (p)=NULL; } }
 Check if not NULL, delete array and set to NULL.
 
#define HF_SAFE_FREE(p)   { if(p) { free (p); (p)=NULL; } }
 Check if not NULL, free and set to NULL.
 
#define HF_SAFE_RELEASE(p)   { if (p) { (p)->Release(); (p)=NULL; } }
 Check if not NULL, release and set to NULL.
 
#define BUFFER_OFFSET(i)   ((int8_hf *)NULL + (i))
 Set buffer offset.
 
#define HF_OFFSETOF(Type, member)   ((size_t)&(((Type*)(0))->member))
 The macro expands to the value of which is the offset, in bytes, from the beginning of an object of specified Type to its specified Member, including padding if any. More...
 
#define hf_max(a, b)   (((a) > (b)) ? (a) : (b))
 Returns the largest of a and b.
 
#define hf_min(a, b)   (((a) < (b)) ? (a) : (b))
 Returns the smallest of a and b.
 
#define HF_AUDIO_MASK_BITSIZE   (0xFF)
 Macro for checking audio mask bit size.
 
#define HF_AUDIO_MASK_DATATYPE   (1<<8)
 Sample is float (fp32_hf) if set.
 
#define HF_AUDIO_MASK_ENDIAN   (1<<12)
 Sample is big endian if set.
 
#define HF_AUDIO_MASK_SIGNED   (1<<15)
 Sample is signed if set.
 
#define HF_AUDIO_BITSIZE(x)   (x & HF_AUDIO_MASK_BITSIZE)
 Macro for determining sample bit size.
 
#define HF_AUDIO_ISFLOAT(x)   (x & HF_AUDIO_MASK_DATATYPE)
 Macro for determining if sample float (fp32_hf) bit is set.
 
#define HF_AUDIO_ISBIGENDIAN(x)   (x & HF_AUDIO_MASK_ENDIAN)
 Macro for determining if sample big endian bit is set.
 
#define HF_AUDIO_ISSIGNED(x)   (x & HF_AUDIO_MASK_SIGNED)
 Macro for determining if sample signed bit is set.
 
#define HF_AUDIO_ISINT(x)   (!HF_AUDIO_ISFLOAT(x))
 Macro for determining if sample int bit is set.
 
#define HF_AUDIO_ISLITTLEENDIAN(x)   (!HF_AUDIO_ISBIGENDIAN(x))
 Macro for determining if sample little endian bit is set.
 
#define HF_AUDIO_ISUNSIGNED(x)   (!HF_AUDIO_ISSIGNED(x))
 Macro for determining if sample unsigned bit is set.
 
#define HF_AUDIOFMT_U8   0x0008
 Audio format: unsigned 8-bit samples.
 
#define HF_AUDIOFMT_S8   0x8008
 Audio format: signed 8-bit samples.
 
#define HF_AUDIOFMT_U16LSB   0x0010
 Audio format: unsigned 16-bit samples (little endian).
 
#define HF_AUDIOFMT_S16LSB   0x8010
 Audio format: signed 16-bit samples (little endian).
 
#define HF_AUDIOFMT_U16MSB   0x1010
 Audio format: unsigned 16-bit samples (big endian).
 
#define HF_AUDIOFMT_S16MSB   0x9010
 Audio format: signed 16-bit samples (big endian).
 
#define HF_AUDIOFMT_U16   HF_AUDIOFMT_U16LSB
 Audio format: unsigned 16-bit samples (little endian).
 
#define HF_AUDIOFMT_S16   HF_AUDIOFMT_S16LSB
 Audio format: signed 16-bit samples (little endian).
 
#define HF_AUDIOFMT_S32LSB   0x8020
 Audio format: signed 32-bit samples (little endian).
 
#define HF_AUDIOFMT_S32MSB   0x9020
 Audio format: signed 32-bit samples (big endian).
 
#define HF_AUDIOFMT_S32   HF_AUDIOFMT_S32LSB
 Audio format: signed 32-bit samples (little endian).
 
#define HF_AUDIOFMT_F32LSB   0x8120
 Audio format: 32-bit floating point samples (little endian).
 
#define HF_AUDIOFMT_F32MSB   0x9120
 Audio format: 32-bit floating point samples (big endian).
 
#define HF_AUDIOFMT_F32   HF_AUDIOFMT_F32LSB
 Audio format: 32-bit floating point samples (little endian).
 

Typedefs

typedef void * openGLContext_hf
 A type definition for void*.
 
typedef void * thread_hf
 A type definition for void*.
 
typedef char int8_hf
 A type definition for char.
 
typedef unsigned char uint8_hf
 A type definition for unsigned char.
 
typedef short int int16_hf
 A type definition for short.
 
typedef unsigned short int uint16_hf
 A type definition for unsigned short.
 
typedef int int32_hf
 A type definition for int.
 
typedef unsigned int uint32_hf
 A type definition for unsigned int.
 
typedef float fp32_hf
 A type definition for float.
 
typedef double fp64_hf
 A type definition for double.
 
typedef long long int int64_hf
 A type definition for long long.
 
typedef unsigned long long int uint64_hf
 A type definition for unsigned long long.
 
typedef int32_hf HF_FileHandle
 A type definition for int32_hf used as File IO handle.
 
typedef uint32_hf HF_AudioDeviceID
 A type definition for uint32_hf used as Audio device id.
 
typedef uint16_hf HF_AudioFormat
 A type definition for uint16_hf used as Audio format. More...
 

Enumerations

enum  HF_WindowFlags {
  HF_WINDOW_FULLSCREEN = 0x00000001, HF_WINDOW_OPENGL = 0x00000002, HF_WINDOW_SHOWN = 0x00000004, HF_WINDOW_HIDDEN = 0x00000008,
  HF_WINDOW_BORDERLESS = 0x00000010, HF_WINDOW_RESIZABLE = 0x00000020, HF_WINDOW_MINIMIZED = 0x00000040, HF_WINDOW_MAXIMIZED = 0x00000080,
  HF_WINDOW_INPUT_GRABBED = 0x00000100, HF_WINDOW_INPUT_FOCUS = 0x00000200, HF_WINDOW_MOUSE_FOCUS = 0x00000400, HF_WINDOW_FOREIGN = 0x00000800
}
 Windows flags enum. More...
 
enum  HF_WindowPos { HF_WINDOW_POS_CENTERED = 0x00000001, HF_WINDOW_POS_UNDEFINED = 0x00000002 }
 Window position enum. More...
 
enum  HF_FullscreenMode { HF_FULLSCREEN_UNKNOWN = 0, HF_FULLSCREEN_WINDOW = 1, HF_FULLSCREEN_DESKTOP = 2 }
 Fullscreen modes enum. More...
 
enum  HF_PowerState {
  HF_POWERSTATE_UNKNOWN = 0, HF_POWERSTATE_ON_BATTERY = 1, HF_POWERSTATE_NO_BATTERY = 2, HF_POWERSTATE_CHARGING = 3,
  HF_POWERSTATE_CHARGED = 4
}
 Power status enum. More...
 
enum  HF_PixelFormat {
  HF_PIXELFORMAT_UNKNOWN = 0x00000001, HF_PIXELFORMAT_INDEX1LSB = 0x00000002, HF_PIXELFORMAT_INDEX1MSB = 0x00000004, HF_PIXELFORMAT_INDEX4LSB = 0x00000008,
  HF_PIXELFORMAT_INDEX4MSB = 0x00000010, HF_PIXELFORMAT_INDEX8 = 0x00000012, HF_PIXELFORMAT_RGB332 = 0x00000014, HF_PIXELFORMAT_RGB444 = 0x00000016,
  HF_PIXELFORMAT_RGB555 = 0x00000018, HF_PIXELFORMAT_BGR555 = 0x00000020, HF_PIXELFORMAT_ARGB4444 = 0x00000022, HF_PIXELFORMAT_RGBA4444 = 0x00000024,
  HF_PIXELFORMAT_ABGR4444 = 0x00000026, HF_PIXELFORMAT_BGRA4444 = 0x00000028, HF_PIXELFORMAT_ARGB1555 = 0x00000030, HF_PIXELFORMAT_RGBA5551 = 0x00000032,
  HF_PIXELFORMAT_ABGR1555 = 0x00000032, HF_PIXELFORMAT_BGRA5551 = 0x00000034, HF_PIXELFORMAT_RGB565 = 0x00000036, HF_PIXELFORMAT_BGR565 = 0x00000038,
  HF_PIXELFORMAT_RGB24 = 0x00000040, HF_PIXELFORMAT_BGR24 = 0x00000042, HF_PIXELFORMAT_RGB888 = 0x00000044, HF_PIXELFORMAT_RGBX8888 = 0x00000046,
  HF_PIXELFORMAT_BGR888 = 0x00000048, HF_PIXELFORMAT_BGRX8888 = 0x00000050, HF_PIXELFORMAT_ARGB8888 = 0x00000052, HF_PIXELFORMAT_RGBA8888 = 0x00000054,
  HF_PIXELFORMAT_ABGR8888 = 0x00000056, HF_PIXELFORMAT_BGRA8888 = 0x00000058, HF_PIXELFORMAT_ARGB2101010 = 0x00000060, HF_PIXELFORMAT_YV12 = 0x00000062,
  HF_PIXELFORMAT_IYUV = 0x00000064, HF_PIXELFORMAT_YUY2 = 0x00000066, HF_PIXELFORMAT_UYVY = 0x00000068, HF_PIXELFORMAT_YVYU = 0x00000100
}
 Pixel format enum. More...
 
enum  HF_CullFaceMode { HF_CULL_FACE_MODE_BACK = 0 }
 Cull Face Mode enum. More...
 
enum  HF_CullFaceOrder { HF_CULL_FACE_ORDER_CW = 0, HF_CULL_FACE_ORDER_CCW = 1 }
 Cull Face Order enum. More...
 
enum  HF_LogicalScaleMode { HF_LOGICALSCALEMODE_DISABLED = 0, HF_LOGICALSCALEMODE_ASPECT = 1, HF_LOGICALSCALEMODE_STRETCH = 2 }
 Logical scale modes enum. More...
 
enum  HF_MusicType { HF_MUSICTYPE_NOTSUPPORTED = 0, HF_MUSICTYPE_WAV, HF_MUSICTYPE_OGG }
 Music file types enum. More...
 
enum  HF_AudioStatus { HF_AUDIO_STOPPED = 0, HF_AUDIO_PLAYING, HF_AUDIO_PAUSED }
 Audio status enum. More...
 
enum  HF_AudioFadeStatus { HF_AUDIO_NO_FADING = 0, HF_AUDIO_FADEIN, HF_AUDIO_FADEOUT }
 Audio fade status enum. More...
 
enum  HF_AudioRate { HF_AUDIORATE_INVALID = -1, HF_AUDIORATE_11025 = 11025, HF_AUDIORATE_22050 = 22050, HF_AUDIORATE_44100 = 44100 }
 Audio rate / frequency enum. More...
 
enum  HF_AudioChannels {
  HF_AUDIOCHANNELS_INVALID = -1, HF_AUDIOCHANNELS_1 = 1, HF_AUDIOCHANNELS_2 = 2, HF_AUDIOCHANNELS_4 = 4,
  HF_AUDIOCHANNELS_6 = 6
}
 Audio channels enum. More...
 
enum  HF_AudioBufferSize { HF_AUDIOBUFFER_INVALID = -1, HF_AUDIOBUFFER_1024 = 1024, HF_AUDIOBUFFER_2048 = 2048, HF_AUDIOBUFFER_4096 = 4096 }
 Audio buffer size enum. More...
 
enum  HF_BufferUsage { HF_BUFFER_USAGE_UNDEFINED = -1, HF_BUFFER_USAGE_STATIC = 0, HF_BUFFER_USAGE_DYNAMIC }
 Buffer usage enum. More...
 
enum  HF_MatrixMode { HF_MATRIX_MODE_PROJECTION = 0, HF_MATRIX_MODE_VIEW, HF_MATRIX_MODE_MODEL }
 Matrix mode enum. More...
 
enum  HF_ResourceType {
  HF_RESOURCE_TYPE_IMAGE = 0, HF_RESOURCE_TYPE_IMAGEATLAS, HF_RESOURCE_TYPE_SOUND, HF_RESOURCE_TYPE_FONT,
  HF_RESOURCE_TYPE_TMXTILEMAP, HF_RESOURCE_TYPE_SHADER, HF_RESOURCE_TYPE_WAVEFRONTOBJ
}
 Resource type enum. More...
 

Detailed Description

Framework data types, defines, typedef's, enum and structs.

Definition in file HFDataTypes.h.

Macro Definition Documentation

◆ HF_OFFSETOF

#define HF_OFFSETOF (   Type,
  member 
)    ((size_t)&(((Type*)(0))->member))

The macro expands to the value of which is the offset, in bytes, from the beginning of an object of specified Type to its specified Member, including padding if any.

Example code:

glEnableVertexAttribArray(mShaderAttrLocations.position);
glVertexAttribPointer(mShaderAttrLocations.position, 3, GL_FLOAT, GL_FALSE,
                      sizeof(VertexPosCol), (GLvoid *)HF_OFFSETOF(VertexPosCol, position));
Parameters
TypeType.
memberMember of Type.
Returns
offset, in bytes.

Definition at line 101 of file HFDataTypes.h.

Typedef Documentation

◆ HF_AudioFormat

A type definition for uint16_hf used as Audio format.

These are what the 16 bits in HF_AudioFormat currently mean: (Unspecified bits are always zero).

  ++-----------------------sample is signed if set
  ||
  ||       ++-----------sample is bigendian if set
  ||       ||
  ||       ||          ++---sample is float if set
  ||       ||          ||
  ||       ||          || +---sample bit size---+
  ||       ||          || |                     |
  15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00

The following audio format defines can be used:

HF_AUDIOFMT_U8
HF_AUDIOFMT_S8
HF_AUDIOFMT_U16LSB
HF_AUDIOFMT_S16LSB
HF_AUDIOFMT_U16MSB
HF_AUDIOFMT_S16MSB
HF_AUDIOFMT_U16
HF_AUDIOFMT_S16
HF_AUDIOFMT_S32LSB
HF_AUDIOFMT_S32MSB
HF_AUDIOFMT_S32
HF_AUDIOFMT_F32LSB
HF_AUDIOFMT_F32MSB
HF_AUDIOFMT_F32

Definition at line 424 of file HFDataTypes.h.

Enumeration Type Documentation

◆ HF_AudioBufferSize

Audio buffer size enum.

Enumerator
HF_AUDIOBUFFER_INVALID 

Audio buffer size invalid.

HF_AUDIOBUFFER_1024 

Audio buffer size: 1024 bytes.

HF_AUDIOBUFFER_2048 

Audio buffer size: 2048 bytes.

HF_AUDIOBUFFER_4096 

Audio buffer size: 4096 bytes.

Definition at line 622 of file HFDataTypes.h.

◆ HF_AudioChannels

Audio channels enum.

Enumerator
HF_AUDIOCHANNELS_INVALID 

Audio channels invalid.

HF_AUDIOCHANNELS_1 

Audio channels: 1 (mono).

HF_AUDIOCHANNELS_2 

Audio channels: 2 (stereo).

HF_AUDIOCHANNELS_4 

Audio channels: 4 (quad).

HF_AUDIOCHANNELS_6 

Audio channels: 6 (Surround 5.1).

Definition at line 610 of file HFDataTypes.h.

◆ HF_AudioFadeStatus

Audio fade status enum.

Enumerator
HF_AUDIO_NO_FADING 

Audio fade status: none.

HF_AUDIO_FADEIN 

Audio fade status: Fade in.

HF_AUDIO_FADEOUT 

Audio fade status: Fade out.

Definition at line 589 of file HFDataTypes.h.

◆ HF_AudioRate

Audio rate / frequency enum.

Enumerator
HF_AUDIORATE_INVALID 

Audio rate invalid.

HF_AUDIORATE_11025 

Audio rate / frequency: 11025.

HF_AUDIORATE_22050 

Audio rate / frequency: 22050.

HF_AUDIORATE_44100 

Audio rate / frequency: 44100.

Definition at line 599 of file HFDataTypes.h.

◆ HF_AudioStatus

Audio status enum.

Enumerator
HF_AUDIO_STOPPED 

Audio status stopped.

HF_AUDIO_PLAYING 

Audio status playing.

HF_AUDIO_PAUSED 

Audio status paused.

Definition at line 579 of file HFDataTypes.h.

◆ HF_BufferUsage

Buffer usage enum.

Enumerator
HF_BUFFER_USAGE_UNDEFINED 

Buffer usage: Undefined.

HF_BUFFER_USAGE_STATIC 

Buffer usage: Static.

HF_BUFFER_USAGE_DYNAMIC 

Buffer usage: Dynamic.

Definition at line 643 of file HFDataTypes.h.

◆ HF_CullFaceMode

Cull Face Mode enum.

Enumerator
HF_CULL_FACE_MODE_BACK 

Culls only the back faces.

Definition at line 542 of file HFDataTypes.h.

◆ HF_CullFaceOrder

Cull Face Order enum.

Enumerator
HF_CULL_FACE_ORDER_CW 

Front-faces are clockwise ordered.

HF_CULL_FACE_ORDER_CCW 

Front-faces are counter-clockwise ordered.

Definition at line 550 of file HFDataTypes.h.

◆ HF_FullscreenMode

Fullscreen modes enum.

Enumerator
HF_FULLSCREEN_UNKNOWN 

Unknown fullscreen mode (set for mobile (iOS, Android etc))

HF_FULLSCREEN_WINDOW 

"real" fullscreen with a videomode change

HF_FULLSCREEN_DESKTOP 

"fake" fullscreen that takes the size of the desktop

Definition at line 465 of file HFDataTypes.h.

◆ HF_LogicalScaleMode

Logical scale modes enum.

Enumerator
HF_LOGICALSCALEMODE_DISABLED 

disabled, not used.

HF_LOGICALSCALEMODE_ASPECT 

Aspect Ratio (adds letterbox/sidebar if needed).

HF_LOGICALSCALEMODE_STRETCH 

Stretch/shrink to fill screen.

Definition at line 559 of file HFDataTypes.h.

◆ HF_MatrixMode

Matrix mode enum.

Enumerator
HF_MATRIX_MODE_PROJECTION 

Matrix mode: Projection.

HF_MATRIX_MODE_VIEW 

Matrix mode: View.

HF_MATRIX_MODE_MODEL 

Matrix mode: Model.

Definition at line 653 of file HFDataTypes.h.

◆ HF_MusicType

Music file types enum.

Enumerator
HF_MUSICTYPE_NOTSUPPORTED 

Not supported music file type.

HF_MUSICTYPE_WAV 

Music file type WAV.

HF_MUSICTYPE_OGG 

Music file type OGG Vorbis.

Definition at line 569 of file HFDataTypes.h.

◆ HF_PixelFormat

Pixel format enum.

Enumerator
HF_PIXELFORMAT_UNKNOWN 

unknown

HF_PIXELFORMAT_INDEX1LSB 

indexed

HF_PIXELFORMAT_INDEX1MSB 

indexed

HF_PIXELFORMAT_INDEX4LSB 

indexed

HF_PIXELFORMAT_INDEX4MSB 

indexed

HF_PIXELFORMAT_INDEX8 

indexed

HF_PIXELFORMAT_RGB332 

rgb332

HF_PIXELFORMAT_RGB444 

rgb444

HF_PIXELFORMAT_RGB555 

rgb555

HF_PIXELFORMAT_BGR555 

bgr555

HF_PIXELFORMAT_ARGB4444 

argb4444

HF_PIXELFORMAT_RGBA4444 

rgba4444

HF_PIXELFORMAT_ABGR4444 

abgr4444

HF_PIXELFORMAT_BGRA4444 

bgra4444

HF_PIXELFORMAT_ARGB1555 

argb1555

HF_PIXELFORMAT_RGBA5551 

rgba5551

HF_PIXELFORMAT_ABGR1555 

abgr1555

HF_PIXELFORMAT_BGRA5551 

bgra5551

HF_PIXELFORMAT_RGB565 

rgb565

HF_PIXELFORMAT_BGR565 

bgr565

HF_PIXELFORMAT_RGB24 

rgb24

HF_PIXELFORMAT_BGR24 

bgr24

HF_PIXELFORMAT_RGB888 

rgb888

HF_PIXELFORMAT_RGBX8888 

rgbx8888

HF_PIXELFORMAT_BGR888 

bgr888

HF_PIXELFORMAT_BGRX8888 

bgrx8888

HF_PIXELFORMAT_ARGB8888 

argb8888

HF_PIXELFORMAT_RGBA8888 

rgba8888

HF_PIXELFORMAT_ABGR8888 

abgr8888

HF_PIXELFORMAT_BGRA8888 

bgra8888

HF_PIXELFORMAT_ARGB2101010 

argb2101010

HF_PIXELFORMAT_YV12 

planar mode: Y + V + U (3 planes)

HF_PIXELFORMAT_IYUV 

planar mode: Y + U + V (3 planes)

HF_PIXELFORMAT_YUY2 

packed mode: Y0+U0+Y1+V0 (1 plane)

HF_PIXELFORMAT_UYVY 

packed mode: U0+Y0+V0+Y1 (1 plane)

HF_PIXELFORMAT_YVYU 

packed mode: Y0+V0+Y1+U0 (1 plane)

Definition at line 499 of file HFDataTypes.h.

◆ HF_PowerState

Power status enum.

Enumerator
HF_POWERSTATE_UNKNOWN 

cannot determine power status

HF_POWERSTATE_ON_BATTERY 

Not plugged in, running on the battery.

HF_POWERSTATE_NO_BATTERY 

Plugged in, no battery available.

HF_POWERSTATE_CHARGING 

Plugged in, charging battery.

HF_POWERSTATE_CHARGED 

Plugged in, battery charged.

Definition at line 475 of file HFDataTypes.h.

◆ HF_ResourceType

Resource type enum.

Enumerator
HF_RESOURCE_TYPE_IMAGE 

Resource type: Image.

HF_RESOURCE_TYPE_IMAGEATLAS 

Resource type: ImageAtlas.

HF_RESOURCE_TYPE_SOUND 

Resource type: Sound.

HF_RESOURCE_TYPE_FONT 

Resource type: Font.

HF_RESOURCE_TYPE_TMXTILEMAP 

Resource type: TmxTileMap.

HF_RESOURCE_TYPE_SHADER 

Resource type: Shader.

HF_RESOURCE_TYPE_WAVEFRONTOBJ 

Resource type: WavefrontOBJ.

Definition at line 663 of file HFDataTypes.h.

◆ HF_WindowFlags

Windows flags enum.

Enumerator
HF_WINDOW_FULLSCREEN 

fullscreen window

HF_WINDOW_OPENGL 

window usable with OpenGL context

HF_WINDOW_SHOWN 

window is visible

HF_WINDOW_HIDDEN 

window is not visible

HF_WINDOW_BORDERLESS 

no window decoration

HF_WINDOW_RESIZABLE 

window can be resized

HF_WINDOW_MINIMIZED 

window is minimized

HF_WINDOW_MAXIMIZED 

window is maximized

HF_WINDOW_INPUT_GRABBED 

window has grabbed input focus

HF_WINDOW_INPUT_FOCUS 

window has input focus

HF_WINDOW_MOUSE_FOCUS 

window has mouse focus

HF_WINDOW_FOREIGN 

window not created by SDL

Definition at line 437 of file HFDataTypes.h.

◆ HF_WindowPos

Window position enum.

Enumerator
HF_WINDOW_POS_CENTERED 

position window centered

HF_WINDOW_POS_UNDEFINED 

undefined window position

Definition at line 456 of file HFDataTypes.h.