Bläddra i källkod

Update to new core, remove namespaces

Kajetan Johannes Hammerle 3 månader sedan
förälder
incheckning
4a8ef9abb1

+ 3 - 3
CMakeLists.txt

@@ -23,9 +23,9 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
     set(COMPILE_OPTIONS "")
     set(LINK_OPTIONS "")
     set(LOG_LEVEL 2)
-    set(DEFINITIONS CORE_CHECK_MEMORY)
+    set(DEFINITIONS CHECK_MEMORY)
 else()
-    set(DEFINITIONS ERROR_SIMULATOR CORE_CHECK_MEMORY)
+    set(DEFINITIONS ERROR_SIMULATOR CHECK_MEMORY)
     if(CMAKE_C_COMPILER_ID STREQUAL "GNU")
         set(COMPILE_OPTIONS --coverage)
         set(LINK_OPTIONS gcov)
@@ -57,7 +57,7 @@ target_compile_options(gaming_core PUBLIC
     -fdiagnostics-color=always
 )
 target_compile_definitions(gaming_core
-    PUBLIC CORE_LOG_LEVEL=${LOG_LEVEL}
+    PUBLIC LOG_LEVEL=${LOG_LEVEL}
     PUBLIC ${DEFINITIONS}
 )
 target_link_libraries(gaming_core

+ 6 - 15
include/core/Image.h

@@ -8,27 +8,18 @@ typedef struct {
     int width;
     int height;
     int channels;
-} CoreImage8;
+} Image8;
 
 typedef struct {
     u16* data;
     int width;
     int height;
     int channels;
-} CoreImage16;
+} Image16;
 
-bool coreInitImage8(CoreImage8* image, const char* path);
-void coreDestroyImage8(CoreImage8* image);
-bool coreInitImage16(CoreImage16* image, const char* path);
-void coreDestroyImage16(CoreImage16* image);
-
-#ifdef IMPORT_CORE
-#define Image8 CoreImage8
-#define Image16 CoreImage16
-#define initImage8 coreInitImage8
-#define destroyImage8 coreDestroyImage8
-#define initImage16 coreInitImage16
-#define destroyImage16 coreDestroyImage16
-#endif
+bool initImage8(Image8* image, const char* path);
+void destroyImage8(Image8* image);
+bool initImage16(Image16* image, const char* path);
+void destroyImage16(Image16* image);
 
 #endif

+ 61 - 125
include/core/Network.h

@@ -5,143 +5,79 @@
 #include <core/Types.h>
 
 typedef enum {
-    CORE_PACKET_RELIABLE,
-    CORE_PACKET_SEQUENCED,
-    CORE_PACKET_UNSEQUENCED
-} CorePacketSendMode;
+    PACKET_RELIABLE,
+    PACKET_SEQUENCED,
+    PACKET_UNSEQUENCED
+} PacketSendMode;
 
 typedef struct {
     const char* data;
     size_t size;
     size_t index;
-} CoreInPacket;
+} InPacket;
 
-void coreInitInPacket(CoreInPacket* in, const void* data, size_t n);
-bool coreReadInPacketU8(CoreInPacket* in, u8* u);
-bool coreReadInPacketU16(CoreInPacket* in, u16* u);
-bool coreReadInPacketU32(CoreInPacket* in, u32* u);
-bool coreReadInPacketI8(CoreInPacket* in, i8* i);
-bool coreReadInPacketI16(CoreInPacket* in, i16* i);
-bool coreReadInPacketI32(CoreInPacket* in, i32* i);
-bool coreReadInPacketFloat(CoreInPacket* in, float* f);
-size_t coreReadInPacketString(CoreInPacket* in, char* buffer, size_t n);
-bool coreReadInPacket(CoreInPacket* in, void* buffer, size_t n);
+void initInPacket(InPacket* in, const void* data, size_t n);
+bool readInPacketU8(InPacket* in, u8* u);
+bool readInPacketU16(InPacket* in, u16* u);
+bool readInPacketU32(InPacket* in, u32* u);
+bool readInPacketI8(InPacket* in, i8* i);
+bool readInPacketI16(InPacket* in, i16* i);
+bool readInPacketI32(InPacket* in, i32* i);
+bool readInPacketFloat(InPacket* in, float* f);
+size_t readInPacketString(InPacket* in, char* buffer, size_t n);
+bool readInPacket(InPacket* in, void* buffer, size_t n);
 
 typedef struct {
-    CoreBuffer data;
-} CoreOutPacket;
+    Buffer data;
+} OutPacket;
 
