Emscripten: Add Platform::MarkPresentable
So the website knows when to swap the thumbnail with the canvas of the TPT instance
This commit is contained in:
parent
6ceb51b408
commit
7365d7e11c
@ -493,6 +493,7 @@ int Main(int argc, char *argv[])
|
||||
catch (std::exception & e)
|
||||
{
|
||||
new ErrorMessage("Error", ByteString(e.what()).FromUtf8());
|
||||
Platform::MarkPresentable();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,10 +49,4 @@ void MainLoop()
|
||||
{
|
||||
UpdateFpsLimit();
|
||||
MainLoopBody();
|
||||
EM_ASM({
|
||||
let canvas = document.querySelector("canvas.emscripten");
|
||||
if (canvas) {
|
||||
canvas.scrollIntoView(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -74,6 +74,16 @@ int InvokeMain(int argc, char *argv[])
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MarkPresentable()
|
||||
{
|
||||
EM_ASM({
|
||||
try {
|
||||
window.mark_presentable();
|
||||
} catch (e) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void MaybeTriggerSyncFs()
|
||||
{
|
||||
if (!syncFsInFlight && shouldSyncFs.exchange(false, std::memory_order_relaxed))
|
||||
|
@ -6,4 +6,8 @@ int InvokeMain(int argc, char *argv[])
|
||||
{
|
||||
return Main(argc, argv);
|
||||
}
|
||||
|
||||
void MarkPresentable()
|
||||
{
|
||||
}
|
||||
}
|
||||
|
@ -66,6 +66,8 @@ namespace Platform
|
||||
ByteString DefaultDdir();
|
||||
|
||||
int InvokeMain(int argc, char *argv[]);
|
||||
|
||||
void MarkPresentable();
|
||||
}
|
||||
|
||||
extern "C" int Main(int argc, char *argv[]);
|
||||
|
@ -1225,6 +1225,10 @@ void GameController::OpenSaveDone()
|
||||
|
||||
void GameController::OpenSavePreview(int saveID, int saveDate, SavePreviewType savePreviewType)
|
||||
{
|
||||
if (savePreviewType == savePreviewUrl)
|
||||
{
|
||||
gameView->SkipIntroText();
|
||||
}
|
||||
activePreview = new PreviewController(saveID, saveDate, savePreviewType, [this] { OpenSaveDone(); }, nullptr);
|
||||
ui::Engine::Ref().ShowWindow(activePreview->GetView());
|
||||
}
|
||||
|
@ -1659,6 +1659,11 @@ void GameView::OnFileDrop(ByteString filename)
|
||||
c->LoadSaveFile(std::move(saveFile));
|
||||
|
||||
// hide the info text if it's not already hidden
|
||||
SkipIntroText();
|
||||
}
|
||||
|
||||
void GameView::SkipIntroText()
|
||||
{
|
||||
introText = 0;
|
||||
}
|
||||
|
||||
|
@ -225,4 +225,6 @@ public:
|
||||
void DoKeyRelease(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt) override;
|
||||
|
||||
class OptionListener;
|
||||
|
||||
void SkipIntroText();
|
||||
};
|
||||
|
@ -52,6 +52,7 @@ void PreviewController::Update()
|
||||
}
|
||||
if (previewModel->GetDoOpen() && previewModel->GetSaveInfo() && previewModel->GetSaveInfo()->GetGameSave())
|
||||
{
|
||||
Platform::MarkPresentable();
|
||||
Exit();
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gui/Style.h"
|
||||
|
||||
#include "common/tpt-rand.h"
|
||||
#include "common/platform/Platform.h"
|
||||
#include "Format.h"
|
||||
#include "Misc.h"
|
||||
|
||||
@ -607,6 +608,7 @@ void PreviewView::SaveLoadingError(String errorMessage)
|
||||
{
|
||||
doError = true;
|
||||
doErrorMessage = errorMessage;
|
||||
Platform::MarkPresentable();
|
||||
}
|
||||
|
||||
void PreviewView::NotifyCommentsPageChanged(PreviewModel * sender)
|
||||
|
Reference in New Issue
Block a user