initwindow()
doesn't seem to work, nor does initgraph()
.
How do I set the width and height of the window?
initwindow()
doesn't seem to work, nor does initgraph()
.
How do I set the width and height of the window?
I got my info from https://askubuntu.com/questions/525051/how-do-i-use-graphics-h-in-ubuntu...
/* demo.c*/
#include<graphics.h>
int main()
{
int gd = DETECT,gm,left=100,top=100,right=200,bottom=200,x= 300,y=150,radius=50;
initgraph(&gd,&gm,NULL);
rectangle(left, top, right, bottom);
circle(x, y, radius);
bar(left + 300, top, right + 300, bottom);
line(left - 10, top + 150, left + 410, top + 150);
ellipse(x, y + 200, 0, 360, 100, 50);
outtextxy(left + 100, top + 325, "C Graphics Program");
delay(5000);
closegraph();
return 0;
}
This seems like graphics.h
has a defined DETECT
variable that I would assume would detect your default width / height. Look into that and I think you may find your answer.
This library is ancient. I wouldn't be surprised if you found a system that doesn't support it.
Use any of:
(Okay, you can do this, but please don't)
The BGI library is very old. But it was very good, convenient, and useful. Consequently, there are quite a few working versions floating around.
Some versions let you set any arbitrary window size.
Some versions only permit some window sizes.
Some versions don't let you choose.
Hence, you absolutely must read the documentation that came with whatever version you are using to see how to properly initialize the window, and which function to call.
You can try this:
initwindow(1000, 1000); /* (size X, size Y) */
setactivepage(0);