Salut,
I've got two display drawing functions, "DrawDepartures", which is the one to be used normally, and a "DrawIdle", in case there are no trips left in the timetable. "DrawIdle" looks like this:
Code
- procedure DrawIdle;
- begin
- //Vælger den script-tesktur(index i Objektindstillinger i CT) der skal bearbejdes
- TexSelTex(Self, 0);
- //Indstiller farven til transparent
- TexSetColor(Self, Color(0,0,0,0));
- //Gør hele script-teksturen transparent
- TexClear(Self);
- TexSelTex(Self, 1);
- TexSetColor(Self, Color(0,0,0,0));
- TexClear(Self);
- TexWriteLn(Self, defaultString, 50, 12, Font, false, 1);
- //Upscaling of the font
- TexCopy(Self, 1, 0, 0, 0, WIDTH, HEIGHT, 0, 0, 16, Color(0,0,0,255), Color(0,0,0,255));
- end;
and my SimStep and timer function looks like this:
Code
- function RunTimerMain: boolean;
- BEGIN
- result := false;
- Timer := Timer - Timegap;
- if Timer <= 0 then
- BEGIN
- result := true;
- END;
- END;
- procedure Initialize;
- begin
- Timer = 0;
- ... //The rest is omitted
- end
- procedure SimStep;
- begin
- //Check if it is the first run of SimStep(FirstStart, set in Initialize):
- if FirstStart then
- BEGIN
- FirstStart := false;
- //Indstiller displayet til det i variablerne angivne stoppested
- StatPIS_Login(Self, $map_StationName, $map_TrackName);
- END;
- if RunTimerMain then
- BEGIN
- //Nulstiller nedtælling til 10 sekunder
- Timer := REFRESH_TIME;
- //Calls the procedure GetInfo
- GetInfo;
- //Beslutter, hvad der skal skrives hvert 10. sekund. Hvis der er ture i listen, kaldes DrawDepartures, hvis ikke skrives "Ude af drift"
- if datacount > 0 then DrawDepartures
- else DrawIdle;
- END;
- end;
I've got a main timer (the function RunTimerMain), which just counts down from 10 to 0, then updates the display with one of the two mentioned functions. However, the "DrawIdle" one should cycle between three different modes, within the main timer:
- Blank (~5-6 seconds)
- Danish text (2 seconds)
- English text (2 seconds)
So, I need a separate timer for the function "DrawIdle", which contains a timer for each display state.
How could I implement this?
-Thor