GlenDC / trixel

An easy to use webtool, to make trixel art.
http://www.glendc.com/trixel/
MIT License
18 stars 0 forks source link

Cache difference of buttons down now and in the past #67

Closed GlenDC closed 9 years ago

GlenDC commented 9 years ago

Right now to check wether or not a button/key has just been pressed, we check wether it's currently down and not yet previously. This is not a huge problem, but it's certainly not the best way. So it is probably better just to compute the difference and cache it, when assigning the fresh list to our state.

A cached list can be added both for keys and buttons, replacing previousButtonsDown and making the IsButtonJustInSet and IsKeyCodeJustInSet redundant.

This will also make the Update Logic a lot simpler...