[cc65] tgi_sprite and friends

From: Karri Kaksonen <karri1sipo.fi>
Date: 2012-11-06 08:08:57
Hi,

The new and shiny sp65 tool can convert bitmaps to byte arrays. The 
values AX,AY are the
action point values. In this case (0,0) is the top left of the sprite.

The command sp65 -r Tree.pck -c lynx-sprite -w 
Tree.c,ident=Tree,ax=0,ay=0 would create a file
Tree.c with content like below.

/*
* This file was generated by sp65 2.13.9 from
* Tree.pcx (45x51, 15 colors, indexed)
*/

#define  Tree_COLORS       15
#define  Tree_WIDTH        45
#define  Tree_HEIGHT       51
#define  Tree_AX       0
#define  Tree_AY       0
const  unsigned  char  Tree[]  =  {
0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x44,0x44,0x44,0x44,0x4C,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,

Perhaps a good next step would be
to create two new primitives for displaying them.

The Lynx is currently using a primitive called

tgi_sprite(sprite);

for displaying a bitmap.

A more portable function could be:

tgi_spritexy(posx, posy, sprite);

The posx, posy is where to draw the action point of a sprite. If the 
graphics is a cursor array the action point
is the pixel at the arrow point. If it is a crosshair it is in the center.

This would open up a way to port graphics from one system to another as 
the sprite is machine dependent
because of different resolution, different number of colors, different size.

--
Karri

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Nov 6 08:09:16 2012

This archive was generated by hypermail 2.1.8 : 2012-11-06 08:09:20 CET