ashea-code / BLUI

Rich HTML UI engine for UE4
MIT License
861 stars 261 forks source link
c-plus-plus chromium game html ue4 unreal-engine

release BLUI-logo

Getnamo Fork Notes

Fork made to support small additions and changes for certain use cases.

To install check out the latest releases https://github.com/getnamo/BLUI/releases and drag and drop Plugins folder into your project root folder

Download and Fullscreen Support

Contains changes to allow downloading of files via the inbuilt browser.

Updated CEF build to 3.2556 to support fullscreen videos.

Convenience Blueprints

The native plugin didn't contain any self contained drag and drop examples so I've added some.

examples

BluiWidget

A user widget (UMG) blueprint which embeds a BLU texture as an image brush. Contains various utility functions to allow loading and parsing urls easily. Call InitBluEye with starting url and browser window size to start this widget. See BluiWorldWidgetActorExample for an example of how it's used in practice.

BluiWorldWidgetActorExample

Encapsulated BluiWidget user widget in an actor. Drag and drop this actor into your scene and it will auto-spawn the required BluTickActor to make everything work.

example output

3 BluiWorldWIdgetActorExample actors with youtube.com, blui ue4 and local://test.html specified as their URL respectively

Url

By default the actor will check the url for local:// protocol and load local content first if detected. This should be placed inside the following directory: {project root}/Content/html. NB: You can still use the vanilla blui:// protocol which will load content relative to your project root.

local url

e.g. having a test.html file inside your Content/html folder

Basic URL validity is also tested, but you can safely ignore http:// etc. E.g. just specifying youtube.com will resolve correctly

If your URL isn't valid however, it will redirect the string as a search term e.g. typing a sentance or a search term.

auto-search

You can untick Should Auto Search Invalid Url to disable this behavior.

Resize

By default the actor has a BLUI resolution of 1000x1000, you can change this by just changing the user widget draw size.

resize

BluTickActor

Instead of ticking in your level bp, I prefer to use a simple actor to do the ticking. Other convenience blueprints may spawn this as necessary so if you use those, you don't ever need to use this directly.

//End Fork Notes

HTML powered UI and HUD for Unreal Engine 4

(Hit up the wiki for a quick start guide!)

Do you use BLUI in your project? I'd really love it if you credit me and it! You can even use the logo right here!

License: MIT

What is it?

BLUI is an Unreal Engine 4 plugin that allows easy interaction with the Chromium Embedded Framework. It provides a simple Material Instance and input functions to help streamline the rendering of rich HTML interfaces.

BLUI tries to stay out of the way as much as possible. All rendering of the DOM and processing of the JavaScript happens in a separate process, just like Chromium. BLUI only updates the texture inside the material instance when Chromium requests a redraw, not every tick, saving a bit more processing along the way.

Features

Setting up the editor and project

Then copy the BLUI folder into the "Plugins" folder within your project directory, and enable the plugin.

Re-generate your project's Visual Studio file and load up the editor. Then check the plugin list to ensure it has been loaded!

Updating the CEF event loop

You must call the BluManager::doBluMessageLoop(); method every tick in order for the CEF process to update properly. To do this, override the default GameMode's Tick function and include the Blu/Public/BluManager.h header file. You can then call the appropriate method.

As of now, you no longer need to do this. You can simply call a blueprint node to Tick the CEF loop every tick of the level blueprint.

Loading Local Files

Set your default URL or use the "Load URL" node/method to load a URL that starts with blui:// this will point to the directory root of the project or the game (if packaged). So if you wanted to load an HTML file from YourProject/UI/file.html, set the URL to blui://UI/file.html

HUD Example Blueprint

Within the release, you'll find an ExampleHUD blueprint file, place this into your project's blueprints directory to try it out! (It's a simple UMG widget pre-configures to accept keyboard and mouse input, with a BluEye instance hooked up to a canvas)

Shipping Your Game (Linux)

Copy all contents of the Linux shipping files into your packaged game's GameName/Binaries/{Linux}, these are the required files for the Chromium process.