summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/SCsub1
-rw-r--r--platform/uwp/app.cpp6
-rw-r--r--platform/uwp/app.h1
-rw-r--r--platform/uwp/context_egl_uwp.h2
-rw-r--r--platform/uwp/export/export.cpp10
-rw-r--r--platform/uwp/os_uwp.cpp88
-rw-r--r--platform/uwp/os_uwp.h10
-rw-r--r--platform/uwp/power_uwp.cpp77
-rw-r--r--platform/uwp/power_uwp.h56
9 files changed, 29 insertions, 222 deletions
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index c14290f0c4..620d8c3c3a 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -7,7 +7,6 @@ files = [
'#platform/windows/key_mapping_windows.cpp',
'#platform/windows/windows_terminal_logger.cpp',
'joypad_uwp.cpp',
- 'power_uwp.cpp',
'context_egl_uwp.cpp',
'app.cpp',
'os_uwp.cpp',
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index a47fe96c1b..ccb4b43373 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -410,14 +410,16 @@ void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Wind
ke.type = OS_UWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
- ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
+ ke.keycode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
+ ke.physical_keycode = KeyMappingWindows::get_scansym((unsigned int)key_args->KeyStatus.ScanCode);
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
ke.type = OS_UWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
- ke.scancode = 0;
+ ke.keycode = 0;
+ ke.physical_keycode = 0;
ke.echo = (!p_pressed && !char_args->KeyStatus.IsKeyReleased) || (p_pressed && char_args->KeyStatus.WasKeyDown);
}
diff --git a/platform/uwp/app.h b/platform/uwp/app.h
index 302d9759b3..b7265ad086 100644
--- a/platform/uwp/app.h
+++ b/platform/uwp/app.h
@@ -34,7 +34,6 @@
#include <wrl.h>
-// ANGLE doesn't provide a specific lib for GLES3, so we keep using GLES2
#include "GLES2/gl2.h"
#include "os_uwp.h"
diff --git a/platform/uwp/context_egl_uwp.h b/platform/uwp/context_egl_uwp.h
index 7a41685867..fa61cf50c6 100644
--- a/platform/uwp/context_egl_uwp.h
+++ b/platform/uwp/context_egl_uwp.h
@@ -45,7 +45,7 @@ class ContextEGL_UWP {
public:
enum Driver {
GLES_2_0,
- GLES_3_0,
+ VULKAN, // FIXME: Add Vulkan support.
};
private:
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 57fb9004b8..533293387d 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -1004,7 +1004,7 @@ public:
return list;
}
- virtual Ref<Texture> get_logo() const {
+ virtual Ref<Texture2D> get_logo() const {
return logo;
}
@@ -1176,7 +1176,7 @@ public:
err += TTR("Invalid square 71x71 logo image dimensions (should be 71x71).") + "\n";
}
- if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 0)) {
+ if (!p_preset->get("images/square150x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square150x150_logo"))), 150, 150)) {
valid = false;
err += TTR("Invalid square 150x150 logo image dimensions (should be 150x150).") + "\n";
}
@@ -1397,7 +1397,7 @@ public:
}
if (!FileAccess::exists(signtool_path)) {
- ERR_PRINTS("Could not find signtool executable at " + signtool_path + ", aborting.");
+ ERR_PRINT("Could not find signtool executable at " + signtool_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
@@ -1418,12 +1418,12 @@ public:
}
if (!FileAccess::exists(cert_path)) {
- ERR_PRINTS("Could not find certificate file at " + cert_path + ", aborting.");
+ ERR_PRINT("Could not find certificate file at " + cert_path + ", aborting.");
return ERR_FILE_NOT_FOUND;
}
if (cert_alg < 0 || cert_alg > 2) {
- ERR_PRINTS("Invalid certificate algorithm " + itos(cert_alg) + ", aborting.");
+ ERR_PRINT("Invalid certificate algorithm " + itos(cert_alg) + ", aborting.");
return ERR_INVALID_DATA;
}
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index d5047b53ab..4ddb5463d0 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -36,7 +36,6 @@
#include "core/io/marshalls.h"
#include "core/project_settings.h"
#include "drivers/gles2/rasterizer_gles2.h"
-#include "drivers/gles3/rasterizer_gles3.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
@@ -141,8 +140,6 @@ void OS_UWP::initialize_core() {
//RedirectIOToConsole();
ThreadUWP::make_default();
- SemaphoreWindows::make_default();
- MutexWindows::make_default();
RWLockWindows::make_default();
FileAccess::make_default<FileAccessWindows>(FileAccess::ACCESS_RESOURCES);
@@ -186,71 +183,33 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
main_loop = NULL;
outside = true;
+ // FIXME: Hardcoded for now, add Vulkan support.
+ p_video_driver = VIDEO_DRIVER_GLES2;
ContextEGL_UWP::Driver opengl_api_type = ContextEGL_UWP::GLES_2_0;
- if (p_video_driver == VIDEO_DRIVER_GLES2) {
- opengl_api_type = ContextEGL_UWP::GLES_2_0;
- }
-
bool gl_initialization_error = false;
- gl_context = NULL;
- while (!gl_context) {
- gl_context = memnew(ContextEGL_UWP(window, opengl_api_type));
-
- if (gl_context->initialize() != OK) {
- memdelete(gl_context);
- gl_context = NULL;
-
- if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) {
- if (p_video_driver == VIDEO_DRIVER_GLES2) {
- gl_initialization_error = true;
- break;
- }
-
- p_video_driver = VIDEO_DRIVER_GLES2;
- opengl_api_type = ContextEGL_UWP::GLES_2_0;
- } else {
- gl_initialization_error = true;
- break;
- }
- }
- }
+ gl_context = memnew(ContextEGL_UWP(window, opengl_api_type));
- while (true) {
- if (opengl_api_type == ContextEGL_UWP::GLES_3_0) {
- if (RasterizerGLES3::is_viable() == OK) {
- RasterizerGLES3::register_config();
- RasterizerGLES3::make_current();
- break;
- } else {
- if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) {
- p_video_driver = VIDEO_DRIVER_GLES2;
- opengl_api_type = ContextEGL_UWP::GLES_2_0;
- continue;
- } else {
- gl_initialization_error = true;
- break;
- }
- }
- }
+ if (gl_context->initialize() != OK) {
+ memdelete(gl_context);
+ gl_context = NULL;
+ gl_initialization_error = true;
+ }
- if (opengl_api_type == ContextEGL_UWP::GLES_2_0) {
- if (RasterizerGLES2::is_viable() == OK) {
- RasterizerGLES2::register_config();
- RasterizerGLES2::make_current();
- break;
- } else {
- gl_initialization_error = true;
- break;
- }
+ if (opengl_api_type == ContextEGL_UWP::GLES_2_0) {
+ if (RasterizerGLES2::is_viable() == OK) {
+ RasterizerGLES2::register_config();
+ RasterizerGLES2::make_current();
+ } else {
+ gl_initialization_error = true;
}
}
if (gl_initialization_error) {
OS::get_singleton()->alert("Your video card driver does not support any of the supported OpenGL versions.\n"
"Please update your drivers or if you have a very old or integrated GPU upgrade it.",
- "Unable to initialize Video driver");
+ "Unable to initialize video driver");
return ERR_UNAVAILABLE;
}
@@ -310,8 +269,6 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
AudioDriverManager::initialize(p_audio_driver);
- power_manager = memnew(PowerUWP);
-
managed_object->update_clipboard();
Clipboard::ContentChanged += ref new EventHandler<Platform::Object ^>(managed_object, &ManagedType::on_clipboard_changed);
@@ -647,7 +604,8 @@ void OS_UWP::process_key_events() {
key_event->set_shift(kev.shift);
key_event->set_control(kev.control);
key_event->set_echo(kev.echo);
- key_event->set_scancode(kev.scancode);
+ key_event->set_keycode(kev.keycode);
+ key_event->set_physical_keycode(kev.physical_keycode);
key_event->set_unicode(kev.unicode);
key_event->set_pressed(kev.pressed);
@@ -893,18 +851,6 @@ bool OS_UWP::_check_internal_feature_support(const String &p_feature) {
return p_feature == "pc";
}
-OS::PowerState OS_UWP::get_power_state() {
- return power_manager->get_power_state();
-}
-
-int OS_UWP::get_power_seconds_left() {
- return power_manager->get_power_seconds_left();
-}
-
-int OS_UWP::get_power_percent_left() {
- return power_manager->get_power_percent_left();
-}
-
OS_UWP::OS_UWP() {
key_event_pos = 0;
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index fb43ab382e..ac6e0f3dd5 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -39,7 +39,6 @@
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#include "joypad_uwp.h"
#include "main/input_default.h"
-#include "power_uwp.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
#include "servers/visual_server.h"
@@ -62,7 +61,8 @@ public:
bool alt, shift, control;
MessageType type;
bool pressed;
- unsigned int scancode;
+ unsigned int keycode;
+ unsigned int physical_keycode;
unsigned int unicode;
bool echo;
CorePhysicalKeyStatus status;
@@ -102,8 +102,6 @@ private:
AudioDriverXAudio2 audio_driver;
- PowerUWP *power_manager;
-
MouseMode mouse_mode;
bool alt_mem;
bool gr_mem;
@@ -254,10 +252,6 @@ public:
void input_event(const Ref<InputEvent> &p_event);
- virtual OS::PowerState get_power_state();
- virtual int get_power_seconds_left();
- virtual int get_power_percent_left();
-
void queue_key_event(KeyEvent &p_event);
OS_UWP();
diff --git a/platform/uwp/power_uwp.cpp b/platform/uwp/power_uwp.cpp
deleted file mode 100644
index c6b4359392..0000000000
--- a/platform/uwp/power_uwp.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*************************************************************************/
-/* power_uwp.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#include "power_uwp.h"
-
-PowerUWP::PowerUWP() :
- nsecs_left(-1),
- percent_left(-1),
- power_state(OS::POWERSTATE_UNKNOWN) {
-}
-
-PowerUWP::~PowerUWP() {
-}
-
-bool PowerUWP::UpdatePowerInfo() {
- // TODO, WinRT: Battery info is available on at least one WinRT platform (Windows Phone 8). Implement UpdatePowerInfo as appropriate. */
- /* Notes from SDL:
- - the Win32 function, GetSystemPowerStatus, is not available for use on WinRT
- - Windows Phone 8 has a 'Battery' class, which is documented as available for C++
- - More info on WP8's Battery class can be found at http://msdn.microsoft.com/library/windowsphone/develop/jj207231
- */
- return false;
-}
-
-OS::PowerState PowerUWP::get_power_state() {
- if (UpdatePowerInfo()) {
- return power_state;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to POWERSTATE_UNKNOWN");
- return OS::POWERSTATE_UNKNOWN;
- }
-}
-
-int PowerUWP::get_power_seconds_left() {
- if (UpdatePowerInfo()) {
- return nsecs_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
-
-int PowerUWP::get_power_percent_left() {
- if (UpdatePowerInfo()) {
- return percent_left;
- } else {
- WARN_PRINT("Power management is not implemented on this platform, defaulting to -1");
- return -1;
- }
-}
diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h
deleted file mode 100644
index 5e28cf65e5..0000000000
--- a/platform/uwp/power_uwp.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************/
-/* power_uwp.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* https://godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-
-#ifndef POWER_UWP_H
-#define POWER_UWP_H
-
-#include "core/os/dir_access.h"
-#include "core/os/file_access.h"
-#include "core/os/os.h"
-
-class PowerUWP {
-
-private:
- int nsecs_left;
- int percent_left;
- OS::PowerState power_state;
-
- bool UpdatePowerInfo();
-
-public:
- PowerUWP();
- virtual ~PowerUWP();
-
- OS::PowerState get_power_state();
- int get_power_seconds_left();
- int get_power_percent_left();
-};
-
-#endif // POWER_UWP_H