{"action":"created","issue":{"url":"https://api.github.com/repos/castle-engine/castle-engine/issues/14","labels_url":"https://api.github.com/repos/castle-engine/castle-engine/issues/14/labels{/name}","comments_url":"https://api.github.com/repos/castle-engine/castle-engine/issues/14/comments","events_url":"https://api.github.com/repos/castle-engine/castle-engine/issues/14/events","html_url":"https://github.com/castle-engine/castle-engine/pull/14","id":123187333,"number":14,"title":"Tiled maps support","user":{"login":"tsr8","id":6218555,"avatar_url":"https://avatars.githubusercontent.com/u/6218555?v=3","gravatar_id":"","url":"https://api.github.com/users/tsr8","html_url":"https://github.com/tsr8","followers_url":"https://api.github.com/users/tsr8/followers","following_url":"https://api.github.com/users/tsr8/following{/other_user}","gists_url":"https://api.github.com/users/tsr8/gists{/gist_id}","starred_url":"https://api.github.com/users/tsr8/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tsr8/subscriptions","organizations_url":"https://api.github.com/users/tsr8/orgs","repos_url":"https://api.github.com/users/tsr8/repos","events_url":"https://api.github.com/users/tsr8/events{/privacy}","received_events_url":"https://api.github.com/users/tsr8/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-20T22:42:39Z","updated_at":"2015-12-23T06:30:20Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/castle-engine/castle-engine/pulls/14","html_url":"https://github.com/castle-engine/castle-engine/pull/14","diff_url":"https://github.com/castle-engine/castle-engine/pull/14.diff","patch_url":"https://github.com/castle-engine/castle-engine/pull/14.patch"},"body":"Created this request to show my progress with implementation of TMX files support (TCastleTiledMap component). Please review and comment. Decided to write it to separate .inc (like in CastleGLImages) file because CastleControls is so big."},"comment":{"url":"https://api.github.com/repos/castle-engine/castle-engine/issues/comments/166813870","html_url":"https://github.com/castle-engine/castle-engine/pull/14#issuecomment-166813870","issue_url":"https://api.github.com/repos/castle-engine/castle-engine/issues/14","id":166813870,"user":{"login":"michaliskambi","id":1076978,"avatar_url":"https://avatars.githubusercontent.com/u/1076978?v=3","gravatar_id":"","url":"https://api.github.com/users/michaliskambi","html_url":"https://github.com/michaliskambi","followers_url":"https://api.github.com/users/michaliskambi/followers","following_url":"https://api.github.com/users/michaliskambi/following{/other_user}","gists_url":"https://api.github.com/users/michaliskambi/gists{/gist_id}","starred_url":"https://api.github.com/users/michaliskambi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/michaliskambi/subscriptions","organizations_url":"https://api.github.com/users/michaliskambi/orgs","repos_url":"https://api.github.com/users/michaliskambi/repos","events_url":"https://api.github.com/users/michaliskambi/events{/privacy}","received_events_url":"https://api.github.com/users/michaliskambi/received_events","type":"User","site_admin":false},"created_at":"2015-12-23T06:30:20Z","updated_at":"2015-12-23T06:30:20Z","body":"> What is the reason to make 3 classes like TIsometricMap, TOrthogonalMap, THexagonalMap? Map type is defined in TMX file so programmer don't have to create for instance TIsometricMap explicitly.\r\n\r\nYou're right! Since the format chooses the rendering mode (and also, maybe it can change at runtime --- at least in Tiled, I see that you can change map \"orientation\" at any point), it would be uncomfortable to split it into 3 separate classes.\r\n\r\n> I think that one class like TTiledMap based on TUIControl will do rendering depends of TMX content. Eventually make another class to load a TMX file. It's not so hard for me to change it with your suggestions but it must be think over :)\r\n\r\nI think that splitting into one rendering/UI class like TCastleTiledMapControl (descends from TUIControl) and one class that holds the information like TCastleTiledMap (descends from TComponent) may still be nice. \r\n\r\n- Consider the example with \"Orcs and Volcanoes\" http://castle-engine.sourceforge.net/news.php?id=2013-09-15 where I could happily use the information contained in TCastleTiledMap, but I don't want it's 2D rendering, I want specialized 3D rendering.\r\n\r\n- Also, I imagine that TCastleTiledMap can eventually grow with some useful methods for processing maps. Like in https://github.com/castle-engine/hydra-battles/blob/master/code/gameabstractmap.pas I implemented utilities like Neighbors , HandleNeighbors, PositionToTile... All these could be implemented in a generic way (handling all 3 map orientations) in TTiledMap. So it will be beneficial to separate the \"information processing\" class TCastleTiledMap from \"display/input\" class TCastleTiledMapControl.\r\n\r\nAnyway, treat it only as a guideline (\"how I would do it\") at this point. The decision whether to do the split may be more obvious later in the implementation process:)\r\n\r\n> Pointers are necessary to make specialized lists (can't use records directly - compiler errors).\r\n\r\nIf you want to have a list of records, use our own TGenericStructList. It can be used quite like TFPGList (in fact, it was based on FGL sources), but it handles records without any problems:) This also gives you performance --- all the consecutive records will be in one memory stream.\r\n"}}