소스 검색

platform

banana-cakes
Felix Brendel 5 년 전
부모
커밋
eb1d178de3
3개의 변경된 파일21개의 추가작업 그리고 1개의 파일을 삭제
  1. +9
    -0
      platform.hpp
  2. +2
    -0
      testing.hpp
  3. +10
    -1
      types.hpp

+ 9
- 0
platform.hpp 파일 보기

@@ -0,0 +1,9 @@
#pragma once

#if defined(_WIN32) || defined(_WIN64)
#pragma message("Compiling for Windows")
#define FTB_WINDOWS
#elseif
#pragma message("Compiling for Linux")
#define FTB_LINUX
#endif

+ 2
- 0
testing.hpp 파일 보기

@@ -1,3 +1,5 @@
#include "./types.hpp"

typedef s32 testresult;

#define epsilon 2.2204460492503131E-16


+ 10
- 1
types.hpp 파일 보기

@@ -1,5 +1,6 @@
#pragma once

#include "platform.hpp"
#include <stdint.h>
#include <string.h>

@@ -27,10 +28,18 @@ struct String {
char* data;
};

inline auto heap_copy_c_string(const char* str) -> char* {
#ifdef FTB_WINDOWS
return _strdup(str);
#else
return strdup(str);
#endif
}

inline auto make_heap_string(const char* str) -> String {
String ret;
ret.length = strlen(str);
ret.data = _strdup(str);
ret.data = heap_copy_c_string(str);
return ret;
}



불러오는 중...
취소
저장