11-04-2015, 01:55 AM
I think it would be entirely down to what you're trying to do, and you need to consider efficient code that won't hold up processing time depending on the context. Two situations come to mind reading that:
- During a certain time-frame, you want to check if no button is being pressed. Therefore only during this time would you check if no button is pressed. Other times, you can avoid the check entirely.
- You can work out what specific buttons you won't want to be pressed, because others won't be used in that situation. A flag would be changed true/false when a button is pressed or not, the code would be executed, and not executed again until that flag doesn't match up (to prevent it looping).
... or maybe that latter example really applies to the former too. I'm not sure.
- During a certain time-frame, you want to check if no button is being pressed. Therefore only during this time would you check if no button is pressed. Other times, you can avoid the check entirely.
- You can work out what specific buttons you won't want to be pressed, because others won't be used in that situation. A flag would be changed true/false when a button is pressed or not, the code would be executed, and not executed again until that flag doesn't match up (to prevent it looping).
... or maybe that latter example really applies to the former too. I'm not sure.