yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
object_templates.h
Go to the documentation of this file.
1#ifndef YAZE_APP_ZELDA3_DUNGEON_OBJECT_TEMPLATES_H
2#define YAZE_APP_ZELDA3_DUNGEON_OBJECT_TEMPLATES_H
3
4#include <string>
5#include <vector>
6
7#include "absl/status/status.h"
8#include "absl/status/statusor.h"
10
11namespace yaze {
12namespace zelda3 {
13
14// Represents an object within a template, relative to the template's origin
16 int id;
17 int rel_x; // Relative X offset
18 int rel_y; // Relative Y offset
19 int size;
20 int layer;
21};
22
23// Represents a reusable group of objects
25 std::string name;
26 std::string description;
27 std::string category;
28 std::vector<TemplateObject> objects;
29};
30
32 public:
35
36 // Load templates from the assets directory
37 absl::Status LoadTemplates(const std::string& directory_path);
38
39 // Save a new template
40 absl::Status SaveTemplate(const ObjectTemplate& tmpl,
41 const std::string& directory_path);
42
43 // Get all loaded templates
44 const std::vector<ObjectTemplate>& GetTemplates() const { return templates_; }
45
46 // Create a template from a selection of room objects
47 // origin_x/y are usually the top-left most object's coordinates or a specific
48 // anchor
50 const std::string& name, const std::string& description,
51 const std::vector<RoomObject>& objects, int origin_x, int origin_y);
52
53 // Instantiate a template at a specific position
54 std::vector<RoomObject> InstantiateTemplate(const ObjectTemplate& tmpl,
55 int x, int y, Rom* rom);
56
57 private:
58 std::vector<ObjectTemplate> templates_;
59};
60
61} // namespace zelda3
62} // namespace yaze
63
64#endif // YAZE_APP_ZELDA3_DUNGEON_OBJECT_TEMPLATES_H
The Rom class is used to load, save, and modify Rom data. This is a generic SNES ROM container and do...
Definition rom.h:24
static ObjectTemplate CreateFromObjects(const std::string &name, const std::string &description, const std::vector< RoomObject > &objects, int origin_x, int origin_y)
std::vector< ObjectTemplate > templates_
const std::vector< ObjectTemplate > & GetTemplates() const
std::vector< RoomObject > InstantiateTemplate(const ObjectTemplate &tmpl, int x, int y, Rom *rom)
absl::Status LoadTemplates(const std::string &directory_path)
absl::Status SaveTemplate(const ObjectTemplate &tmpl, const std::string &directory_path)
std::vector< TemplateObject > objects