mirror of
https://github.com/UpsilonNumworks/Upsilon.git
synced 2026-03-18 21:30:38 +01:00
[ion/web] Fix screenshots
This commit is contained in:
@@ -5,6 +5,7 @@ LD = emcc
|
||||
EMSCRIPTEN_ASYNC_SYMBOLS = \
|
||||
SAFE_HEAP_LOAD \
|
||||
SAFE_HEAP_STORE \
|
||||
_IonDisplayForceRefresh\
|
||||
_IonEventsEmscriptenKeyDown \
|
||||
_IonEventsEmscriptenKeyUp \
|
||||
_IonEventsEmscriptenPushEvent \
|
||||
@@ -121,4 +122,4 @@ EMSCRIPTEN_INIT_FILE ?= 0
|
||||
LDFLAGS += --memory-init-file $(EMSCRIPTEN_INIT_FILE)
|
||||
|
||||
SFLAGS += $(EMFLAGS)
|
||||
LDFLAGS += $(EMFLAGS) -Oz -s EXPORTED_FUNCTIONS='["_main", "_IonSimulatorKeyboardKeyDown", "_IonSimulatorKeyboardKeyUp", "_IonSimulatorEventsPushEvent", "_IonSoftwareVersion", "_IonPatchLevel"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["UTF8ToString"]'
|
||||
LDFLAGS += $(EMFLAGS) -Oz -s EXPORTED_FUNCTIONS='["_main", "_IonSimulatorKeyboardKeyDown", "_IonSimulatorKeyboardKeyUp", "_IonSimulatorEventsPushEvent", "_IonSoftwareVersion", "_IonPatchLevel", "_IonDisplayForceRefresh"]' -s EXTRA_EXPORTED_RUNTIME_METHODS='["UTF8ToString"]'
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include <ion.h>
|
||||
#include "../shared/main.h"
|
||||
|
||||
extern "C" const char * IonSoftwareVersion() {
|
||||
return Ion::softwareVersion();
|
||||
@@ -7,3 +8,8 @@ extern "C" const char * IonSoftwareVersion() {
|
||||
extern "C" const char * IonPatchLevel() {
|
||||
return Ion::patchLevel();
|
||||
}
|
||||
|
||||
extern "C" void IonDisplayForceRefresh() {
|
||||
Ion::Simulator::Main::setNeedsRefresh();
|
||||
Ion::Simulator::Main::refresh();
|
||||
}
|
||||
|
||||
@@ -261,6 +261,9 @@ Epsilon(Module);
|
||||
</script>
|
||||
<script>
|
||||
function screenshot() {
|
||||
<!--toDataURL needs the canvas to be refreshed-->
|
||||
Module._IonDisplayForceRefresh();
|
||||
|
||||
var canvas = document.querySelector('.screen');
|
||||
var link = document.createElement('a');
|
||||
link.download = 'screenshot.png';
|
||||
|
||||
Reference in New Issue
Block a user