-void coreInitOutPacket(CoreOutPacket* out);
-void coreDestroyOutPacket(CoreOutPacket* out);
-void coreWriteOutPacketU8(CoreOutPacket* out, u8 u);
-void coreWriteOutPacketU16(CoreOutPacket* out, u16 u);
-void coreWriteOutPacketU32(CoreOutPacket* out, u32 u);
-void coreWriteOutPacketI8(CoreOutPacket* out, i8 i);
-void coreWriteOutPacketI16(CoreOutPacket* out, i16 i);
-void coreWriteOutPacketI32(CoreOutPacket* out, i32 i);
-void coreWriteOutPacketFloat(CoreOutPacket* out, float f);
-void coreWriteOutPacketString(CoreOutPacket* out, const char* buffer);
-void coreWriteOutPacket(CoreOutPacket* out, const void* buffer, size_t n);
+void initOutPacket(OutPacket* out);
+void destroyOutPacket(OutPacket* out);
+void writeOutPacketU8(OutPacket* out, u8 u);
+void writeOutPacketU16(OutPacket* out, u16 u);
+void writeOutPacketU32(OutPacket* out, u32 u);
+void writeOutPacketI8(OutPacket* out, i8 i);
+void writeOutPacketI16(OutPacket* out, i16 i);
+void writeOutPacketI32(OutPacket* out, i32 i);
+void writeOutPacketFloat(OutPacket* out, float f);
+void writeOutPacketString(OutPacket* out, const char* buffer);
+void writeOutPacket(OutPacket* out, const void* buffer, size_t n);
 
-typedef u16 CorePort;
-typedef void (*CoreOnServerConnect)(void);
-typedef void (*CoreOnServerDisconnect)(void);
-typedef void (*CoreOnServerPacket)(CoreInPacket*);
+typedef u16 Port;
+typedef void (*OnServerConnect)(void);
+typedef void (*OnServerDisconnect)(void);
+typedef void (*OnServerPacket)(InPacket*);
 
-bool coreStartClient(void);
-void coreStopClient(void);
-bool coreConnectClient(const char* server, CorePort port, int timeoutTicks);
-void coreSetClientTimeout(u32 timeout, u32 timeoutMin, u32 timeoutMax);
-void coreDisconnectClient(int timeoutTicks);
-void coreSendClientPacket(const CoreOutPacket* p, CorePacketSendMode mode);
-void coreTickClient(void);
-void coreSetClientConnectHandler(CoreOnServerConnect oc);
-void coreSetClientDisconnectHandler(CoreOnServerDisconnect od);
-void coreSetClientPacketHandler(CoreOnServerPacket op);
-void coreResetClientHandler(void);
-bool coreIsClientConnecting(void);
-bool coreIsClientConnected(void);
+bool startClient(void);
+void stopClient(void);
+bool connectClient(const char* server, Port port, int timeoutTicks);
+void setClientTimeout(u32 timeout, u32 timeoutMin, u32 timeoutMax);
+void disconnectClient(int timeoutTicks);
+void sendClientPacket(const OutPacket* p, PacketSendMode mode);
+void tickClient(void);
+void setClientConnectHandler(OnServerConnect oc);
+void setClientDisconnectHandler(OnServerDisconnect od);
+void setClientPacketHandler(OnServerPacket op);
+void resetClientHandler(void);
+bool isClientConnecting(void);
+bool isClientConnected(void);
 
-typedef int CoreClient;
-typedef void (*CoreOnClientConnect)(CoreClient);
-typedef void (*CoreOnClientDisconnect)(CoreClient);
-typedef void (*CoreOnClientPacket)(CoreClient, CoreInPacket*);
+typedef int Client;
+typedef void (*OnClientConnect)(Client);
+typedef void (*OnClientDisconnect)(Client);
+typedef void (*OnClientPacket)(Client, InPacket*);
 
