From dd3596072447661ac50300ddb4bf4191940f2bce Mon Sep 17 00:00:00 2001 From: Sebastian Krzyszkowiak Date: Thu, 28 Jul 2022 21:39:09 +0200 Subject: [PATCH] utils: Set background in SetBackgroundColor on Emscripten --- src/utils.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils.c b/src/utils.c index d5cafe5..034536d 100644 --- a/src/utils.c +++ b/src/utils.c @@ -798,4 +798,10 @@ SYMBOL_EXPORT double GetGameSpeed(struct Game* game) { SYMBOL_EXPORT void SetBackgroundColor(struct Game* game, ALLEGRO_COLOR bg) { game->_priv.bg = bg; +#ifdef __EMSCRIPTEN__ + EM_ASM({ + document.body.style.backgroundColor = 'rgb(' + $0 + ',' + $1 + ',' + $2 + ')'; + }, + (int)(bg.r * 255), (int)(bg.g * 255), (int)(bg.b * 255)); +#endif }