{"action":"created","issue":{"url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/40","repository_url":"https://api.github.com/repos/kroyee/SpeedBlocks","labels_url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/40/comments","events_url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/40/events","html_url":"https://github.com/kroyee/SpeedBlocks/issues/40","id":215968662,"number":40,"title":"[UX] One assignment per key","user":{"login":"jefgenowitsch","id":803239,"avatar_url":"https://avatars1.githubusercontent.com/u/803239?v=3","gravatar_id":"","url":"https://api.github.com/users/jefgenowitsch","html_url":"https://github.com/jefgenowitsch","followers_url":"https://api.github.com/users/jefgenowitsch/followers","following_url":"https://api.github.com/users/jefgenowitsch/following{/other_user}","gists_url":"https://api.github.com/users/jefgenowitsch/gists{/gist_id}","starred_url":"https://api.github.com/users/jefgenowitsch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jefgenowitsch/subscriptions","organizations_url":"https://api.github.com/users/jefgenowitsch/orgs","repos_url":"https://api.github.com/users/jefgenowitsch/repos","events_url":"https://api.github.com/users/jefgenowitsch/events{/privacy}","received_events_url":"https://api.github.com/users/jefgenowitsch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-03-22T06:46:32Z","updated_at":"2017-03-22T18:19:25Z","closed_at":null,"body":"**Steps to reproduce:**\r\n\r\nAssign a key\r\n\r\n**Expected result:**\r\n\r\nThe assigned key is locked and cannot be assigned multiple times\r\n\r\n**Actual Result**\r\n\r\nThe assigned key isn't locked"},"comment":{"url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/comments/288492434","html_url":"https://github.com/kroyee/SpeedBlocks/issues/40#issuecomment-288492434","issue_url":"https://api.github.com/repos/kroyee/SpeedBlocks/issues/40","id":288492434,"user":{"login":"kroyee","id":26490745,"avatar_url":"https://avatars2.githubusercontent.com/u/26490745?v=3","gravatar_id":"","url":"https://api.github.com/users/kroyee","html_url":"https://github.com/kroyee","followers_url":"https://api.github.com/users/kroyee/followers","following_url":"https://api.github.com/users/kroyee/following{/other_user}","gists_url":"https://api.github.com/users/kroyee/gists{/gist_id}","starred_url":"https://api.github.com/users/kroyee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kroyee/subscriptions","organizations_url":"https://api.github.com/users/kroyee/orgs","repos_url":"https://api.github.com/users/kroyee/repos","events_url":"https://api.github.com/users/kroyee/events{/privacy}","received_events_url":"https://api.github.com/users/kroyee/received_events","type":"User","site_admin":false},"created_at":"2017-03-22T18:19:25Z","updated_at":"2017-03-22T18:19:25Z","body":"No, the comparison is right. *key and options->left is the same kind of object, otherwise it would not compile.\r\n\r\nBut *key is a pointer to one of the keys. So if your trying to set the options->left then *key will be pointing to options->left, and you are doing the equivalent of:\r\nif (options->left != options->left)\r\nwitch will always be false.\r\n\r\nA better aproach would be to do this:\r\n```\r\nif (event.key.code == options->right)\r\n  options->right = sf::Keyboard::Unknown;\r\nif (event.key.code == options->left)\r\n  options->left = sf::Keyboard::Unknown;\r\nif (event.key.code == options->down)\r\n  options->down = sf::Keyboard::Unknown;\r\n// -- and so on for all the keys, and after you can do\r\n*key = event.key.code;\r\n```\r\n\r\nBUT... IF something was changed to Unknown, you also need to update the text on that button.\r\nSo here some rework would be needed to make sure we have a way to access the button objects.\r\n\r\nThis could be done by giving them a name when we added them to the gui before with:\r\nGenOpt->add(LeB);\r\nif we change this to:\r\nGenOpt->add(LeB, \"BindLeft\");\r\n\r\nthen we can retrieve that object by calling gui.get<tgui::Button>(\"BindLeft\")->setText(\"\");\r\n\r\nwe are getting a generic tgui::Widget object-pointer from our call to gui.get, we are then casting it to a tgui::Button (witch is a derived class of tgui::widget) and calling it's setText function with the value of and empry string (making the button display nothing instead of whatever was there before).\r\n\r\nI would again encourage you to go to the TGUI website and look at the tutorials there. Things are very well explained."}}
{"actor":{"display_login":"kroyee"}}