{"id":108,"date":"2020-06-11T18:02:00","date_gmt":"2020-06-11T23:02:00","guid":{"rendered":"https:\/\/cynthiamcmahon.ca\/blog\/index.php\/2020\/06\/input-use-cases\/"},"modified":"2020-06-11T18:02:00","modified_gmt":"2020-06-11T23:02:00","slug":"input-use-cases","status":"publish","type":"post","link":"https:\/\/cynthiamcmahon.ca\/blog\/2020\/06\/input-use-cases\/","title":{"rendered":"Input use cases"},"content":{"rendered":"<div>There are 4 basic input use cases. A key is down, a key is up, a key that was up the previous frame is now down and a key that was down the previous frame is now up. The same is true for mouse buttons. Analog inputs have more use cases such as how far in a direction it is pressed.<\/div>\n<div><\/div>\n<div>The most common use case for a key being down is movement in a direction. If the key is down the object moves in a direction. Another reason could be a shield or some other state.<\/div>\n<div><\/div>\n<div>A key being up is less common. I would use it for charging something. For example, if space caused a shield to be up while pressed and it recharged while it is up you&#8217;d want to test for that.<\/div>\n<div><\/div>\n<div>A key that was up and is now down is most common for instant actions that need to happen immediately. The most common is firing a weapon.<\/div>\n<div><\/div>\n<div>A key that was down and now up is often used in UI. I use it in menus and activating objects. In theory it prevents bleed through between frames.<\/div>\n","protected":false},"excerpt":{"rendered":"<p>There are 4 basic input use cases. A key is down, a key is up, a key that was up the previous frame is now down and a key that was down the previous frame is now up. The same is true for mouse buttons. Analog inputs have more use cases such as how far &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":0,"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"wp:attachment":[{"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cynthiamcmahon.ca\/blog\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}