TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: MIKE DELEONARDIS
from: HERMAN SCHONFELD
date: 1998-04-17 08:58:00
subject: Pixel

MD>Does anyone know how to put a red pixel at location 10,30?
MD>am i not being able to do it because graphics.h is screwed up?
Are you using the bgi? If so, don't try custom code. Use the functions it 
provides. If, however, you want to do custom graphics. Here are some 
functions.
I hope you have a 32bit compiler handy.
#ifdef __DJGPP__
char *vga = NULL;
#endif
#ifdef __WATCOM__
char *vga = (char *) 0x0A0000;
#endif
void setmode(unsigned char mode)
{
  #ifdef __WATCOM__
  union REGS r;
  r.h.al = mode;
  r.h.ah = 0x0;
  int86(0x10, &r, &r);
  #endif
  #ifdef __DJGPP_
  __dpmi_regs r;
  r.h.al = mode;
  r.h.ah = 0x0;
  __dpmi_int(0x10, &r);
  __djgpp_nearptr_enable()
  vga = (char *)(0xA0000 + djgpp_conventional_base);
  #endif
};
void putpixel(int x, int y, int c)
{
  vga[y*320+x]=c;
};
int getpixel(int x, int y)
{
 return vga[y*320+x];
};
... Best file compressor around: DEL *.* (100% compression!)
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.