Page 2 of 2

Re: polygon is not drawn

Posted: Fri Jul 15, 2022 2:43 pm
by cero
You didn't allocate it, and wrote to random memory. You really need to review your C basics.

Re: polygon is not drawn

Posted: Fri Jul 15, 2022 6:57 pm
by alko
:oops:

Code: Select all

 line = MEM_alloc( sizeof(Line));

Re: polygon is not drawn

Posted: Fri Jul 15, 2022 9:26 pm
by alko
Also I want to place sprite behind two layers.

1.) how to set offset address of sprite after:

Code: Select all

 u16 ind = BMP_FB1ENDTILEINDEX    ;
 ind += cabin.tileset->numTile;
 

2.) how to set attributes priority?

Image

Re: polygon is not drawn

Posted: Tue Jul 19, 2022 10:00 am
by Stef
alko wrote: Fri Jul 15, 2022 6:57 pm :oops:

Code: Select all

 line = MEM_alloc( sizeof(Line));
No, it's really overkill and you may not release it properly later.
Just use static structure for that:

Code: Select all

 Line line;
line.pt1.x =0;
line.pt1.y =0;
line.pt2.x =100;
line.pt2.y =100;
line.col=10;

BMP_drawLine(&line);

Re: polygon is not drawn

Posted: Thu Aug 11, 2022 9:22 pm
by alko
I placed a sprite and artifacts appeared

Code: Select all

 BMP_init(TRUE, BG_B, PAL1, TRUE);
    BMP_setBufferCopy(TRUE);
    SYS_enableInts();
   u16 ind = BMP_FB1ENDTILEINDEX    ; //TILE_USERINDEX;
VDP_setPalette(PAL0, cabin.palette->data);
VDP_drawImageEx(BG_A, &cabin, TILE_ATTR_FULL(PAL0, TRUE, FALSE, FALSE, ind),0, 0, FALSE, TRUE);
ind += cabin.tileset->numTile;

SPR_init();

VDP_setPalette(PAL2, earth.palette->data);
sprites[0] = SPR_addSprite( &earth ,160, 100, TILE_ATTR(PAL2, FALSE, FALSE, FALSE));
SPR_setVRAMTileIndex(sprites[0],ind);

SPR_update();
SYS_doVBlankProcess();

Image