{"action":"created","comment":{"url":"https://api.github.com/repos/jean553/Memoris/pulls/comments/71601259","id":71601259,"diff_hunk":"@@ -0,0 +1,118 @@\n+/*\n+ * Memoris\n+ * Copyright (C) 2015  Jean LELIEVRE\n+ *\n+ * This program is free software: you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License as published by\n+ * the Free Software Foundation, either version 3 of the License, or\n+ * (at your option) any later version.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.\n+*/\n+\n+/**\n+ * @file Level.cpp\n+ * @brief level entity\n+ * @package entities\n+ * @author Jean LELIEVRE <Jean.LELIEVRE@supinfo.com>\n+ */\n+\n+#include \"Level.hpp\"\n+\n+#include \"Context.hpp\"\n+#include \"cells.hpp\"\n+\n+namespace memoris\n+{\n+namespace entities\n+{\n+\n+/**\n+ *\n+ */\n+Level::Level()\n+{\n+    /* call the separated method that initializes all the cells with empty\n+       cells */\n+    initializeCells();\n+}\n+\n+/**\n+ *\n+ */\n+void Level::display(const unsigned short& floor) const\n+{\n+    /* calculate the index of the first cell of the given floor */\n+    const unsigned short firstCellIndex = floor * 320;\n+\n+    /* calculate the index of the last cell of the given floor */\n+    const unsigned short lastCellIndex = floor * 320 + 320;\n+\n+    /* only display the cells of the given floor; all the other cells of the\n+       level are ignored */\n+    for(\n+        unsigned short index = firstCellIndex;\n+        index < lastCellIndex;\n+        index++\n+    )\n+    {\n+        /* get an unique pointer, get the cell object from this pointer */\n+        (*cells[index]).display();\n+    }\n+}\n+\n+/**\n+ *\n+ */\n+void Level::initializeCells()\n+{\n+    /* positions cursor used to keep trace of the initialized cell position\n+       when initializing every cell one by one */\n+    unsigned short horizontalPositionCursor {0}, verticalPositionCursor {0};\n+\n+    /* there are 3200 cells per level, 320 per floor, there are 10 floors */\n+    for(unsigned short index {0}; index < 3200; index++)\n+    {\n+        /* create an unique pointer to a cell object; the horizontal position\n+           of a cell is equal to 300 (horizontal position of the grid) + 50\n+           (cell width including separator) * the horizontal position cursor;\n+           the vertical position of a cell is equal to 98 (vertical position of\n+           the grid) + 50 (cell height including separator) * the vertical\n+           position cursor; the data type expected by the Cell constructor for\n+           the position is a float; this is faster to calculate positions with\n+           unsigned shorts, and cast them to float at the end when setting\n+           the data */\n+        std::unique_ptr<Cell> cell(\n+            new Cell(\n+                300.f + 50.f * static_cast<float>(horizontalPositionCursor),\n+                98.f + 50.f * static_cast<float>(verticalPositionCursor),\n+                cells::EMPTY_CELL\n+            )\n+        );\n+\n+        /* increment the horizontal position cursor */\n+        horizontalPositionCursor++;\n+\n+        /* */","path":"src/Level.cpp","position":102,"original_position":102,"commit_id":"14f6f5b789a16464d1453409a0cd777643803d2b","original_commit_id":"14f6f5b789a16464d1453409a0cd777643803d2b","user":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"body":"comment","created_at":"2016-07-20T20:33:59Z","updated_at":"2016-07-20T20:33:59Z","html_url":"https://github.com/jean553/Memoris/pull/545#discussion_r71601259","pull_request_url":"https://api.github.com/repos/jean553/Memoris/pulls/545","_links":{"self":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/comments/71601259"},"html":{"href":"https://github.com/jean553/Memoris/pull/545#discussion_r71601259"},"pull_request":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/545"}}},"pull_request":{"url":"https://api.github.com/repos/jean553/Memoris/pulls/545","id":78213859,"html_url":"https://github.com/jean553/Memoris/pull/545","diff_url":"https://github.com/jean553/Memoris/pull/545.diff","patch_url":"https://github.com/jean553/Memoris/pull/545.patch","issue_url":"https://api.github.com/repos/jean553/Memoris/issues/545","number":545,"state":"open","locked":false,"title":"Create level entity and displays it inside the game controller","user":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-20T20:30:08Z","updated_at":"2016-07-20T20:33:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2b8374046afc4c5c7bd45503e97f898a14d5d35a","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/jean553/Memoris/pulls/545/commits","review_comments_url":"https://api.github.com/repos/jean553/Memoris/pulls/545/comments","review_comment_url":"https://api.github.com/repos/jean553/Memoris/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jean553/Memoris/issues/545/comments","statuses_url":"https://api.github.com/repos/jean553/Memoris/statuses/14f6f5b789a16464d1453409a0cd777643803d2b","head":{"label":"jean553:create_level_entity","ref":"create_level_entity","sha":"14f6f5b789a16464d1453409a0cd777643803d2b","user":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"repo":{"id":33491186,"name":"Memoris","full_name":"jean553/Memoris","owner":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jean553/Memoris","description":"Memoris is a 2D graphical video game developped in C++ using the SFML media library.","fork":false,"url":"https://api.github.com/repos/jean553/Memoris","forks_url":"https://api.github.com/repos/jean553/Memoris/forks","keys_url":"https://api.github.com/repos/jean553/Memoris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jean553/Memoris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jean553/Memoris/teams","hooks_url":"https://api.github.com/repos/jean553/Memoris/hooks","issue_events_url":"https://api.github.com/repos/jean553/Memoris/issues/events{/number}","events_url":"https://api.github.com/repos/jean553/Memoris/events","assignees_url":"https://api.github.com/repos/jean553/Memoris/assignees{/user}","branches_url":"https://api.github.com/repos/jean553/Memoris/branches{/branch}","tags_url":"https://api.github.com/repos/jean553/Memoris/tags","blobs_url":"https://api.github.com/repos/jean553/Memoris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jean553/Memoris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jean553/Memoris/git/refs{/sha}","trees_url":"https://api.github.com/repos/jean553/Memoris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jean553/Memoris/statuses/{sha}","languages_url":"https://api.github.com/repos/jean553/Memoris/languages","stargazers_url":"https://api.github.com/repos/jean553/Memoris/stargazers","contributors_url":"https://api.github.com/repos/jean553/Memoris/contributors","subscribers_url":"https://api.github.com/repos/jean553/Memoris/subscribers","subscription_url":"https://api.github.com/repos/jean553/Memoris/subscription","commits_url":"https://api.github.com/repos/jean553/Memoris/commits{/sha}","git_commits_url":"https://api.github.com/repos/jean553/Memoris/git/commits{/sha}","comments_url":"https://api.github.com/repos/jean553/Memoris/comments{/number}","issue_comment_url":"https://api.github.com/repos/jean553/Memoris/issues/comments{/number}","contents_url":"https://api.github.com/repos/jean553/Memoris/contents/{+path}","compare_url":"https://api.github.com/repos/jean553/Memoris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jean553/Memoris/merges","archive_url":"https://api.github.com/repos/jean553/Memoris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jean553/Memoris/downloads","issues_url":"https://api.github.com/repos/jean553/Memoris/issues{/number}","pulls_url":"https://api.github.com/repos/jean553/Memoris/pulls{/number}","milestones_url":"https://api.github.com/repos/jean553/Memoris/milestones{/number}","notifications_url":"https://api.github.com/repos/jean553/Memoris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jean553/Memoris/labels{/name}","releases_url":"https://api.github.com/repos/jean553/Memoris/releases{/id}","deployments_url":"https://api.github.com/repos/jean553/Memoris/deployments","created_at":"2015-04-06T16:07:52Z","updated_at":"2016-06-03T16:25:38Z","pushed_at":"2016-07-20T20:30:08Z","git_url":"git://github.com/jean553/Memoris.git","ssh_url":"git@github.com:jean553/Memoris.git","clone_url":"https://github.com/jean553/Memoris.git","svn_url":"https://github.com/jean553/Memoris","homepage":"","size":29511,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"base":{"label":"jean553:master","ref":"master","sha":"5c570c01acb7a630cf656dd81f38b71f98a98d39","user":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"repo":{"id":33491186,"name":"Memoris","full_name":"jean553/Memoris","owner":{"login":"jean553","id":8011398,"avatar_url":"https://avatars.githubusercontent.com/u/8011398?v=3","gravatar_id":"","url":"https://api.github.com/users/jean553","html_url":"https://github.com/jean553","followers_url":"https://api.github.com/users/jean553/followers","following_url":"https://api.github.com/users/jean553/following{/other_user}","gists_url":"https://api.github.com/users/jean553/gists{/gist_id}","starred_url":"https://api.github.com/users/jean553/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jean553/subscriptions","organizations_url":"https://api.github.com/users/jean553/orgs","repos_url":"https://api.github.com/users/jean553/repos","events_url":"https://api.github.com/users/jean553/events{/privacy}","received_events_url":"https://api.github.com/users/jean553/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jean553/Memoris","description":"Memoris is a 2D graphical video game developped in C++ using the SFML media library.","fork":false,"url":"https://api.github.com/repos/jean553/Memoris","forks_url":"https://api.github.com/repos/jean553/Memoris/forks","keys_url":"https://api.github.com/repos/jean553/Memoris/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jean553/Memoris/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jean553/Memoris/teams","hooks_url":"https://api.github.com/repos/jean553/Memoris/hooks","issue_events_url":"https://api.github.com/repos/jean553/Memoris/issues/events{/number}","events_url":"https://api.github.com/repos/jean553/Memoris/events","assignees_url":"https://api.github.com/repos/jean553/Memoris/assignees{/user}","branches_url":"https://api.github.com/repos/jean553/Memoris/branches{/branch}","tags_url":"https://api.github.com/repos/jean553/Memoris/tags","blobs_url":"https://api.github.com/repos/jean553/Memoris/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jean553/Memoris/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jean553/Memoris/git/refs{/sha}","trees_url":"https://api.github.com/repos/jean553/Memoris/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jean553/Memoris/statuses/{sha}","languages_url":"https://api.github.com/repos/jean553/Memoris/languages","stargazers_url":"https://api.github.com/repos/jean553/Memoris/stargazers","contributors_url":"https://api.github.com/repos/jean553/Memoris/contributors","subscribers_url":"https://api.github.com/repos/jean553/Memoris/subscribers","subscription_url":"https://api.github.com/repos/jean553/Memoris/subscription","commits_url":"https://api.github.com/repos/jean553/Memoris/commits{/sha}","git_commits_url":"https://api.github.com/repos/jean553/Memoris/git/commits{/sha}","comments_url":"https://api.github.com/repos/jean553/Memoris/comments{/number}","issue_comment_url":"https://api.github.com/repos/jean553/Memoris/issues/comments{/number}","contents_url":"https://api.github.com/repos/jean553/Memoris/contents/{+path}","compare_url":"https://api.github.com/repos/jean553/Memoris/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jean553/Memoris/merges","archive_url":"https://api.github.com/repos/jean553/Memoris/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jean553/Memoris/downloads","issues_url":"https://api.github.com/repos/jean553/Memoris/issues{/number}","pulls_url":"https://api.github.com/repos/jean553/Memoris/pulls{/number}","milestones_url":"https://api.github.com/repos/jean553/Memoris/milestones{/number}","notifications_url":"https://api.github.com/repos/jean553/Memoris/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jean553/Memoris/labels{/name}","releases_url":"https://api.github.com/repos/jean553/Memoris/releases{/id}","deployments_url":"https://api.github.com/repos/jean553/Memoris/deployments","created_at":"2015-04-06T16:07:52Z","updated_at":"2016-06-03T16:25:38Z","pushed_at":"2016-07-20T20:30:08Z","git_url":"git://github.com/jean553/Memoris.git","ssh_url":"git@github.com:jean553/Memoris.git","clone_url":"https://github.com/jean553/Memoris.git","svn_url":"https://github.com/jean553/Memoris","homepage":"","size":29511,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":22,"forks":0,"open_issues":22,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/545"},"html":{"href":"https://github.com/jean553/Memoris/pull/545"},"issue":{"href":"https://api.github.com/repos/jean553/Memoris/issues/545"},"comments":{"href":"https://api.github.com/repos/jean553/Memoris/issues/545/comments"},"review_comments":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/545/comments"},"review_comment":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jean553/Memoris/pulls/545/commits"},"statuses":{"href":"https://api.github.com/repos/jean553/Memoris/statuses/14f6f5b789a16464d1453409a0cd777643803d2b"}}}}
{"actor":{"display_login":"jean553"}}