Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: dinosteven on October 08, 2012, 09:22:52 am

Title: Grayscale Problems
Post by: dinosteven on October 08, 2012, 09:22:52 am
I can't get my grey timer to work!
Where T goes from 375 to 0, my code:
Code: [Select]
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
It works, but it leaves behind some residue. ??? Why?

Also, in a totally separate problem, is there a way to display both buffers together without flashing between the two? I want to use the back buffer as something I can pxl-test() separately from the main buffer, but I don't want it to be grey.
Title: Re: Grayscale Problems
Post by: cooliojazz on October 08, 2012, 11:02:20 am
Make sure you are clearing the back buffer between each usage (ClrDrawr), otherwise you will get 2 pixel tall blocks left behind as it inverts it.  (Also: shouldnt the first be solid and the second inverted?)

As for displaying both buffers, im not sure exactly what you are asking.  Are you trying to mask them of something?  if you want to just draw them both together, doing DispGraph:DispGraph(L3) will draw them one on top of the other.  if you just want to be able to pxl-test the back buffer though, you dont actually have to draw it, just use pxl-Test()r.  Maybe i'm missing something, what are you actually trying to do?
Title: Re: Grayscale Problems
Post by: dinosteven on October 08, 2012, 11:48:36 am
I clear the buffer with [ClrDraw^rr] so it clears both. What it's supposed to do is erase the whole timer, then draw the parts that are left in the timer. Then I do DispGraph^rr.
Changing the order makes it fill grey from top to bottom (quite smoothly), but I want it to be all grey and have white come down until it's all white.

You solved my other problem with DispGraph:DispGraph(L3)!
I wanted to display them both as 1 buffer, but be able to pxl-test() them separately. I can do that now, thanks!
Title: Re: Grayscale Problems
Post by: dinosteven on October 25, 2012, 09:36:03 pm
*bump
Code: [Select]
:375->T
:Repeat T=0
:T--
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
:End
It leaves some residue; please tell me how to fix this!
Title: Re: Grayscale Problems
Post by: Hayleia on October 26, 2012, 01:18:55 am
Would you mind posting more of your code ? For now, there is no chance to leave any residue anywhere since there is no DispGraph or DispGraph^r

Is this what you are trying to do ?
(http://img.removedfromgame.com/imgs/m.gif)

If so, the right code (unoptimized) is:
:375->T
:Repeat T=0
:T--
:RectI(76,62-(T*2/15),8,T*2/15)^^r
:.draw the rectangle
:DispGraph^^r
:RectI(76,62-(T*2/15),8,T*2/15)^^r
:.erase the rectangle
:End
Title: Re: Grayscale Problems
Post by: dinosteven on October 26, 2012, 08:14:17 am
It's in a game I'm making. Here's the code with a dispgraph
Code: [Select]
:375->T
:Repeat T=0
:T--
:RectI(76,12,8,50)^r
:Rect(76,62-(T*2/15),8,T*2/15)^r
:DispGraph^rr
:End
Yeah, forgot the DispGraph^rr. But that's essentially what the problem code in the game is.
I'm too lazy to make a new .gif, so here's an old one I made showcasing the menu. You can see the residue pretty easily. Also attached my source for the game.
Title: Re: Grayscale Problems
Post by: Darl181 on October 26, 2012, 08:27:48 am
Try putting the T-- after the RectI(). If I'm reading the code right, that's what's erasing the rectangle?

Edit: ok looked it a bit more closely..what's going on is the top part of the rectangle isn't being erased, it's just being inverted every frame. If the rectangle were on the front buffer, you'd see it leaving a kind of flickery mess behind :P Because of how the grayscale works, it leaves a flickery crosshatch behind.
I'm guessing here, but try this:

375->T
Repeat T=0
RectI(76,62-(T*2/15),8,T*2/15)^r
T--
Rect(76,62-(T*2/15),8,T*2/15)^r
DispGraph^rr
End


Edit2: what heyleia did looks like it works too.
Title: Re: Grayscale Problems
Post by: Hayleia on October 26, 2012, 10:38:07 am
Edit2: what heyleia did looks like it works too.
(Who's "heyleia" ? Don't know that person :P)
Title: Re: Grayscale Problems
Post by: Darl181 on October 26, 2012, 11:02:45 am
Hm, guess that's what posting at ~5 in the morning causes :P
Title: Re: Grayscale Problems
Post by: dinosteven on October 26, 2012, 07:02:05 pm
Thank you. So. Very. Much. It works!
Title: Re: Grayscale Problems
Post by: dinosteven on October 26, 2012, 08:32:36 pm
Also, Hayleia, where did you get that font? I looks awesome; I want it!

EDIT: I suppose this isn't really worth a new post, so it's an edit:
Thanks for the font link. This inspired me to get zStart working again (it used to always crash) and it doesn't crash now!
Title: Re: Grayscale Problems
Post by: Darl181 on October 26, 2012, 10:25:18 pm
Glad to hear it's working now :)

Edit: also a friendly reminder: double-posting in a short time span (less than around 6 hrs or so) is generally discouraged, you can edit the already-made post instead ;)
Title: Re: Grayscale Problems
Post by: Hayleia on October 27, 2012, 01:11:01 am
Thank you. So. Very. Much. It works!
Glad to be helpful :)
Also note that the code I provided is not optimized at all, you could routinize the Rect call instead of putting twice the same command.

Also, Hayleia, where did you get that font? I looks awesome; I want it!
It is Spyro's font (http://ourl.ca/10110/285258) (you need zStart (http://ourl.ca/10110/315102) to use it). I only changed the cursors, all the rest is his work.