RavEngine
Loading...
Searching...
No Matches
Format.hpp
1#pragma once
2#include <string_view>
3#include "Types.hpp"
4
5#if __has_include(<format>)
6#include <format>
7#define fmt_src std
8#else
9#include <fmt/format.h>
10#define fmt_src fmt
11#endif
12
13template <>
14struct fmt_src::formatter<EntityHandle> {
15
16 constexpr auto parse(fmt_src::format_parse_context& ctx) {
17 return ctx.begin();
18 }
19
20 auto format(const EntityHandle& id, fmt_src::format_context& ctx) const {
21 return fmt_src::format_to(ctx.out(), "{}", entity_id_t(id.id));
22 }
23};
24
25namespace RavEngine{
26
27template< class... Args >
28constexpr auto Format(fmt_src::format_string<Args...> formatstr, Args&& ... args){
29 return fmt_src::format(formatstr, std::forward<Args>(args)...);
30}
31
32template<typename ... T>
33auto VFormat(const std::string_view formatstr, T&& ... args){
34 return fmt_src::vformat(formatstr, fmt_src::make_format_args(args...));
35}
36
37}
Definition Animation.hpp:6
Definition Types.hpp:10