From 8fc8ef13dc7234b6b76d935259140841f18ecf1c Mon Sep 17 00:00:00 2001 From: Viet Dinh <36768030+Desdaemon@users.noreply.github.com> Date: Sun, 3 Nov 2024 23:05:07 -0500 Subject: [PATCH] Add missing PreloadFile implementation (#52) --- src/platform/emscripten/interface.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/platform/emscripten/interface.cpp b/src/platform/emscripten/interface.cpp index 76b8309f4..5e284407c 100644 --- a/src/platform/emscripten/interface.cpp +++ b/src/platform/emscripten/interface.cpp @@ -158,6 +158,14 @@ bool Emscripten_Interface::ResetCanvas() { return DisplayUi != nullptr; } +void Emscripten_Interface::PreloadFile(std::string dir, std::string path, bool graphic) { + auto* request = AsyncHandler::RequestFile(dir, path); + if (!request->IsReady()) { + request->SetGraphicFile(graphic); + request->Start(); + } +} + // Binding code EMSCRIPTEN_BINDINGS(player_interface) { emscripten::class_("api")