Porytiles
Loading...
Searching...
No Matches
tileset_artifact.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5
6namespace porytiles2 {
7
22 public:
35 enum class Type {
38 top_png,
44 tiles_png,
46 pal_n,
47 config,
49 // pal_hint_n, // TODO: pal hints could be like Porytiles1's palette primers?
50 };
51
57 explicit TilesetArtifact(const Type type) : type_{type}, name_{std::nullopt}, index_{std::nullopt} {}
58
68 explicit TilesetArtifact(const Type type, std::string name)
69 : type_{type}, name_{std::move(name)}, index_{std::nullopt}
70 {
71 }
72
82 explicit TilesetArtifact(const Type type, unsigned int index) : type_{type}, name_{std::nullopt}, index_{index} {}
83
95 explicit TilesetArtifact(const Type type, std::string name, int index)
96 : type_{type}, name_{std::move(name)}, index_{index}
97 {
98 }
99
105 [[nodiscard]] Type type() const
106 {
107 return type_;
108 }
109
115 [[nodiscard]] std::optional<std::string> name() const
116 {
117 return name_;
118 }
119
125 [[nodiscard]] std::optional<unsigned int> index() const
126 {
127 return index_;
128 }
129
130 private:
131 Type type_;
132 /*
133 * TODO: this isn't the best design, compiler can no longer catch programmer errors. If programmer forgets to
134 * provide a name/index, Porytiles has to panic which is not great. Ideally we'd like the compiler to help the
135 * programmer here.
136 */
137 std::optional<std::string> name_;
138 std::optional<unsigned int> index_;
139};
140
141} // namespace porytiles2
Represents a Pokémon Generation III decomp tileset artifact with type and optional metadata.
TilesetArtifact(const Type type, std::string name)
Constructs a tileset artifact with a type and name.
TilesetArtifact(const Type type)
Constructs a tileset artifact with only a type.
TilesetArtifact(const Type type, std::string name, int index)
Constructs a tileset artifact with a type, name, and index.
Type type() const
Gets the artifact type.
TilesetArtifact(const Type type, unsigned int index)
Constructs a tileset artifact with a type and index.
std::optional< std::string > name() const
Gets the artifact name if present.
Type
Enumeration of all supported tileset artifact types.
@ porytiles_anim_frame
Animation frame PNG for Porytiles-format animation.
@ attributes_csv
CSV file containing metatile attribute overrides.
@ middle_png
Middle layer PNG input image.
@ metatile_attributes_bin
Metatile attributes output for Porymap.
@ bottom_png
Bottom layer PNG input image.
@ top_png
Top layer PNG input image.
@ pal_n
JASC palette data file.
@ metatiles_bin
Metatile data output for Porymap.
@ pal_override_n
JASC palette override file.
@ tiles_png
Combined tile sheet PNG output for Porymap.
@ local_config
Tileset configuration YAML file.
@ porymap_anim_frame
Animation frame PNG for Porymap-format animation.
std::optional< unsigned int > index() const
Gets the artifact index if present.