Archived

This topic is now archived and is closed to further replies.

NewBie Question

This topic is 5153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I had about 1 year programming experience in java and now i moved on to C/C++ and i wonder what happened to simple gui that in Java anyone can make with a couple of simple commands? The question is : How do one makes a simple consol or window where u can draw lines and circles and whatever else u want to draw in C/C++ ? thank you for your attention

Share this post


Link to post
Share on other sites
The C++ standard libraries do not include any graphical functions whatsoever; the only user interfaces that can be made in a straightforward fashion with standard C++ are text interfaces, and even then the functionality is limited (straight text I/O, no colours, cursor positioning, etc.). The reason for this is that C++ is designed to run on a large number of different platforms, and furthermore, to run fast on all of these platforms. It cannot assume functionality that runs well on some specific platform but requires resource-hogging workarounds/emulation on other systems. (In fact, since some of these systems might not even have graphics capabilities at all, even to assume text mode might be daring ...)

Java, by contrast, is written to run only on one single system. (Insert pause here while audience gasps and drops shocked remarks.) As it happens this single system is a virtual machine which is emulated in the Java VM on many different system, but conceptually you are always working with the same things. Also, while Strostrup has made it clear that the purpose of C++ is to add solid functionality without ever sacrificing efficiency, Java seems (to me) by contrast to be designed to come with a useful collection of classes for general use and GUI design - whether this will take a speed hit on some particular system is not as huge an issue. It''s not necessarily slow (usually it is not), but it''s not as close to the bare bones, either.

If you want to work with any sort of windowing system in C++, you will either have to use the windowing system API itself (Win32, for example) or use some third-party library that handles this for you (GLUT does this; I suspect/believe that SDL and Allegro do it, too).

Share this post


Link to post
Share on other sites