 |
GrayGetSwitchCount |
Function (Macro) |
Returns the current plane switch counter.
Previous versions of the TIGCC (up to v0.91) grayscale support were lacking a
mechanism to synchronize to the internal switching of the grayscales planes,
which is quite necessary for almost any kind of "high-speed" games where the
grayscale graphics change a lot.
This is why Thomas Nussbaumer implemented a plane switch counter which is
increased after every processed plane switch.
A complete grayscale frame consists of 2 plane switches.
GrayOn resets the switch counter value to 0.
A program which wants to synchronize to the plane switching within a loop can do
this like this, for example:
unsigned long cur_count = GrayGetSwitchCount ();
do {
unsigned long wait_for = cur_count + 2;
while ((cur_count = GrayGetSwitchCount ()) < wait_for);
// We'll always come here after the same plane
// (dark plane or light plane) was switched.
// Do something here ...
} while (some_condition);
Deprecated alias: GetGraySwitchCount
See also: GraySetSwitchCount