SCE Ticker |
Print Previous Next |
Functions Provided By SCE Ticker
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:
Deprecated Functions
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; }
|