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