A function that allows you to convert a 2d vector into a single byte and back into a vector. Useful when you want to send player joystick input over the network.

Play with it here:
https://www.desmos.com/calculator/zpob0tj445

And code can be found here:
https://gist.github.com/jespertheend/53cddb4a15055d63ab2a9c0585265eda

vec2 to byte and back

Desmos