-bool coreStartServer(CorePort port, size_t maxClients);
-void coreStopServer(void);
-void coreTickServer(void);
-void coreSendServerPacketBroadcast(const CoreOutPacket* p,
-                                   CorePacketSendMode mode);
-void coreSendServerPacket(CoreClient client, const CoreOutPacket* p,
-                          CorePacketSendMode mode);
-void coreSetServerTimeout(CoreClient client, u32 timeout, u32 timeoutMin,
-                          u32 timeoutMax);
-void coreDisconnectServerClient(CoreClient client);
-void coreSetServerConnectHandler(CoreOnClientConnect oc);
-void coreSetServerDisconnectHandler(CoreOnClientDisconnect od);
-void coreSetServerPacketHandler(CoreOnClientPacket op);
-void coreResetServerHandler(void);
-
-#ifdef IMPORT_CORE
-#define PacketSendMode CorePacketSendMode
-#define PACKET_RELIABLE CORE_PACKET_RELIABLE
-#define PACKET_SEQUENCED CORE_PACKET_SEQUENCED
-#define PACKET_UNSEQUENCED CORE_PACKET_UNSEQUENCED
-#define InPacket CoreInPacket
-#define initInPacket coreInitInPacket
-#define readInPacketU8 coreReadInPacketU8
-#define readInPacketU16 coreReadInPacketU16
-#define readInPacketU32 coreReadInPacketU32
-#define readInPacketI8 coreReadInPacketI8
-#define readInPacketI16 coreReadInPacketI16
-#define readInPacketI32 coreReadInPacketI32
-#define readInPacketFloat coreReadInPacketFloat
-#define readInPacketString coreReadInPacketString
-#define readInPacket coreReadInPacket
-#define OutPacket CoreOutPacket
-#define initOutPacket coreInitOutPacket
-#define destroyOutPacket coreDestroyOutPacket
-#define writeOutPacketU8 coreWriteOutPacketU8
-#define writeOutPacketU16 coreWriteOutPacketU16
-#define writeOutPacketU32 coreWriteOutPacketU32
-#define writeOutPacketI8 coreWriteOutPacketI8
-#define writeOutPacketI16 coreWriteOutPacketI16
-#define writeOutPacketI32 coreWriteOutPacketI32
-#define writeOutPacketFloat coreWriteOutPacketFloat
-#define writeOutPacketString coreWriteOutPacketString
-#define writeOutPacket coreWriteOutPacket
-#define Port CorePort
-#define OnServerConnect CoreOnServerConnect
-#define OnServerDisconnect CoreOnServerDisconnect
-#define OnServerPacket CoreOnServerPacket
-#define startClient coreStartClient
-#define stopClient coreStopClient
-#define connectClient coreConnectClient
-#define setClientTimeout coreSetClientTimeout
-#define disconnectClient coreDisconnectClient
-#define sendClientPacket coreSendClientPacket
-#define tickClient coreTickClient
-#define setClientConnectHandler coreSetClientConnectHandler
-#define setClientDisconnectHandler coreSetClientDisconnectHandler
-#define setClientPacketHandler coreSetClientPacketHandler
-#define resetClientHandler coreResetClientHandler
-#define isClientConnecting coreIsClientConnecting
-#define isClientConnected coreIsClientConnected
-#define Client CoreClient
-#define OnClientConnect CoreOnClientConnect
-#define OnClientDisconnect CoreOnClientDisconnect
-#define OnClientPacket CoreOnClientPacket
-#define startServer coreStartServer
-#define stopServer coreStopServer
-#define tickServer coreTickServer
-#define sendServerPacketBroadcast coreSendServerPacketBroadcast
-#define sendServerPacket coreSendServerPacket
-#define setServerTimeout coreSetServerTimeout
-#define disconnectServerClient coreDisconnectServerClient
-#define setServerConnectHandler coreSetServerConnectHandler
-#define setServerDisconnectHandler coreSetServerDisconnectHandler
-#define setServerPacketHandler coreSetServerPacketHandler
-#define resetServerHandler coreResetServerHandler
-#endif
+bool startServer(Port port, size_t maxClients);
+void stopServer(void);
+void tickServer(void);
+void sendServerPacketBroadcast(const OutPacket* p, PacketSendMode mode);
+void sendServerPacket(Client client, const OutPacket* p, PacketSendMode mode);
+void setServerTimeout(Client client, u32 timeout, u32 timeoutMin,
+                      u32 timeoutMax);
+void disconnectServerClient(Client client);
+void setServerConnectHandler(OnClientConnect oc);
+void setServerDisconnectHandler(OnClientDisconnect od);
+void setServerPacketHandler(OnClientPacket op);
+void resetServerHandler(void);
 
 #endif

