From bee1428a3521af5870d098b3da5275bd495682f7 Mon Sep 17 00:00:00 2001 From: That_One_Nerd Date: Mon, 29 Apr 2024 17:36:04 -0400 Subject: [PATCH] Starting off. --- include/sharpsoft/all.hpp | 1 + include/sharpsoft/global_misc.hpp | 17 +++++++++ include/sharpsoft/src/global_manager.cpp | 48 ++++++++++++++++++++++++ src/main.cpp | 7 +++- 4 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 include/sharpsoft/all.hpp create mode 100644 include/sharpsoft/global_misc.hpp create mode 100644 include/sharpsoft/src/global_manager.cpp diff --git a/include/sharpsoft/all.hpp b/include/sharpsoft/all.hpp new file mode 100644 index 0000000..290f937 --- /dev/null +++ b/include/sharpsoft/all.hpp @@ -0,0 +1 @@ +#include "global_misc.hpp" diff --git a/include/sharpsoft/global_misc.hpp b/include/sharpsoft/global_misc.hpp new file mode 100644 index 0000000..4b5b969 --- /dev/null +++ b/include/sharpsoft/global_misc.hpp @@ -0,0 +1,17 @@ +#pragma once + +namespace sharp +{ + struct global_properties + { + static const global_properties defaults; + }; + + void initialize(); + void initialize(const global_properties& flags); + void uninitialize(); + void re_initialize(); + void re_initialize(const global_properties& flags); + + bool is_initialized(); +} diff --git a/include/sharpsoft/src/global_manager.cpp b/include/sharpsoft/src/global_manager.cpp new file mode 100644 index 0000000..8960e8a --- /dev/null +++ b/include/sharpsoft/src/global_manager.cpp @@ -0,0 +1,48 @@ +#include "sharpsoft/global_misc.hpp" + +using namespace sharp; + +const global_properties global_properties::defaults = { }; // TODO + +bool initialized = false; + +void sharp::initialize() +{ + if (initialized) return; + initialize(global_properties::defaults); +} +void sharp::initialize(const global_properties& flags) +{ + if (initialized) return; + + // TODO + + initialized = true; +} + +void sharp::uninitialize() +{ + if (!initialized) return; + + // TODO + + initialized = false; +} + +void sharp::re_initialize() +{ + if (!initialized) return; + uninitialize(); + initialize(); +} +void sharp::re_initialize(const global_properties& flags) +{ + if (!initialized) return; + uninitialize(); + initialize(); +} + +bool sharp::is_initialized() +{ + return initialized; +} diff --git a/src/main.cpp b/src/main.cpp index b332322..3feaeaa 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,8 +1,13 @@ #include "main.h" +#include "sharpsoft/all.hpp" + +// This library is intended to be referenced by the prefix `sharp::` +// Including `using namespace sharp;` is not recommended. void initialize() { - + // Initialize Sharpsoft. + sharp::initialize(); } void disabled() { }