add colour picker to imgui
[vg.git] / vg_platform.h
index 2ebc506ea032249a1985507afe4cbd19ba029b0c..e8b288e9731afd4034d922ff010a5ed3e4054700 100644 (file)
@@ -1,12 +1,6 @@
 #ifndef VG_PLATFORM_H
 #define VG_PLATFORM_H
 
-#ifdef VG_RELEASE
- #define VG_STATIC static
-#else
- #define VG_STATIC
-#endif
-
 //#include "vg.h"
 #include "vg_stdint.h"
 
@@ -50,6 +44,9 @@ struct vg_achievement
 #include <math.h>
 #include <stdio.h>
 #include <errno.h>
+#include <stdlib.h>
+
+#include "vg_string.h"
 
 enum strncpy_behaviour{
    k_strncpy_always_add_null = 0,
@@ -57,8 +54,8 @@ enum strncpy_behaviour{
    k_strncpy_overflow_fatal = 2
 };
 
-VG_STATIC void vg_fatal_error( const char *fmt, ... );
-VG_STATIC u32 vg_strncpy( const char *src, char *dst, u32 len,
+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<len; i++ ){
@@ -80,51 +77,7 @@ VG_STATIC u32 vg_strncpy( const char *src, char *dst, u32 len,
    return 0;
 }
 
-typedef struct vg_str vg_str;
-struct vg_str{
-   char *buffer;
-   u32 i, len;
-};
-
-VG_STATIC void vg_strnull( vg_str *str, char *buffer, u32 len )
-{
-   str->buffer = buffer;
-   str->buffer[0] = '\0';
-   str->i = 0;
-   str->len = len;
-}
-
-VG_STATIC void vg_strcat( vg_str *str, const char *append )
-{
-   for( u32 i=0; str->i < str->len; i++, str->i ++ ){
-      str->buffer[ str->i ] = append[i];
-
-      if( append[i] == '\0' ) return;
-   }
-}
-
-VG_STATIC int vg_strgood( vg_str *str )
-{
-   if( str->i == str->len ){
-      if( str->buffer[str->i -1] == '\0' ) return 1;
-      else return 0;
-   }
-   else return 1;
-}
-
-VG_STATIC char *vg_strch( vg_str *str, char c )
-{
-   char *ptr = NULL;
-   for( u32 i=0; i<str->i; i++ ){
-      if( str->buffer[i] == c )
-         ptr = str->buffer+i;
-   }
-
-   return ptr;
-}
-
-VG_STATIC u32 vg_strdjb2( const char *str )
-{
+static u32 vg_strdjb2( const char *str ){
    u32 hash = 5381, c;
 
    while( (c = *str++) )
@@ -133,7 +86,7 @@ VG_STATIC u32 vg_strdjb2( const char *str )
    return hash;
 }
 
-VG_STATIC int vg_strdjb2_eq( const char *s1, u32 h1, 
+static int vg_strdjb2_eq( const char *s1, u32 h1, 
                              const char *s2, u32 h2 )
 {
    if( h1 == h2 ){