utils: Set <body> background in SetBackgroundColor on Emscripten

This commit is contained in:
Sebastian Krzyszkowiak 2022-07-28 21:39:09 +02:00
parent ca1cbc19b7
commit dd35960724
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -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
}