Alright. So I have a Macbook Pro.

I also know a bit of c++.

I want to know how to draw simple shapes. You know, rectangles, circles and stuff. Like in java (while using console) you can do c.drawRect and stuff? Same way.. is there something or some way to do the same in c++ on a mac?

I don't mind using an IDE if I have to.

I need a proper step-wise tutorial.

thanks :)

Recommended Answers

All 6 Replies

I'v been looking into this subject too, and as far as I can find there's no real API for this supplied in the C++ std library.

I think you need to use Qt or XCode for this, but even then, I don't think you can draw into the the terminal.

OpenGL is another option of course, since it is supplied with OS X by default. You can use it with XCode probably.

As a fanboy of Qt, I recommend you research it a little. It's a very powerful cross platform GUI based on c++. Any programs you write using the Qt API can be built on windows, mac, and linux ( among others ). While drawing shapes in a QGraphicsView is not especially simple ( the QGraphicsView widget has a ton of capabilities ), the Qt API is fairly easy to use. Like I said previously, it is very powerful, but it is also very well documented. There are many tutorials online, and the online documentation is extensive. To top it all off, Trolltech (the maker of Qt) has a free integrated IDE called QtCreator for creating Qt projects. QtCreator is a full featured c++ IDE with a graphical designer for Qt widgets. Anyhow, I highly recommend Qt for anyone seeking to make interactive graphical programs in c++.

Qt Homepage
Qt Documentation

I'd recommend SFML if you don't need a GUI.
Using SFML is child's play and they have many code examples.

Ok... I have quite a few replies here which I can consider. Here's another question, on my windows system I use the old Turbo C++ IDE (the DOS looking type :P ) I believe it can use the graphics.h library.. anyone know how to use that perhaps to draw simple shapes?

No... forget about graphics.h and especially about Turbo C++. It doesn't just "look" DOS-like, it is a DOS IDE. Its time has run out twenty years ago.

commented: Amen +4
commented: Good answer :) +31

At least there's a simple answer I think everyone will give:

There are no standard C++ libraries for GUI's.

Which is both a good and a sad thing...

commented: agree +31
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.