Legacy:Font/setColorMask
From Spherical
Set color masking for the font.
Contents
Usage
Font.setColorMask(color);
- color Sphere Color object. The mask color
Examples
The easiest way to take advantage of this function is to make/take a completely white font, and use colors in-game to control the color of the font.
var font = GetSystemFont();
var red = CreateColor(255, 0, 0);
font.setColorMask(red);
font.drawText(0, 0, "Hello everynyun~!");
The following is a simple demo of a line of text with a pulsating color:
var font = GetSystemFont();
var direction = 1;
var greenness = 0;
SetFrameRate(60);
while (!IsAnyKeyPressed())
{
greenness += direction;
if (greenness > 255)
{
greenness = 255;
direction = -1;
}
if (greenness < 0)
{
greenness = 0;
direction = 1;
}
var col = CreateColor(0, greenness, 0);
font.setColorMask(col);
font.drawText("Press any key to quit...");
FlipScreen();
}
Notes
- Once you set a mask color, it remains with the font until you change it. To reset the font's mask, use pure white (255, 255, 255) as the masking color.
- This function uses the filtering/shaping method of color masking.
- If you wish to change and restore the mask color, use Font.getColorMask().
See also
- Sphere Font object
- Sphere Color object
- Color masking
- CreateColor()
- FlipScreen()
- Font.drawText()
- Font.getColorMask()
- GetSystemFont()
- IsAnyKeyPressed()
- SetFrameRate()