简体   繁体   中英

Graphics using Standard C++ only?

I just want to know whether Standard C++ allows GUI programming?

There are 2 aspects of this:

  1. Widgets for UI like window, dialog, push button, etc
  2. Graphics like drawing circle, rectangle, spline, etc

I have been using Qt for my UI & haven't seen anybody doing GUI in C++ only.

PS: I am concerned with C++ language only, I know that Java allows GUI programming!

UPDATE: A new question was added here: How frameworks like Qt create GUI, if C++ has no functionality for that?

No, this isn't possible. C++ works on many devices, some of which simply don't have that capability.

Qt can do this, usually because the Operating Systems on which it runs do offer that functionality. It's usually exposed as a set of C functions, which in practice means they're callable by the C++ code in Qt. What the OS uses internally, who knows. It may even leave some of the work to the GPU nowadays.

And on some embedded systems, Qt just gets a pointer to the screen memory, and does all the pixel manipulations itself. That's not a solution when you have to share the screen with multiple applications, but for single-function devices it definitely works.

No. There is nothing about GUI in C++ standard.

Frameworks use OS facilities. Standard C++ - no.

No, it's not included. You may want to read the explanation from the language creator: http://www.stroustrup.com/bs_faq.html#gui

GUI frameworks use the low-level facilities provided by the operating system API or the window manager API.

It allows it, in the sense that it doesn't restrict the ability of an implementation to make available GUI facilities should it choose.

The standard doesn't required a GUI environment to be available - lots of implementations' run time environments don't have one available so there is no mandated standard interface.

There is also no standardized optional GUI interface, either.

Standard C++ does not prohibit GUI programming (IOW, it allows it), but at the same time it does not provide any standard library functionality for that. That's beyond the scope of the language and its standard library and is OS/platform-specific.

About the only thing graphics you can do in plain C++ directly is ASCII art . :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM