Sometimes all you want to do in your app or game is display some HTML content. But you also don't want to take a dependency on Internet Explorer or other installed web browser. Being a hobby, independent, or just for fun at home, developer you don't have many resources and just wish there was a browser you could easily embedded and deploy in your app. That it would be awesome if you could easily used it in a .Net app, be it VB.net, WinForms or WPF.
I give you Awesomium!
Awesomium is the first, full-featured, windowless web-browser framework.
It is crazy fast, supports the latest stuff, and is super simple to use in your own applications .
Great for use in 3D games, .NET apps, HTML GUIs, and way more.
For In-Game Browsing:
Add a custom web-browser to your game to grant users access to forums, guides, and additional online game content without ever leaving your application.
For .NET and WPF:
Great when used with WPF; get started quickly with our drop-in WebViewControl or use our full .NET API for total customization. No airspace issues here!
For HTML UIs:
Power your UI with latest-generation XHTML, CSS, and JS. Mature toolset and rapid-prototyping possibilities make this a great new option for game developers.
And I said free for indie's, right?
Now the actual source for Awesomium is not free, but it is available.
So if the source for Awesomium isn't free why am I chatting it up? Because the SDK and AwesomiumSharp wrapper are free (given the conditions above).
Here's a snap of the C# WPF based "tabbed browser" sample included in the SDK;
And here's the binaries, all the binaries, for this sample;
The AwesomiumSharp solution;
(Yeah, there's a Mono Project too...
Because "I'm a VBer" let's take a quick look at the VB.Net WinForm code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim config As WebCore.Config = New WebCore.Config()
config.enablePlugins = True
webView = WebCore.CreateWebview(webViewBitmap.Width, webViewBitmap.Height)
Dim bmp As Bitmap
Private Sub render()
Dim rBuffer As RenderBuffer = webView.Render()
Dim data(webViewBitmap.Width * webViewBitmap.Height) As Integer
Marshal.Copy(rBuffer.GetBuffer(), data, 0, webViewBitmap.Width * webViewBitmap.Height)
bmp = New Bitmap(webViewBitmap.Width, webViewBitmap.Height, PixelFormat.Format32bppArgb)
Dim bits As BitmapData = bmp.LockBits(New Rectangle(0, 0, webViewBitmap.Width, webViewBitmap.Height), ImageLockMode.ReadWrite, bmp.PixelFormat)
Dim ptr As IntPtr = bits.Scan0.ToInt32()
rBuffer.CopyTo(ptr, bits.Stride, 4, False)
webViewBitmap.Image = bmp
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If webView.IsDirty Then
Yeah, it might be a little more work using this control, but the power it gives you is hard to beat.
Given that this is, in reality, a commercial product, you'd expect some documentation...
Hi there, welcome to the Awesomium .NET API docs! Awesomium is a software library that makes it easy to put the web in your applications. Whether that means embedded web browsing, rendering pages as images, streaming pages over the net, or manipulating web content live for some other purpose, Awesomium does it all.
Here's a simple example of using the API to render a page once:WebCore.Initialize(new WebCore.Config());WebView webView = WebCore.CreateWebview(800, 600);
If you are interested in just adding a standalone WebView to your WPF application with minimal work, take a look at AwesomiumSharp.WebViewControl (it should be available in your Toolbox if you add a reference to AwesomiumSharp in your project, just drag-and-drop and you're done).
If you're looking to have HTML in your app and would like to embed a controlled renderer this might just be your ticket to awesome...