Cogs.Core
BridgeApi.h
1// Common definitions for Cogs Bridge Functions.
2#pragma once
3
4#include <stdint.h>
5#include <stddef.h>
6
7#if defined( __cplusplus )
8 #define COGSCORE_EXTERN_C extern "C"
9#else
10 #define COGSCORE_EXTERN_C
11#endif
12
13#if defined( _WIN32 )
14 #if defined( COGSCORE_BUILD )
15 #if defined( COGSCORE_DLL )
16 #define COGSCORE_BRIDGE COGSCORE_EXTERN_C __declspec(dllexport)
17 #endif
18 #else
19 #if defined( COGSCORE_DLL )
20 #define COGSCORE_BRIDGE COGSCORE_EXTERN_C __declspec(dllimport)
21 #endif
22 #endif
23#elif defined( EMSCRIPTEN )
24 #include <emscripten/emscripten.h>
25 #define COGSCORE_BRIDGE COGSCORE_EXTERN_C EMSCRIPTEN_KEEPALIVE
26#endif
27#if !defined( COGSCORE_BRIDGE )
28 #define COGSCORE_BRIDGE COGSCORE_EXTERN_C
29#endif
30
31#ifdef EMSCRIPTEN
32 typedef int EntityId;
33 typedef int ComponentId;
34 typedef int ResourceId;
35#else
36 typedef size_t EntityId;
37 typedef uint16_t ComponentId;
38 typedef int ResourceId;
39#endif
40
41#if defined( __cplusplus )
42
43 namespace Cogs::Core
44 {
45 constexpr EntityId NoEntity = static_cast<EntityId>(-1);
46 constexpr ComponentId NoComponentId = static_cast<ComponentId>(-1);
47 constexpr ResourceId NoResourceId = static_cast<ResourceId>(-1);
48 }
49#else
50 #define NoEntity (-1)
51 #define NoComponentId (-1)
52 #define NoResourceId (-1)
53#endif
54
57typedef void BridgeContext;
58
61typedef void BridgeView;
62
64typedef uint16_t FieldId;
65
67typedef size_t PointerId;
68
70typedef int CogsBool;
71
72typedef const char* (*GetClipboardTextFn)(void*);
73typedef void (*SetClipboardTextFn)(void*, const char*);
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....