summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/context_egl_uwp.h2
-rw-r--r--platform/uwp/detect.py16
-rw-r--r--platform/uwp/export/export.cpp37
-rw-r--r--platform/uwp/os_uwp.cpp13
-rw-r--r--platform/uwp/os_uwp.h6
5 files changed, 42 insertions, 32 deletions
diff --git a/platform/uwp/context_egl_uwp.h b/platform/uwp/context_egl_uwp.h
index 6f333b8e6a..5e7dc1802d 100644
--- a/platform/uwp/context_egl_uwp.h
+++ b/platform/uwp/context_egl_uwp.h
@@ -35,7 +35,7 @@
#include <EGL/egl.h>
-#include "core/error_list.h"
+#include "core/error/error_list.h"
#include "core/os/os.h"
using namespace Windows::UI::Core;
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index 669bfe6814..2af7803749 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -65,12 +65,14 @@ def configure(env):
env.Append(CCFLAGS=["/MD"])
env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
+ env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"])
elif env["target"] == "debug":
env.Append(CCFLAGS=["/Zi"])
env.Append(CCFLAGS=["/MDd"])
- env.Append(CPPDEFINES=["DEBUG_ENABLED", "DEBUG_MEMORY_ENABLED"])
+ env.Append(CPPDEFINES=["DEBUG_ENABLED"])
env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
+ env.AppendUnique(CPPDEFINES=["WINDOWS_SUBSYSTEM_CONSOLE"])
env.Append(LINKFLAGS=["/DEBUG"])
## Compiler configuration
@@ -78,6 +80,9 @@ def configure(env):
env["ENV"] = os.environ
vc_base_path = os.environ["VCTOOLSINSTALLDIR"] if "VCTOOLSINSTALLDIR" in os.environ else os.environ["VCINSTALLDIR"]
+ # Force to use Unicode encoding
+ env.AppendUnique(CCFLAGS=["/utf-8"])
+
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
env.Prepend(CPPPATH=[angle_root + "/include"])
@@ -120,7 +125,9 @@ def configure(env):
print("Compiled program architecture will be a x86 executable. (forcing bits=32).")
else:
print(
- "Failed to detect MSVC compiler architecture version... Defaulting to 32-bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup."
+ "Failed to detect MSVC compiler architecture version... Defaulting to 32-bit executable settings"
+ " (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture"
+ " this build is compiled for. You should check your settings/compilation setup."
)
env["bits"] = "32"
@@ -160,7 +167,10 @@ def configure(env):
env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/x86/store/references"])
env.Append(
- CCFLAGS='/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split()
+ CCFLAGS=(
+ '/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX-'
+ " /Zc:forScope /Gd /EHsc /nologo".split()
+ )
)
env.Append(CPPDEFINES=["_UNICODE", "UNICODE", ("WINAPI_FAMILY", "WINAPI_FAMILY_APP")])
env.Append(CXXFLAGS=["/ZW"])
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 0fd017f96e..30568241a9 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -29,14 +29,15 @@
/*************************************************************************/
#include "export.h"
-#include "core/bind/core_bind.h"
+
+#include "core/config/project_settings.h"
+#include "core/core_bind.h"
#include "core/crypto/crypto_core.h"
#include "core/io/marshalls.h"
#include "core/io/zip_io.h"
-#include "core/object.h"
+#include "core/object/class_db.h"
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
-#include "core/project_settings.h"
#include "core/version.h"
#include "editor/editor_export.h"
#include "editor/editor_node.h"
@@ -249,7 +250,7 @@ void AppxPackager::make_content_types(const String &p_path) {
Map<String, String> types;
for (int i = 0; i < file_metadata.size(); i++) {
- String ext = file_metadata[i].name.get_extension();
+ String ext = file_metadata[i].name.get_extension().to_lower();
if (types.has(ext)) {
continue;
@@ -961,7 +962,7 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
return true;
}
- static Error save_appx_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total) {
+ static Error save_appx_file(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key) {
AppxPackager *packager = (AppxPackager *)p_userdata;
String dst_path = p_path.replace_first("res://", "game/");
@@ -969,24 +970,24 @@ class EditorExportPlatformUWP : public EditorExportPlatform {
}
public:
- virtual String get_name() const {
+ virtual String get_name() const override {
return "UWP";
}
- virtual String get_os_name() const {
+ virtual String get_os_name() const override {
return "UWP";
}
- virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const {
+ virtual List<String> get_binary_extensions(const Ref<EditorExportPreset> &p_preset) const override {
List<String> list;
list.push_back("appx");
return list;
}
- virtual Ref<Texture2D> get_logo() const {
+ virtual Ref<Texture2D> get_logo() const override {
return logo;
}
- virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) {
+ virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) override {
r_features->push_back("s3tc");
r_features->push_back("etc");
switch ((int)p_preset->get("architecture/target")) {
@@ -1002,7 +1003,10 @@ public:
}
}
- virtual void get_export_options(List<ExportOption> *r_options) {
+ virtual void get_export_options(List<ExportOption> *r_options) override {
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
+ r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
+
r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "architecture/target", PROPERTY_HINT_ENUM, "arm,x86,x64"), 1));
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "command_line/extra_args"), ""));
@@ -1044,9 +1048,6 @@ public:
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_wide310x150"), false));
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "tiles/show_name_on_square310x310"), false));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
- r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
-
// Capabilities
const char **basic = uwp_capabilities;
while (*basic) {
@@ -1067,7 +1068,7 @@ public:
}
}
- virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const {
+ virtual bool can_export(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates) const override {
String err;
bool valid = false;
@@ -1177,7 +1178,7 @@ public:
return valid;
}
- virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) {
+ virtual Error export_project(const Ref<EditorExportPreset> &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override {
String src_appx;
EditorProgress ep("export", "Exporting for UWP", 7, true);
@@ -1418,12 +1419,12 @@ public:
return OK;
}
- virtual void get_platform_features(List<String> *r_features) {
+ virtual void get_platform_features(List<String> *r_features) override {
r_features->push_back("pc");
r_features->push_back("UWP");
}
- virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) {
+ virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) override {
}
EditorExportPlatformUWP() {
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index ee25754704..79508055e5 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -33,9 +33,8 @@
#include "os_uwp.h"
+#include "core/config/project_settings.h"
#include "core/io/marshalls.h"
-#include "core/project_settings.h"
-#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/unix/ip_unix.h"
#include "drivers/windows/dir_access_windows.h"
#include "drivers/windows/file_access_windows.h"
@@ -297,7 +296,7 @@ Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
void OS_UWP::set_clipboard(const String &p_text) {
DataPackage ^ clip = ref new DataPackage();
clip->RequestedOperation = DataPackageOperation::Copy;
- clip->SetText(ref new Platform::String((const wchar_t *)p_text.c_str()));
+ clip->SetText(ref new Platform::String((LPCWSTR)(p_text.utf16().get_data())));
Clipboard::SetContent(clip);
};
@@ -347,8 +346,8 @@ void OS_UWP::finalize_core() {
}
void OS_UWP::alert(const String &p_alert, const String &p_title) {
- Platform::String ^ alert = ref new Platform::String(p_alert.c_str());
- Platform::String ^ title = ref new Platform::String(p_title.c_str());
+ Platform::String ^ alert = ref new Platform::String((LPCWSTR)(p_alert.utf16().get_data()));
+ Platform::String ^ title = ref new Platform::String((LPCWSTR)(p_title.utf16().get_data()));
MessageDialog ^ msg = ref new MessageDialog(alert, title);
@@ -715,7 +714,7 @@ bool OS_UWP::has_virtual_keyboard() const {
return UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
-void OS_UWP::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
+void OS_UWP::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect, bool p_multiline, int p_max_input_length, int p_cursor_start, int p_cursor_end) {
InputPane ^ pane = InputPane::GetForCurrentView();
pane->TryShow();
}
@@ -739,7 +738,7 @@ static String format_error_message(DWORD id) {
Error OS_UWP::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
String full_path = "game/" + p_path;
- p_library_handle = (void *)LoadPackagedLibrary(full_path.c_str(), 0);
+ p_library_handle = (void *)LoadPackagedLibrary((LPCWSTR)(full_path.utf16().get_data()), 0);
ERR_FAIL_COND_V_MSG(!p_library_handle, ERR_CANT_OPEN, "Can't open dynamic library: " + full_path + ", error: " + format_error_message(GetLastError()) + ".");
return OK;
}
diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h
index 95359c68b0..88961bf143 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -35,7 +35,7 @@
#include "core/input/input.h"
#include "core/math/transform_2d.h"
#include "core/os/os.h"
-#include "core/ustring.h"
+#include "core/string/ustring.h"
#include "drivers/xaudio2/audio_driver_xaudio2.h"
#include "joypad_uwp.h"
#include "servers/audio_server.h"
@@ -234,7 +234,7 @@ public:
virtual bool has_touchscreen_ui_hint() const;
virtual bool has_virtual_keyboard() const;
- virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
+ virtual void show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect = Rect2(), bool p_multiline = false, int p_max_input_length = -1, int p_cursor_start = -1, int p_cursor_end = -1);
virtual void hide_virtual_keyboard();
virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false);
@@ -245,7 +245,7 @@ public:
void run();
- virtual bool get_swap_ok_cancel() { return true; }
+ virtual bool get_swap_cancel_ok() { return true; }
void input_event(const Ref<InputEvent> &p_event);