{"action":"created","comment":{"url":"https://api.github.com/repos/mosra/magnum/pulls/comments/59543699","id":59543699,"diff_hunk":"@@ -0,0 +1,652 @@\n+#ifndef Magnum_Platform_GlfwApplication_h\n+#define Magnum_Platform_GlfwApplication_h\n+/*\n+    This file is part of Magnum.\n+\n+    Copyright © 2010, 2011, 2012, 2013, 2014, 2015, 2016\n+              Vladimír Vondruš <mosra@centrum.cz>\n+\n+    Permission is hereby granted, free of charge, to any person obtaining a\n+    copy of this software and associated documentation files (the \"Software\"),\n+    to deal in the Software without restriction, including without limitation\n+    the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+    and/or sell copies of the Software, and to permit persons to whom the\n+    Software is furnished to do so, subject to the following conditions:\n+\n+    The above copyright notice and this permission notice shall be included\n+    in all copies or substantial portions of the Software.\n+\n+    THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n+    THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+    FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+    DEALINGS IN THE SOFTWARE.\n+*/\n+\n+/** @file\n+ * @brief Class @ref Magnum::Platform::GlfwApplication, macro @ref MAGNUM_GLFWAPPLICATION_MAIN()\n+ */\n+\n+#include <memory>\n+#include <string>\n+\n+#include \"Magnum/Magnum.h\"\n+#include \"Magnum/Math/Vector2.h\"\n+#include \"Magnum/Platform/Platform.h\"\n+\n+/* We must include our own GL headers first to avoid conflicts */\n+#include \"Magnum/OpenGL.h\"\n+\n+#include <glfw3.h>\n+\n+namespace Magnum { namespace Platform {\n+\n+/** @nosubgrouping\n+@brief GLFW application\n+\n+Application using GLFW toolkit. Supports keyboard and mouse handling with\n+support for changing cursor and mouse tracking and warping.\n+\n+This application library is available only on desktop OpenGL (Linux, Windows,\n+OS X). It depends on **GLFW** library and is built if `WITH_GLFWAPPLICATION` is\n+enabled in CMake.\n+\n+## Bootstrap application\n+\n+Fully contained base application using @ref GlfwApplication along with\n+CMake setup is available in `base-glut` branch of\n+[Magnum Bootstrap](https://github.com/mosra/magnum-bootstrap) repository,\n+download it as [tar.gz](https://github.com/mosra/magnum-bootstrap/archive/base-glut.tar.gz)\n+or [zip](https://github.com/mosra/magnum-bootstrap/archive/base-glut.zip) file.\n+After extracting the downloaded archive you can build and run the application\n+with these four commands:\n+\n+    mkdir build && cd build\n+    cmake ..\n+    cmake --build .\n+    ./src/MyApplication # or ./src/Debug/MyApplication\n+\n+See @ref cmake for more information.\n+\n+## General usage\n+\n+In CMake you need to request `GlfwApplication` component of `Magnum` package\n+and link to `Magnum::GlfwApplication` target. If no other application is\n+requested, you can also use generic `Magnum::Application` alias to simplify\n+porting. Again, see @ref building and @ref cmake for more information.\n+\n+In C++ code you need to implement at least @ref drawEvent() to be able to draw\n+on the screen. The subclass can be then used directly in `main()` -- see\n+convenience macro @ref MAGNUM_GLFWAPPLICATION_MAIN(). See @ref platform for\n+more information.\n+@code\n+class MyApplication: public Platform::GlfwApplication {\n+    // implement required methods...\n+};\n+MAGNUM_GLFWAPPLICATION_MAIN(MyApplication)\n+@endcode\n+\n+If no other application header is included, this class is also aliased to\n+`Platform::Application` and the macro is aliased to `MAGNUM_APPLICATION_MAIN()`\n+to simplify porting.\n+*/\n+class GlfwApplication {\n+    public:\n+        /** @brief Application arguments */\n+        struct Arguments {\n+            /** @brief Constructor */\n+            /*implicit*/ constexpr Arguments(int& argc, char** argv) noexcept: argc{argc}, argv{argv} {}\n+\n+            int& argc;      /**< @brief Argument count */\n+            char** argv;    /**< @brief Argument values */\n+        };\n+\n+        class Configuration;\n+        class InputEvent;\n+        class KeyEvent;\n+        class MouseEvent;\n+        class MouseMoveEvent;\n+\n+        /** @copydoc Sdl2Application::Sdl2Application(const Arguments&, const Configuration&) */\n+        #ifdef DOXYGEN_GENERATING_OUTPUT\n+        explicit GlfwApplication(const Arguments& arguments, const Configuration& configuration = Configuration());\n+        #else\n+        /* To avoid \"invalid use of incomplete type\" */\n+        explicit GlfwApplication(const Arguments& arguments, const Configuration& configuration);\n+        explicit GlfwApplication(const Arguments& arguments);\n+        #endif\n+\n+        /** @copydoc Sdl2Application::Sdl2Application(const Arguments&, std::nullptr_t) */\n+        explicit GlfwApplication(const Arguments& arguments, std::nullptr_t);\n+\n+        /** @brief Copying is not allowed */\n+        GlfwApplication(const GlfwApplication&) = delete;\n+\n+        /** @brief Moving is not allowed */\n+        GlfwApplication(GlfwApplication&&) = delete;\n+\n+        /** @brief Copying is not allowed */\n+        GlfwApplication& operator=(const GlfwApplication&) = delete;\n+\n+        /** @brief Moving is not allowed */\n+        GlfwApplication& operator=(GlfwApplication&&) = delete;\n+\n+        /**\n+         * @brief Execute main loop\n+         * @return Value for returning from `main()`\n+         *\n+         * See @ref MAGNUM_GLFWAPPLICATION_MAIN() for usage information.\n+         */\n+        int exec() {\n+            while(!glfwWindowShouldClose(_window)) {\n+                if(_needsRedraw) {\n+                    drawEvent();\n+                }\n+                glfwPollEvents();\n+            }\n+            return 0;\n+        }","path":"src/Magnum/Platform/GlfwApplication.h","position":150,"original_position":150,"commit_id":"54201781440f4b306ff442631038c75d7e5c9863","original_commit_id":"54201781440f4b306ff442631038c75d7e5c9863","user":{"login":"mosra","id":344828,"avatar_url":"https://avatars.githubusercontent.com/u/344828?v=3","gravatar_id":"","url":"https://api.github.com/users/mosra","html_url":"https://github.com/mosra","followers_url":"https://api.github.com/users/mosra/followers","following_url":"https://api.github.com/users/mosra/following{/other_user}","gists_url":"https://api.github.com/users/mosra/gists{/gist_id}","starred_url":"https://api.github.com/users/mosra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosra/subscriptions","organizations_url":"https://api.github.com/users/mosra/orgs","repos_url":"https://api.github.com/users/mosra/repos","events_url":"https://api.github.com/users/mosra/events{/privacy}","received_events_url":"https://api.github.com/users/mosra/received_events","type":"User","site_admin":false},"body":"Can you put the implementation into the `*.cpp` file?","created_at":"2016-04-13T13:06:50Z","updated_at":"2016-04-13T13:06:50Z","html_url":"https://github.com/mosra/magnum/pull/141#discussion_r59543699","pull_request_url":"https://api.github.com/repos/mosra/magnum/pulls/141","_links":{"self":{"href":"https://api.github.com/repos/mosra/magnum/pulls/comments/59543699"},"html":{"href":"https://github.com/mosra/magnum/pull/141#discussion_r59543699"},"pull_request":{"href":"https://api.github.com/repos/mosra/magnum/pulls/141"}}},"pull_request":{"url":"https://api.github.com/repos/mosra/magnum/pulls/141","id":66306970,"html_url":"https://github.com/mosra/magnum/pull/141","diff_url":"https://github.com/mosra/magnum/pull/141.diff","patch_url":"https://github.com/mosra/magnum/pull/141.patch","issue_url":"https://api.github.com/repos/mosra/magnum/issues/141","number":141,"state":"open","locked":false,"title":"[WIP] Add GlfwApplication","user":{"login":"Squareys","id":1889284,"avatar_url":"https://avatars.githubusercontent.com/u/1889284?v=3","gravatar_id":"","url":"https://api.github.com/users/Squareys","html_url":"https://github.com/Squareys","followers_url":"https://api.github.com/users/Squareys/followers","following_url":"https://api.github.com/users/Squareys/following{/other_user}","gists_url":"https://api.github.com/users/Squareys/gists{/gist_id}","starred_url":"https://api.github.com/users/Squareys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squareys/subscriptions","organizations_url":"https://api.github.com/users/Squareys/orgs","repos_url":"https://api.github.com/users/Squareys/repos","events_url":"https://api.github.com/users/Squareys/events{/privacy}","received_events_url":"https://api.github.com/users/Squareys/received_events","type":"User","site_admin":false},"body":"Hi @mosra !\r\n\r\nAs discussed via gitter, I am implement an `Application` class based on GLFW, which supports creation of Vulkan contexts and therefore acts as a basis for the Magnum Vulkan implementation.\r\n\r\n**This pull request is still work in progress**\r\n\r\nThis already compiles, but is not enabled on ci. Since creating Vulkan contexts will only be supported in GLFW 3.2, which is not quite released yet, we will need to have the ci build it from https://github.com/glfw/glfw.\r\n\r\nI have not tested this yet, it might be completely unusable. Other than that, you may want to have a look at naming/doc in the Key enum. Also, the main loop maybe.\r\n\r\nRegards,\r\nSquareys (Jonathan Hale)\r\n\r\nTODO:\r\n - [ ] `exit()`\r\n - [ ] `tickEvent()`?\r\n - [ ] More context/window flags?\r\n - [ ] Run a sample application, possibly add a bootstrap for https://github.com/mosra/magnum-bootstrap.\r\n - [ ] @mosra shall I already add the context creation for Vulkan in this PR?\r\n","created_at":"2016-04-13T11:41:19Z","updated_at":"2016-04-13T13:06:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e744fe6eaac690791ec49c82177b1882ba4851eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mosra/magnum/pulls/141/commits","review_comments_url":"https://api.github.com/repos/mosra/magnum/pulls/141/comments","review_comment_url":"https://api.github.com/repos/mosra/magnum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mosra/magnum/issues/141/comments","statuses_url":"https://api.github.com/repos/mosra/magnum/statuses/54201781440f4b306ff442631038c75d7e5c9863","head":{"label":"Squareys:glfw-application","ref":"glfw-application","sha":"54201781440f4b306ff442631038c75d7e5c9863","user":{"login":"Squareys","id":1889284,"avatar_url":"https://avatars.githubusercontent.com/u/1889284?v=3","gravatar_id":"","url":"https://api.github.com/users/Squareys","html_url":"https://github.com/Squareys","followers_url":"https://api.github.com/users/Squareys/followers","following_url":"https://api.github.com/users/Squareys/following{/other_user}","gists_url":"https://api.github.com/users/Squareys/gists{/gist_id}","starred_url":"https://api.github.com/users/Squareys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squareys/subscriptions","organizations_url":"https://api.github.com/users/Squareys/orgs","repos_url":"https://api.github.com/users/Squareys/repos","events_url":"https://api.github.com/users/Squareys/events{/privacy}","received_events_url":"https://api.github.com/users/Squareys/received_events","type":"User","site_admin":false},"repo":{"id":33696624,"name":"magnum","full_name":"Squareys/magnum","owner":{"login":"Squareys","id":1889284,"avatar_url":"https://avatars.githubusercontent.com/u/1889284?v=3","gravatar_id":"","url":"https://api.github.com/users/Squareys","html_url":"https://github.com/Squareys","followers_url":"https://api.github.com/users/Squareys/followers","following_url":"https://api.github.com/users/Squareys/following{/other_user}","gists_url":"https://api.github.com/users/Squareys/gists{/gist_id}","starred_url":"https://api.github.com/users/Squareys/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Squareys/subscriptions","organizations_url":"https://api.github.com/users/Squareys/orgs","repos_url":"https://api.github.com/users/Squareys/repos","events_url":"https://api.github.com/users/Squareys/events{/privacy}","received_events_url":"https://api.github.com/users/Squareys/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Squareys/magnum","description":"C++11/C++14 and OpenGL graphics engine","fork":true,"url":"https://api.github.com/repos/Squareys/magnum","forks_url":"https://api.github.com/repos/Squareys/magnum/forks","keys_url":"https://api.github.com/repos/Squareys/magnum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Squareys/magnum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Squareys/magnum/teams","hooks_url":"https://api.github.com/repos/Squareys/magnum/hooks","issue_events_url":"https://api.github.com/repos/Squareys/magnum/issues/events{/number}","events_url":"https://api.github.com/repos/Squareys/magnum/events","assignees_url":"https://api.github.com/repos/Squareys/magnum/assignees{/user}","branches_url":"https://api.github.com/repos/Squareys/magnum/branches{/branch}","tags_url":"https://api.github.com/repos/Squareys/magnum/tags","blobs_url":"https://api.github.com/repos/Squareys/magnum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Squareys/magnum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Squareys/magnum/git/refs{/sha}","trees_url":"https://api.github.com/repos/Squareys/magnum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Squareys/magnum/statuses/{sha}","languages_url":"https://api.github.com/repos/Squareys/magnum/languages","stargazers_url":"https://api.github.com/repos/Squareys/magnum/stargazers","contributors_url":"https://api.github.com/repos/Squareys/magnum/contributors","subscribers_url":"https://api.github.com/repos/Squareys/magnum/subscribers","subscription_url":"https://api.github.com/repos/Squareys/magnum/subscription","commits_url":"https://api.github.com/repos/Squareys/magnum/commits{/sha}","git_commits_url":"https://api.github.com/repos/Squareys/magnum/git/commits{/sha}","comments_url":"https://api.github.com/repos/Squareys/magnum/comments{/number}","issue_comment_url":"https://api.github.com/repos/Squareys/magnum/issues/comments{/number}","contents_url":"https://api.github.com/repos/Squareys/magnum/contents/{+path}","compare_url":"https://api.github.com/repos/Squareys/magnum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Squareys/magnum/merges","archive_url":"https://api.github.com/repos/Squareys/magnum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Squareys/magnum/downloads","issues_url":"https://api.github.com/repos/Squareys/magnum/issues{/number}","pulls_url":"https://api.github.com/repos/Squareys/magnum/pulls{/number}","milestones_url":"https://api.github.com/repos/Squareys/magnum/milestones{/number}","notifications_url":"https://api.github.com/repos/Squareys/magnum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Squareys/magnum/labels{/name}","releases_url":"https://api.github.com/repos/Squareys/magnum/releases{/id}","deployments_url":"https://api.github.com/repos/Squareys/magnum/deployments","created_at":"2015-04-09T22:49:56Z","updated_at":"2016-03-14T07:53:21Z","pushed_at":"2016-04-13T11:26:47Z","git_url":"git://github.com/Squareys/magnum.git","ssh_url":"git@github.com:Squareys/magnum.git","clone_url":"https://github.com/Squareys/magnum.git","svn_url":"https://github.com/Squareys/magnum","homepage":"http://mosra.cz/blog/magnum.php","size":21390,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mosra:master","ref":"master","sha":"59af7e1920393239a1e506a8e82fdc06bb23408b","user":{"login":"mosra","id":344828,"avatar_url":"https://avatars.githubusercontent.com/u/344828?v=3","gravatar_id":"","url":"https://api.github.com/users/mosra","html_url":"https://github.com/mosra","followers_url":"https://api.github.com/users/mosra/followers","following_url":"https://api.github.com/users/mosra/following{/other_user}","gists_url":"https://api.github.com/users/mosra/gists{/gist_id}","starred_url":"https://api.github.com/users/mosra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosra/subscriptions","organizations_url":"https://api.github.com/users/mosra/orgs","repos_url":"https://api.github.com/users/mosra/repos","events_url":"https://api.github.com/users/mosra/events{/privacy}","received_events_url":"https://api.github.com/users/mosra/received_events","type":"User","site_admin":false},"repo":{"id":1182756,"name":"magnum","full_name":"mosra/magnum","owner":{"login":"mosra","id":344828,"avatar_url":"https://avatars.githubusercontent.com/u/344828?v=3","gravatar_id":"","url":"https://api.github.com/users/mosra","html_url":"https://github.com/mosra","followers_url":"https://api.github.com/users/mosra/followers","following_url":"https://api.github.com/users/mosra/following{/other_user}","gists_url":"https://api.github.com/users/mosra/gists{/gist_id}","starred_url":"https://api.github.com/users/mosra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mosra/subscriptions","organizations_url":"https://api.github.com/users/mosra/orgs","repos_url":"https://api.github.com/users/mosra/repos","events_url":"https://api.github.com/users/mosra/events{/privacy}","received_events_url":"https://api.github.com/users/mosra/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mosra/magnum","description":"C++11/C++14 and OpenGL graphics engine","fork":false,"url":"https://api.github.com/repos/mosra/magnum","forks_url":"https://api.github.com/repos/mosra/magnum/forks","keys_url":"https://api.github.com/repos/mosra/magnum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mosra/magnum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mosra/magnum/teams","hooks_url":"https://api.github.com/repos/mosra/magnum/hooks","issue_events_url":"https://api.github.com/repos/mosra/magnum/issues/events{/number}","events_url":"https://api.github.com/repos/mosra/magnum/events","assignees_url":"https://api.github.com/repos/mosra/magnum/assignees{/user}","branches_url":"https://api.github.com/repos/mosra/magnum/branches{/branch}","tags_url":"https://api.github.com/repos/mosra/magnum/tags","blobs_url":"https://api.github.com/repos/mosra/magnum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mosra/magnum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mosra/magnum/git/refs{/sha}","trees_url":"https://api.github.com/repos/mosra/magnum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mosra/magnum/statuses/{sha}","languages_url":"https://api.github.com/repos/mosra/magnum/languages","stargazers_url":"https://api.github.com/repos/mosra/magnum/stargazers","contributors_url":"https://api.github.com/repos/mosra/magnum/contributors","subscribers_url":"https://api.github.com/repos/mosra/magnum/subscribers","subscription_url":"https://api.github.com/repos/mosra/magnum/subscription","commits_url":"https://api.github.com/repos/mosra/magnum/commits{/sha}","git_commits_url":"https://api.github.com/repos/mosra/magnum/git/commits{/sha}","comments_url":"https://api.github.com/repos/mosra/magnum/comments{/number}","issue_comment_url":"https://api.github.com/repos/mosra/magnum/issues/comments{/number}","contents_url":"https://api.github.com/repos/mosra/magnum/contents/{+path}","compare_url":"https://api.github.com/repos/mosra/magnum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mosra/magnum/merges","archive_url":"https://api.github.com/repos/mosra/magnum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mosra/magnum/downloads","issues_url":"https://api.github.com/repos/mosra/magnum/issues{/number}","pulls_url":"https://api.github.com/repos/mosra/magnum/pulls{/number}","milestones_url":"https://api.github.com/repos/mosra/magnum/milestones{/number}","notifications_url":"https://api.github.com/repos/mosra/magnum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mosra/magnum/labels{/name}","releases_url":"https://api.github.com/repos/mosra/magnum/releases{/id}","deployments_url":"https://api.github.com/repos/mosra/magnum/deployments","created_at":"2010-12-19T22:19:59Z","updated_at":"2016-04-12T07:52:02Z","pushed_at":"2016-04-13T11:41:20Z","git_url":"git://github.com/mosra/magnum.git","ssh_url":"git@github.com:mosra/magnum.git","clone_url":"https://github.com/mosra/magnum.git","svn_url":"https://github.com/mosra/magnum","homepage":"http://mosra.cz/blog/magnum.php","size":22441,"stargazers_count":729,"watchers_count":729,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":89,"mirror_url":null,"open_issues_count":25,"forks":89,"open_issues":25,"watchers":729,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mosra/magnum/pulls/141"},"html":{"href":"https://github.com/mosra/magnum/pull/141"},"issue":{"href":"https://api.github.com/repos/mosra/magnum/issues/141"},"comments":{"href":"https://api.github.com/repos/mosra/magnum/issues/141/comments"},"review_comments":{"href":"https://api.github.com/repos/mosra/magnum/pulls/141/comments"},"review_comment":{"href":"https://api.github.com/repos/mosra/magnum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mosra/magnum/pulls/141/commits"},"statuses":{"href":"https://api.github.com/repos/mosra/magnum/statuses/54201781440f4b306ff442631038c75d7e5c9863"}}}}