Drawing Graphical Images

Jan 17, 2011 at 11:25pm
Can someone direct me or explain to how to draw graphical images in C++?

Just a simple stick figure.

Jan 17, 2011 at 11:26pm
Are you asking how to draw ASCII art in the console or 2d graphics? For 2d graphics google SDL, SFML, or Allegro.
Jan 17, 2011 at 11:33pm
I think in the console.

I have to use a library and draw a figure.
Jan 17, 2011 at 11:40pm
You should #include "ccc_win.h" library which you have to download.
Here is a sample code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 int ccc_win_main()
 int ccc_win_main()
 {  Point p(1, 3);
    Point a = b;
    Point r = b;
    a.move(0, 1);
    r.move(1, 0);
    Line s(b, a);
    Line t(b, r);
    cwin << s << t;
    s.move(1, 0);
    t.move(0, 1);
    cwin << s << t;
 
    return 0;
 }

I am not sure if it will compile there may be a small mistake like a missed ";" or sth because i dont have the ccc_win lib now.
But thats the way.
you can create points
- Point p(1, 3)
move lines
-a.move(0, 1)
create circles :
Point p(1,3);
cwin << p << Circle(p,2.5);
where p are the coordinates and 2.5 is the radius.
you can type messages
-Point p(1,3);
Message greeting(p, "Hello, Window!");
cwin << greeting;
and so on.

Edit:You can also use the get.mouse function
- Point center = cwin.get_mouse("Enter the center of the circle:");
The program prompts the user to click on the console, and thats the senter of the circle.You may use that not only for center of the circle!
I think you got the idea.
Good luck
Last edited on Jan 17, 2011 at 11:45pm
Jan 17, 2011 at 11:43pm
Hey that sounds simple thanks guys ^_^
Jan 17, 2011 at 11:46pm
If you are using Dev c++ you add the library when you click on project>>add to project>>(path to the ccc_win.h)add ccc_win.h, or there will be an error -
ccc_win.h - no such file or directory !!!
Last edited on Jan 17, 2011 at 11:47pm
Jan 18, 2011 at 12:03am
what is the (path to the ccc_win.h)?
i saved dev C++ in default area (C:\\pragram files\\Devc++", but it contains a whole bunch of folders and files and i cant find the ccc_win.h file
Jan 18, 2011 at 12:17am
UGH

ugh ugh ugh.

Do not use the console for graphics. It's 100000x harder and fuglier than using an actual window.

Obligatory link: http://www.cplusplus.com/forum/articles/28558/
Jan 18, 2011 at 12:33am
Don't think they are using console, Disch...

Check out wxDev-C++... Dev-C++ hasn't been updated since... uh, I think 2003, but it says 1991 on the program
Jan 18, 2011 at 1:17am
haha thanks Disch
and craniumonempty, theres a difference between wxDev-C++ and Dev-C++?
Jan 18, 2011 at 1:33am
what is the (path to the ccc_win.h)?
i saved dev C++ in default area (C:\\pragram files\\Devc++", but it contains a whole bunch of folders and files and i cant find the ccc_win.h file


I told you to download ccc_win.h
Its not in dev-c++ .
Jan 18, 2011 at 1:40am
Downloading a header file won't do you any good. You need an accompanying library.

Trust me. Don't waste your time. Console graphics are much, much harder than using a graphics lib.
Jan 18, 2011 at 12:47pm
Why its much much harder.If he add to the project ccc_win and write the code, there appears the white screen and you just click on it.Isnt it the same?
Jan 18, 2011 at 12:52pm
if he is using something that is an object that the linker can't find, then it will be a problem.. Here are the full instructions for the Horstmann Code Libraries...

http://www.cs.drexel.edu/~mcs171/sp06/Horstmann/Graphics/NET/index.html

.. ccc_win.h doesn't have a cpp file, so yeah, it'll (probably) work, but if you want more advanced features, then you'll need a little more
Last edited on Jan 18, 2011 at 12:53pm
Jan 18, 2011 at 12:55pm
actually, that calls shap_ccc.h which does have a cpp, so you'll need the object also.
Topic archived. No new replies allowed.