aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crepe/api/AssetManager.h4
-rw-r--r--src/crepe/api/AssetManager.hpp3
-rw-r--r--src/crepe/api/Color.h1
-rw-r--r--src/crepe/api/Config.h4
-rw-r--r--src/crepe/api/Transform.h1
-rw-r--r--src/crepe/util/color.cpp67
-rw-r--r--src/crepe/util/color.h2
-rw-r--r--src/crepe/util/log.cpp18
-rw-r--r--src/crepe/util/log.h13
-rw-r--r--src/example/log.cpp3
-rw-r--r--src/example/script.cpp2
-rw-r--r--src/makefile4
12 files changed, 84 insertions, 38 deletions
diff --git a/src/crepe/api/AssetManager.h b/src/crepe/api/AssetManager.h
index a53ace5..3e72a49 100644
--- a/src/crepe/api/AssetManager.h
+++ b/src/crepe/api/AssetManager.h
@@ -26,10 +26,10 @@ public:
public:
template <typename asset>
- std::shared_ptr<asset> cache(const std::string & file_path, bool reload = false);
+ std::shared_ptr<asset> cache(const std::string & file_path,
+ bool reload = false);
};
} // namespace crepe::api
#include "AssetManager.hpp"
-
diff --git a/src/crepe/api/AssetManager.hpp b/src/crepe/api/AssetManager.hpp
index 083fd9d..468724c 100644
--- a/src/crepe/api/AssetManager.hpp
+++ b/src/crepe/api/AssetManager.hpp
@@ -5,7 +5,8 @@
namespace crepe::api {
template <typename asset>
-std::shared_ptr<asset> AssetManager::cache(const std::string & file_path, bool reload) {
+std::shared_ptr<asset> AssetManager::cache(const std::string & file_path,
+ bool reload) {
auto it = asset_cache.find(file_path);
if (!reload && it != asset_cache.end()) {
diff --git a/src/crepe/api/Color.h b/src/crepe/api/Color.h
index 36d91ef..e818de4 100644
--- a/src/crepe/api/Color.h
+++ b/src/crepe/api/Color.h
@@ -6,6 +6,7 @@ class Color {
// FIXME: can't these colors be defined as a `static constexpr const Color`
// instead?
+
public:
Color(double red, double green, double blue, double alpha);
static const Color & get_white();
diff --git a/src/crepe/api/Config.h b/src/crepe/api/Config.h
index 24b5529..8a7f268 100644
--- a/src/crepe/api/Config.h
+++ b/src/crepe/api/Config.h
@@ -7,6 +7,7 @@ namespace crepe::api {
class Config {
private:
Config() = default;
+
public:
~Config() = default;
@@ -36,5 +37,4 @@ public:
} log;
};
-}
-
+} // namespace crepe::api
diff --git a/src/crepe/api/Transform.h b/src/crepe/api/Transform.h
index c17ae34..c69ec61 100644
--- a/src/crepe/api/Transform.h
+++ b/src/crepe/api/Transform.h
@@ -12,6 +12,7 @@ class Transform : public Component {
// FIXME: What's the difference between the `Point` and `Position`
// classes/structs? How about we replace both with a universal `Vec2` that
// works similar (or the same) as those found in GLSL?
+
public:
Transform(uint32_t id, Point &, double, double);
~Transform();
diff --git a/src/crepe/util/color.cpp b/src/crepe/util/color.cpp
index bdf5809..a7bbc81 100644
--- a/src/crepe/util/color.cpp
+++ b/src/crepe/util/color.cpp
@@ -1,8 +1,8 @@
#include <cstdarg>
+#include "../api/Config.h"
#include "color.h"
#include "fmt.h"
-#include "../api/Config.h"
using namespace crepe::util;
using namespace std;
@@ -41,20 +41,51 @@ LogColor & LogColor::reset() {
return *this;
}
-LogColor & LogColor::fg_black(bool bright) { return this->add_code(bright ? 90 : 30); }
-LogColor & LogColor::fg_red(bool bright) { return this->add_code(bright ? 91 : 31); }
-LogColor & LogColor::fg_green(bool bright) { return this->add_code(bright ? 92 : 32); }
-LogColor & LogColor::fg_yellow(bool bright) { return this->add_code(bright ? 93 : 33); }
-LogColor & LogColor::fg_blue(bool bright) { return this->add_code(bright ? 94 : 34); }
-LogColor & LogColor::fg_magenta(bool bright) { return this->add_code(bright ? 95 : 35); }
-LogColor & LogColor::fg_cyan(bool bright) { return this->add_code(bright ? 96 : 36); }
-LogColor & LogColor::fg_white(bool bright) { return this->add_code(bright ? 97 : 37); }
-LogColor & LogColor::bg_black(bool bright) { return this->add_code(bright ? 100 : 40); }
-LogColor & LogColor::bg_red(bool bright) { return this->add_code(bright ? 101 : 41); }
-LogColor & LogColor::bg_green(bool bright) { return this->add_code(bright ? 102 : 42); }
-LogColor & LogColor::bg_yellow(bool bright) { return this->add_code(bright ? 103 : 43); }
-LogColor & LogColor::bg_blue(bool bright) { return this->add_code(bright ? 104 : 44); }
-LogColor & LogColor::bg_magenta(bool bright) { return this->add_code(bright ? 105 : 45); }
-LogColor & LogColor::bg_cyan(bool bright) { return this->add_code(bright ? 106 : 46); }
-LogColor & LogColor::bg_white(bool bright) { return this->add_code(bright ? 107 : 47); }
-
+LogColor & LogColor::fg_black(bool bright) {
+ return this->add_code(bright ? 90 : 30);
+}
+LogColor & LogColor::fg_red(bool bright) {
+ return this->add_code(bright ? 91 : 31);
+}
+LogColor & LogColor::fg_green(bool bright) {
+ return this->add_code(bright ? 92 : 32);
+}
+LogColor & LogColor::fg_yellow(bool bright) {
+ return this->add_code(bright ? 93 : 33);
+}
+LogColor & LogColor::fg_blue(bool bright) {
+ return this->add_code(bright ? 94 : 34);
+}
+LogColor & LogColor::fg_magenta(bool bright) {
+ return this->add_code(bright ? 95 : 35);
+}
+LogColor & LogColor::fg_cyan(bool bright) {
+ return this->add_code(bright ? 96 : 36);
+}
+LogColor & LogColor::fg_white(bool bright) {
+ return this->add_code(bright ? 97 : 37);
+}
+LogColor & LogColor::bg_black(bool bright) {
+ return this->add_code(bright ? 100 : 40);
+}
+LogColor & LogColor::bg_red(bool bright) {
+ return this->add_code(bright ? 101 : 41);
+}
+LogColor & LogColor::bg_green(bool bright) {
+ return this->add_code(bright ? 102 : 42);
+}
+LogColor & LogColor::bg_yellow(bool bright) {
+ return this->add_code(bright ? 103 : 43);
+}
+LogColor & LogColor::bg_blue(bool bright) {
+ return this->add_code(bright ? 104 : 44);
+}
+LogColor & LogColor::bg_magenta(bool bright) {
+ return this->add_code(bright ? 105 : 45);
+}
+LogColor & LogColor::bg_cyan(bool bright) {
+ return this->add_code(bright ? 106 : 46);
+}
+LogColor & LogColor::bg_white(bool bright) {
+ return this->add_code(bright ? 107 : 47);
+}
diff --git a/src/crepe/util/color.h b/src/crepe/util/color.h
index 66f3a28..91e1abe 100644
--- a/src/crepe/util/color.h
+++ b/src/crepe/util/color.h
@@ -48,4 +48,4 @@ private:
std::string final = "";
};
-} // namespace crepe::util::color
+} // namespace crepe::util
diff --git a/src/crepe/util/log.cpp b/src/crepe/util/log.cpp
index 5ff2ad4..6bcc4ae 100644
--- a/src/crepe/util/log.cpp
+++ b/src/crepe/util/log.cpp
@@ -3,20 +3,25 @@
#include <cstdlib>
#include <string>
+#include "../api/Config.h"
#include "fmt.h"
#include "log.h"
-#include "../api/Config.h"
using namespace crepe::util;
using namespace std;
string log_prefix(LogLevel level) {
switch (level) {
- case LogLevel::TRACE: return LogColor().fg_white().str("[TRACE]") + " ";
- case LogLevel::DEBUG: return LogColor().fg_magenta().str("[DEBUG]") + " ";
- case LogLevel::INFO: return LogColor().fg_blue().str("[INFO]") + " ";
- case LogLevel::WARNING: return LogColor().fg_yellow().str("[WARN]") + " ";
- case LogLevel::ERROR: return LogColor().fg_red().str("[ERROR]") + " ";
+ case LogLevel::TRACE:
+ return LogColor().fg_white().str("[TRACE]") + " ";
+ case LogLevel::DEBUG:
+ return LogColor().fg_magenta().str("[DEBUG]") + " ";
+ case LogLevel::INFO:
+ return LogColor().fg_blue().str("[INFO]") + " ";
+ case LogLevel::WARNING:
+ return LogColor().fg_yellow().str("[WARN]") + " ";
+ case LogLevel::ERROR:
+ return LogColor().fg_red().str("[ERROR]") + " ";
}
return "";
}
@@ -46,4 +51,3 @@ void crepe::util::logf(LogLevel level, const char * fmt, ...) {
log(level, va_stringf(args, fmt));
va_end(args);
}
-
diff --git a/src/crepe/util/log.h b/src/crepe/util/log.h
index 5ee67eb..308ba96 100644
--- a/src/crepe/util/log.h
+++ b/src/crepe/util/log.h
@@ -6,12 +6,19 @@
#include "color.h"
// utility macros
-#define _crepe_logf_here(level, format, ...) crepe::util::logf(level, "%s" format, crepe::util::LogColor().fg_white(false).fmt("%s (%s:%d)", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__), __VA_ARGS__)
+#define _crepe_logf_here(level, format, ...) \
+ crepe::util::logf( \
+ level, "%s" format, \
+ crepe::util::LogColor().fg_white(false).fmt( \
+ "%s (%s:%d)", __PRETTY_FUNCTION__, __FILE_NAME__, __LINE__), \
+ __VA_ARGS__)
// very illegal global function-style macros
// NOLINTBEGIN
-#define dbg_logf(fmt, ...) _crepe_logf_here(crepe::util::LogLevel::DEBUG, ": " fmt, __VA_ARGS__)
-#define dbg_log(str) _crepe_logf_here(crepe::util::LogLevel::DEBUG, "%s: " str, "")
+#define dbg_logf(fmt, ...) \
+ _crepe_logf_here(crepe::util::LogLevel::DEBUG, ": " fmt, __VA_ARGS__)
+#define dbg_log(str) \
+ _crepe_logf_here(crepe::util::LogLevel::DEBUG, "%s: " str, "")
#define dbg_trace() _crepe_logf_here(crepe::util::LogLevel::TRACE, "%s", "")
// NOLINTEND
diff --git a/src/example/log.cpp b/src/example/log.cpp
index 86ef193..3bc6d80 100644
--- a/src/example/log.cpp
+++ b/src/example/log.cpp
@@ -3,8 +3,8 @@
* Standalone example for usage of the logging functions
*/
-#include <crepe/util/log.h>
#include <crepe/api/Config.h>
+#include <crepe/util/log.h>
using namespace crepe;
using namespace crepe::util;
@@ -22,4 +22,3 @@ int main() {
return 0;
}
-
diff --git a/src/example/script.cpp b/src/example/script.cpp
index f737a90..d0cc121 100644
--- a/src/example/script.cpp
+++ b/src/example/script.cpp
@@ -7,8 +7,8 @@
#include <crepe/ScriptSystem.h>
#include <crepe/util/log.h>
-#include <crepe/api/Config.h>
#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/Config.h>
#include <crepe/api/GameObject.h>
#include <crepe/api/Script.h>
diff --git a/src/makefile b/src/makefile
index c1ef601..3f74a2a 100644
--- a/src/makefile
+++ b/src/makefile
@@ -2,5 +2,7 @@
FMT += $(shell git ls-files '*.c' '*.cpp' '*.h' '*.hpp')
format: FORCE
- clang-tidy -p build/compile_commands.json --fix-errors $(FMT)
+ # clang-tidy -p build/compile_commands.json --fix-errors $(FMT)
+
+# TODO: re-enable linter after 2024-11-10