Buttons & palette constants
Every Munos script gets two sets of named constants auto-injected by the compiler — you can use them without declaring anything.
Button constants
Gamepad buttons, normalized across NES, Game Boy, and the common SNES subset. Declared as const … : i32. Always use the names, never the raw numbers — the values are an implementation detail.
| Constant | Value |
|---|---|
BUTTON_A | 0 |
BUTTON_B | 1 |
BUTTON_SELECT | 2 |
BUTTON_START | 3 |
BUTTON_UP | 4 |
BUTTON_DOWN | 5 |
BUTTON_LEFT | 6 |
BUTTON_RIGHT | 7 |
Used with event input, input_held, input_pressed. The v1 surface reads controller 1 only.
NES palette constants
The compiler also injects the NES master palette as named const … : u32 colors, so you can build palettes from readable names instead of raw hex:
var pal: u32[] = [0x00000000, NES_RED, NES_WHITE, NES_DARK_BLUE]Each color resolves to the RGB the NES actually renders for that hardware index. (The constants carry 0xFF in the high byte; the draw compositor ignores the high byte, so it's harmless — transparency is still by palette index 0.)
Naming scheme
Most hues come in four shades — NES_DARK_*, NES_*, NES_LIGHT_*, NES_PALE_*:
| Family | Constants |
|---|---|
| Grey | NES_BLACK, NES_DARK_GREY, NES_GREY, NES_LIGHT_GREY, NES_WHITE |
| Blue | NES_DARK_BLUE, NES_BLUE, NES_LIGHT_BLUE, NES_PALE_BLUE |
| Purple | NES_DARK_PURPLE, NES_PURPLE, NES_LIGHT_PURPLE, NES_PALE_PURPLE |
| Magenta | NES_DARK_MAGENTA, NES_MAGENTA, NES_LIGHT_MAGENTA, NES_PALE_MAGENTA |
| Red | NES_DARK_RED, NES_RED, NES_LIGHT_RED, NES_PALE_RED |
| Orange | NES_DARK_ORANGE, NES_ORANGE, NES_LIGHT_ORANGE, NES_PALE_ORANGE |
| Yellow | NES_DARK_YELLOW, NES_YELLOW, NES_LIGHT_YELLOW, NES_PALE_YELLOW |
| Lime | NES_DARK_LIME, NES_LIME, NES_LIGHT_LIME, NES_PALE_LIME |
| Green | NES_DARK_GREEN, NES_GREEN, NES_LIGHT_GREEN, NES_PALE_GREEN |
| Teal | NES_DARK_TEAL, NES_TEAL, NES_LIGHT_TEAL, NES_PALE_TEAL |
| Cyan | NES_DARK_CYAN, NES_CYAN, NES_LIGHT_CYAN, NES_PALE_CYAN |
These name the genuine NES hardware colors, so a palette built from them looks right on a real NES render. For non-NES targets they're still perfectly good named RGB values.