Mail Archives: djgpp/1998/08/01/14:00:37
From: | "I Know Not" <nobody AT nowhere DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Someone Please Help me draw a line!!!
|
Lines: | 109
|
Message-ID: | <GuIw1.1413$Wb1.761593920@newsreader.digex.net>
|
Date: | Sat, 01 Aug 1998 17:45:10 GMT
|
NNTP-Posting-Host: | 204.91.8.224
|
NNTP-Posting-Date: | Sat, 01 Aug 1998 13:45:10 EDT
|
Organization: | DIGEX, Inc. - Beltsville, MD - http://www.digex.net
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Ladies and Gents of the DJGPP world:
As a newbie, I understand that this question may be quite stupid, but I must
ask. After reading many different readme and info files I finally achieved
for the monitor to give me a sign that it actually changed to a mode 13h --
the graphics mode. However it will not show a pixel, a box or a line.
Nothing. It goes to the graphics mode and comes right back to the text
(regular) mode and finishes the program. Here is the program that I am
trying to work with:
#include <dpmi.h>
#include <libgrx.h>
#include <clipping.h>
#include "conio.h"
#include "sys/farptr.h"
/*-----------------THE LINE FUNCTION-----------------------*/
void GrLine(int x1,int y1,int x2,int y2,GrColor c)
{
clip_line(CURC,x1,y1,x2,y2);
mouse_block(CURC,x1,y1,x2,y2);
(*FDRV->drawline)(
x1 + CURC->gc_xoffset,
y1 + CURC->gc_yoffset,
x2 - x1,
y2 - y1,
c
);
mouse_unblock();
}
/*----------------------THE BOX FUNCTION-------------------*/
void GrBox(int x1,int y1,int x2,int y2,GrColor c)
{
int ox1,oy1,ox2,oy2;
isort(x1,x2); ox1 = x1; ox2 = x2;
isort(y1,y2); oy1 = y1; oy2 = y2;
clip_ordbox(CURC,x1,y1,x2,y2);
mouse_block(CURC,x1,y1,x2,y2);
if(!(oy1 -= y1)) (*FDRV->drawhline)(
x1 + CURC->gc_xoffset,
y1 + CURC->gc_yoffset,
x2 - x1 + 1,
c
);
if(!(oy2 -= y2) && ((y1 != y2) || oy1)) (*FDRV->drawhline)(
x1 + CURC->gc_xoffset,
y2 + CURC->gc_yoffset,
x2 - x1 + 1,
c
);
if((y2 = y2 - (oy1 ? y1 : ++y1) + (oy2 ? 1 : 0)) > 0) {
if(!(ox1 -= x1)) (*FDRV->drawvline)(
x1 + CURC->gc_xoffset,
y1 + CURC->gc_yoffset,
y2,
c
);
if((ox2 == x2) && ((x1 != x2) || ox1)) (*FDRV->drawvline)(
x2 + CURC->gc_xoffset,
y1 + CURC->gc_yoffset,
y2,
c
);
}
mouse_unblock();
}
/*---------------------------THE VIDEO MODE FUNCTION------------*/
void initgraph(void) {
__dpmi_regs regs;
regs.x.ax = 0x13;
__dpmi_int(0x10,®s);
}
void closegraph(void) {
__dpmi_regs regs;
regs.x.ax = 0x3;
__dpmi_int(0x10,®s);
}
/*-----------------------THE MAIN FUNCTION------------------*/
int main(void)
{
initgraph();
GrLine(100, 100, 200, 200, 15);
GrBox( 150, 150, 220, 220, 15);
closegraph();
getch();
return 0;
}
Could someone please explain how to draw a line? Please!!!
Thank you very much, I will check back to see if any replies have been
posted.
- Raw text -