xLib Grayscale

With xLib grayscale is very easy and good. You might think now: Basic? Grayscale? I couldn't find a xLib command that does that? Then your right: there is not such a command. You'll have to trick a bit for it with recalling a pic very often in XOR-logic, so inversion.
So you have a normal screen and a other image that is recalled in XOR often.

For example, your screen is like this:
This is in pic 1:

Then you have this code:

:DelVar A
:Repeat A

And till you press a key the screen will be like this:

Ok, as you may notice the image in pic 1 is very often recalled in XOR-logic, and that seems then as grey scale.

Now some training:
Try to make this sprite:

Ok, the image that inverts everything is obvious, because it is just everywhere where it is supposed to be grey:

More complicated is the image that should be displayed a the beginning. You might think of this:
It would work out, but the grey wouldn't look to good.

Better is this:
because of the checked tiles it seems better to the eye, it is a optical solution.
So if you have dcs the code to display that in grey till a key is pressed would be:

:real(0,0  //clears the screen
:identity(5,"00003C3C3C3C0000",0,0,1,8,0,0,0  //draws the sprite that will invert the screen
:identity(1,1,1  //saves it in pic 1
:real(0,0  //clears the screen
:identity(5,"FF81A995A99581FF",0,0,1,8,0,0,0  //the sprite, the grey thing is checked
:Repeat Ans  //repeats till something is in Ans
:real(3,1,3,1,1  //inverts the screen with pic 1
:getKey  //puts the Key in Ans


Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License