SetPen(pen, color[, t])
pen
to the color specified by color
.
The change will be done in the currently active palette. By default, the current display's
palette is the active palette but of course only in case the current display is a palette mode
display. See Palette mode displays for details. A palette can be made the active one by
using the SelectPalette() command.
Alternatively, you can also make SetPen()
change pens in a different palette object.
To do so, you need to pass the optional table argument t
to SetPen()
and specify
the Type
and ID
tags. See below for an example.
The following tags are supported by the optional table argument t
:
Type:
#ANIM #BGPIC #BRUSH #DISPLAY #LAYER #PALETTE #SPRITE |
Note that if you use types #ANIM
or #SPRITE
, you also need to set the Frame
tag (see below) to indicate the frame whose pen you want to modify. If
you use #LAYER
and the specified layer is an anim layer, you also need to
set the Frame
tag.
Type
defaults to the type of the currently active palette selected using
SelectPalette(). See SelectPalette for details.
ID:
Frame:
@DISPLAY {Palette = #PALETTE_MONOCHROME} SetFillStyle(#FILLCOLOR) SetPaletteMode(#PALETTEMODE_PEN) SetDrawPen(1) Box(#CENTER, #CENTER, 320, 240) WaitLeftMouse SetPen(0, #WHITE) SetPen(1, #BLACK)The code above creates a monochrome palette display with a black background and white rectangle in the center. After a mouse-click the colors of the background and the white rectangle will be reversed by setting pen 0 to white and pen 1 to black.
SetPen(4, #RED, {Type = #BRUSH, ID = 2})The code changes pen 4 in brush 2 to red.