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#20redchillipadi wants to merge 2 commits intoedoren:masterfrom redchillipadi:master
redchillipadi wants to merge 2 commits intoedoren:masterfrom
redchillipadi:master
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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