Page 1 of 1

Help:Graphics in C

Posted: Fri Nov 23, 2012 12:01 pm
by rakeen

Code: Select all

#include<graphics.h>
#include<conio.h>
main()
{
   int gd = DETECT, gm;
   initgraph(&gd, &gm, "C:\\TC\\BGI");
   ellipse(100, 100, 0, 360, 50, 25);
   getch();
   closegraph();
   return 0;
}
Can anyone explain what are DETECT,gm,initgraph,closegraph?and what do they do?

Are libraries included in the IDE or the compiler?
If I compile a program having graphics library, then will the program run on(the exe file) another device without compiler?

What is that path(...TC\bgi) for?

How can I make menu(like the one we've in the top of our folder... file,tools,help) in C?

Re: Help:Graphics in C

Posted: Wed Apr 24, 2013 12:21 pm
by leonardo shawon
initgraph function is used to initialize with the graphics library and changes to the graphics screen for drawing. It is the first step you need to do during graphics programming.
closegraph closegraph function closes the graphics mode, deallocates all memory allocated by graphics system and restores the screen to the mode it was in before you called initgraph.

check this link: same problem
http://www.programmingsimplified.com/c- ... g-tutorial
What is that path(...TC\bgi) for?
>> I did not understand question.
If I compile a program having graphics library, then will the program run on(the exe file) another device without compiler?

You have to make it an .exe file. Most compiler have it. [ generally its like, make a project, write the code and then create a jar/exe file)
How can I make menu(like the one we've in the top of our folder... file,tools,help) in C?
You need to create a user interface. Some compiler like Netbeans provide drag and drop interface. You dont have to write a lot of codes and also you dont have to think about the position them. You just have to define how they are gonna react when they are being pressed/any action occurred.
What i told you is about Java. But I believe C also works in almost similar way.
Thank you.

Re: Help:Graphics in C

Posted: Wed Apr 24, 2013 2:29 pm
by Phlembac Adib Hasan
graphic.h অনেক পুরান লাইব্রেরি। এইটা এখন অচল। বর্তমানে অনেক উন্নত লাইব্রেরী আছে। যেমন-SDL,Qt,OGRE ইত্যাদি। OGRE ব্যবহার করে নাকি 3D গ্রাফিক্স করা যায়! আমি এটা কখনো ব্যবহার করি নাই অবশ্য। SDL আমার কাছে অনেক ভালো লাগে। এক সপ্তাহ আগে আমি একটা অ্যালজেব্রাইক ক্যালকুলেটরের ডিজাইন করার সময় এইটা দিয়ে ইন্টারফেস বানাইসিলাম, চমৎকার কাজ করসিল।