use sprites to draw cursor and board
this is a bit more code, but ten times less cycles to
draw the board and the cursor. the latter now looks slightly different,
this is somewhat unintentional, but only slightly.
also board is now drawn at the background layer, while
everything else is on foreground. doesn't matter much, but
makes more sense.
in uxn32 redrawing the cursor erases figures. looks awful and is a bug.
but this happens probably because uxn32 lacks the recent update to
a screen device.
refactoring and optimization
- remove logic from drawing code (also simplify)
- remove ability to make move with space key
- fix bug where game instantly restarts at the end
(key release event was triggering the restart)
compact board drawing code
also make cursor change color in place
tictactoe.tal
simple little game that took me far longer than i thought it would.
installation
you need uxn assembler and emulator. for example, check out uxn-sdl
(which also contains uxnasm, the assembler) and drifblim
(the self-hosted assembler).
controls
arrow keys to move, button A (or control) to make your move.
when the game is over, press any button to restart.
licence
ISC (see LICENCE
).