Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: Blue72 on September 23, 2011, 05:56:39 pm

Title: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 05:56:39 pm
So I've found that the Text( command spaces are excellent for erasing sprites, but on some people's calculators it seems to erase one pixel below the space as well.

The TI-Basic Developer wiki says this:

"On the TI-84+ and TI-84+ SE, the Text( command may also erase a single row of pixels underneath the text: whether this occurs or not depends on whether it was the menu screen or the table that was visited last, of the two."

This is very vague to me, and I don't understand what "the menu" refers to, since it clearly isn't the homescreen. Anyone have insight?
Title: Re: Text Command Erasing Pixels
Post by: Builderboy on September 23, 2011, 06:07:06 pm
It means the Mode menu, if a calculator visits the mode menu, a flag is set that makes text erase the pixels beneath it.  Visiting a menu such as the table selection, or the metrix editor resets the flag.  On the newest OS however, there is no way to reset the flag, which can be annoying to games that rely on the text not having the erasing underneath.
Title: Re: Text Command Erasing Pixels
Post by: Yeong on September 23, 2011, 06:10:30 pm
It means the Mode menu, if a calculator visits the mode menu, a flag is set that makes text erase the pixels beneath it.  Visiting a menu such as the table selection, or the metrix editor resets the flag.  On the newest OS however, there is no way to reset the flag, which can be annoying to games that rely on the text not having the erasing underneath.
Yeah I hate that XP
Title: Re: Text Command Erasing Pixels
Post by: boot2490 on September 23, 2011, 06:16:24 pm
That's why you draw tilemaps from the bottom up.

Oh wait... the other thing.. that DOES suck!!
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 06:39:54 pm
Grrr... Can someone think of a different or better way to erase 6x6 sprites? I used to do it with lines before I though of the Text( way, but the speed benefits are such that I would find it hard to return.
Title: Re: Text Command Erasing Pixels
Post by: Yeong on September 23, 2011, 06:52:58 pm
Pxl-Off?
or install xLib or DCS7 and run:
real(12,7,A,B,A+5,B+5), where A and B is X and Y coordinate accordingly
Title: Re: Text Command Erasing Pixels
Post by: FinaleTI on September 23, 2011, 06:53:29 pm
Courtesy of ztrumpet in his Vertical Text Sprites topic:
Quote from: ztrumpet
Edit:  After I wrote this, TI released OS 2.53 MP.  It messes with the flag so you can't reset it with G-T.  Instead, you must use a small Asm program with this hex code: FDCB058EC9  However, on the old (read: better) OSes you can use G-T.
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 06:55:09 pm
I'll try that, but I'm curious as to whether Pxl-Off( would be faster than lines. Logic suggest to me that it would be both slower and larger, but am I incorrect?
Title: Re: Text Command Erasing Pixels
Post by: Yeong on September 23, 2011, 06:56:54 pm
you're correct, but it's one of the way XP
Probably using that hexcode will help you a bunch though.
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 06:59:56 pm
Maybe I'm crazy, but I want this game to be only one program and only BASIC... I'll learn Axe for my next project for sure though...

Is there really no better way to efficiently erase areas of the screen? Can I somehow check the flag and have it tell the user to go the Mode screen if it's wrong?

Also, is there a command to clear the Y= screen? It always messes stuff up when there are equations in there.
Title: Re: Text Command Erasing Pixels
Post by: Builderboy on September 23, 2011, 07:38:53 pm
If you use Pt-Off(X,Y,3) you might be able to turn it off pretty quickly using only a few hardcoded commands
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 07:48:46 pm
I think it would be better using Pt-Off(X,Y,2), if it were a cross then I wouldn't be able to get corners without overlapping.

Is it possible to read the flag? I don't really know anything about how that system works...
Title: Re: Text Command Erasing Pixels
Post by: Builderboy on September 23, 2011, 08:00:47 pm
Oh whoops yeah i meant Pt-Off(X,Y,2) x.x I forgot which number was which :P  And there is no direct way to read the flag, but you can test it by simply displaying a pixel, and then display a space above it, then detect if the pixel was erased or not
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 08:03:08 pm
How do I test if it was changed?
Title: Re: Text Command Erasing Pixels
Post by: Builderboy on September 23, 2011, 09:10:43 pm
Use pixel-test() to determine the color of the pixel
Title: Re: Text Command Erasing Pixels
Post by: ztrumpet on September 23, 2011, 10:35:54 pm
I suggest doing this:
Pt-Off(X+1,Y+1,2)
Pt-Off(X+1,Y+1)
Pt-Off(X+4,Y+1,2)
Pt-Off(X+4,Y+1)
Pt-Off(X+1,Y+4,2)
Pt-Off(X+1,Y+4)
Pt-Off(X+4,Y+4,2)
Pt-Off(X+4,Y+4)
It's not very elegant, but it's the best I can come up with.
If you can deal with it being 8 pixels long (but still 6 wide), I strongly recommend doing this:
Text(-1,Y,X,"   // One space

Good luck! :)
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 10:46:00 pm
I do appreciate all of the suggestions, but I have decided to stick with the small spaces, and add an inconspicuous pixel under text on the start menu. It checks to see if it's there, and if not, it shows an error screen which explains that the user needs to open and close the table and restart the program.  :)
Title: Re: Text Command Erasing Pixels
Post by: ztrumpet on September 23, 2011, 10:48:41 pm
I do appreciate all of the suggestions, but I have decided to stick with the small spaces, and add an inconspicuous pixel under text on the start menu. It checks to see if it's there, and if not, it shows an error screen which explains that the user needs to open and close the table and restart the program.  :)
Remember that this won't work on the MP OSes (Because TI is lame).

However, if you still want to go through with it, use this code instead of exiting:
:G-T
:DispGraph
:Full

This will automatically display the table, so then you don't even have to exit the program.
Title: Re: Text Command Erasing Pixels
Post by: Blue72 on September 23, 2011, 10:59:52 pm
How frustrating :P Ah well, I've decided to just display a warning instead that explains that it might have erasing bugs and then run the possible fix.