summaryrefslogtreecommitdiff
path: root/platform/javascript/os_javascript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/javascript/os_javascript.cpp')
-rw-r--r--platform/javascript/os_javascript.cpp21
1 files changed, 20 insertions, 1 deletions
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index 34dce90b6b..13615de65b 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -220,6 +220,20 @@ void OS_JavaScript::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_scre
p_list->push_back(OS::VideoMode(screen.width, screen.height, true));
}
+bool OS_JavaScript::get_window_per_pixel_transparency_enabled() const {
+ if (!is_layered_allowed()) {
+ return false;
+ }
+ return transparency_enabled;
+}
+
+void OS_JavaScript::set_window_per_pixel_transparency_enabled(bool p_enabled) {
+ if (!is_layered_allowed()) {
+ return;
+ }
+ transparency_enabled = p_enabled;
+}
+
// Keys
template <typename T>
@@ -886,10 +900,14 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver,
EmscriptenWebGLContextAttributes attributes;
emscripten_webgl_init_context_attributes(&attributes);
- attributes.alpha = false;
+ attributes.alpha = GLOBAL_GET("display/window/per_pixel_transparency/allowed");
attributes.antialias = false;
ERR_FAIL_INDEX_V(p_video_driver, VIDEO_DRIVER_MAX, ERR_INVALID_PARAMETER);
+ if (p_desired.layered) {
+ set_window_per_pixel_transparency_enabled(true);
+ }
+
bool gles3 = true;
if (p_video_driver == VIDEO_DRIVER_GLES2) {
gles3 = false;
@@ -1315,6 +1333,7 @@ OS_JavaScript::OS_JavaScript(int p_argc, char *p_argv[]) {
window_maximized = false;
entering_fullscreen = false;
just_exited_fullscreen = false;
+ transparency_enabled = false;
main_loop = NULL;