How to modifiy line() width
Lox Chatterbox

I want to increase the width of the line() function. How should I implement it?

LennyLen

You'd be best switching to Allegro 5, which allows you to set the thickness of the line.

Todd Cope

There are a several ways to accomplish this in Allegro 4. I'll list a few below:

  1. do_line()

  2. polygon()

  3. rectfill()

do_line() is probably the easiest. I would probably just pass it a callback that renders a circle that has a diameter the desired thickness. These circles should be centered around the x- and y-coordinates Allegro passes to the callback. This is somewhat wasteful as it will rewrite many pixels as the line is drawn. It may not matter depending on what you are trying to accomplish.

rectfill() can be used if your line is parallel to the grid of pixels.

polygon() will require you to do some trigonometry to get the positions of the vertices needed to make the line.

Thread #618644. Printed from Allegro.cc