GoogleMax2D

Community Forums/Showcase/GoogleMax2D

Brucey(Posted 2014) [#1]
Google rendering in Max2D :-)



and the code :
SuperStrict

Framework cef.cef
Import brl.glmax2d

InitCEFApp()

Graphics 1088, 832, 0

Local browser:TCEFBrowser = New TCEFBrowser.Create("http://google.com", 1024, 768)


While Not KeyDown(KEY_ESCAPE)

	UpdateCEF()

	Cls
	
	Local image:TImage = LoadImage(browser.pixmap)
	DrawImage image, 20, 20
	
	Flip

Wend


The concept :

* I wondered how I might render an HTML-based/externally driven UI in BlitzMax. Rather than work out clever graphics stuff in BlitzMax to do menus, tables and so on, why not borrow the strength of HTML/JS/CSS to do it for me?
* It appears to be a (fairly) popular way of adding a UI to games - for example there are similar things such as Scaleform which many AAA games use (based on Flash/ActionScript 3).

The implementation :
* Uses Chromium Embedded Framework (CEF) to render the page. (a WebKit-based engine)
* My colour format is wrong RGBA instead of ARGB, hence the funky colours.
* Not entirely efficient yet as you can see by the image loading. But as a proof of concept, it's not so bad.
* Cross-platform and 64-bit supported.

The background can be set to transparent, and your page can be any size, so in theory you could render little parts of your UI separately with different "browsers".

Haven't tried interaction yet (i.e mouse movement and clicks), but youtube videos play, with sound ;-)


Anyways, I should probably be doing something more useful with my time - like bcc_ng...

:o)


GW(Posted 2014) [#2]
Awesome!

How much does it add to the size the executable? Or is it dynamically linked?


Who was John Galt?(Posted 2014) [#3]
You're a bonnie lad, Brucey. Glad Scotland didn't make tracks and take you with... ;)


degac(Posted 2014) [#4]
Ohhhhhh! It's Christmas time?!?!??

Nice, very nice!


Derron(Posted 2014) [#5]
Yay, now installing adblock for blitzmax *joking*.

Think the filesize increase is much higher than with other html-viewers (as it is more "feature complete") - what a pitty.


Cannot imagine how to use it as "[G]UI"-replacement.


bye
Ron


BlitzSupport(Posted 2014) [#6]
Awesome, as always! Looks nice and easy to use, too.


Blitzplotter(Posted 2014) [#7]
Awesome, html esque front ends, I've seen some hardware configured with a similar thing.


LT(Posted 2014) [#8]
This is great! I looked into this a while back and couldn't figure out how to get it working, so hats off to you. :)

Can you access the render as a texture?

EDIT: Apparently, the answer is yes! :)


LT(Posted 2014) [#9]
Cannot imagine how to use it as "[G]UI"-replacement.
Chromium gives you everything that can be put on a web page, including WebGL. If the GUI is a separate page, then it can work immediately for doing things like tracking progress and stats. If it can be rendered to a texture, then it could be overlaid and used as a GUI, though it might be a bit slow. It also has the advantage of reusability - a leaderboard implementation could be used in game and on the game's web site.

Personally, I think there's no substitute for a great 2D in 3D GUI system, but Chromium definitely provides an exciting alternative.


BlitzSupport(Posted 2014) [#10]

Can you access the render as a texture?



Don't see why not -- you have Image and Pixmap access right there:

Local image:TImage = LoadImage(browser.pixmap)



LT(Posted 2014) [#11]
..you have Image and Pixmap access right there
D'oh! Clearly, I wasn't paying attention! :O

It would probably be a bit slow, but good enough for many applications. Still, I wonder how the pixmap gets created and if there is a way to generate a texture in more direct fashion..


PhotonTom(Posted 2014) [#12]
Wow amazing work :)
I'm really interested in getting this working on minib3d, how easy would it be and have you put your current code online yet brucy?


Pingus(Posted 2014) [#13]
Awesome ! Totally awesome !

Does that means that a html5 app (made in Monkey) could run inside a Bmax app ?
Useless but fun idea...


SLotman(Posted 2014) [#14]
Cool! Does this mean we could in theory build our own browsers without having to resort to IE?

Can't wait to download this :)


LT(Posted 2014) [#15]
Does this mean we could in theory build our own browsers without having to resort to IE?
Yes, that's what it means. All that and more! :)


Richard Betson(Posted 2014) [#16]
Sweet. :)

. . .and Brucey I just got your database mod going, also so sweet. :D


ziggy(Posted 2014) [#17]
Amazing.. Also, that means you're also integrating the CEF JavaScript JIT engine?


Ferret(Posted 2014) [#18]
Interesting :)

So i can get multiple pages and show them in a mosaic?