Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: dinosteven on November 09, 2012, 09:48:51 pm

Title: Sprites and Greyscale
Post by: dinosteven on November 09, 2012, 09:48:51 pm
So... How do I do a Pt-On() where only the 'on' points are turned on?
How do I make it so it graphs that to both buffers?
Do I need to use two commands, or can I do it all in one command?
And the same questions for Pt-Off()
Title: Re: Sprites and Greyscale
Post by: squidgetx on November 09, 2012, 09:53:58 pm
Pt-On uses 'or' logic, so any black pixels in your sprite will be drawn black (n or 1 = 1), and anything white in the sprite will be transparent (n or 0 = n)
Pt-Off overwrites completely, so black will be black and white will be solid white.

To make them draw to the backbuffer, just add the ^r (radians symbol) at the end
Title: Re: Sprites and Greyscale
Post by: dinosteven on November 09, 2012, 10:00:03 pm
How do I use an inverse function? Where it makes a white where it should be black, and black where it should be white?
And can I write to both buffers in one command? Not
Pt-On(X,Y,Pic1):Pt-On(X,Y,Pic1)^r
but Pt-On(X,Y,Pic1)^Coolsymbol
Title: Re: Sprites and Greyscale
Post by: squidgetx on November 09, 2012, 10:04:42 pm
You can't do it in one command, nor should you want to. Grayscale sprites come in two layers, so (well, I guess you waste a few cycles reloading the x and y arguments) you'd most commonly have code that looks like pt-on(x,y,pic1) : pt-on(x,y,pic1+8)r
Pt-Change is the invert, and it uses xor logic. So anything black on the sprite will be black if the pixel that's being drawn on is white, (1 xor 0 = 1), and white (invert) if the pixel it's being drawn on is black (1 xor 1 = 0). White pixels in the sprite will be transparent (n xor 0 = n)
Title: Re: Sprites and Greyscale
Post by: dinosteven on November 09, 2012, 10:39:28 pm
So say something is all white on the main buffer and either all black or all white on the back buffer. I want to do a Pt-On() of a sprite to both buffers so the black points are entirely black and the white points of the sprite depend on how it already was.
I also want to use the same sprite and turn on all points that should be white in the main buffer and turn off all points that should be white.
Basically, I want to output a sprite and its exact inverse onto a possible grey background.
Title: Re: Sprites and Greyscale
Post by: shmibs on November 10, 2012, 02:27:16 am
could you draw that in a picture? i'm not really getting what you're trying to say.
Title: Re: Sprites and Greyscale
Post by: willrandship on November 10, 2012, 02:58:50 am
Easiest and fastest way to draw an inverse sprite: Draw a filled sprite (or a black square) and pt-change on top of it. Great way to get transparency
Title: Re: Sprites and Greyscale
Post by: dinosteven on November 10, 2012, 08:49:18 am
Here's what I wanted. Making the sprite black or white without any grey on it, regardless of the state of the background.
EDIT: But my RAM just cleared randomly, deleting all my sprites. ARGH
Title: Re: Sprites and Greyscale
Post by: willrandship on November 10, 2012, 08:55:26 am
Well, that depends on what you're using. If you're using Black and white only, you ignore the back buffer entirely, but when using 3 or 4-level greyscale, just draw the sprite to both layers. That way, if it's black, it's all the way black, and white is all the way white.

To draw black, use pt-On.

To draw white, use pt-On then pt-Change (fill then invert)

To get a combination of the two, use pt-On with a silhouette, and use pt-change with a different sprite, which has all the white pixels as black.
Title: Re: Sprites and Greyscale
Post by: aeTIos on November 10, 2012, 08:56:56 am
I think pt-off is what you need.
EDIT: and an additional pt-off()^r when you use 4-lv gray.