gobadge
gobadge copied to clipboard
Use point struct as position
This PR intend is to improve code readability. I introduce Point type that handle x and y value for an element (snake body, apple)
I hope it does bring more readability to the code.
Note: code compiles, but I still need to flash and validate everything is still fine.
Wouldn't it be better to use image.Point
for this? https://pkg.go.dev/image#Point
At the time I wrote the original code (many years ago :rofl: ), image.Point was causing some compilation errors, that should have been fixed by now, but, image.Point uses int
instead of int16 (used by the display coords), casting will be needed in many places and in my opinion it will make readability worse. I vote for maintaining custom Point Struct instead of image.Point.
I cannot say I had thought this through as I didn't know about image.Point
😆