Graphics using only standard C ++?

I just want to know if Standard C ++ allows you to program a graphical interface?

There are two aspects to this:

  • Widgets for the user interface, such as a window, dialog, button, etc.
  • Graphics, how to draw a circle, rectangle, spline, etc.

I used Qt for my user interface and did not see anyone running the GUI in C ++ only.

PS: I only deal with C ++, I know that Java allows you to program a graphical interface!

UPDATE: A new question has been added here: How frameworks like Qt create a graphical interface if C ++ has no functions for this?

+7
source share
5 answers

No, It is Immpossible. C ++ works on many devices, some of which simply do not have this feature.

Qt can do this, usually because the operating systems it runs on offer this functionality. It is usually displayed as a set of C functions, which in practice means that they can be called with C ++ code in Qt. What uses the OS inside, who knows. This may even leave some of the work on the GPU for now.

And on some embedded systems, Qt just gets a pointer to the screen memory and does all the pixel manipulation. This is not a solution when you need to share a screen with multiple applications, but for single-function devices, it definitely works.

+5
source

Not. There is nothing about the GUI in the C ++ standard.

The framework uses OS tools. Standard C ++ - no.

+4
source

No, it is not included. You can read the explanation from the creator of the language: http://www.stroustrup.com/bs_faq.html#gui

Graphical GUIs use the low-level tools provided by the operating system API or the window manager API.

+3
source

He allows this in the sense that he does not limit the ability of the implementation to provide accessible GUI facilities if he chooses.

The standard does not require a GUI to be available - many runtime environments do not have one available, so there is no standard standard interface.

There is also no standardized additional GUI.

+2
source

The C ++ standard does not prohibit GUI programming (IOW, it allows it), but at the same time it does not provide any standard library functions for this. This is beyond the scope of the language and its standard library and is OS / platform dependent.

The only graphic you can do in plain C ++ is ASCII art . :)

+1
source

All Articles