Omnimaga

Calculator Community => TI Calculators => TI-BASIC => Topic started by: meishe91 on May 02, 2010, 05:57:23 pm

Title: Hex with Sprites
Post by: meishe91 on May 02, 2010, 05:57:23 pm
Hello All,

Could someone please explain how hex works with creating sprites and all that? All I really know is that [FFFFFFFFFFFFFFFF] creates a solid 8*8 block while [0000000000000000] leaves a blank 8*8 area. Any help is very appreciated :)
Title: Re: Hex with Sprites
Post by: calcdude84se on May 02, 2010, 06:13:01 pm
Well, do you know how hex is just a representation of binary? 0=0000,1=0001, and so on, with C=1100, E=1110, and all the other hex digits.
You basically just draw your 8*8 sprite, and then for each row make two hex digits, one for each four bits in the row. For example, 11001001 is C9. Do this and you will have 8 pairs of digits, for 16 total. Reading these left to right, top to bottom gives the hex code for the sprite.
For the reverse, put the 16 digits into 8 rows, two digits in each row. Replace each digit with the binary that corresponds to it, and you'll have an 8*8 sprite.
Maybe I forgot to mention this, but black pixels are 1's and white pixels 0's.
Hope this helps!
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 02, 2010, 06:17:04 pm
0=00000000
1=00000001
2=00000010
3=00000011
4=00000100
5=00000101
6=00000110
7=00000111
8=00001000
9=00001001
A=00001010
B=00001011
C=00001100
D=00001101
E=00001110
F=00001111

10=00010000
20=00100000
30=00110000
40=01000000
50=01010000
60=01100000
70=01110000
80=10000000
90=10010000
A0=10100000
B0=10110000
C0=11000000
D0=11010000
E0=11100000
F0=11110000


A 8x8 binary sprite is made of 8 binary strings of 8 numbers. 1=black and 0=white. If for example, the first row of your sprite is 11011011, separate it like this:

1101 1011
First, using the chart above, would be D, while the second would be B, in hex. Combined together gives DB. If you got a 8x8 sprite, repeat the process with all 8 rows of pixels.

Alternatively there are some pic to hex or bin to hex converters in the Axe parser forum and on ticalc.org, which speeds up the process in some cases, but I think the method above is the fastest to convert them manually.
Title: Re: Hex with Sprites
Post by: tifreak on May 02, 2010, 06:22:36 pm
let's not forget http://www.ticalc.org/archives/files/fileinfo/389/38904.html

It was made specifically for this function, converting a sprite into hex code. ^ ^
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 02, 2010, 06:25:47 pm
Oh forgot about that one, thanks for reminding me ^^
Title: Re: Hex with Sprites
Post by: meishe91 on May 02, 2010, 08:15:29 pm
Thanks guys :) I'm not really looking for a "Sprite-to-Hex" converter (besides to look for examples of how) because I just needed to kinda understand the basics so I can hopefully implement it into a program I plan to work on soon.
Title: Re: Hex with Sprites
Post by: tr1p1ea on May 02, 2010, 08:23:47 pm
CalcGS is also highly recommended. It supports sprites & tilemaps plus 4-level grayscale and will export data that you can use with your assembler.

http://www.ticalc.org/archives/files/fileinfo/132/13274.html
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 02, 2010, 08:31:58 pm
Doesn't calcgs import sprite data in a rather strange way, though?
Title: Re: Hex with Sprites
Post by: Quigibo on May 02, 2010, 09:09:26 pm
I use this one.  Its really basic, but its great for monochrome images and supports any size you want.

http://www.ticalc.org/archives/files/fileinfo/134/13415.html (http://www.ticalc.org/archives/files/fileinfo/134/13415.html)
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 02, 2010, 09:15:53 pm
that one gave me an hard time, though x.x

When I tried to run it I ended up with full of missing .OCX/.DLL errors and had to go search them online to get it to work x.x
 
To anyone wanting to use this program, watch out for viruses if you download OCX files because some sites aren't very legit x.x
Title: Re: Hex with Sprites
Post by: meishe91 on May 02, 2010, 09:28:39 pm
Isn't that the one in the downloads section? Or is that a different one?
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 02, 2010, 10:31:18 pm
It's in the downloads sections. I still need to add a few alternatives, though.
Title: Re: Hex with Sprites
Post by: tr1p1ea on May 03, 2010, 01:01:50 am
With CalcGS you can import from the clipboard or from BMP's. The only thing you have to remember is to set the size.
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 03, 2010, 01:06:27 am
can it import tiles from a BMP tilesheet? I mean, will it separate them in 8x8 tiles if you tell it to do so?
Title: Re: Hex with Sprites
Post by: tr1p1ea on May 03, 2010, 02:02:43 am
It certainly will.
Title: Re: Hex with Sprites
Post by: DJ Omnimaga on May 03, 2010, 02:33:27 am
Ok thanks for the info :)