Skip to content

Instantly share code, notes, and snippets.

@gabrielflorit
Last active February 20, 2019 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gabrielflorit/13002edb2d5854e81d54b6a203df3618 to your computer and use it in GitHub Desktop.
Save gabrielflorit/13002edb2d5854e81d54b6a203df3618 to your computer and use it in GitHub Desktop.
SCRIPT-8
// title: input demo
initialState = {
input: null
}
update = (state, input) => {
state.input = {
...input
}
}
draw = state => {
clear()
rectStroke(0, 0, 128, 128, 6)
print(39, 3, 'press buttons', 0)
Object.entries(state.input).forEach(([key, value], i) => {
print(i % 2 ? 74 : 4, 18 + Math.floor(i / 2) * 8, key, value ? 0 : 5)
})
}
{
"lines": [
20,
0,
0,
0,
0,
0,
0,
0
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment