Help:Graphics in C

Discuss Computer Science and Programming related problems

Moderators: bristy1588, Labib

User avatar
rakeen
Posts: 384
Joined: Thu Dec 09, 2010 5:21 pm
Location: Dhaka

Help:Graphics in C

Unread post by rakeen » Fri Nov 23, 2012 12:01 pm

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?
r@k€€/|/

User avatar
leonardo shawon
Posts: 169
Joined: Sat Jan 01, 2011 4:59 pm
Location: Dhaka

Re: Help:Graphics in C

Unread post by leonardo shawon » Wed Apr 24, 2013 12:21 pm

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.
Ibtehaz Shawon
BRAC University.

long way to go .....

User avatar
Phlembac Adib Hasan
Posts: 1016
Joined: Tue Nov 22, 2011 7:49 pm
Location: 127.0.0.1
Contact:

Re: Help:Graphics in C

Unread post by Phlembac Adib Hasan » Wed Apr 24, 2013 2:29 pm

graphic.h অনেক পুরান লাইব্রেরি। এইটা এখন অচল। বর্তমানে অনেক উন্নত লাইব্রেরী আছে। যেমন-SDL,Qt,OGRE ইত্যাদি। OGRE ব্যবহার করে নাকি 3D গ্রাফিক্স করা যায়! আমি এটা কখনো ব্যবহার করি নাই অবশ্য। SDL আমার কাছে অনেক ভালো লাগে। এক সপ্তাহ আগে আমি একটা অ্যালজেব্রাইক ক্যালকুলেটরের ডিজাইন করার সময় এইটা দিয়ে ইন্টারফেস বানাইসিলাম, চমৎকার কাজ করসিল।
Welcome to BdMO Online Forum. Check out Forum Guides & Rules

Post Reply