Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to build native C++ apps with HTML/CSS UI?

Yes, it is possible. What you want is a C++ web framework. You could start by looking at CppCMS—a Free High Performance Web Development Framework (not a CMS) aimed for Rapid Web Application Development.

Edit: After the question has been clarified, I think Awesomium would be a good fit for your needs.

You can achieve the same functionality by embedding WebKit (or Gecko) but as far as I know that is exactly what Awesomium does behind the scenes.

An alternative is librocket—a C++ interface middleware package designed for game applications. As you can guess from the description it is a good fit for games or real-time applications.


Sciter is exactly that - embeddable HTML/CSS engine with C/C++ API. Compact and multi-platform.

And check this article.

Sciter has the same feature set as WPF but uses HTML/CSS instead of XAML and uses native API.

Features out of the box:

  • HTML, CSS, SVG, aPNG (animated PNGs), image sprites,
  • <plaintext> - editor with syntax highlighting,
  • <htmlarea> - WYSIWYG HTML editor,
  • <frame type=pager> - print preview and HTML/CSS print,
  • animations,
  • HTTP client, REST/JSON client, WebSocket's, DataSockets,
  • etc.

The same application with Sciter UI running on Windows, MacOS and Linux from the same sources:

enter image description here

Disclaimer: I am an author of Sciter Engine.

2021 update: you can also use Sciter.JS that is version of Sciter that uses standard JavaScript (ES2020) script engine.


I think Electron would be a nice addition to the other answers.

It uses NodeJS to run a Webkit Window. Electron itself is only html/css/js, but you can use any Node Module within your Electron App - including custom, natively compiled C++ code. A possible Module to embed your C++ code would be node-gyp.

Be aware, however, that this workflow may include a little bit more JS than you would have with the other answers.

My favourite text editor, Atom, was made with Electron.


You can use Chromium Embedded Framework to embed HTML5 content in your app. You'll get might and speed of Chromium and ability to build GUI apps the same way you develop web applications.


I suggest checking out Ultralight HTML UI Engine
Not Open Source, Available for C++. OpenGL and DirectX rendering supported.

Ultralight is the lighter, faster option to integrate HTML UI in your C++ app.

It's made by the creator of Awesomium, who unfortunately decided to delete Awesomium.

If you need something more heavy weight I recommend taking a look at CEF. It’s a very powerful (and open source) tool.