gutter_runner/game/debug/helpers.odin

25 lines
389 B
Odin

package debug
import rl "vendor:raylib"
int_to_color :: proc(num: i32) -> (color: rl.Color) {
x := int_hash(num)
color.r = u8(x % 256)
color.g = u8((x / 256) % 256)
color.b = u8((x / 256 / 256) % 256)
color.a = 255
return
}
int_hash :: proc(num: i32) -> u32 {
x := cast(u32)num
x = ((x >> 16) ~ x) * 0x45d9f3b
x = ((x >> 16) ~ x) * 0x45d9f3b
x = (x >> 16) ~ x
return x
}