7 #ifndef VOXELFARM_VOXELFARM_H
8 #define VOXELFARM_VOXELFARM_H
10 #include "VoxelFarmConfig.h"
16 const int ERROR_UNKNOWN = 1;
17 const int ERROR_INVALID_SIZE = 2;
18 const int ERROR_FILENOTFOUND = 3;
21 typedef void OnError(
int code,
const char* message,
const char* data,
bool& terminate);
25 void notifyError(
int code,
const char* message,
const char* data,
bool terminate);
27 extern std::ofstream logstream;
29 #if VOXELFARM_USE_DEFAULT_ALLOC
30 static inline void* MallocDefault(
size_t nBytes)
32 void* result = malloc(nBytes);
33 if (result ==
nullptr)
35 throw std::bad_alloc();
40 static inline void* CallocDefault(
size_t nObjects,
size_t nSize)
42 void* result = calloc(nObjects, nSize);
43 if (result ==
nullptr)
45 throw std::bad_alloc();
50 static inline void* ReallocDefault(
void* ptr,
size_t nBytes)
52 void* result = realloc(ptr, nBytes);
53 if (result ==
nullptr)
55 throw std::bad_alloc();
550 #endif // VOXELFARM_VOXELFARM_H
Contains all classes and functions for the VoxelFarm engine.
void notifyError(int code, const char *message, const char *data, bool terminate)
Notifies there was an error.
OnError * onError
Error event handler.
void OnError(int code, const char *message, const char *data, bool &terminate)
Prototype for error event.