The SCE Color Fill effect provides some functions to set the fill mode, the fill time, the delay time, and the mix color setting. Settings for the different fill modes cannot be set, yet.
Functions Provided By SCE Color Fill
The following table provides an overview of all functions the effect can use:
Function
|
Description
|
void SetMixColor(int enable)
|
Disables the mix color mode if enable is false, otherwise it will be enabled.
|
int GetMixColor()
|
Returns true if the mix color mode is enabled.
|
void SetFillMode(int mode)
|
Sets the fill mode. The table below describes the valid values for parameter mode.
|
int GetFillMode()
|
Returns the current fill mode. See the table below for the meaning of the return values.
|
void SetFillTime(float filltime)
|
Sets the fill time in seconds. This is the time in which the effect has to fill the whole matrix with pixels.
|
float GetFillTime()
|
Returns the fill time in seconds.
|
void SetDuration(float delaytime)
|
Sets the duration in seconds. This is the time the effect waits after it has filled the whole matrix.
|
float GetDuration()
|
Returns the duration in seconds.
|
void SetColor(int idx, color c)
|
Sets the color at the specified index in the Color Table dialog. If idx is out of range, nothing happens.
|
color GetColor(int idx)
|
Returns the color with the specified index in the color table. If the index is out of range, black is returned.
|
int GetColorCount()
|
Returns the number of colors in the color table.
|
void AddColor(int idx, color c)
|
Adds another color to the color table at the specified index position. If the index is lower or equal to 0, the new color is added to the first position. If the index is greater than the current number of colors, the new color is added at the end.
|
void RemoveColor(int idx)
|
Removes the color located at the specified index. If the given index is out of range, nothing happens. The Color Table of this effect needs to include at least 2 entries.
|
void SetWidth(int size)
|
Sets the size of objects for the fill mode Random, Drops, Snake, and Tetris. Valid values range from 1 to double the size of the virtual matrix.
|
int GetWidth()
|
Returns the size of objects for the fill mode Random, Drops, Snake, and Tetris.
|
void SetPitch(int pitch)
|
Sets the distance of objects for the fill mode Random, and Drops. Valid values range from 1 to double the size of the virtual matrix.
|
int GetPitch()
|
Returns the distance of objects for the fill mode Random, and Drops.
|
void SetShape(int shape)
|
Sets the shape of objects for the fill mode Random, Drops, and Tetris. Applicable values can be found in the table below.
|
int GetShape()
|
Returns the shape of objects for the fill mode Drops.
|
void SetMirror(int value)
|
Activates or deactivates mirror mode for the fill mode Snake. Applicable values are 0 (off) and 1 (on).
|
int GetMirror()
|
Returns if mirror mode is activated or not.
|
void SetCircle(int value)
|
Activates or deactivates circle mode for the fill mode Snake. Applicable values are 0 (off) and 1 (on).
|
int GetCircle()
|
Returns if circle mode is activated or not.
|
void SetCenter(int value)
|
Activates or deactivates center mode for the fill mode Snake. Applicable values are 0 (off) and 1 (on).
|
int GetCenter()
|
Returns if center mode is activated or not.
|
This Effect uses the Color Table. Learn more about Using Colors.
Setting The Fill Mode
By using the function SetFillMode it is possible to set the mode the effect uses to fill the matrix. The following constants must be used to set the different fill modes:
Value
|
Description
|
MODE_RANDOM
|
Sets the Random fill mode.
|
MODE_DROPS
|
Sets the Drops fill mode.
|
MODE_SNAKE
|
Sets the Snake fill mode.
|
MODE_FLAT
|
Sets the Flat fill mode.
|
MODE_COLLAPSE
|
Sets the Collapse fill mode.
|
MODE_TETRIS
|
Sets the Tetris fill mode.
|
Shapes for Fill Mode Drops
The fill mode Drops uses various geometrical figures. With the function SetShape it is possible to change them. The following values can be used as parameter:
Value
|
Description
|
DRAW_RECT
|
Selects the unfilled rectangle for drawing.
|
FILL_RECT
|
Selects the filled rectangle for drawing.
|
DRAW_CIRCLE
|
Selects the unfilled circle for drawing.
|
FILL_CIRCLE
|
Selects the filled circle for drawing.
|
DRAW_CROSS
|
Selects the cross for drawing.
|
DRAW_STAR
|
Selects the star for drawing.
|
DRAW_LINE
|
Selects the line mode for drawing.
|
DRAW_DIAMOND
|
Selects the unfilled diamond for drawing.
|
FILL_DIAMOND
|
Selects the filled diamond for drawing.
|
DRAW_RANDOM
|
Selects random shapes for drawing.
|
Full Example
The following example changes the fill mode after the matrix has been filled up completely.
int g_startTime;
void InitEffect()
{
time t = GetTime();
g_startTime = t.hour * 3600 + t.min * 60 + t.sec;
}
void PreRenderEffect()
{
time t = GetTime();
int t2 = t.hour * 3600 + t.min * 60 + t.sec;
if(t2 - g_startTime > (int)GetFillTime())
{
g_startTime = t2;
if(GetFillMode() == MODE_RANDOM)
SetFillMode(MODE_DROPS);
else if(GetFillMode() == MODE_DROPS)
SetFillMode(MODE_SNAKE);
else if(GetFillMode() == MODE_SNAKE)
SetFillMode(MODE_FLAT);
else if(GetFillMode() == MODE_FLAT)
SetFillMode(MODE_COLLAPSE);
else if(GetFillMode() == MODE_COLLAPSE)
SetFillMode(MODE_TETRIS);
else {
SetFillMode(MODE_DROPS);
}
}
}
void PostRenderEffect()
{
if(GetFillTime() != 10)
SetFillTime(10);
}
Explanation:
Since the effect cannot detect when the matrix has been filled up, it uses the fill time and changes the fill mode after the fill time has passed. In the PostRenderEffect function the time is corrected and set to 10, because each fill mode sets its own default time when activated.
|