Hi, cant get sprites to work in amidevcpp - have been trying for days
I open the screen with:
Code:
genscreen = OpenScreenTags(NULL,
SA_DisplayID, LORES_KEY,
SA_Depth, 4,
// Give me a lot of border
SA_Width, 320,
SA_Height, 256,
SA_Overscan, 0,
// Hold the titlebar, please
SA_Quiet, TRUE,
// Give me sysfont 0 as default rastport font.
SA_SysFont, 1,
SA_Draggable,0,
SA_Exclusive,1,
SA_Colors,ColorSpec,
SA_Type, CUSTOMSCREEN,
TAG_DONE);
and can easily draw with standard RectFill etc, but cant get sprites to work.
My spritedata:
Code:
UWORD sprite_data[]={
0, 0, /* position control */
0xffff, 0x0000, /* image data line 1, color 1 */
0xffff, 0x0000, /* image data line 2, color 1 */
0x0000, 0xffff, /* image data line 3, color 2 */
0x0000, 0xffff, /* image data line 4, color 2 */
0x0000, 0x0000, /* image data line 5, transparent */
0x0000, 0xffff, /* image data line 6, color 2 */
0x0000, 0xffff, /* image data line 7, color 2 */
0xffff, 0xffff, /* image data line 8, color 3 */
0xffff, 0xffff, /* image data line 9, color 3 */
0, 0 /* reserved, must init to 0 0 */
};
My sprite show code:
Code:
struct SimpleSprite * sprite;
int sprite_num = GetSprite(sprite, 1);
if (sprite_num != -1) {
// here still is ok, usually get sprite num =1
// create a emty pointer
UWORD * spritedata;
// allocate chipmemory
spritedata=(UWORD) AllocMem(sizeof(sprite_data),MEMF_CHIP);
// copy sprite data into chipmemory
CopyMem(sprite_data,spritedata,sizeof(sprite_data));
// still all ok - get correct data in spritedata
ChangeSprite(NULL, sprite, &spritedata); // no error
// but no sprite!!!
}
I have seren examples where you need to set
sprite->x=0;
sprite->y=0;
sprite->height=9;
but cant do that in amidevcpp - get compile error "dereferencing pointer to incomplete type"
Any help is appreciated.
Regards....