Emscripten version compiles

This commit is contained in:
Yousef Khadadeh 2026-03-07 20:15:20 +03:00
parent 9a1c2e516e
commit 0406ec3caf
3 changed files with 10 additions and 8 deletions

View file

@ -203,7 +203,7 @@ else()
add_executable(main ${sources})
endif()
if((NOT ANDROID) AND (NOT EMSCRIPTEN))
if(NOT ANDROID)
set_target_properties(main PROPERTIES OUTPUT_NAME "infinipaint")
endif()

View file

@ -81,7 +81,7 @@ void ScreenshotTool::gui_toolbox() {
if(t.gui.text_button_wide("Take Screenshot", "Take Screenshot")) {
controls.selectionMode = ScreenshotControls::SelectionMode::NO_SELECTION;
#ifdef __EMSCRIPTEN__
take_screenshot("a" + controls.typeSelections[screenshotConfig.selectedType]);
take_screenshot("a" + controls.typeSelections[screenshotConfig.selectedType], screenshotConfig.selectedType);
#else
// We can't actually use the extension from the callback, so we have to set the extension of choice beforehand
Toolbar::ExtensionFilter setExtensionFilter;
@ -343,8 +343,8 @@ void ScreenshotTool::take_screenshot(const std::filesystem::path& filePath, Scre
std::string mimeTypeArray[] = {"image/jpeg", "image/png", "image/webp"};
auto skData = out.detachAsData();
emscripten_browser_file::download(
"screenshot" + controls.typeSelections[extType],
mimeTypeArray[extType],
"screenshot" + controls.typeSelections[screenshotType],
mimeTypeArray[screenshotType],
std::string_view((const char*)skData->bytes(), skData->size())
);
}

View file

@ -186,10 +186,16 @@ void InputManager::Text::update_accepting_input(SDL_Window* window) {
SDL_SetTextInputArea(window, &r, 0);
}
SDL_StartTextInputWithProperties(window, propIDVal);
#ifdef __EMSCRIPTEN__
isAcceptingInputEmscripten = 1;
#endif
}
else {
SDL_StopTextInput(window);
SDL_SetTextInputArea(window, nullptr, 0);
#ifdef __EMSCRIPTEN__
isAcceptingInputEmscripten = 0;
#endif
}
}
@ -1192,8 +1198,4 @@ void InputManager::frame_reset(const Vector2i& windowSize) {
toggleFullscreen = false;
hideCursor = false;
#ifdef __EMSCRIPTEN__
isAcceptingInputEmscripten = text.acceptingInput ? 1 : 0;
#endif
}