13#include <emscripten.h>
14#include <emscripten/val.h>
15#include <emscripten/bind.h>
16#include <emscripten/html5.h>
24using namespace emscripten;
27BEGIN_IGRAPHICS_NAMESPACE
31 return val::global(
"document").call<val>(
"getElementById", std::string(
"canvas"));
34static val GetPreloadedImages()
36 return val::global(
"Browser")[
"preloadedImages"];
39extern void GetScreenDimensions(
int& width,
int& height);
52 void DrawResize()
override;
54 const char* GetPlatformAPIStr()
override {
return "WEB"; }
56 void HideMouseCursor(
bool hide,
bool lock)
override;
57 void MoveMouseCursor(
float x,
float y)
override { }
58 ECursor SetMouseCursor(ECursor cursorType)
override;
59 void GetMouseLocation(
float& x,
float&y)
const override;
61 void ForceEndUserEdit()
override {}
62 void* OpenWindow(
void* pParent)
override;
63 void CloseWindow()
override {}
64 void* GetWindow()
override {
return nullptr; }
65 bool WindowIsOpen()
override {
return GetWindow(); }
66 bool GetTextFromClipboard(WDL_String& str)
override { str.Set(mClipboardText.Get());
return true; }
67 bool SetTextInClipboard(
const char* str)
override { mClipboardText.Set(str);
return true; }
68 void UpdateTooltips()
override {}
69 EMsgBoxResult ShowMessageBox(
const char* str,
const char* title, EMsgBoxType type, IMsgBoxCompletionHandlerFunc completionHandler)
override;
71 void PromptForFile(WDL_String& filename, WDL_String& path, EFileAction action,
const char* ext, IFileDialogCompletionHandlerFunc completionHandler)
override;
72 void PromptForDirectory(WDL_String& path, IFileDialogCompletionHandlerFunc completionHandler)
override;
73 bool PromptForColor(
IColor& color,
const char* str, IColorPickerHandlerFunc func)
override;
74 bool OpenURL(
const char* url,
const char* msgWindowTitle,
const char* confirmMsg,
const char* errMsgOnFailure)
override;
76 bool PlatformSupportsMultiTouch()
const override {
return true; }
79 static void OnMainLoopTimer();
85 void CreatePlatformTextEntry(
int paramIdx,
const IText& text,
const IRECT& bounds,
int length,
const char* str)
override;
88 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fileNameOrResID)
override;
89 PlatformFontPtr LoadPlatformFont(
const char* fontID,
const char* fontName, ETextStyle style)
override;
90 PlatformFontPtr LoadPlatformFont(
const char* fontID,
void* pData,
int dataSize)
override;
91 void CachePlatformFont(
const char* fontID,
const PlatformFontPtr& font)
override {}
93 WDL_String mClipboardText;
96END_IGRAPHICS_NAMESPACE
Used for choosing a drawing backend.
An editor delegate base class that uses IGraphics for the UI.
IGraphics platform class for the web.
Used to manage color data, independent of draw class/platform.
Used to manage a rectangular area, independent of draw class/platform.
IText is used to manage font and text/text entry style for a piece of text on the UI,...