+ 2 - 2
include/core/VulkanWrapper.h

@@ -1,5 +1,5 @@
 #define GLFW_INCLUDE_VULKAN
 #include <GLFW/glfw3.h>
 
-bool coreInitVulkan(void);
-void coreDestroyVulkan(void);
+bool initVulkan(void);
+void destroyVulkan(void);

+ 52 - 99
include/core/WindowManager.h

@@ -3,108 +3,61 @@
 
 #include <core/Vector.h>
 
-typedef bool (*CoreWindowRunHandler)(void* data);
-typedef void (*CoreWindowTickHandler)(void* data);
-typedef void (*CoreWindowRenderHandler)(void* data, float lag);
+typedef bool (*WindowRunHandler)(void* data);
+typedef void (*WindowTickHandler)(void* data);
+typedef void (*WindowRenderHandler)(void* data, float lag);
 
 typedef struct {
-    CoreIntVector2 size;
+    IntVector2 size;
     bool fullscreen;
     const char* name;
-} CoreWindowOptions;
-
-bool coreOpenWindow(const CoreWindowOptions* options);
-void coreCloseWindow(void);
-void coreShowWindow(void);
-void coreTrapWindowCursor(void);
-void coreFreeWindowCursor(void);
-bool coreIsWindowCursorTrapped(void);
-const CoreIntVector2* coreGetWindowSize(void);
-bool coreHasWindowSizeChanged(void);
-bool coreShouldWindowClose(void);
-
-void coreSetWindowRunHandler(CoreWindowRunHandler wr, void* data);
-void coreSetWindowTickHandler(CoreWindowTickHandler t, void* data);
-void coreSetWindowRenderHandler(CoreWindowRenderHandler r, void* data);
-void coreSetWindowNanosPerTick(i64 nanos);
-void coreRunWindow(void);
-float coreGetWindowTicksPerSecond(void);
-float coreGetWindowFramesPerSecond(void);
-
-void coreSetInputLimit(size_t limit);
-void coreResetInput(void);
-void coreEnableInput(void);
-void coreDisableInput(void);
-bool coreIsInputEnabled(void);
-void coreFillInput(const char* s);
-size_t coreGetInputCursor(void);
-void coreSetInputCursor(size_t index);
-const char* coreGetInputString(void);
-
-typedef size_t CoreButton;
-
-CoreButton coreAddButton(const char* name);
-void coreBindKeyToButton(CoreButton b, int key);
-void coreBindGamepadToButton(CoreButton b, int gamepadButton);
-void coreBindMouseToButton(CoreButton b, int mouseButton);
-
-CoreVector2 coreGetLastMousePosition(void);
-CoreVector2 coreGetMousePosition(void);
-CoreVector2 coreGetLeftGamepadAxis(void);
-CoreVector2 coreGetRightGamepadAxis(void);
-float coreGetLeftGamepadTrigger(void);
-float coreGetRightGamepadTrigger(void);
-
-bool coreIsButtonDown(CoreButton b);
-int coreGetButtonDownTime(CoreButton b);
-bool coreWasButtonReleased(CoreButton b);
-const char* coreGetButtonName(CoreButton b);
-
-#ifdef IMPORT_CORE
-#define WindowRunHandler CoreWindowRunHandler
-#define WindowTickHandler CoreWindowTickHandler
-#define WindowRenderHandler CoreWindowRenderHandler
-#define WindowOptions CoreWindowOptions
-#define openWindow coreOpenWindow
-#define closeWindow coreCloseWindow
-#define showWindow coreShowWindow
-#define trapWindowCursor coreTrapWindowCursor
-#define freeWindowCursor coreFreeWindowCursor
-#define isWindowCursorTrapped coreIsWindowCursorTrapped
-#define getWindowSize coreGetWindowSize
-#define hasWindowSizeChanged coreHasWindowSizeChanged
-#define shouldWindowClose coreShouldWindowClose
-#define setWindowRunHandler coreSetWindowRunHandler
-#define setWindowTickHandler coreSetWindowTickHandler
-#define setWindowRenderHandler coreSetWindowRenderHandler
-#define setWindowNanosPerTick coreSetWindowNanosPerTick
-#define runWindow coreRunWindow
-#define getWindowTicksPerSecond coreGetWindowTicksPerSecond
-#define getWindowFramesPerSecond coreGetWindowFramesPerSecond
-#define setInputLimit coreSetInputLimit
-#define resetInput coreResetInput
-#define enableInput coreEnableInput
-#define disableInput coreDisableInput
-#define isInputEnabled coreIsInputEnabled
-#define fillInput coreFillInput
-#define getInputCursor coreGetInputCursor
-#define setInputCursor coreSetInputCursor
-#define getInputString coreGetInputString
-#define Button CoreButton
-#define addButton coreAddButton
-#define bindKeyToButton coreBindKeyToButton
-#define bindGamepadToButton coreBindGamepadToButton
-#define bindMouseToButton coreBindMouseToButton
-#define getLastMousePosition coreGetLastMousePosition
-#define getMousePosition coreGetMousePosition
-#define getLeftGamepadAxis coreGetLeftGamepadAxis
-#define getRightGamepadAxis coreGetRightGamepadAxis
-#define getLeftGamepadTrigger coreGetLeftGamepadTrigger
-#define getRightGamepadTrigger coreGetRightGamepadTrigger
-#define isButtonDown coreIsButtonDown
-#define getButtonDownTime coreGetButtonDownTime
-#define wasButtonReleased coreWasButtonReleased
-#define getButtonName coreGetButtonName
-#endif
+} WindowOptions;
+
+bool openWindow(const WindowOptions* options);
+void closeWindow(void);
+void showWindow(void);
+void trapWindowCursor(void);
+void freeWindowCursor(void);
+bool isWindowCursorTrapped(void);
+const IntVector2* getWindowSize(void);
+bool hasWindowSizeChanged(void);
+bool shouldWindowClose(void);
+
+void setWindowRunHandler(WindowRunHandler wr, void* data);
+void setWindowTickHandler(WindowTickHandler t, void* data);
+void setWindowRenderHandler(WindowRenderHandler r, void* data);
+void setWindowNanosPerTick(i64 nanos);
+void runWindow(void);
+float getWindowTicksPerSecond(void);
+float getWindowFramesPerSecond(void);
+
+void setInputLimit(size_t limit);
+void resetInput(void);
+void enableInput(void);
+void disableInput(void);
+bool isInputEnabled(void);
+void fillInput(const char* s);
+size_t getInputCursor(void);
+void setInputCursor(size_t index);
+const char* getInputString(void);
+
+typedef size_t Button;
+
+Button addButton(const char* name);
+void bindKeyToButton(Button b, int key);
+void bindGamepadToButton(Button b, int gamepadButton);
+void bindMouseToButton(Button b, int mouseButton);
+
+Vector2 getLastMousePosition(void);
+Vector2 getMousePosition(void);
+Vector2 getLeftGamepadAxis(void);
+Vector2 getRightGamepadAxis(void);
+float getLeftGamepadTrigger(void);
+float getRightGamepadTrigger(void);
+
+bool isButtonDown(Button b);
+int getButtonDownTime(Button b);
+bool wasButtonReleased(Button b);
+const char* getButtonName(Button b);
 
 #endif

