210192d60e7164fbf6e15ed72940bb74da6b62c6
[vg.git] / vg_platform.h
1 #ifndef VG_PLATFORM_H
2 #define VG_PLATFORM_H
3
4 #ifdef VG_RELEASE
5 #define VG_STATIC static
6 #else
7 #define VG_STATIC
8 #endif
9
10 //#include "vg.h"
11 #include "vg_stdint.h"
12
13 /* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
14
15 typedef unsigned int uint;
16
17 typedef int v2i[2];
18 typedef int v3i[3];
19 typedef int v4i[4];
20 typedef float v2f[2];
21 typedef float v3f[3];
22 typedef float v4f[4];
23 typedef v2f m2x2f[2];
24 typedef v3f m3x3f[3];
25 typedef v3f m4x3f[4];
26 typedef v4f m4x4f[4];
27 typedef v3f boxf[2];
28
29 // Resource types
30 typedef struct vg_tex2d vg_tex2d;
31
32 struct vg_achievement
33 {
34 int is_set;
35 const char *name;
36 };
37
38 #define vg_static_assert _Static_assert
39 #define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))
40 #define VG_MUST_USE_RESULT __attribute__((warn_unused_result))
41
42 VG_STATIC void vg_strncpy( const char *src, char *dst, u32 len )
43 {
44 for( u32 i=0; i<len; i++ )
45 {
46 dst[i] = src[i];
47
48 if( !src[i] )
49 break;
50 }
51 }
52
53 #include <stdio.h>
54 #include <dirent.h>
55 #include <string.h>
56 #include <stdarg.h>
57 #include <ctype.h>
58 #include <math.h>
59 #include <assert.h>
60
61 #define VG_MIN( A, B ) ((A)<(B)?(A):(B))
62 #define VG_MAX( A, B ) ((A)>(B)?(A):(B))
63 #endif