revision 2
[vg.git] / vg_platform.h
index 6707af7cab28a4862211f569b0c0660c5e84cc93..5ec7287ab436d692f8fb40141627b790ed423cd5 100644 (file)
@@ -1,25 +1,7 @@
-#ifndef VG_PLATFORM_H
-#define VG_PLATFORM_H
+#pragma once
 
-//#include "vg.h"
+#if 0
 #include "vg_stdint.h"
-
-/* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */
-
-typedef unsigned int uint;
-
-typedef int            v2i[2];
-typedef int            v3i[3];
-typedef int            v4i[4];
-typedef float          v2f[2];
-typedef float          v3f[3];
-typedef float          v4f[4];
-typedef v2f                    m2x2f[2];
-typedef v3f                    m3x3f[3];
-typedef v3f                    m4x3f[4];
-typedef v4f       m4x4f[4];
-typedef v3f                    boxf[2];
-
 // Resource types
 typedef struct vg_tex2d vg_tex2d;
 
@@ -29,38 +11,55 @@ struct vg_achievement
        const char *name;
 };
 
-#ifndef VG_STATIC
-#define VG_STATIC static
-#endif
-
 #define vg_static_assert _Static_assert
-#define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))
 #define VG_MUST_USE_RESULT __attribute__((warn_unused_result))
 
-VG_STATIC void vg_strncpy( const char *src, char *dst, u32 len )
-{
-   for( u32 i=0; i<len; i++ )
-   {
-      dst[i] = src[i];
-
-      if( !src[i] )
-         break;
-   }
-}
-
-#define VG_REQUIRED_ASSET( TYPE, DECL, FN, PATH, ... )                         \
-   TYPE DECL = FN( PATH,##__VA_ARGS__ );                                       \
-   vg_required( DECL, "Resource is required but failed to load: '" PATH "'" );
 
 #include <stdio.h>
-#include <dirent.h>
 #include <string.h>
 #include <stdarg.h>
 #include <ctype.h>
 #include <math.h>
 #include <assert.h>
+#include <setjmp.h>
+#include <sys/time.h>
+#include <math.h>
+#include <stdio.h>
+#include <errno.h>
+#include <stdlib.h>
+#endif
+
+#include <stdlib.h>
+#include <stdint.h>
+
+typedef uint8_t  u8;
+typedef uint16_t u16;
+typedef uint32_t u32;
+typedef uint64_t u64;
+typedef int8_t   i8;
+typedef int16_t  i16;
+typedef int32_t  i32;
+typedef int64_t  i64;
+typedef float    f32;
+typedef double   f64;
+typedef uint8_t  bool;
+
+typedef unsigned int uint;
+typedef int            v2i[2];
+typedef int            v3i[3];
+typedef int            v4i[4];
+typedef float          v2f[2];
+typedef float          v3f[3];
+typedef float          v4f[4];
+typedef v2f                    m2x2f[2];
+typedef v3f                    m3x3f[3];
+typedef v3f                    m4x3f[4];
+typedef v4f       m4x4f[4];
+typedef v3f                    boxf[2];
+
+/* anything compiled against VG shall implement this function somewhere. */
+void vg_fatal_error( const char *fmt, ... );
 
 #define VG_MIN( A, B ) ((A)<(B)?(A):(B))
 #define VG_MAX( A, B ) ((A)>(B)?(A):(B))
-
-#endif
+#define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))