Skip to content

Commit de573bd

Browse files
authored
Merge pull request #91 from NOOBDY/glm-logging
added string cast
2 parents cd17945 + 87fb8f4 commit de573bd

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

include/Util/Logger.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#include <spdlog/spdlog.h>
77

8+
#include "Util/Transform.hpp"
9+
810
namespace Util::Logger {
911
enum class Level {
1012
TRACE,
@@ -28,4 +30,14 @@ Level GetLevel();
2830
#define LOG_CRITICAL(...) spdlog::critical(__VA_ARGS__)
2931
} // namespace Util::Logger
3032

33+
template <>
34+
struct fmt::formatter<Util::Transform> : fmt::formatter<std::string> {
35+
auto format(Util::Transform t, format_context &ctx) const
36+
-> decltype(ctx.out()) {
37+
return format_to(ctx.out(), "T: {} R: {} rad S: {}",
38+
glm::to_string(t.translation), t.rotation,
39+
glm::to_string(t.scale));
40+
}
41+
};
42+
3143
#endif

include/pch.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
#ifndef PCH_HPP
22
#define PCH_HPP
33

4+
#include <array>
45
#include <memory>
6+
#include <set>
57
#include <string>
68
#include <vector>
7-
#include <array>
8-
#include <set>
99

1010
#include <SDL.h>
1111
#include <SDL_events.h>
1212
#include <SDL_image.h>
13-
#include <SDL_ttf.h>
1413
#include <SDL_mixer.h>
14+
#include <SDL_ttf.h>
1515

1616
#include <GL/glew.h>
1717

1818
#include <glm/glm.hpp>
1919
#include <glm/gtx/matrix_transform_2d.hpp>
20+
#include <glm/gtx/string_cast.hpp>
2021

2122
#endif

0 commit comments

Comments
 (0)