[HTML5 BP Nodes For You] Victory BP Library Plugin Nodes for HTML5 ♥ Rama

Dear Community,

I’ve spent most of my spare time for past 2 days researching a particular issue related to HTML5 developmenti n UE4, which is the issue that it is very hard to show/hide the mouse cursor at will when playing a UE4 game within a web browser!

My fundamental issue was being able to show hide the cursor when switching between UMG and regular gameplay, and the node I am giving you today does this!

I’ve finally generated a BP node that makes it easy for you to properly and definitively show/hide the mouse cursor at any time of your choosing, during runtime within an HTML5 game!


**Show Or Hide?!**

Yes the SetCursorVisible node will actually show or hide the cursor depending on the boolean value

1. If showing, the cursor is unlocked from the viewport / canvas
2. If hiding, the cursor is locked to the viewport / canvas

Please note there is a brief delay after the node is run before the new cursor state takes effect :)

Sometimes an extra click is required to resume hiding the cursor, which ties into the HTML5Application.cpp emscripten callback.

How Does It Work In Editor Builds?

The SetCursorVisible node will show up in-Editor but will not do anything unless your game is packaged for HTML5.

See my picture for the event you can write using my BP Library to show/hide the cursor for HTML5 OR regular UE4 games!

**Is HTML5**

I've written a C++ boolean check that you can easily make into a switch macro to perform unique BP Logic based on whether your game is currently running on an HTML5 build or is an editor/console build!

This allows you to use different Particle Effects / Lighting Settings / Quality Settings, or any other custom BP logic you want, based on whether the game is an HTML5 build or not!


C++ Code For You

Here is the C++ code being used by my SetCursorVisible BP node, source code is included in my plugin download :slight_smile:

	#include "SDL_opengl.h"

	#include "emscripten.h"
	#include "html5.h"

void UVictoryBPHTML::VictoryHTML5_SetCursorVisible(bool MakeVisible)
		**#if PLATFORM_HTML5_WIN32**
			SDL_SetWindowGrab(WindowHandle, SDL_FALSE); 
			UE_LOG(VictoryPluginHTML, Log, TEXT("SDL Showing Mouse Cursor"));
			UE_LOG(VictoryPluginHTML, Log, TEXT("Exiting Pointer Lock"));
		**#if PLATFORM_HTML5_WIN32**
			SDL_SetWindowGrab(WindowHandle, SDL_TRUE);
			UE_LOG(VictoryPluginHTML, Log, TEXT("SDL Hiding Mouse Cursor"));
			emscripten_request_pointerlock ( "#canvas" , true);
			UE_LOG(VictoryPluginHTML, Log, TEXT("Entering Pointer Lock"));

Happy Holidays!




**Latest plugin download on the UE4 Wiki: (7.16 mb) **

Not using the latest engine version? Check out my wiki section on which plugin release dates go with which engine version!

**Plugin Release Dates and UE4 Engine Versions**

Victory Plugin Binaries for Packaged Games

**Victory Plugin on Media Fire**

**If your browser is not updating the Wiki download page** to the most recent version, you can use my alternative Media Fire download link!

Please note the mediafire version includes both the editor and packaged game binaries in the same file ♥ Rama



Donations can be sent to me via:

Hello Rama.
I am getting a incompatible - missing error after restarting UE4.11.2

What do i have to do?