delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/29/11:15:28

From: Laurence Withers <lwithers AT lwithers DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Some functions in Allegro I'm not sure of.
Date: Sat, 29 Aug 1998 16:10:04 +0100
Organization: IP
Message-ID: <qwXH8aAMnB61EwKD@lwithers.demon.co.uk>
References: <6s87mb$9hq$1 AT toto DOT tig DOT com DOT au>
NNTP-Posting-Host: lwithers.demon.co.uk
MIME-Version: 1.0
Lines: 32
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

--- Original Message ---
From: Deathifier <storey AT tig DOT com DOT au>
Time: Sat, 29 Aug 199816:38:36

[snip]
>void do_line(BITMAP *bmp, int x1, y1, x2, y2, int d, void (*proc)());
[snip]
>I understand most of it, except for:
>int d
>void (*proc) ()
[snip]

OK, what you want to do is have a function that will be called for each
discrete point along the line. For example:

void my_putpixel(BITMAP *bmp, int x, int y, int d)
{
    // draw a pixel on bmp and x, y using color d
}

Then, call the do_line function:

  do_line(screen, 0, 0, 639, 479, 1, my_putpixel);
or
  void(*proc)();
  proc = my_putpixel;
  do_line(screen, 0, 0, 639, 479, 1, my_putpixel);

HTH. Mail me if you need more help. Bye for now,
-- 
Laurence Withers, mailto:lwithers AT lwithers DOT demon DOT co DOT uk
OPES Homepage:   http://www.lwithers.demon.co.uk/opes/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019