Omnimaga
Calculator Community => TI Calculators => TI-BASIC => Topic started by: {AP} on February 13, 2009, 12:47:16 pm
-
Updated multiple times due to unexpected problems.
Everything works fine in this version.
I apologize for anyone who may have been following the old version. (it won't crash your calc or anything, just look weird)
Here's a quick "Spriting with Hex Code" tutorial.
Hex code is just a series of numbers and letters 0-9 and A-F.
Each digit is responsible for 4 pixels.
X = on (black)
. = off (white)
0 - ....
1 - ...X
2 - ..X.
3 - ..XX
4 - .X..
5 - .X.X
6 - .XX.
7 - .XXX
8 - X...
9 - X..X
A - X.X.
B - X.XX
C - XX..
D - XX.X
E - XXX.
F - XXXX
Here's an example of an S sprite.
In full it's "007C82807C02827C". (look at the digits in the parentheses on the side in order)
0 -> . . . . | . . . . <- 0 (00)
7 -> . X X X | X X . . <- C (7C)
8 -> X . . . | . . X . <- 2 (82)
8 -> X . . . | . . . . <- 0 (80)
7 -> . X X X | X X . . <- C (7C)
0 -> . . . . | . . X . <- 2 (02)
8 -> X . . . | . . X . <- 2 (82)
7 -> . X X X | X X . . <- C (7C)
Any questions, just ask.
-
So if it is just a string, ("007C82807C02827C") how does it know to make a square image? Lets say I wanted to make a 94 by 62 image like that. How would I? How do you tell it how to form the image?
-
HOly necro post
Basically Celtic3 takes the hex value and uses it with a asm sprite routine. the way it reads the string its stored like a actual data for a sprite in memory.
and for that consult the celtic 3 read me its all listed in there ^_^ (i dont have a copy handy sorry :/)
-
Hehe, nice :) Okay, so I am assuming this is for the identity(5 command? If so, you will need to know how to convert binary to hex which isn't too difficult. Each hex digit is 4 bits or pixels. So for the byte on the screen 01111110, we get the first pixel off followed by 6 pixels on and then a pixel off. Convert this to hex and you have "7E" as a more compressed form :) However, if you want an easier. If you want to make a sprite that is two bytes wide and 3 pixels tall:
01111111 11111110 = 7F FE
10000000 00000001 = 80 01
01111111 11111110 = 7F FE
So we would use the code "7FFE80017FFE" for the picture :) You can likewise apply this to wider and taller sprites, however for a sprite that large, it is better to just use a picture. You can use the xLIB functions of Celtic 3 to make hacked pictures (I think they are real(3 and real(9)
I hope this helps?
EDIT: I used to code a lot with Celtic 3, so I know I have the readme somewhere on my computer. Hopefully next time I will be able to give a better answer :)