-
Notifications
You must be signed in to change notification settings - Fork 5
/
VisualNodeCore.h
97 lines (77 loc) · 2.38 KB
/
VisualNodeCore.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#pragma once
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#elif __linux__
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#endif
#define IMGUI_DEFINE_MATH_OPERATORS
#include "imgui.h"
#include "imgui_internal.h"
#include <random>
#include <queue>
#include <chrono>
#include <fstream>
#include <functional>
#include <unordered_map>
#include "glm/vec2.hpp"
#include "glm/vec3.hpp"
#include "glm/trigonometric.hpp"
#include "glm/geometric.hpp"
#include "jsoncpp/json/json.h"
namespace VisNodeSys
{
#define SINGLETON_PUBLIC_PART(CLASS_NAME) \
static CLASS_NAME& getInstance() \
{ \
if (!Instance) \
Instance = new CLASS_NAME(); \
return *Instance; \
} \
\
~CLASS_NAME();
#define SINGLETON_PRIVATE_PART(CLASS_NAME) \
static CLASS_NAME* Instance; \
CLASS_NAME(); \
CLASS_NAME(const CLASS_NAME &); \
void operator= (const CLASS_NAME &);
#define FE_MAP_TO_STR_VECTOR(map) \
std::vector<std::string> result; \
auto iterator = map.begin(); \
while (iterator != map.end()) \
{ \
result.push_back(iterator->first); \
iterator++; \
} \
\
return result;
#define VISUAL_NODE_SYSTEM_VERSION "0.1.0"
class NodeCore
{
SINGLETON_PRIVATE_PART(NodeCore)
friend class NodeArea;
friend class NodeSystem;
bool bIsInTestMode = false;
std::string GetUniqueID();
bool bIsFontsInitialized = false;
std::vector<ImFont*> Fonts;
void InitializeFonts();
std::string Base64Characters =
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"0123456789+/";
public:
SINGLETON_PUBLIC_PART(NodeCore)
// This function can produce ID's that are "unique" with very rare collisions.
// For most purposes it can be considered unique.
// ID is a 24 long string.
std::string GetUniqueHexID();
bool SetClipboardText(std::string Text);
std::string GetClipboardText();
std::string Base64Encode(unsigned char const* BytesToEncode, unsigned int Length);
bool IsBase64(unsigned char Character);
std::string Base64Decode(std::string const& EncodedString);
};
#define NODE_CORE VisNodeSys::NodeCore::getInstance()
}