mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-22 14:44:34 +00:00
Adapt render size to fit browser window.
This commit is contained in:
parent
73f6e73c51
commit
4b5a823d39
@ -5,7 +5,7 @@ CFLAGS += -sUSE_FREETYPE=1 -pthread
|
||||
CXXFLAGS := $(CFLAGS) -std=c++17
|
||||
DEFINES += -DIMGUI_ENABLE_FREETYPE -DIMGUI_IMPL_OPENGL_ES2
|
||||
INCLUDES := -I../../../imgui -I$(HOME)/.emscripten_cache/sysroot/include/capstone
|
||||
LIBS += -lpthread -ldl $(HOME)/.emscripten_cache/sysroot/lib/libcapstone.a -sUSE_GLFW=3 -sTOTAL_MEMORY=512mb -sWASM_BIGINT=1 -sPTHREAD_POOL_SIZE=4 --preload-file embed.tracy
|
||||
LIBS += -lpthread -ldl $(HOME)/.emscripten_cache/sysroot/lib/libcapstone.a -sUSE_GLFW=3 -sTOTAL_MEMORY=512mb -sWASM_BIGINT=1 -sPTHREAD_POOL_SIZE=4 -sEXPORTED_FUNCTIONS=_main,_nativeResize -sEXPORTED_RUNTIME_METHODS=ccall --preload-file embed.tracy
|
||||
|
||||
PROJECT := Tracy
|
||||
IMAGE := $(PROJECT)-$(BUILD).html
|
||||
|
@ -90,6 +90,10 @@
|
||||
var preloadElement = document.getElementById('preload');
|
||||
var canvasElement = document.getElementById('canvas');
|
||||
|
||||
function resizeHandler() {
|
||||
Module.ccall('nativeResize', 'number', ['number', 'number'], [window.innerWidth, window.innerHeight]);
|
||||
}
|
||||
|
||||
var Module = {
|
||||
preRun: [],
|
||||
postRun: [],
|
||||
@ -129,11 +133,10 @@
|
||||
progressElement.max = null;
|
||||
progressElement.hidden = true;
|
||||
preloadElement.hidden = true;
|
||||
if (!text) spinnerElement.style.display = 'none';
|
||||
/*
|
||||
canvasElement.width = window.innerWidth;
|
||||
canvasElement.height = window.innerHeight;
|
||||
*/
|
||||
if (!text) {
|
||||
spinnerElement.style.display = 'none';
|
||||
resizeHandler();
|
||||
}
|
||||
}
|
||||
statusElement.innerHTML = text;
|
||||
},
|
||||
@ -152,15 +155,8 @@
|
||||
if (text) console.error('[post-exception status] ' + text);
|
||||
};
|
||||
};
|
||||
/*
|
||||
addEventListener('resize', (event) => {
|
||||
canvasElement.width = window.innerWidth;
|
||||
canvasElement.height = window.innerHeight;
|
||||
});
|
||||
*/
|
||||
addEventListener('resize', resizeHandler);
|
||||
</script>
|
||||
<script async type="text/javascript" src="Tracy-release.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
@ -199,3 +199,11 @@ float Backend::GetDpiScale()
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
extern "C" int nativeResize( int width, int height )
|
||||
{
|
||||
glfwSetWindowSize( s_window, width, height );
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user