Scrolling sign function (and non-blocking Wait() query)

Started by AdamM, Fri 18/04/2008 01:03:59

Previous topic - Next topic

Pumaman

Ok, you need to bear in mind that the screen only gets updated after repeatedly_execute_always has finished running.

Therefore what's happening is that when signTimer1 reaches 0, it is restoring the old copy of the screen, but not drawing anything to it before the end of the funtion. That means that you get 1 frame with no text on the screen, which causes the flickering effect.

In order to fix it, just move the "if (signTimer1 == 0)" block of code ABOVE the "    if (pixelsright!=0 && signTimer1!=0)" code -- and do a similar thing for the signTimer2 and signTimer3 blocks of code too.

That way, when the timer reaches 0, it will clear the screen and then immediately redraw it at the new X position, and you won't see the flicker.

AdamM

Thanks CJ, you rock.

My last two hurdles are:

1) Fixing the function for messages longer than the sign
2) Fixing the function to run more than once simultaneously on the same screen

After a night of trial-and-error with some more amateur code I've solved the first one, but thinking about the second one poses a puzzler. Is it possible?

Pumaman

Well, you'd just need to have a copy of all the relevant variables (eg. signTimer1, signTimer2, etc) for each sign on the screen. You could do this by converting the variables to arrays, or better perhaps creating a struct that represents a sign, and then telling the scrolling functions which struct to operate on.

SMF spam blocked by CleanTalk