Harmonic Flow Framework (libhffwk)
Cross platform C++ 2D Game Engine Framework
HFDataTypes.h
Go to the documentation of this file.
1 /*
2  Harmonic Flow Framework
3  Copyright (C) 2011-2018 Andreas Widen <andreas@harmonicflow.org>
4 
5  This software is provided 'as-is', without any express or implied
6  warranty. In no event will the authors be held liable for any damages
7  arising from the use of this software.
8 
9  Permission is granted to anyone to use this software for any purpose,
10  including commercial applications, and to alter it and redistribute it
11  freely, subject to the following restrictions:
12 
13  1. The origin of this software must not be misrepresented; you must not
14  claim that you wrote the original software. If you use this software
15  in a product, an acknowledgment in the product documentation would be
16  appreciated but is not required.
17  2. Altered source versions must be plainly marked as such, and must not be
18  misrepresented as being the original software.
19  3. This notice may not be removed or altered from any source distribution.
20 */
21 #pragma once
22 
23 /** @file
24  * @brief Framework data types, defines, typedef's, enum and structs.
25 */
26 
27 // =================================================
28 // Useful generic defines
29 // =================================================
30 #ifndef HF_PI
31 /**
32  * @brief The number PI is a mathematical constant, the ratio of a
33  * circle's circumference to its diameter.
34  */
35 #define HF_PI (3.141593f)
36 #endif
37 
38 #ifndef NULL
39 /**
40  * @brief Convenient define for 0.
41  */
42 #define NULL 0
43 #endif
44 
45 #ifndef HF_SAFE_DELETE
46 /**
47  * @brief Check if not NULL, delete and set to NULL.
48  */
49 #define HF_SAFE_DELETE(p) { if(p) { delete (p); (p)=NULL; } }
50 #endif
51 
52 #ifndef HF_SAFE_DELETE_ARR
53 /**
54  * @brief Check if not NULL, delete array and set to NULL.
55  */
56 #define HF_SAFE_DELETE_ARR(p) { if(p) { delete [] (p); (p)=NULL; } }
57 #endif
58 
59 #ifndef HF_SAFE_FREE
60 /**
61  * @brief Check if not NULL, free and set to NULL.
62  */
63 #define HF_SAFE_FREE(p) { if(p) { free (p); (p)=NULL; } }
64 #endif
65 
66 #ifndef HF_SAFE_RELEASE
67 /**
68  * @brief Check if not NULL, release and set to NULL.
69  */
70 #define HF_SAFE_RELEASE(p) { if (p) { (p)->Release(); (p)=NULL; } }
71 #endif
72 
73 #ifndef BUFFER_OFFSET
74 /**
75  * @brief Set buffer offset.
76  */
77 #define BUFFER_OFFSET(i) ((int8_hf *)NULL + (i))
78 #endif
79 
80 #ifndef HF_OFFSETOF
81 /**
82  * @brief The macro expands to the value of which is the offset, in bytes,
83  * from the beginning of an object of specified Type to its specified Member,
84  * including padding if any.
85  *
86  * Example code:
87  * @verbatim
88  glEnableVertexAttribArray(mShaderAttrLocations.position);
89  glVertexAttribPointer(mShaderAttrLocations.position, 3, GL_FLOAT, GL_FALSE,
90  sizeof(VertexPosCol), (GLvoid *)HF_OFFSETOF(VertexPosCol, position));
91  @endverbatim
92  *
93  * @param Type Type.
94  * @param member Member of Type.
95  *
96  * @return offset, in bytes.
97  */
98 #if defined(__clang__) && defined(HF_64BIT)
99 #define HF_OFFSETOF(Type, member) ((unsigned long)&(((Type*)(0))->member))
100 #else
101 #define HF_OFFSETOF(Type, member) ((size_t)&(((Type*)(0))->member))
102 #endif
103 /*
104 #elif defined(__GNUC__)
105 #define HF_OFFSETOF(Type, member) ((size_t)&(((Type*)(0))->member))
106 #elif defined(_MSC_VER)
107 #define HF_OFFSETOF(Type, member) ((size_t)&(((Type*)(0))->member))
108 #endif
109 */
110 #endif
111 
112 #ifndef hf_max
113 /**
114  * @brief Returns the largest of a and b.
115  */
116 #define hf_max(a,b) (((a) > (b)) ? (a) : (b))
117 #endif
118 
119 #ifndef hf_min
120 /**
121  * @brief Returns the smallest of a and b.
122  */
123 #define hf_min(a,b) (((a) < (b)) ? (a) : (b))
124 #endif
125 
126 /**
127  * @brief Macro for checking audio mask bit size.
128  */
129 #define HF_AUDIO_MASK_BITSIZE (0xFF)
130 
131 /**
132  * @brief Sample is float (fp32_hf) if set.
133  */
134 #define HF_AUDIO_MASK_DATATYPE (1<<8)
135 
136 /**
137  * @brief Sample is big endian if set.
138  */
139 #define HF_AUDIO_MASK_ENDIAN (1<<12)
140 
141 /**
142  * @brief Sample is signed if set.
143  */
144 #define HF_AUDIO_MASK_SIGNED (1<<15)
145 
146 /**
147  * @brief Macro for determining sample bit size.
148  */
149 #define HF_AUDIO_BITSIZE(x) (x & HF_AUDIO_MASK_BITSIZE)
150 
151 /**
152  * @brief Macro for determining if sample float (fp32_hf) bit is set.
153  */
154 #define HF_AUDIO_ISFLOAT(x) (x & HF_AUDIO_MASK_DATATYPE)
155 
156 /**
157  * @brief Macro for determining if sample big endian bit is set.
158  */
159 #define HF_AUDIO_ISBIGENDIAN(x) (x & HF_AUDIO_MASK_ENDIAN)
160 
161 /**
162  * @brief Macro for determining if sample signed bit is set.
163  */
164 #define HF_AUDIO_ISSIGNED(x) (x & HF_AUDIO_MASK_SIGNED)
165 
166 /**
167  * @brief Macro for determining if sample int bit is set.
168  */
169 #define HF_AUDIO_ISINT(x) (!HF_AUDIO_ISFLOAT(x))
170 
171 /**
172  * @brief Macro for determining if sample little endian bit is set.
173  */
174 #define HF_AUDIO_ISLITTLEENDIAN(x) (!HF_AUDIO_ISBIGENDIAN(x))
175 
176 /**
177  * @brief Macro for determining if sample unsigned bit is set.
178  */
179 #define HF_AUDIO_ISUNSIGNED(x) (!HF_AUDIO_ISSIGNED(x))
180 
181 /**
182  * @brief Audio format: unsigned 8-bit samples.
183  */
184 #define HF_AUDIOFMT_U8 0x0008
185 
186 /**
187  * @brief Audio format: signed 8-bit samples.
188  */
189 #define HF_AUDIOFMT_S8 0x8008
190 
191 /**
192  * @brief Audio format: unsigned 16-bit samples (little endian).
193  */
194 #define HF_AUDIOFMT_U16LSB 0x0010
195 
196 /**
197  * @brief Audio format: signed 16-bit samples (little endian).
198  */
199 #define HF_AUDIOFMT_S16LSB 0x8010
200 
201 /**
202  * @brief Audio format: unsigned 16-bit samples (big endian).
203  */
204 #define HF_AUDIOFMT_U16MSB 0x1010
205 
206 /**
207  * @brief Audio format: signed 16-bit samples (big endian).
208  */
209 #define HF_AUDIOFMT_S16MSB 0x9010
210 
211 /**
212  * @brief Audio format: unsigned 16-bit samples (little endian).
213  */
214 #define HF_AUDIOFMT_U16 HF_AUDIOFMT_U16LSB
215 
216 /**
217  * @brief Audio format: signed 16-bit samples (little endian).
218  */
219 #define HF_AUDIOFMT_S16 HF_AUDIOFMT_S16LSB
220 
221 /**
222  * @brief Audio format: signed 32-bit samples (little endian).
223  */
224 #define HF_AUDIOFMT_S32LSB 0x8020
225 
226 /**
227  * @brief Audio format: signed 32-bit samples (big endian).
228  */
229 #define HF_AUDIOFMT_S32MSB 0x9020
230 
231 /**
232  * @brief Audio format: signed 32-bit samples (little endian).
233  */
234 #define HF_AUDIOFMT_S32 HF_AUDIOFMT_S32LSB
235 
236 /**
237  * @brief Audio format: 32-bit floating point samples (little endian).
238  */
239 #define HF_AUDIOFMT_F32LSB 0x8120
240 
241 /**
242  * @brief Audio format: 32-bit floating point samples (big endian).
243  */
244 #define HF_AUDIOFMT_F32MSB 0x9120
245 
246 /**
247  * @brief Audio format: 32-bit floating point samples (little endian).
248  */
249 #define HF_AUDIOFMT_F32 HF_AUDIOFMT_F32LSB
250 
251 /**
252  * @cond DOXYGEN_EXCLUDE
253  */
254 // one define which can be used to check if on Windows platform
255 #if defined(HF_PLATFORM_WINDOWS_D3D9) || defined(HF_PLATFORM_WINDOWS_OPENGL)
256 #ifndef HF_PLATFORM_WINDOWS
257 #define HF_PLATFORM_WINDOWS
258 #endif
259 #endif
260 
261 // define renderer: DirectX
262 #if defined(HF_PLATFORM_WINDOWS_D3D9)
263 #ifndef HF_RENDERER_DIRECT3D
264 #define HF_RENDERER_DIRECT3D
265 #endif
266 #endif
267 
268 // make sure OpenGL extensions is defined while including 'SDL_opengl.h'
269 #if defined(HF_PLATFORM_WINDOWS_OPENGL) || defined(HF_PLATFORM_OSX) || \
270  defined(HF_PLATFORM_LINUX)
271 #ifndef GL_GLEXT_PROTOTYPES
272 #define GL_GLEXT_PROTOTYPES
273 #endif
274 // define renderer: OpenGL
275 #ifndef HF_RENDERER_OPENGL
276 #define HF_RENDERER_OPENGL
277 #endif
278 #endif
279 
280 // we're using SDL
281 #if defined(HF_PLATFORM_WINDOWS_D3D9) || defined(HF_PLATFORM_WINDOWS_OPENGL) || \
282  defined(HF_PLATFORM_OSX) || defined(HF_PLATFORM_LINUX) || \
283  defined(HF_PLATFORM_IOS) || defined(HF_PLATFORM_ANDROID)
284 #ifndef HF_THREADS_SDL
285 #define HF_THREADS_SDL
286 #endif
287 #ifndef HF_SDL_ENABLED
288 #define HF_SDL_ENABLED
289 #endif
290 #endif
291 
292 #if defined(HF_PLATFORM_IOS) || defined(HF_PLATFORM_ANDROID)
293 #ifndef GL_GLEXT_PROTOTYPES
294 #define GL_GLEXT_PROTOTYPES
295 #endif
296 // define renderer: OpenGL ES
297 #ifndef HF_RENDERER_OPENGLES
298 #define HF_RENDERER_OPENGLES
299 #endif
300 #endif
301 
302 #if defined(HF_PLATFORM_IOS)
303 #ifndef __IPHONEOS__
304 #define __IPHONEOS__
305 #endif
306 #endif
307 
308 /**
309  * @endcond
310  */
311 
312 // =================================================
313 // Portable data types
314 // =================================================
315 
316 /**
317  * @brief A type definition for void*.
318  */
319 typedef void *openGLContext_hf;
320 
321 /**
322  * @brief A type definition for void*.
323  */
324 typedef void *thread_hf;
325 
326 /**
327  * @brief A type definition for char.
328  */
329 typedef char int8_hf;
330 
331 /**
332  * @brief A type definition for unsigned char.
333  */
334 typedef unsigned char uint8_hf;
335 
336 /**
337  * @brief A type definition for short.
338  */
339 typedef short int int16_hf;
340 
341 /**
342  * @brief A type definition for unsigned short.
343  */
344 typedef unsigned short int uint16_hf;
345 
346 /**
347  * @brief A type definition for int.
348  */
349 typedef int int32_hf;
350 
351 /**
352  * @brief A type definition for unsigned int.
353  */
354 typedef unsigned int uint32_hf;
355 
356 /**
357  * @brief A type definition for float.
358  */
359 typedef float fp32_hf;
360 
361 /**
362  * @brief A type definition for double.
363  */
364 typedef double fp64_hf;
365 
366 /**
367  * @brief A type definition for long long.
368  *
369 */
370 typedef long long int int64_hf;
371 
372 /**
373  * @brief A type definition for unsigned long long.
374  *
375 */
376 typedef unsigned long long int uint64_hf;
377 
378 /**
379  * @brief A type definition for int32_hf used as File IO handle.
380  */
382 
383 /**
384  * @brief A type definition for uint32_hf used as Audio device id.
385  */
387 
388 /**
389  * @brief A type definition for uint16_hf used as Audio format.
390  *
391  * These are what the 16 bits in HF_AudioFormat currently mean:
392  * (Unspecified bits are always zero).
393  *
394  * @verbatim
395  ++-----------------------sample is signed if set
396  ||
397  || ++-----------sample is bigendian if set
398  || ||
399  || || ++---sample is float if set
400  || || ||
401  || || || +---sample bit size---+
402  || || || | |
403  15 14 13 12 11 10 09 08 07 06 05 04 03 02 01 00
404  @endverbatim
405  *
406  * The following audio format defines can be used:
407  @verbatim
408  HF_AUDIOFMT_U8
409  HF_AUDIOFMT_S8
410  HF_AUDIOFMT_U16LSB
411  HF_AUDIOFMT_S16LSB
412  HF_AUDIOFMT_U16MSB
413  HF_AUDIOFMT_S16MSB
414  HF_AUDIOFMT_U16
415  HF_AUDIOFMT_S16
416  HF_AUDIOFMT_S32LSB
417  HF_AUDIOFMT_S32MSB
418  HF_AUDIOFMT_S32
419  HF_AUDIOFMT_F32LSB
420  HF_AUDIOFMT_F32MSB
421  HF_AUDIOFMT_F32
422  @endverbatim
423  */
425 
426 /**
427  * @brief Window handle struct.
428  */
429 typedef struct
430 {
431  void *window; ///< window handle pointer
432 } HF_Window;
433 
434 /**
435  * @brief Windows flags enum.
436  */
437 typedef enum
438 {
439  HF_WINDOW_FULLSCREEN = 0x00000001, ///< fullscreen window
440  HF_WINDOW_OPENGL = 0x00000002, ///< window usable with OpenGL context
441  HF_WINDOW_SHOWN = 0x00000004, ///< window is visible
442  HF_WINDOW_HIDDEN = 0x00000008, ///< window is not visible
443  HF_WINDOW_BORDERLESS = 0x00000010, ///< no window decoration
444  HF_WINDOW_RESIZABLE = 0x00000020, ///< window can be resized
445  HF_WINDOW_MINIMIZED = 0x00000040, ///< window is minimized
446  HF_WINDOW_MAXIMIZED = 0x00000080, ///< window is maximized
447  HF_WINDOW_INPUT_GRABBED = 0x00000100, ///< window has grabbed input focus
448  HF_WINDOW_INPUT_FOCUS = 0x00000200, ///< window has input focus
449  HF_WINDOW_MOUSE_FOCUS = 0x00000400, ///< window has mouse focus
450  HF_WINDOW_FOREIGN = 0x00000800 ///< window not created by SDL
452 
453 /**
454  * @brief Window position enum.
455  */
456 typedef enum
457 {
458  HF_WINDOW_POS_CENTERED = 0x00000001, ///< position window centered
459  HF_WINDOW_POS_UNDEFINED = 0x00000002 ///< undefined window position
460 } HF_WindowPos;
461 
462 /**
463  * @brief Fullscreen modes enum.
464  */
465 typedef enum
466 {
467  HF_FULLSCREEN_UNKNOWN = 0, ///< Unknown fullscreen mode (set for mobile (iOS, Android etc))
468  HF_FULLSCREEN_WINDOW = 1, ///< "real" fullscreen with a videomode change
469  HF_FULLSCREEN_DESKTOP = 2 ///< "fake" fullscreen that takes the size of the desktop
471 
472 /**
473  * @brief Power status enum.
474  */
475 typedef enum
476 {
477  HF_POWERSTATE_UNKNOWN = 0, ///< cannot determine power status
478  HF_POWERSTATE_ON_BATTERY = 1, ///< Not plugged in, running on the battery
479  HF_POWERSTATE_NO_BATTERY = 2, ///< Plugged in, no battery available
480  HF_POWERSTATE_CHARGING = 3, ///< Plugged in, charging battery
481  HF_POWERSTATE_CHARGED = 4 ///< Plugged in, battery charged
482 } HF_PowerState;
483 
484 /**
485  * @brief Display mode struct.
486  */
487 typedef struct
488 {
489  uint32_hf pixelformat; ///< pixel format
490  int32_hf w; ///< width
491  int32_hf h; ///< height
492  int32_hf refreshRate; ///< refresh rate
493  void *driverData; ///< driver data (used internally)
495 
496 /**
497  * @brief Pixel format enum.
498  */
499 typedef enum
500 {
501  HF_PIXELFORMAT_UNKNOWN = 0x00000001, ///< unknown
502  HF_PIXELFORMAT_INDEX1LSB = 0x00000002, ///< indexed
503  HF_PIXELFORMAT_INDEX1MSB = 0x00000004, ///< indexed
504  HF_PIXELFORMAT_INDEX4LSB = 0x00000008, ///< indexed
505  HF_PIXELFORMAT_INDEX4MSB = 0x00000010, ///< indexed
506  HF_PIXELFORMAT_INDEX8 = 0x00000012, ///< indexed
507  HF_PIXELFORMAT_RGB332 = 0x00000014, ///< rgb332
508  HF_PIXELFORMAT_RGB444 = 0x00000016, ///< rgb444
509  HF_PIXELFORMAT_RGB555 = 0x00000018, ///< rgb555
510  HF_PIXELFORMAT_BGR555 = 0x00000020, ///< bgr555
511  HF_PIXELFORMAT_ARGB4444 = 0x00000022, ///< argb4444
512  HF_PIXELFORMAT_RGBA4444 = 0x00000024, ///< rgba4444
513  HF_PIXELFORMAT_ABGR4444 = 0x00000026, ///< abgr4444
514  HF_PIXELFORMAT_BGRA4444 = 0x00000028, ///< bgra4444
515  HF_PIXELFORMAT_ARGB1555 = 0x00000030, ///< argb1555
516  HF_PIXELFORMAT_RGBA5551 = 0x00000032, ///< rgba5551
517  HF_PIXELFORMAT_ABGR1555 = 0x00000032, ///< abgr1555
518  HF_PIXELFORMAT_BGRA5551 = 0x00000034, ///< bgra5551
519  HF_PIXELFORMAT_RGB565 = 0x00000036, ///< rgb565
520  HF_PIXELFORMAT_BGR565 = 0x00000038, ///< bgr565
521  HF_PIXELFORMAT_RGB24 = 0x00000040, ///< rgb24
522  HF_PIXELFORMAT_BGR24 = 0x00000042, ///< bgr24
523  HF_PIXELFORMAT_RGB888 = 0x00000044, ///< rgb888
524  HF_PIXELFORMAT_RGBX8888 = 0x00000046, ///< rgbx8888
525  HF_PIXELFORMAT_BGR888 = 0x00000048, ///< bgr888
526  HF_PIXELFORMAT_BGRX8888 = 0x00000050, ///< bgrx8888
527  HF_PIXELFORMAT_ARGB8888 = 0x00000052, ///< argb8888
528  HF_PIXELFORMAT_RGBA8888 = 0x00000054, ///< rgba8888
529  HF_PIXELFORMAT_ABGR8888 = 0x00000056, ///< abgr8888
530  HF_PIXELFORMAT_BGRA8888 = 0x00000058, ///< bgra8888
531  HF_PIXELFORMAT_ARGB2101010 = 0x00000060, ///< argb2101010
532  HF_PIXELFORMAT_YV12 = 0x00000062, ///< planar mode: Y + V + U (3 planes)
533  HF_PIXELFORMAT_IYUV = 0x00000064, ///< planar mode: Y + U + V (3 planes)
534  HF_PIXELFORMAT_YUY2 = 0x00000066, ///< packed mode: Y0+U0+Y1+V0 (1 plane)
535  HF_PIXELFORMAT_UYVY = 0x00000068, ///< packed mode: U0+Y0+V0+Y1 (1 plane)
536  HF_PIXELFORMAT_YVYU = 0x00000100 ///< packed mode: Y0+V0+Y1+U0 (1 plane)
538 
539 /**
540  * @brief Cull Face Mode enum.
541  */
542 typedef enum
543 {
544  HF_CULL_FACE_MODE_BACK = 0, ///< Culls only the back faces.
546 
547 /**
548  * @brief Cull Face Order enum.
549  */
550 typedef enum
551 {
552  HF_CULL_FACE_ORDER_CW = 0, ///< Front-faces are clockwise ordered.
553  HF_CULL_FACE_ORDER_CCW = 1 ///< Front-faces are counter-clockwise ordered.
555 
556 /**
557  * @brief Logical scale modes enum.
558  */
559 typedef enum
560 {
561  HF_LOGICALSCALEMODE_DISABLED = 0, ///< disabled, not used.
562  HF_LOGICALSCALEMODE_ASPECT = 1, ///< Aspect Ratio (adds letterbox/sidebar if needed).
563  HF_LOGICALSCALEMODE_STRETCH = 2 ///< Stretch/shrink to fill screen.
565 
566 /**
567  * @brief Music file types enum.
568  */
569 typedef enum
570 {
571  HF_MUSICTYPE_NOTSUPPORTED = 0, ///< Not supported music file type.
572  HF_MUSICTYPE_WAV, ///< Music file type WAV.
573  HF_MUSICTYPE_OGG ///< Music file type OGG Vorbis.
574 } HF_MusicType;
575 
576 /**
577  * @brief Audio status enum.
578  */
579 typedef enum
580 {
581  HF_AUDIO_STOPPED = 0, ///< Audio status stopped.
582  HF_AUDIO_PLAYING, ///< Audio status playing.
583  HF_AUDIO_PAUSED ///< Audio status paused.
585 
586 /**
587  * @brief Audio fade status enum.
588  */
589 typedef enum
590 {
591  HF_AUDIO_NO_FADING = 0, ///< Audio fade status: none.
592  HF_AUDIO_FADEIN, ///< Audio fade status: Fade in.
593  HF_AUDIO_FADEOUT ///< Audio fade status: Fade out.
595 
596 /**
597  * @brief Audio rate / frequency enum.
598  */
599 typedef enum
600 {
601  HF_AUDIORATE_INVALID = -1, ///< Audio rate invalid.
602  HF_AUDIORATE_11025 = 11025, ///< Audio rate / frequency: 11025.
603  HF_AUDIORATE_22050 = 22050, ///< Audio rate / frequency: 22050.
604  HF_AUDIORATE_44100 = 44100 ///< Audio rate / frequency: 44100.
605 } HF_AudioRate;
606 
607 /**
608  * @brief Audio channels enum.
609  */
610 typedef enum
611 {
612  HF_AUDIOCHANNELS_INVALID = -1, ///< Audio channels invalid.
613  HF_AUDIOCHANNELS_1 = 1, ///< Audio channels: 1 (mono).
614  HF_AUDIOCHANNELS_2 = 2, ///< Audio channels: 2 (stereo).
615  HF_AUDIOCHANNELS_4 = 4, ///< Audio channels: 4 (quad).
616  HF_AUDIOCHANNELS_6 = 6 ///< Audio channels: 6 (Surround 5.1).
618 
619 /**
620  * @brief Audio buffer size enum.
621  */
622 typedef enum
623 {
624  HF_AUDIOBUFFER_INVALID = -1, ///< Audio buffer size invalid.
625  HF_AUDIOBUFFER_1024 = 1024, ///< Audio buffer size: 1024 bytes.
626  HF_AUDIOBUFFER_2048 = 2048, ///< Audio buffer size: 2048 bytes.
627  HF_AUDIOBUFFER_4096 = 4096 ///< Audio buffer size: 4096 bytes.
629 
630 /**
631  * @brief Thread info struct used for HFCore::ThreadListener callbacks.
632  */
633 typedef struct
634 {
635  int32_hf id; ///< Arbitary ID useful for identifying the thread.
636  void *data; ///< Arbitary user data.
637  void *listener; ///< Pointer to registered HFCore::ThreadListener class.
638 } HF_ThreadInfo;
639 
640 /**
641  * @brief Buffer usage enum.
642  */
643 typedef enum
644 {
645  HF_BUFFER_USAGE_UNDEFINED = -1, ///< Buffer usage: Undefined.
646  HF_BUFFER_USAGE_STATIC = 0, ///< Buffer usage: Static.
647  HF_BUFFER_USAGE_DYNAMIC ///< Buffer usage: Dynamic.
649 
650 /**
651  * @brief Matrix mode enum.
652  */
653 typedef enum
654 {
655  HF_MATRIX_MODE_PROJECTION = 0, ///< Matrix mode: Projection.
656  HF_MATRIX_MODE_VIEW, ///< Matrix mode: View.
657  HF_MATRIX_MODE_MODEL ///< Matrix mode: Model.
658 } HF_MatrixMode;
659 
660 /**
661  * @brief Resource type enum.
662  */
663 typedef enum
664 {
665  HF_RESOURCE_TYPE_IMAGE = 0, ///< Resource type: Image.
666  HF_RESOURCE_TYPE_IMAGEATLAS, ///< Resource type: ImageAtlas.
667  HF_RESOURCE_TYPE_SOUND, ///< Resource type: Sound.
668  HF_RESOURCE_TYPE_FONT, ///< Resource type: Font.
669  HF_RESOURCE_TYPE_TMXTILEMAP, ///< Resource type: TmxTileMap.
670  HF_RESOURCE_TYPE_SHADER, ///< Resource type: Shader.
671  HF_RESOURCE_TYPE_WAVEFRONTOBJ ///< Resource type: WavefrontOBJ.
unsigned int uint32_hf
A type definition for unsigned int.
Definition: HFDataTypes.h:354
Music file type OGG Vorbis.
Definition: HFDataTypes.h:573
Resource type: TmxTileMap.
Definition: HFDataTypes.h:669
Not plugged in, running on the battery.
Definition: HFDataTypes.h:478
double fp64_hf
A type definition for double.
Definition: HFDataTypes.h:364
Unknown fullscreen mode (set for mobile (iOS, Android etc))
Definition: HFDataTypes.h:467
Thread info struct used for HFCore::ThreadListener callbacks.
Definition: HFDataTypes.h:633
int int32_hf
A type definition for int.
Definition: HFDataTypes.h:349
unsigned long long int uint64_hf
A type definition for unsigned long long.
Definition: HFDataTypes.h:376
cannot determine power status
Definition: HFDataTypes.h:477
Plugged in, no battery available.
Definition: HFDataTypes.h:479
HF_WindowFlags
Windows flags enum.
Definition: HFDataTypes.h:437
Audio channels: 1 (mono).
Definition: HFDataTypes.h:613
HF_MusicType
Music file types enum.
Definition: HFDataTypes.h:569
Not supported music file type.
Definition: HFDataTypes.h:571
HF_AudioRate
Audio rate / frequency enum.
Definition: HFDataTypes.h:599
Audio status stopped.
Definition: HFDataTypes.h:581
int32_hf id
Arbitary ID useful for identifying the thread.
Definition: HFDataTypes.h:635
HF_PowerState
Power status enum.
Definition: HFDataTypes.h:475
window has grabbed input focus
Definition: HFDataTypes.h:447
Resource type: ImageAtlas.
Definition: HFDataTypes.h:666
Matrix mode: Projection.
Definition: HFDataTypes.h:655
Audio rate / frequency: 44100.
Definition: HFDataTypes.h:604
Front-faces are counter-clockwise ordered.
Definition: HFDataTypes.h:553
window is not visible
Definition: HFDataTypes.h:442
packed mode: Y0+U0+Y1+V0 (1 plane)
Definition: HFDataTypes.h:534
Audio rate / frequency: 22050.
Definition: HFDataTypes.h:603
Stretch/shrink to fill screen.
Definition: HFDataTypes.h:563
position window centered
Definition: HFDataTypes.h:458
Culls only the back faces.
Definition: HFDataTypes.h:544
uint32_hf pixelformat
pixel format
Definition: HFDataTypes.h:489
window is visible
Definition: HFDataTypes.h:441
Audio fade status: Fade in.
Definition: HFDataTypes.h:592
Audio buffer size: 2048 bytes.
Definition: HFDataTypes.h:626
unsigned short int uint16_hf
A type definition for unsigned short.
Definition: HFDataTypes.h:344
HF_CullFaceOrder
Cull Face Order enum.
Definition: HFDataTypes.h:550
"real" fullscreen with a videomode change
Definition: HFDataTypes.h:468
Audio channels: 6 (Surround 5.1).
Definition: HFDataTypes.h:616
window usable with OpenGL context
Definition: HFDataTypes.h:440
HF_AudioBufferSize
Audio buffer size enum.
Definition: HFDataTypes.h:622
window is maximized
Definition: HFDataTypes.h:446
window is minimized
Definition: HFDataTypes.h:445
Audio fade status: Fade out.
Definition: HFDataTypes.h:593
Display mode struct.
Definition: HFDataTypes.h:487
void * openGLContext_hf
A type definition for void*.
Definition: HFDataTypes.h:319
Resource type: Image.
Definition: HFDataTypes.h:665
window has mouse focus
Definition: HFDataTypes.h:449
int32_hf h
height
Definition: HFDataTypes.h:491
Resource type: Shader.
Definition: HFDataTypes.h:670
Buffer usage: Undefined.
Definition: HFDataTypes.h:645
Aspect Ratio (adds letterbox/sidebar if needed).
Definition: HFDataTypes.h:562
Plugged in, charging battery.
Definition: HFDataTypes.h:480
uint16_hf HF_AudioFormat
A type definition for uint16_hf used as Audio format.
Definition: HFDataTypes.h:424
Audio rate / frequency: 11025.
Definition: HFDataTypes.h:602
planar mode: Y + V + U (3 planes)
Definition: HFDataTypes.h:532
HF_CullFaceMode
Cull Face Mode enum.
Definition: HFDataTypes.h:542
Audio channels: 2 (stereo).
Definition: HFDataTypes.h:614
short int int16_hf
A type definition for short.
Definition: HFDataTypes.h:339
void * thread_hf
A type definition for void*.
Definition: HFDataTypes.h:324
Resource type: Font.
Definition: HFDataTypes.h:668
HF_AudioChannels
Audio channels enum.
Definition: HFDataTypes.h:610
char int8_hf
A type definition for char.
Definition: HFDataTypes.h:329
long long int int64_hf
A type definition for long long.
Definition: HFDataTypes.h:370
int32_hf HF_FileHandle
A type definition for int32_hf used as File IO handle.
Definition: HFDataTypes.h:381
HF_AudioStatus
Audio status enum.
Definition: HFDataTypes.h:579
Audio buffer size invalid.
Definition: HFDataTypes.h:624
void * listener
Pointer to registered HFCore::ThreadListener class.
Definition: HFDataTypes.h:637
Audio channels invalid.
Definition: HFDataTypes.h:612
Buffer usage: Dynamic.
Definition: HFDataTypes.h:647
Matrix mode: Model.
Definition: HFDataTypes.h:657
HF_WindowPos
Window position enum.
Definition: HFDataTypes.h:456
no window decoration
Definition: HFDataTypes.h:443
undefined window position
Definition: HFDataTypes.h:459
Window handle struct.
Definition: HFDataTypes.h:429
Audio fade status: none.
Definition: HFDataTypes.h:591
Audio buffer size: 4096 bytes.
Definition: HFDataTypes.h:627
disabled, not used.
Definition: HFDataTypes.h:561
window has input focus
Definition: HFDataTypes.h:448
packed mode: Y0+V0+Y1+U0 (1 plane)
Definition: HFDataTypes.h:536
Audio rate invalid.
Definition: HFDataTypes.h:601
void * driverData
driver data (used internally)
Definition: HFDataTypes.h:493
planar mode: Y + U + V (3 planes)
Definition: HFDataTypes.h:533
Front-faces are clockwise ordered.
Definition: HFDataTypes.h:552
HF_MatrixMode
Matrix mode enum.
Definition: HFDataTypes.h:653
HF_AudioFadeStatus
Audio fade status enum.
Definition: HFDataTypes.h:589
window not created by SDL
Definition: HFDataTypes.h:450
Matrix mode: View.
Definition: HFDataTypes.h:656
Audio status paused.
Definition: HFDataTypes.h:583
void * window
window handle pointer
Definition: HFDataTypes.h:431
HF_FullscreenMode
Fullscreen modes enum.
Definition: HFDataTypes.h:465
"fake" fullscreen that takes the size of the desktop
Definition: HFDataTypes.h:469
Audio status playing.
Definition: HFDataTypes.h:582
void * data
Arbitary user data.
Definition: HFDataTypes.h:636
int32_hf w
width
Definition: HFDataTypes.h:490
int32_hf refreshRate
refresh rate
Definition: HFDataTypes.h:492
HF_ResourceType
Resource type enum.
Definition: HFDataTypes.h:663
Audio buffer size: 1024 bytes.
Definition: HFDataTypes.h:625
Resource type: WavefrontOBJ.
Definition: HFDataTypes.h:671
unsigned char uint8_hf
A type definition for unsigned char.
Definition: HFDataTypes.h:334
HF_PixelFormat
Pixel format enum.
Definition: HFDataTypes.h:499
window can be resized
Definition: HFDataTypes.h:444
HF_LogicalScaleMode
Logical scale modes enum.
Definition: HFDataTypes.h:559
fullscreen window
Definition: HFDataTypes.h:439
packed mode: U0+Y0+V0+Y1 (1 plane)
Definition: HFDataTypes.h:535
Audio channels: 4 (quad).
Definition: HFDataTypes.h:615
Resource type: Sound.
Definition: HFDataTypes.h:667
float fp32_hf
A type definition for float.
Definition: HFDataTypes.h:359
Buffer usage: Static.
Definition: HFDataTypes.h:646
Music file type WAV.
Definition: HFDataTypes.h:572
Plugged in, battery charged.
Definition: HFDataTypes.h:481
uint32_hf HF_AudioDeviceID
A type definition for uint32_hf used as Audio device id.
Definition: HFDataTypes.h:386
HF_BufferUsage
Buffer usage enum.
Definition: HFDataTypes.h:643