Porytiles
Loading...
Searching...
No Matches
tiles_pal_mode.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5
7
8namespace porytiles2 {
9
11
12[[nodiscard]] inline std::optional<TilesPalMode> tiles_pal_mode_from_str(const std::string &str)
13{
14 if (str == "true-color") {
15 return std::optional{TilesPalMode::true_color};
16 }
17 if (str == "greyscale") {
18 return std::optional{TilesPalMode::greyscale};
19 }
20 return std::nullopt;
21}
22
23[[nodiscard]] inline std::string to_string(const TilesPalMode m)
24{
25 switch (m) {
27 return "true-color";
29 return "greyscale";
30 }
31 panic("unhandled TilesPalMode value");
32}
33
34inline std::ostream &operator<<(std::ostream &os, const TilesPalMode m)
35{
36 return os << to_string(m);
37}
38
39} // namespace porytiles2
void panic(const StringViewSourceLoc &s)
Unconditionally terminates the program with a panic message.
Definition panic.hpp:53
std::optional< TilesPalMode > tiles_pal_mode_from_str(const std::string &str)
std::ostream & operator<<(std::ostream &os, const Rgba32 &rgba)
Stream insertion operator for Rgba32.
Definition rgba32.hpp:92
std::string to_string(const IncrementalBuildMode &value)