Page 1 of 1

### Drawing lines/pixels

Posted: Mon Jun 26, 2017 3:04 am
Hi guys,

I'm just starting out with 68k asm and making some progress. I decided to go this route just as a pure learning experience (I have done a few demos in C wirh the SGDK before) and I want to make something similar to an Android game I published a few years back.

Basically it has a poly web like Tempest that I want to do with line art and rotate. The 3D rotational math etc I've done when building engines in C++ so I think I can handle that but I was wondering in the Genny's tile based system how it would be possible to draw lines from point to point?

As I said I'm just starting out with asm. Just getting stuff showing on screen so this is very new, different and exciting for me. In other words, what would be the processes to follow? Not asking for code just a general idea on how this would work so I can figure it out

### Re: Drawing lines/pixels

Posted: Mon Jun 26, 2017 5:59 am
I had to solve this exact problem for Big's Fishing Derby. The basic idea is that you have to draw a line using one tater algorithm (e.g., Bresenham's) into a tile buffer.

But how this goes will depend on whether you are drawing the line with sprites or with planes: if using planes, you can draw the tiles more or less independently and update the tilemap whenever you are done with a tile; for sprites, you have to determine if it would be better to keep the tiles together, forming a bigger sprite, or if you have to split them into more sprites, and go on generating the sprites along with the tiles.

### Re: Drawing lines/pixels

Posted: Mon Jun 26, 2017 8:15 am
flamewing wrote:I had to solve this exact problem for Big's Fishing Derby. The basic idea is that you have to draw a line using one tater algorithm (e.g., Bresenham's) into a tile buffer.

But how this goes will depend on whether you are drawing the line with sprites or with planes: if using planes, you can draw the tiles more or less independently and update the tilemap whenever you are done with a tile; for sprites, you have to determine if it would be better to keep the tiles together, forming a bigger sprite, or if you have to split them into more sprites, and go on generating the sprites along with the tiles.
Interesting. I thought about sprites but then I'd have to rotate them individually to keep up with the overall object's rotation. I think this might be a bit advanced to worry about at this stage... will have a look into it though. Thanks for the info

### Re: Drawing lines/pixels

Posted: Mon Jun 26, 2017 8:43 am
How would this be done with polygons?

### Re: Drawing lines/pixels

Posted: Mon Jun 26, 2017 8:58 am
Maybe you can have a look on the SGDK bitmap engine :

https://github.com/Stephane-D/SGDK/blob ... /src/bmp.c
https://github.com/Stephane-D/SGDK/blob ... rc/bmp_a.s

It contains both line and polygon drawing code (in assembly here)

### Re: Drawing lines/pixels

Posted: Tue Jun 27, 2017 2:44 am
Thanks! That should help get me started