Skip to content

Store ObjectGroup::Objects in unordered_map and added Accessor functions#20

Open
redchillipadi wants to merge 2 commits intoedoren:masterfrom
redchillipadi:master
Open

Store ObjectGroup::Objects in unordered_map and added Accessor functions#20
redchillipadi wants to merge 2 commits intoedoren:masterfrom
redchillipadi:master

Conversation

@redchillipadi
Copy link
Copy Markdown

In my game I am storing the player's spawn location as an object within the tmx file but the current API has no functions to access an Object from the TileMap by name or determine its x and y coordinates

To aid the lookup of a particular object I have converted vectorObjectGroup::Object to unordered_map<string, ObjectGroup::Object> and added GetObject(string object_name) to return a particular Object. This also meant changing AddObject() to be passed an Object pointer and subsequent changes in the Parser.

I also added GetName(), GetX(), GetY() accessor functions to the ObjectGroup::Object. This is all I currently need but I am happy to add the others (and make bool visible private) if this is felt worthwhile.

A few small documentation corrections to Layers, TileMap and TileSet header files were also added

In my game I am storing player spawn locations as an object within the tmx file but the current API has no functions to access an Object by name or determine its x and y coordinates

To aid the lookup of a particular object I have converted vector<ObjectGroup::Object> to unordered_map<string, ObjectGroup::Object> and added GetObject(string object_name) to return a particular Object
This also meant changing AddObject() to be passed an Object pointer and subsequent changes in the Parser.

I also added GetName(), GetX(), GetY() accessor functions to the ObjectGroup::Object

A few small documentation corrections to TileMap and TileSet were also added
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant