X-Git-Url: https://harrygodden.com/git/?p=vg.git;a=blobdiff_plain;f=vg_platform.h;h=319f7a9abd1892e2fb4b8d03860484aa4c5725a0;hp=e8b288e9731afd4034d922ff010a5ed3e4054700;hb=HEAD;hpb=5cc37bf42297227603b045317af94952fff07bf3 diff --git a/vg_platform.h b/vg_platform.h index e8b288e..b846b06 100644 --- a/vg_platform.h +++ b/vg_platform.h @@ -1,13 +1,21 @@ -#ifndef VG_PLATFORM_H -#define VG_PLATFORM_H +#pragma once -//#include "vg.h" -#include "vg_stdint.h" - -/* Copyright (C) 2021-2022 Harry Godden (hgn) - All Rights Reserved */ +#include +#include + +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]; @@ -20,85 +28,15 @@ typedef v3f m4x3f[4]; typedef v4f m4x4f[4]; typedef v3f boxf[2]; -// Resource types -typedef struct vg_tex2d vg_tex2d; - -struct vg_achievement -{ - int is_set; - const char *name; -}; - -#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)) - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "vg_string.h" - -enum strncpy_behaviour{ - k_strncpy_always_add_null = 0, - k_strncpy_allow_cutoff = 1, - k_strncpy_overflow_fatal = 2 -}; +/* anything compiled against VG shall implement this function somewhere. */ +void vg_fatal_error( const char *fmt, ... ); -static void vg_fatal_error( const char *fmt, ... ); -static u32 vg_strncpy( const char *src, char *dst, u32 len, - enum strncpy_behaviour behaviour ) -{ - for( u32 i=0; i(B)?(A):(B)) -#endif +#define vg_list_size( A ) (sizeof(A)/sizeof(A[0]))