PICO8 - 记录十六进制数的奇怪方式

PICO8 - strange way to record HEX number

我想了解特定脚本(淡入淡出功能)在 PICO8 中的工作原理:

function fade()
  fadep=split("0xffff.8,0xfffe.8,0xffec.8,0xfec8.8,0xec80.8,0xc800.8,0x8000.8,0x0.8")
  for i=0,64 do
    fillp(fadep[flr(i/(32/#fadep))+1])
    rectfill(0,0,127,127,0)
    flip()
  end
end

我知道 split() 函数将参数中的数字拆分为逗号分隔(默认情况下),我们将像第一个 "0xffff.8" 一样得到 8 个十六进制数字。 据我所知,十六进制数字以 "0x" 开头,但最后的 ".8" 是什么意思? 谢谢!

在函数 filp 中根据 wiki

Alternatively, you can set the pattern to make the off bits transparent (showing what is drawn underneath). To do this, add 0b0.1, or 0x0.8 if using hex, to the pattern value

它明确地将关闭位设置为透明,如 fillp 文章中所述

The color parameter to the drawing functions (such as circfill()) can set two colors, to be used for the on bits (1's) and off bits (0's) of the pattern. The four lower bits of the color value are the "on" color, and the higher bits are the "off" color. For example, to draw the on bits as light blue (12, or 0xc) and the off bits as dark blue (1), set the color to 0x1c (28).

That's the fractional portion of a hex number. You can also use the fractional portion on the decimal and binary representations.

符号有点奇怪,但感谢您的提问,学习起来很有趣。