Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
message(FATAL_ERROR "Prevented in-tree build.")
endif()

cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)

project(love)

Expand Down
24 changes: 24 additions & 0 deletions src/modules/keyboard/sdl/Keyboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
#include "Keyboard.h"
#include "window/Window.h"

#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif

namespace love
{
namespace keyboard
Expand Down Expand Up @@ -112,9 +116,29 @@ Keyboard::Scancode Keyboard::getScancodeFromKey(Key key) const
void Keyboard::setTextInput(bool enable)
{
if (enable)
{
SDL_StartTextInput();
#ifdef __EMSCRIPTEN__
// Call JavaScript function to show mobile keyboard
EM_ASM({
if (typeof window.SDL_StartTextInput === 'function') {
window.SDL_StartTextInput();
}
});
#endif
}
else
{
SDL_StopTextInput();
#ifdef __EMSCRIPTEN__
// Call JavaScript function to hide mobile keyboard
EM_ASM({
if (typeof window.SDL_StopTextInput === 'function') {
window.SDL_StopTextInput();
}
});
#endif
}
}

void Keyboard::setTextInput(bool enable, double x, double y, double w, double h)
Expand Down