{"action":"created","issue":{"url":"https://api.github.com/repos/glfw/glfw/issues/455","labels_url":"https://api.github.com/repos/glfw/glfw/issues/455/labels{/name}","comments_url":"https://api.github.com/repos/glfw/glfw/issues/455/comments","events_url":"https://api.github.com/repos/glfw/glfw/issues/455/events","html_url":"https://github.com/glfw/glfw/issues/455","id":59231154,"number":455,"title":"Input redesign","user":{"login":"dv343","id":1692175,"avatar_url":"https://avatars.githubusercontent.com/u/1692175?v=3","gravatar_id":"","url":"https://api.github.com/users/dv343","html_url":"https://github.com/dv343","followers_url":"https://api.github.com/users/dv343/followers","following_url":"https://api.github.com/users/dv343/following{/other_user}","gists_url":"https://api.github.com/users/dv343/gists{/gist_id}","starred_url":"https://api.github.com/users/dv343/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dv343/subscriptions","organizations_url":"https://api.github.com/users/dv343/orgs","repos_url":"https://api.github.com/users/dv343/repos","events_url":"https://api.github.com/users/dv343/events{/privacy}","received_events_url":"https://api.github.com/users/dv343/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-27T12:38:23Z","updated_at":"2015-02-28T12:20:49Z","closed_at":null,"body":"I know this would be a very big change on the external interface, but I think that at the end it would be good enought.\r\nMy idea is to change the way users prompt for input status. Now, this is achieved by using callbacks(one for each type of input: key callback, mouse button callback, mouse position callback...) and glfwGet* (getKey, getCursor...). My proposal is to unify all input events to just one type, this way all input could be prompted by using something like:\r\nfloat glfwGetInput(unsigned long code, int mods);\r\nThe code paramter will be an identifier of keys, mouse buttons, mouse wheel, joysticks... Each key would have three identifiers, for example: KEY_ESCAPE_PRESS, KEY_ESCAPE_RELEASE and KEY_ESCAPE_PRESSING (the key has been pressed and it is not released). The returning float would be 1.0 if code is KEY_ESCAPE_PRESS and is the key pressed, 0.0 otherwise. For cursor and joysticks the returning float would be the position of the prompted axe.\r\nA getAllInputs function (a function which returns an array of all events) would be very useful too.\r\nI did an input module (a glfw wrapper), which do exactly this and it's only 200 lines long plus a 100 lines long hashmap module, so I think this can be achieved without bloating GLFW.\r\n\r\nI think this would be a very good simplification. Moreover, it provides an easy to use interface for a mapping module (ie.: GLFW_KEY_ESCAPE_PRESS => INPUT_EXIT_PROGRAM). That's on my wrapper module too, but I guess that mapping would be considered outside the scope of GLFW.\r\n\r\nI don't know a lot of GLFW internals, but I read some of the input system code and I think I could re-write, at least, the X11 module."},"comment":{"url":"https://api.github.com/repos/glfw/glfw/issues/comments/76523897","html_url":"https://github.com/glfw/glfw/issues/455#issuecomment-76523897","issue_url":"https://api.github.com/repos/glfw/glfw/issues/455","id":76523897,"user":{"login":"capnm","id":4047289,"avatar_url":"https://avatars.githubusercontent.com/u/4047289?v=3","gravatar_id":"","url":"https://api.github.com/users/capnm","html_url":"https://github.com/capnm","followers_url":"https://api.github.com/users/capnm/followers","following_url":"https://api.github.com/users/capnm/following{/other_user}","gists_url":"https://api.github.com/users/capnm/gists{/gist_id}","starred_url":"https://api.github.com/users/capnm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/capnm/subscriptions","organizations_url":"https://api.github.com/users/capnm/orgs","repos_url":"https://api.github.com/users/capnm/repos","events_url":"https://api.github.com/users/capnm/events{/privacy}","received_events_url":"https://api.github.com/users/capnm/received_events","type":"User","site_admin":false},"created_at":"2015-02-28T12:20:49Z","updated_at":"2015-02-28T12:20:49Z","body":"> KEY_ESCAPE_PRESSING (the key has been pressed and it is not released)\r\n\r\nI already tried to implement this in glfw, but unfortunately it seems to be not possible to get\r\nalways corresponding press/release events from the window manager reliably. IIRC there was missing release event by loosing/entering window focus, etc."}}