A89: Re: Sprites with ti-gcc


[Prev][Next][Index][Thread]

A89: Re: Sprites with ti-gcc




> How do I make a sprite for the ti-gcc compiler?  I read through the
> documentation but I don't know how to define a sprite.  What I have is:
>
> static unsigned int sprite[8][8] = {{0,1,1,1,1,1,1,0},
>                                 {1,1,0,1,1,0,1,1},
>                                 {0,1,1,1,1,1,1,0},
>                                 {0,0,0,1,1,0,0,0},
>                                 {0,0,0,1,1,0,0,0},
>                                 {0,0,0,1,1,0,0,0},
>                                 {0,0,0,1,1,0,0,0},
>                                 {0,0,0,1,1,0,0,0}};
>
> But when I use this it just gives me a 1pixel thick line?  The sprite routine
> I'm using is:
>
> Sprite16 (30, 30, 8, sprite, LCD_MEM, SPRT_OR);
>
> How do I make a sprite that I want to use?

That code creates data that is 8*8*2 = 128 bytes big. You can't write bits
directly in C like that - you have to write it in bytes or words:
(I assume that Sprite16 takes words here)

static unsigned int sprite[8] =
{0x007e,0x00db,0x007e,0x0018,0x0018,0x0018,0x0018,0x0018};

Now, designings sprites like this is a real pain, so usually a program is used
that converts graphic data to sprite data (like my own raw2sprite) or a sprite
editor is used that can output C code (there are some on ticalc, and I think the
IDE will have that ability someday).

 / Niklas Brunlid
Check out Prosit for the TI-89 / TI-92+ at http://prosit.ticalc.org
Random PQF Quote follows:

The Ephebians made wine out of anything they could put in a bucket, and ate
anything that couldn't climb out of one.
        -- (Terry Pratchett, Pyramids)





Follow-Ups: References: