News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

[CPCtelera] sprite conversion/display not right

Started by awergh, 13:30, 27 June 16

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

awergh

It seems I've run into some trouble making sprites display correctly.

So I have an "exciting" 6x5 sprite that I drew in Gimp following these instructions.
Creating images for the Amstrad - CPCWiki
[attachimg=1]

I then converted it like so:

cpct_img2tileset -m 0 -tw 6 -th 5 red.png

PROCESSING FILE 'red.png'
CPC Mode        : 0
Tile Size       : 6x5 pixels
Interlaced Mask : no
Transparency    : no
Generate Tileset: no
Basename        : 'g_tile'
Palette         : 1 24 20 6 26 0 2 8 10 12 14 16 18 22 24 16 (Firmware values)
[PROCESSING] Converting tiles to CPCtelera's C code using Img2CPC...
SUCCESS! Files 'red.c' and 'red.h' have been created with CPCtelera's codification of tiles/sprites from 'red.png'.


I then include the generated source files and I get this result.
[attachimg=2]


cpct_disableFirmware();
cpct_memset(CPCT_VMEM_START, 0, 0x4000);
cpct_setVideoMode(0);
pvmem = cpct_getScreenPtr(CPCT_VMEM_START, 20, 96);
cpct_drawSprite(g_tile_red, pvmem, 6, 5);



EDIT:
Nevermind it appears that I have to set the width to be 3 instead of 6 as the array generated is [3 * 5].

EgoTrip

Don't forget the co-ords are in bytes, not pixels. So for MODE 0 you have to halve the x and in MODE 1 quarter it.

awergh

that makes sense I clearly didn't pay enough attention to the doco

Powered by SMFPacks Menu Editor Mod