diff options
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/detect.py | 11 | ||||
-rw-r--r-- | platform/uwp/export/app_packager.cpp | 2 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 54 | ||||
-rw-r--r-- | platform/uwp/os_uwp.h | 7 |
4 files changed, 39 insertions, 35 deletions
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index 2c5746cb06..64fe5bc4a2 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -3,6 +3,11 @@ import os import sys from platform_methods import detect_arch +from typing import TYPE_CHECKING + +if TYPE_CHECKING: + from SCons import Environment + def is_active(): return True @@ -39,7 +44,7 @@ def get_flags(): ] -def configure(env): +def configure(env: "Environment"): # Validate arch. supported_arches = ["x86_32", "x86_64", "arm32"] if env["arch"] not in supported_arches: @@ -83,7 +88,7 @@ def configure(env): env.AppendUnique(CCFLAGS=["/utf-8"]) # ANGLE - angle_root = os.getenv("ANGLE_SRC_PATH") + angle_root = os.environ["ANGLE_SRC_PATH"] env.Prepend(CPPPATH=[angle_root + "/include"]) jobs = str(env.GetOption("num_jobs")) angle_build_cmd = ( @@ -94,7 +99,7 @@ def configure(env): + " /p:Configuration=Release /p:Platform=" ) - if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): + if os.path.isfile(f"{angle_root}/winrt/10/src/angle.sln"): env["build_angle"] = True ## Architecture diff --git a/platform/uwp/export/app_packager.cpp b/platform/uwp/export/app_packager.cpp index 87224d38b8..6f8966b9ff 100644 --- a/platform/uwp/export/app_packager.cpp +++ b/platform/uwp/export/app_packager.cpp @@ -301,7 +301,7 @@ Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t Vector<uint8_t> file_buffer; // Data for compression - z_stream strm; + z_stream strm{}; Vector<uint8_t> strm_in; strm_in.resize(BLOCK_SIZE); Vector<uint8_t> strm_out; diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 494f5ec4b9..141c28c713 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -159,7 +159,7 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a outside = true; // FIXME: Hardcoded for now, add Vulkan support. - p_video_driver = VIDEO_DRIVER_OPENGL; + p_video_driver = RENDERING_DRIVER_OPENGL3; ContextEGL_UWP::Driver opengl_api_type = ContextEGL_UWP::GLES_2_0; bool gl_initialization_error = false; @@ -444,24 +444,17 @@ String OS_UWP::get_name() const { return "UWP"; } -OS::Date OS_UWP::get_date(bool p_utc) const { - SYSTEMTIME systemtime; - if (p_utc) { - GetSystemTime(&systemtime); - } else { - GetLocalTime(&systemtime); - } +String OS_UWP::get_distribution_name() const { + return get_name(); +} - Date date; - date.day = systemtime.wDay; - date.month = Month(systemtime.wMonth); - date.weekday = Weekday(systemtime.wDayOfWeek); - date.year = systemtime.wYear; - date.dst = false; - return date; +String OS_UWP::get_version() const { + winrt::hstring df_version = VersionInfo().DeviceFamilyVersion(); + static String version = String(winrt::to_string(df_version).c_str()); + return version; } -OS::Time OS_UWP::get_time(bool p_utc) const { +OS::DateTime OS_UWP::get_datetime(bool p_utc) const { SYSTEMTIME systemtime; if (p_utc) { GetSystemTime(&systemtime); @@ -469,11 +462,23 @@ OS::Time OS_UWP::get_time(bool p_utc) const { GetLocalTime(&systemtime); } - Time time; - time.hour = systemtime.wHour; - time.min = systemtime.wMinute; - time.sec = systemtime.wSecond; - return time; + //Get DST information from Windows, but only if p_utc is false. + TIME_ZONE_INFORMATION info; + bool daylight = false; + if (!p_utc && GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT) { + daylight = true; + } + + DateTime dt; + dt.year = systemtime.wYear; + dt.month = Month(systemtime.wMonth); + dt.day = systemtime.wDay; + dt.weekday = Weekday(systemtime.wDayOfWeek); + dt.hour = systemtime.wHour; + dt.minute = systemtime.wMinute; + dt.second = systemtime.wSecond; + dt.dst = daylight; + return dt; } OS::TimeZoneInfo OS_UWP::get_time_zone_info() const { @@ -821,10 +826,6 @@ OS_UWP::OS_UWP() { pressrc = 0; old_invalid = true; mouse_mode = MOUSE_MODE_VISIBLE; -#ifdef STDOUT_FILE - stdo = fopen("stdout.txt", "wb"); -#endif - gl_context = nullptr; display_request = ref new Windows::System::Display::DisplayRequest(); @@ -842,7 +843,4 @@ OS_UWP::OS_UWP() { } OS_UWP::~OS_UWP() { -#ifdef STDOUT_FILE - fclose(stdo); -#endif } diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 5a58486ee7..c1df7827cd 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -42,9 +42,9 @@ #include "servers/rendering/renderer_compositor.h" #include "servers/rendering_server.h" -#include <fcntl.h> #include <io.h> #include <stdio.h> + #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -183,9 +183,10 @@ public: virtual MainLoop *get_main_loop() const; virtual String get_name() const; + virtual String get_distribution_name() const; + virtual String get_version() const; - virtual Date get_date(bool p_utc) const; - virtual Time get_time(bool p_utc) const; + virtual DateTime get_datetime(bool p_utc) const; virtual TimeZoneInfo get_time_zone_info() const; virtual uint64_t get_unix_time() const; |