|
10 | 10 | #include "Log.h" |
11 | 11 | #include "Utils.h" |
12 | 12 |
|
| 13 | +namespace |
| 14 | +{ |
| 15 | + constexpr static struct |
| 16 | + { |
| 17 | + const char* id; |
| 18 | + const char* name; |
| 19 | + sConfig::Algorithm algorithm; |
| 20 | + } Algos[] = { |
| 21 | + { "kdtree", "KD-Tree", sConfig::Algorithm::KDTree }, |
| 22 | + { "classic", "Classic", sConfig::Algorithm::Classic }, |
| 23 | + }; |
| 24 | + |
| 25 | +} // namespace |
| 26 | + |
13 | 27 | void sConfig::dump() const |
14 | 28 | { |
15 | 29 | // General |
16 | | - cLog::Info("Method: {}", slowMethod ? "Classic" : "KD-Tree"); |
| 30 | + cLog::Info("Algorithm: {}", ToName(algorithm)); |
17 | 31 | cLog::Info("Border: {} px", border); |
18 | 32 | cLog::Info("Padding: {} px", padding); |
19 | | - cLog::Info("Max atlas size: {} px", maxTextureSize); |
| 33 | + cLog::Info("Max atlas size: {} px", maxAtlasSize); |
20 | 34 |
|
21 | 35 | // Features |
22 | | - cLog::Info("Keep hotspot float: {}", isEnabled(keepFloat) ? "Enabled" : "Disabled"); |
23 | | - cLog::Info("Power of Two: {}", isEnabled(pot) ? "Enabled" : "Disabled"); |
24 | | - // cLog::Info("Multi-atlas: {}", isEnabled(multi) ? "Enabled" : "Disabled"); |
25 | | - cLog::Info("Trim sprites: {}", isEnabled(trim) ? "Enabled" : "Disabled"); |
26 | | - cLog::Info("Drop extension: {}", isEnabled(dropExt) ? "Enabled" : "Disabled"); |
27 | | - cLog::Info("Allow duplicates: {}", isEnabled(alowDupes) ? "Enabled" : "Disabled"); |
28 | | - cLog::Info("Overlay: {}", isEnabled(overlay) ? "Enabled" : "Disabled"); |
| 36 | + cLog::Info("Keep hotspot float: {}", toString(keepFloat)); |
| 37 | + cLog::Info("Power of Two: {}", toString(pot)); |
| 38 | + // cLog::Info("Multi-atlas: {}", toString(multi)); |
| 39 | + cLog::Info("Trim sprites: {}", toString(trimSprite)); |
| 40 | + cLog::Info("Drop extension: {}", toString(dropExt)); |
| 41 | + cLog::Info("Allow duplicates: {}", toString(alowDupes)); |
| 42 | + cLog::Info("Overlay: {}", toString(overlay)); |
| 43 | +} |
| 44 | + |
| 45 | +sConfig::Algorithm sConfig::ToAlgorithm(const char* str) |
| 46 | +{ |
| 47 | + for (const auto& m : Algos) |
| 48 | + { |
| 49 | + if (::strcmp(str, m.id) == 0) |
| 50 | + { |
| 51 | + return m.algorithm; |
| 52 | + } |
| 53 | + } |
| 54 | + return sConfig::Algorithm::KDTree; |
| 55 | +} |
| 56 | + |
| 57 | +const char* sConfig::ToName(Algorithm algo) |
| 58 | +{ |
| 59 | + for (const auto& m : Algos) |
| 60 | + { |
| 61 | + if (m.algorithm == algo) |
| 62 | + { |
| 63 | + return m.name; |
| 64 | + } |
| 65 | + } |
| 66 | + return "Unknown"; |
29 | 67 | } |
0 commit comments