#include <iostream>
int main()
{
std::cout << "Hi, I'm Borislav!\n";
std::cout << "These slides are here: https://is.gd/html5gui\n";
return 0;
}
So you want to make a GUI?
A challenger appears
They've come a long way
.
sophisticated optimized
powerful... ubiquitous
This is a browser
The browser is an immensely powerful presentation platform
It's our user interface to the Internet
sophisticated optimized
powerful... ubiquitous
Developer Type
Programming Language
Developer Type
Programming Language
Developer Type
Programming Language
Finding experienced and competent HTML 5 developers is easier than finding experienced and competent C++ developers
Can we make use of all that?
Briefly
That's what every single web page is
Including this one
More than simply writing HTML, CSS, and JavaScript
$ npm start - the ultimate build server
$ python -m SimpleHTTPServer 8080
XMLHttpRequest. It's not for XML. Any text or binary worksfunction idle() {
fetch('clientReady') // get some "fake" service resource
.then(data => {
dispatch(xhr.responseText); // dispatch and use the response
idle(); // request more from the server
})
.catch(error => console.log('Error: ' + xhr.status));
}
// ignore other xhr responses
But where is XMLHttpRequest?
function idle() {
let xhr = new XMLHttpRequest();
xhr.open('GET', 'clientReady'); // get some "fake" service resource
xhr.onreadystatechange = function () {
if (xhr.readyState === 4) { // 4 = request done
if (xhr.status === 200) { // 200 = OK
dispatch(xhr.responseText); // dispatch and use the response
idle(); // request more from the server
} else {
console.log('Error: ' + xhr.status); // error
}
}
};
xhr.send(null);
}
// ignore other xhr responses
PS Do use fetch if you do Ajax
let ws = new WebSocket('ws://localhost:7658');
ws.onopen = myOnConnectionOpenedFunc;
ws.onclose = myOnConnectionClosedFunc;
ws.onmessage = myOnMessageFunc;
ws.onerror = myOnErrorFunc;
...
ws.send('message to the server');
A continuous connection between the server and the client
$ npm start and the marvelous workflow
let ws = new WebSocket('ws://localhost:7658');
ws.onopen = myOnConnectionOpenedFunc;
ws.onclose = myOnConnectionClosedFunc;
ws.onmessage = myOnMessageFunc;
ws.onerror = myOnErrorFunc;
...
ws.send('message to the server');
This doesn't have to be the same URL as the HTTP server
A browser as a library
openBrowserWindow(url)
For many platforms this is WebView
Then it's like an HTTP server
QWebView - wraps native browser.QWebViewstd::web_view Too early to sayChromium is pretty popular.
Typically game-dev territory
<img src=id123 />Just for completeness
Join me in Crest 3 at 20:30 for more
Addendum session in Crest 3 at 20:30
Borislav Stanimirov / ibob.github.io / @stanimirovb
Demos: github.com/iboB/html5-gui-demo
These slides: ibob.github.io/slides/html5-gui/
Slides license Creative Commons By 4.0