+ 4 - 5
src/Image.c

@@ -1,13 +1,12 @@
-#define IMPORT_CORE
 #include "core/Image.h"
 
-#include <core/Utility.h>
 #define STB_IMAGE_IMPLEMENTATION
 #define STBI_ONLY_PNG
-#define STBI_MALLOC(n) cAllocate(n)
-#define STBI_REALLOC(p, n) cReallocate(p, n)
-#define STBI_FREE(p) cFree(p)
+#define STBI_MALLOC(n) coreAllocate(n)
+#define STBI_REALLOC(p, n) coreReallocate(p, n)
+#define STBI_FREE(p) coreFree(p)
 #include <core/Logger.h>
+#include <core/Utility.h>
 #include <errno.h>
 #include <stb_image.h>
 #include <string.h>

+ 21 - 16
src/Network.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/Network.h"
 
 #define ENET_IMPLEMENTATION
@@ -11,6 +10,13 @@
 
 #include "ErrorSimulator.h"
 
+// HashMap clients; // Client -> ENetPeer*
+HASHMAP(Client, ENetPeer*, Client)
+#define equalClient equalInt
+#define isInvalidKeyClient isInvalidKeyInt
+#define hashClient hashInt
+HASHMAP_SOURCE(Client, ENetPeer*, Client)
+
 void initInPacket(InPacket* in, const void* data, size_t n) {
     in->data = data;
     in->size = n;
@@ -392,7 +398,7 @@ static void voidClientInPacketDummy(Client, InPacket*) {
 
 typedef struct {
     ENetHost* server;
-    HashMap clients; // Client -> ENetPeer*
+    HashMapClient clients;
     Client idCounter;
     OnClientConnect onConnect;
     OnClientDisconnect onDisconnect;
@@ -422,21 +428,21 @@ bool startServer(Port port, size_t maxClients) {
         LOG_ERROR("Cannot create enet server host");
         return true;
     }
-    initHashMap(&server.clients, sizeof(Client), sizeof(ENetPeer*));
+    initHashMapClient(&server.clients);
     return false;
 }
 
 void stopServer(void) {
     if(server.server != nullptr) {
-        HashMapIterator i;
-        initHashMapIterator(&i, &server.clients);
-        while(hasNextHashMapNode(&i)) {
-            HashMapNode* n = nextHashMapNode(&i);
-            enet_peer_reset(*(ENetPeer**)n->value);
+        HashMapIteratorClient i;
+        initHashMapIteratorClient(&i, &server.clients);
+        while(hasNextHashMapNodeClient(&i)) {
+            HashMapNodeClient* n = nextHashMapNodeClient(&i);
+            enet_peer_reset(*n->value);
         }
         enet_host_destroy(server.server);
         server.server = nullptr;
-        destroyHashMap(&server.clients);
+        destroyHashMapClient(&server.clients);
     }
     removeENet();
 }
@@ -456,9 +462,8 @@ static Client getId(ENetPeer* peer) {
 
 static void handleConnect(ENetEvent* e) {
     Client id = server.idCounter++;
-    assert(searchTypedHashMapKey(&server.clients, Client, id, void*) ==
-           nullptr);
-    putTypedHashMapPair(&server.clients, Client, id, ENetPeer*, e->peer);
+    assert(searchHashMapKeyClient(&server.clients, id) == nullptr);
+    *putHashMapKeyClient(&server.clients, id) = e->peer;
     writeId(e->peer, id);
     server.onConnect(id);
 }
@@ -473,7 +478,7 @@ static void handlePacket(ENetEvent* e) {
 static void handleDisconnect(ENetEvent* e) {
     Client id = getId(e->peer);
     server.onDisconnect(id);
-    removeTypedHashMapKey(&server.clients, Client, id);
+    removeHashMapKeyClient(&server.clients, id);
 }
 
 void tickServer(void) {
@@ -513,7 +518,7 @@ void sendServerPacket(Client clientId, const OutPacket* p,
     if(server.server == nullptr) {
         return;
     }
-    ENetPeer** peer = searchHashMapKey(&server.clients, &clientId);
+    ENetPeer** peer = searchHashMapKeyClient(&server.clients, clientId);
     if(peer != nullptr) {
         enet_uint8 index = (enet_uint8)mode;
         enet_peer_send(*peer, index, fromBuffer(&p->data, index));
@@ -525,7 +530,7 @@ void setServerTimeout(Client clientId, u32 timeout, u32 timeoutMin,
     if(server.server == nullptr) {
         return;
     }
-    ENetPeer** peer = searchHashMapKey(&server.clients, &clientId);
+    ENetPeer** peer = searchHashMapKeyClient(&server.clients, clientId);
     if(peer != nullptr) {
         enet_peer_timeout(*peer, timeout, timeoutMin, timeoutMax);
     }
@@ -535,7 +540,7 @@ void disconnectServerClient(Client clientId) {
     if(server.server == nullptr) {
         return;
     }
-    ENetPeer** peer = searchHashMapKey(&server.clients, &clientId);
+    ENetPeer** peer = searchHashMapKeyClient(&server.clients, clientId);
     if(peer != nullptr) {
         enet_peer_disconnect(*peer, 0);
     }

+ 7 - 8
src/VulkanWrapper.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/VulkanWrapper.h"
 
 #define GLFW_INCLUDE_VULKAN
@@ -95,9 +94,9 @@ static bool initPhysicalDevice() {
         return true;
     }
     VkPhysicalDevice* devices =
-        cAllocate(sizeof(VkPhysicalDevice) * deviceCount);
+        coreAllocate(sizeof(VkPhysicalDevice) * deviceCount);
     bool r = choosePhysicalDevice(devices, deviceCount);
-    cFree(devices);
+    coreFree(devices);
     return r;
 }
 
@@ -105,16 +104,16 @@ static u32 findQueueFamilies(VkPhysicalDevice pd, VkQueueFlags flags) {
     u32 count = 0;
     vkGetPhysicalDeviceQueueFamilyProperties(pd, &count, nullptr);
     VkQueueFamilyProperties* properties =
-        cAllocate(sizeof(VkQueueFamilyProperties) * count);
+        coreAllocate(sizeof(VkQueueFamilyProperties) * count);
     vkGetPhysicalDeviceQueueFamilyProperties(pd, &count, properties);
     for(u32 i = 0; i < count; i++) {
         if(properties[i].queueCount != 0 &&
            (properties[i].queueFlags & flags) == flags) {
-            cFree(properties);
+            coreFree(properties);
             return i;
         }
     }
-    cFree(properties);
+    coreFree(properties);
     return (u32)-1;
 }
 
@@ -146,11 +145,11 @@ static bool initDevice() {
     return false;
 }
 
-bool coreInitVulkan() {
+bool initVulkan() {
     return initInstance() || initPhysicalDevice() || initDevice();
 }
 
-void coreDestroyVulkan(void) {
+void destroyVulkan(void) {
     vkDestroyDevice(vk.device, nullptr);
     vkDestroyInstance(vk.instance, nullptr);
 }

+ 4 - 5
src/WindowManager.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include "core/WindowManager.h"
 
 #include <core/Logger.h>
@@ -199,12 +198,12 @@ bool openWindow(const WindowOptions* o) {
     glfwSetFramebufferSizeCallback(window, onResize);
     glfwSetMouseButtonCallback(window, onMouse);
     glfwSetCursorPosCallback(window, onMouseMove);
-    return coreInitVulkan();
+    return initVulkan();
 }
 
 void closeWindow(void) {
     if(window != nullptr) {
-        coreDestroyVulkan();
+        destroyVulkan();
         glfwDestroyWindow(window);
         window = nullptr;
     }
@@ -357,11 +356,11 @@ void runWindow(void) {
 }
 
 float getWindowTicksPerSecond(void) {
-    return (1000000000.0f * CLOCK_SIZE) / (float)tps.sum;
+    return (1'000'000'000.0f * CLOCK_SIZE) / (float)tps.sum;
 }
 
 float getWindowFramesPerSecond(void) {
-    return (1000000000.0f * CLOCK_SIZE) / (float)fps.sum;
+    return (1'000'000'000.0f * CLOCK_SIZE) / (float)fps.sum;
 }
 
 void setInputLimit(size_t limit) {

+ 0 - 1
test/Main.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <core/Logger.h>
 #include <core/Utility.h>
 #include <locale.h>

+ 0 - 1
test/modules/ImageTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <core/Logger.h>
 #include <stdio.h>
 

+ 0 - 1
test/modules/NetworkTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <core/Logger.h>
 #include <core/Utility.h>
 #include <string.h>

+ 0 - 1
test/modules/WindowManagerTests.c

@@ -1,4 +1,3 @@
-#define IMPORT_CORE
 #include <GLFW/glfw3.h>
 #include <core/Logger.h>
 #include <stdio.h>