www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/11/28/16:32:59

From: Paulo Marques <pie AT mail DOT telepac DOT pt>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Pointer to a function & calling this function after... (VESA LIB)
Date: Wed, 26 Nov 1997 19:38:12 +0100
Organization: PIE
Lines: 32
Message-ID: <347C6C94.3963@mail.telepac.pt>
References: <3477ACD7 DOT 29CFC486 AT polymtl DOT ca>
NNTP-Posting-Host: 194.65.176.219
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Jonathan Villani wrote:
> My problem is that i want to have a pointer that contains the address of
> my putpixel function depending on what mode i am (8bpp to 32bpp) each
> one as a function. 

> void main()
> {
> void far *pix_func = NULL; /* My pointer to the RIGHT putpixel function*/

> /* Select the RIGHT put pixel function */
> if (mode == _8bpp)
>  pix_func = &pix8();          /* get address of putpixel function in
> 8bpp */
> 
> if (mode == _24bpp)
>  pix_func = &pix24();       /* get address of putpixel function in 24bpp

	I suggest that you try to use the right syntax for the function
pointers:

  void (*pix_func)(word,word,byte)=NULL;

and then make the assignements like:

  pix_func=pix24;

	About the assembly part, i gave up assembly after i've seen
assembly code build from C++ programs compiled with DJGPP.
	I once made a class "Sprite" that had the hability to draw
a bitmap inside a 4 vertex poligon streched in any way, and compiled
everything with DJGPP. The final code was able to draw about 2000
polygons a second on my 486 AT 80Mhz machine at that time.

- Raw text -


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