3 ms·
Thanks for the detailed answer. Many years ago, I considered adding an embedded browser (or just HTML renderer) into a game, as a simple way to build the game
by albertzeyer 6y ago
Thanks for the detailed answer.
Many years ago, I considered adding an embedded browser (or just HTML renderer) into a game, as a simple way to build the game menu. The requirements mostly were:
- We needed the raw pixels as output. This was SDL, and the game was purely pixel based. Should also support alpha channel / transparency if possible. Also we would need to be in full control of all input events (keyboard inputs, mouse clicks), and have some easy way to handle some events like button clicks etc.
- Cross-platform (at least Windows, Linux, Mac, iOS, Android, and potentially more). Should also be easy to build, and not have much dependencies.
- It should be a small dependency (WebKit was way overkill; or maybe you can build a stripped down version?).
We gave up. Although we didn't really needed all the modern HTML features, and also no JS. I guess for a projects like yours, you have somewhat different requirements.
I wonder if it is worth it to fork an existing browser (Chromium, Firefox) for your purpose. But this is probably impossible to maintain and keep in sync with upstream.
I wonder whether there are other simple ways to hook into the browser. After all, you are in control of the OS, and you can inject some code. On MacOSX, there was actually some nice way to script things like this. But I think they restricted that very much now.
https://github.com/albertz/Pyjector https://github.com/albertz/Pyjector
https://github.com/albertz/chromehacking/blob/master/chromehacking.py https://github.com/albertz/chromehacking/blob/master/chromeh...
https://src.chromium.org/viewvc/chrome/branches/874/src/chrome/common/mac/cfbundle_blocker.mm?pathrev=105568 https://src.chromium.org/viewvc/chrome/branches/874/src/chro...
- The-Compiler 6y agoI've recently learned about litehtml, which seems pretty much what you are describing: http://www.litehtml.com/ http://www.litehtml.com/ Looks like it started in 2012, but I've never heard about it until a recent plan from Qt to write a wrapper around it: https://lists.qt-project.org/pipermail/development/2021-January/040915.html https://lists.qt-project.org/pipermail/development/2021-Janu... (Probably so that simple things like their help viewer don't need a rather heavy QtWebEngine)
- The-Compiler 6y agoWhoops, I forgot about the other things I wanted to reply to :) > I wonder if it is worth it to fork an existing browser (Chromium, Firefox) for your purpose. But this is probably impossible to maintain and keep in sync with upstream. Yeah. People have suggested that in the past, but keeping up with e.g. Chromium is insane. When QtWebEngine updates their Chromium snapshot (a subset of the entire source) all couple of months, we're talking about millions of changed lines, and I've heard they need around a person-month every time to adjust their stable API to that. Also see: - https://chromium.googlesource.com/chromium/src.git/+log https://chromium.googlesource.com/chromium/src.git/+log - https://twitter.com/the_compiler/status/1330896103911264257 https://twitter.com/the_compiler/status/1330896103911264257 It's pretty much a commit all couple of minutes, almost around the clock. > I wonder whether there are other simple ways to hook into the browser. After all, you are in control of the OS, and you can inject some code. On MacOSX, there was actually some nice way to script things like this. But I think they restricted that very much now. I was actually wondering what someone could do via ChromeDriver: https://chromedriver.chromium.org/ https://chromedriver.chromium.org/ But I suppose the kind of UI/UX you could build with that would still be quite limited, perhaps even more so than what WebExtensions like Vimium or Tridactyl can do.