Re: polygon is not drawn
Posted: Fri Jul 15, 2022 2:43 pm
You didn't allocate it, and wrote to random memory. You really need to review your C basics.
Sega Megadrive/Genesis development
https://gendev.spritesmind.net/forum/
Code: Select all
line = MEM_alloc( sizeof(Line));
Code: Select all
u16 ind = BMP_FB1ENDTILEINDEX ;
ind += cabin.tileset->numTile;
No, it's really overkill and you may not release it properly later.
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);
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();