mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-24 07:14:31 +01:00
Fix emscripten support
This commit is contained in:
@@ -19,6 +19,10 @@
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/core/UTF8.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
#ifdef __MACOSX__
|
||||
// macOS uses COMMAND rather than CTRL for many keyboard shortcuts
|
||||
#define KEYBOARD_PRIMARY_MODIFIER KMOD_GUI
|
||||
@@ -170,7 +174,21 @@ void TextComposition::HandleMessage(const SDL_Event* e)
|
||||
case SDLK_c:
|
||||
if ((modifier & KEYBOARD_PRIMARY_MODIFIER) && _session.Length)
|
||||
{
|
||||
#ifndef __EMSCRIPTEN__
|
||||
SDL_SetClipboardText(_session.Buffer->c_str());
|
||||
#else
|
||||
MAIN_THREAD_EM_ASM(
|
||||
{
|
||||
try
|
||||
{
|
||||
navigator.clipboard.writeText(UTF8ToString($0));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
};
|
||||
},
|
||||
_session.Buffer->c_str());
|
||||
#endif
|
||||
ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {});
|
||||
}
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user