SCE Ticker

   Print  Previous  Next

Functions Provided By SCE Ticker

Function

Description

void SetText(string text)

Sets the text the ticker shows.

string GetText()

Retrieves the text shown by the ticker effect.

void SetDirection(int direction)

Sets the direction of the movement. Allowed are all DIR_ values described in the summary. Use DIR_NONE to stop the movement.

int GetDirection()

Returns the currently set direction.

void SetPixelTextOffset(int x, int y)

Set the text offset in pixel coordinates.

int GetPixelTextOffsetX()

Returns the x coordinate of the text offset using pixel coordinates.

int GetPixelTextOffsetY()

Returns the y coordinate of the text offset using pixel coordinates.

void SetVectorTextOffset(float x, float y)

Sets text offset using relative coordinates.

float GetVectorTextOffsetX()

Returns the x coordinate of the text offset using relative coordinates.

float GetVectorTextOffsetY()

Returns the y coordinate of the text offset using relative coordinates.

int GetPixelTextWidth()

Returns the width of the text using pixel coordinates.

int GetPixelTextHeight()

Returns the height of the text using pixel coordinates.

float GetVectorTextWidth()

Returns the width of the text using relative coordinates.

float GetVectorTextHeight()

Returns the height of the text using relative coordinates.

int GetPixelTextPosX()

Returns the current x coordinate of the position of the text using pixel coordinates.

int GetPixelTextPosY()

Returns the current y coordinate of the position of the text using pixel coordinates.

float GetVectorTextPosX()

Returns the current x coordinate of the position of the text using vector coordinates.

float GetVectorTextPosY()

Returns the current y coordinate of the position of the text using vector coordinates.

void SetTextColor(color col)

Sets the text color.

color GetTextColor()

Retrieves the text color.

void SetBpm(int bpm)

Sets the BPM value. Valid values range from 0 to 9999.

int GetBpm()

Returns the currently used BPM value.

void SetMode(int mode)

Sets the text mode. See below for further details.

int GetMode()

Returns the current text mode. See below for further details.

viod SetReverseSentence(int enable)

Disables "Reverse Sentence" if enable is set to false. Otherwise, use true.

int GetReverseSentence()

Returns true if "Reverse Sentence" is active, otherwise false is returned.

void SetReverseWords(int enable)

Disables "Reverse Words" if enable is set to false. Otherwise, use true.

int GetReverseWords()

Returns true if "Reverse Words" is active, otherwise false is returned.

void SetRotation(int angle)

Rotates the text output by multiples of 90°. Valid values for angle are 0, 90, 180, and 270.

int GetRotation()

Returns the current rotation.

void SetContinuous(int enable)

Enables or disables "Cont. Text" mode. If enable is false, it will be disabled. Otherwise, use true.

int GetContinuous()

Returns true if "Cont. Text" mode is enabled, otherwise false.

void SetSmooth(int enable)

Enables or disables the "smooth" mode. If enable is false, it will be disabled. Otherwise, use true.

int GetSmooth()

Returns true if "smooth" mode is enabled, otherwise false.

int GetFontWidth()

Returns the width of the currently used font.

void SetFontWidth(int width)

Sets the width of the font.

int GetFontHeight()

Returns the height of currently used font.

void SetFontHeight(int height)

Sets the height of the font.

int GetFontItalic()

Returns if the font used is in italics.

void SetFontItalic(int value)

Sets the font in italics (value = 1) or not (value = 0).

int GetFontUnderline()

Returns if the currently used font is underlined.

void SetFontUnderline(int value)

Sets underlining for the font (value = 1) or not (value = 0).

int GetFontStrikeOut()

Returns if the a strikeout font is used.

void SetFontStrikeOut(int value)

Sets strikeout for the font (value = 1) or not (value = 0).

int GetFontWeight()

Returns the weight of the currently used font.

void SetFontWeight(int value)

Sets the weight of the font. Valid values for value range from 0 to 1000.

string GetFontFaceName()

Returns the name of the font currently in use.

void SetFontFaceName(string)

Sets which font to use. A maximum of 31 characters is allowed for string. Example: SetFontFaceName("Arial");

 

Text Modes

The ticker effect supports different modes. The given text can be interpreted as a whole sentence, as single words, or even single characters. With the function SetMode it is possible to set the mode with the following parameters:

Value

Description

MODE_SENTENCE

Sets the sentence mode.

MODE_WORD

Sets the word mode.

MODE_CHAR

Sets the character mode.

 

Deprecated Functions
Deprecated functions are outdated functions and should not be used anymore.

Function/Define

Description

void SetTextMode(int mode)

Use SetMode instead.

void GetTextMode(int mode)

Use GetMode instead.

void SetContinous(int enable)

Use SetContinuous instead.

int GetContinous()

Use GetContinuous instead.

void SetReverseWord(int enable)

Use SetReverseWords instead.

int GetReverseWord()

Use GetReverseWords instead.

TM_SENTENCE

Use MODE_SENTENCE instead.

TM_WORD

Use MODE_WORD instead.

TM_CHAR

Use MODE_CHAR instead.

 

Full Example 1

The following example writes the current time onto the matrix. Furthermore, it moves the text from side to side.

time g_time = GetTime();

 

void InitEffect()

{

    SetText("Hallo Dresden");

    SetDirection(DIR_UP);

}

 

void PreRenderEffect()

{

    time t = GetTime();

 

    int diff = t.sec - g_time.sec;

 

    if(diff > 0 || diff < 0) {

        g_time = t;

        string s;

        if(g_time.hour < 10) {

            s += "0";

        }

        s += (string)g_time.hour;

        s += ":";

 

        if(g_time.min < 10)

            s += "0";

        s += (string)g_time.min;

        

        s += ".";

 

        if(g_time.sec < 10)

            s += "0";

        s += (string)g_time.sec;

 

        SetText(s);

    }

 

    if(GetDirection() == DIR_LEFT) {

        if(GetPixelTextPosX() < 0) {

            SetDirection(DIR_RIGHT);

        }

    } else if(GetDirection() == DIR_RIGHT) {

        if(GetPixelTextPosX() > GetMatrixWidth()- GetPixelTextWidth()) {

            SetDirection(DIR_LEFT);

        }

    } else {

            SetDirection(DIR_LEFT);

    }

}

 

void PostRenderEffect()

{

    int i = 128;

    ClearAlpha(i);

    WriteText(GetText());

}

 

int compareTimes(time t1, time t2)

{

    int result = 0;

    if(t1.hour < t2.hour)

        result = -1;

    else if(t1.hour > t2.hour)

        result = 1;

    else {

        if(t1.min < t2.min)

            result = -1;

        else if(t1.min > t2.min)

            result = 1;

        else {

            if(t1.sec < t2.sec)

                result = -1;

            else if(t1.sec > t2.sec)

                result = 1;

        }

 

    }

 

    return(result);

}

 

Full Example 2

This example includes SetText and GetTime.

 

Example 3

This example creates a digital clock and therefore displays the current time using the SCE Ticker Effect.

@scriptname="macro clock with sce_ticker";

@author="sven";

@version="1.0";

@description="write the current time into the ticker text fields";

 

void InitEffect()

{

 

}

 

void PreRenderEffect()

{        

   time t = GetTime();

   SetText(ZeroString(t.hour) + ":" + ZeroString(t.min) + ":" + ZeroString(t.sec));

}

 

void PostRenderEffect()

{

}

 

void MatrixSizeChanged()

{

 InitEffect();

}

 

string ZeroString(int value)

{

          if(value<10)

                     return "0"+(string)value;

                  return (string)value;

}