Author Topic: Hex to Sprite  (Read 3720 times)

0 Members and 1 Guest are viewing this topic.

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Hex to Sprite
« on: June 22, 2010, 06:32:55 pm »
i'm trying to figure out an algorithm in Axe that's quick and efficient for converting a list of numbers to a sprite. assume the hex data (which is stored in base 10) is located in L1. since there are 4 pixels in a byte i figured you could check for each pixel separately to turn it on. the left most pixel can be checked with If X>7 (X being the nibble being drawn) and the right most one can be checked with
!If X^2. but i'm unsure how to check whether the middle pixels should be turned on (other than comparing X to a list of possible values) i get the feeling i'm doing this completely wrong.

edit: i reread and decided that may be a little hard to understand so here's an example:
the hex string 00050A132346D6FF would be stored as Data(0,0,0,5,0,10,1,3,2,3,4,6,13,6,15,15)
« Last Edit: June 22, 2010, 06:35:44 pm by nemo »


SirCmpwn

  • Guest
Re: Hex to Sprite
« Reply #1 on: June 22, 2010, 06:36:09 pm »
There are 8 pixels in a byte.  The hex data is ASCII?  If so, then you can convert it to a real sprite fairly easily.  If it is the actual sprite data, then just use Pt-On(X,Y,L1

Offline nemo

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1203
  • Rating: +95/-11
    • View Profile
Re: Hex to Sprite
« Reply #2 on: June 22, 2010, 06:44:35 pm »
that doesn't work, but it made me realize that i can just store the data little bit differently and get it to work. thanks.


SirCmpwn

  • Guest
Re: Hex to Sprite
« Reply #3 on: June 22, 2010, 06:45:59 pm »
Sure thing.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Hex to Sprite
« Reply #4 on: June 23, 2010, 12:23:26 am »
Do you want to just convert sprites to data? If so, SirCmpwn made a program that is included in Omnimaga download section called Tilemap to Hex, I believe. It could maybe do what you want in that case.