summaryrefslogtreecommitdiff
path: root/platform/uwp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/uwp')
-rw-r--r--platform/uwp/SCsub4
-rw-r--r--platform/uwp/app.cpp10
-rw-r--r--platform/uwp/app.h2
-rw-r--r--platform/uwp/context_egl_uwp.cpp (renamed from platform/uwp/gl_context_egl.cpp)24
-rw-r--r--platform/uwp/context_egl_uwp.h (renamed from platform/uwp/gl_context_egl.h)34
-rw-r--r--platform/uwp/detect.py35
-rw-r--r--platform/uwp/export/export.cpp104
-rw-r--r--platform/uwp/os_uwp.cpp188
-rw-r--r--platform/uwp/os_uwp.h22
-rw-r--r--platform/uwp/power_uwp.h6
10 files changed, 232 insertions, 197 deletions
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub
index fb0c4a92ae..c14290f0c4 100644
--- a/platform/uwp/SCsub
+++ b/platform/uwp/SCsub
@@ -4,11 +4,11 @@ Import('env')
files = [
'thread_uwp.cpp',
- '#platform/windows/key_mapping_win.cpp',
+ '#platform/windows/key_mapping_windows.cpp',
'#platform/windows/windows_terminal_logger.cpp',
'joypad_uwp.cpp',
'power_uwp.cpp',
- 'gl_context_egl.cpp',
+ 'context_egl_uwp.cpp',
'app.cpp',
'os_uwp.cpp',
]
diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp
index 1b8f9f3f9e..4f2ee0237a 100644
--- a/platform/uwp/app.cpp
+++ b/platform/uwp/app.cpp
@@ -39,7 +39,7 @@
#include "core/os/keyboard.h"
#include "main/main.h"
-#include "platform/windows/key_mapping_win.h"
+#include "platform/windows/key_mapping_windows.h"
#include <collection.h>
@@ -99,7 +99,7 @@ void App::Initialize(CoreApplicationView ^ applicationView) {
// Information about the Suspending and Resuming event handlers can be found here:
// http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh994930.aspx
- os = new OSUWP;
+ os = new OS_UWP;
}
// Called when the CoreWindow object is created (or re-created).
@@ -398,7 +398,7 @@ void App::OnMouseMoved(MouseDevice ^ mouse_device, MouseEventArgs ^ args) {
void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Windows::UI::Core::KeyEventArgs ^ key_args, Windows::UI::Core::CharacterReceivedEventArgs ^ char_args) {
- OSUWP::KeyEvent ke;
+ OS_UWP::KeyEvent ke;
ke.control = sender->GetAsyncKeyState(VirtualKey::Control) == CoreVirtualKeyStates::Down;
ke.alt = sender->GetAsyncKeyState(VirtualKey::Menu) == CoreVirtualKeyStates::Down;
@@ -408,14 +408,14 @@ void App::key_event(Windows::UI::Core::CoreWindow ^ sender, bool p_pressed, Wind
if (key_args != nullptr) {
- ke.type = OSUWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
+ ke.type = OS_UWP::KeyEvent::MessageType::KEY_EVENT_MESSAGE;
ke.unicode = 0;
ke.scancode = KeyMappingWindows::get_keysym((unsigned int)key_args->VirtualKey);
ke.echo = (!p_pressed && !key_args->KeyStatus.IsKeyReleased) || (p_pressed && key_args->KeyStatus.WasKeyDown);
} else {
- ke.type = OSUWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
+ ke.type = OS_UWP::KeyEvent::MessageType::CHAR_EVENT_MESSAGE;
ke.unicode = char_args->KeyCode;
ke.scancode = 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 d403dace9d..0bd996d483 100644
--- a/platform/uwp/app.h
+++ b/platform/uwp/app.h
@@ -103,7 +103,7 @@ namespace GodotUWP
EGLSurface mEglSurface;
CoreWindow^ window;
- OSUWP* os;
+ OS_UWP* os;
int last_touch_x[32]; // 20 fingers, index 31 reserved for the mouse
int last_touch_y[32];
diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/context_egl_uwp.cpp
index db15be3e06..061c54687c 100644
--- a/platform/uwp/gl_context_egl.cpp
+++ b/platform/uwp/context_egl_uwp.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* gl_context_egl.cpp */
+/* context_egl_uwp.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,33 +28,33 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "gl_context_egl.h"
+#include "context_egl_uwp.h"
#include "EGL/eglext.h"
using Platform::Exception;
-void ContextEGL::release_current() {
+void ContextEGL_UWP::release_current() {
eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, mEglContext);
};
-void ContextEGL::make_current() {
+void ContextEGL_UWP::make_current() {
eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
};
-int ContextEGL::get_window_width() {
+int ContextEGL_UWP::get_window_width() {
return width;
};
-int ContextEGL::get_window_height() {
+int ContextEGL_UWP::get_window_height() {
return height;
};
-void ContextEGL::reset() {
+void ContextEGL_UWP::reset() {
cleanup();
@@ -62,7 +62,7 @@ void ContextEGL::reset() {
initialize();
};
-void ContextEGL::swap_buffers() {
+void ContextEGL_UWP::swap_buffers() {
if (eglSwapBuffers(mEglDisplay, mEglSurface) != EGL_TRUE) {
cleanup();
@@ -74,7 +74,7 @@ void ContextEGL::swap_buffers() {
}
};
-Error ContextEGL::initialize() {
+Error ContextEGL_UWP::initialize() {
EGLint configAttribList[] = {
EGL_RED_SIZE, 8,
@@ -190,7 +190,7 @@ Error ContextEGL::initialize() {
return OK;
};
-void ContextEGL::cleanup() {
+void ContextEGL_UWP::cleanup() {
if (mEglDisplay != EGL_NO_DISPLAY && mEglSurface != EGL_NO_SURFACE) {
eglDestroySurface(mEglDisplay, mEglSurface);
@@ -208,14 +208,14 @@ void ContextEGL::cleanup() {
}
};
-ContextEGL::ContextEGL(CoreWindow ^ p_window, Driver p_driver) :
+ContextEGL_UWP::ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver) :
mEglDisplay(EGL_NO_DISPLAY),
mEglContext(EGL_NO_CONTEXT),
mEglSurface(EGL_NO_SURFACE),
driver(p_driver),
window(p_window) {}
-ContextEGL::~ContextEGL() {
+ContextEGL_UWP::~ContextEGL_UWP() {
cleanup();
};
diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/context_egl_uwp.h
index 60feed2e24..0c62fe7456 100644
--- a/platform/uwp/gl_context_egl.h
+++ b/platform/uwp/context_egl_uwp.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* gl_context_egl.h */
+/* context_egl_uwp.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,19 +28,19 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef CONTEXT_EGL_H
-#define CONTEXT_EGL_H
+#ifndef CONTEXT_EGL_UWP_H
+#define CONTEXT_EGL_UWP_H
#include <wrl.h>
-#include "EGL/egl.h"
+#include <EGL/egl.h>
+
#include "core/error_list.h"
#include "core/os/os.h"
-#include "drivers/gl_context/context_gl.h"
using namespace Windows::UI::Core;
-class ContextEGL : public ContextGL {
+class ContextEGL_UWP {
public:
enum Driver {
@@ -63,24 +63,24 @@ private:
Driver driver;
public:
- virtual void release_current();
+ void release_current();
- virtual void make_current();
+ void make_current();
- virtual int get_window_width();
- virtual int get_window_height();
- virtual void swap_buffers();
+ int get_window_width();
+ int get_window_height();
+ void swap_buffers();
- virtual void set_use_vsync(bool use) { vsync = use; }
- virtual bool is_using_vsync() const { return vsync; }
+ void set_use_vsync(bool use) { vsync = use; }
+ bool is_using_vsync() const { return vsync; }
- virtual Error initialize();
+ Error initialize();
void reset();
void cleanup();
- ContextEGL(CoreWindow ^ p_window, Driver p_driver);
- virtual ~ContextEGL();
+ ContextEGL_UWP(CoreWindow ^ p_window, Driver p_driver);
+ ~ContextEGL_UWP();
};
-#endif
+#endif // CONTEXT_EGL_UWP_H
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py
index f25b9ba9cd..00f419f4f0 100644
--- a/platform/uwp/detect.py
+++ b/platform/uwp/detect.py
@@ -1,6 +1,5 @@
import methods
import os
-import string
import sys
@@ -25,11 +24,8 @@ def can_build():
def get_opts():
- from SCons.Variables import BoolVariable
-
return [
('msvc_version', 'MSVC version to use (ignored if the VCINSTALLDIR environment variable is set)', None),
- BoolVariable('use_mingw', 'Use the MinGW compiler even if MSVC is installed (only used on Windows)', False),
]
@@ -57,18 +53,20 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Append(CPPFLAGS=['/O2', '/GL'])
- env.Append(CPPFLAGS=['/MD'])
+ env.Append(CCFLAGS=['/O2', '/GL'])
+ env.Append(CCFLAGS=['/MD'])
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG'])
elif (env["target"] == "release_debug"):
- env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED'])
- env.Append(CPPFLAGS=['/MD'])
+ env.Append(CCFLAGS=['/O2', '/Zi'])
+ env.Append(CCFLAGS=['/MD'])
+ env.Append(CPPFLAGS=['/DDEBUG_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
elif (env["target"] == "debug"):
- env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
- env.Append(CPPFLAGS=['/MDd'])
+ env.Append(CCFLAGS=['/Zi'])
+ env.Append(CCFLAGS=['/MDd'])
+ env.Append(CPPFLAGS=['/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED'])
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
env.Append(LINKFLAGS=['/DEBUG'])
@@ -79,7 +77,7 @@ def configure(env):
# ANGLE
angle_root = os.getenv("ANGLE_SRC_PATH")
- env.Append(CPPPATH=[angle_root + '/include'])
+ env.Prepend(CPPPATH=[angle_root + '/include'])
jobs = str(env.GetOption("num_jobs"))
angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="
@@ -139,19 +137,20 @@ def configure(env):
## Compile flags
- env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
- env.Append(CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
- env.Append(CCFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
+ env.Prepend(CPPPATH=['#platform/uwp', '#drivers/windows'])
+ env.Append(CPPFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
+ env.Append(CPPFLAGS=['/DGLES_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED'])
winver = "0x0602" # Windows 8 is the minimum target for UWP build
- env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
+ env.Append(CPPFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
- env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32', '/DPNG_ABORT=abort'])
+ env.Append(CPPFLAGS=['/D__WRL_NO_DEFAULT_LIB__', '/DWIN32', '/DPNG_ABORT=abort'])
env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
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 /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'.split())
- env.Append(CXXFLAGS='/ZW /FS'.split())
+ 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())
+ env.Append(CPPFLAGS=['/D_UNICODE', '/DUNICODE', '/D "WINAPI_FAMILY=WINAPI_FAMILY_APP"'])
+ env.Append(CXXFLAGS=['/ZW'])
env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])
## Link flags
diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp
index 6f4898c005..cdcad33f6d 100644
--- a/platform/uwp/export/export.cpp
+++ b/platform/uwp/export/export.cpp
@@ -73,7 +73,7 @@ static const char *uwp_uap_capabilities[] = {
"voipCall",
NULL
};
-static const char *uwp_device_capabilites[] = {
+static const char *uwp_device_capabilities[] = {
"bluetooth",
"location",
"microphone",
@@ -187,7 +187,7 @@ class AppxPackager {
public:
void set_progress_task(String p_task) { progress_task = p_task; }
void init(FileAccess *p_fa);
- void add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress = false);
+ Error add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress = false);
void finish();
AppxPackager();
@@ -468,10 +468,12 @@ void AppxPackager::init(FileAccess *p_fa) {
tmp_content_types_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpcontenttypes.xml");
}
-void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
+Error AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t p_len, int p_file_no, int p_total_files, bool p_compress) {
if (p_file_no >= 1 && p_total_files >= 1) {
- EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files);
+ if (EditorNode::progress_task_step(progress_task, "File: " + p_file_name, (p_file_no * 100) / p_total_files)) {
+ return ERR_SKIP;
+ }
}
FileMeta meta;
@@ -505,7 +507,7 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
while (p_len - step > 0) {
- size_t block_size = (p_len - step) > BLOCK_SIZE ? BLOCK_SIZE : (p_len - step);
+ size_t block_size = (p_len - step) > BLOCK_SIZE ? (size_t)BLOCK_SIZE : (p_len - step);
for (uint32_t i = 0; i < block_size; i++) {
strm_in.write[i] = p_buffer[step + i];
@@ -584,6 +586,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t
package->store_buffer(file_buffer.ptr(), file_buffer.size());
file_metadata.push_back(meta);
+
+ return OK;
}
void AppxPackager::finish() {
@@ -646,9 +650,9 @@ AppxPackager::~AppxPackager() {}
////////////////////////////////////////////////////////////////////
-class EditorExportUWP : public EditorExportPlatform {
+class EditorExportPlatformUWP : public EditorExportPlatform {
- GDCLASS(EditorExportUWP, EditorExportPlatform);
+ GDCLASS(EditorExportPlatformUWP, EditorExportPlatform);
Ref<ImageTexture> logo;
@@ -841,7 +845,7 @@ class EditorExportUWP : public EditorExportPlatform {
}
uap++;
}
- const char **device = uwp_device_capabilites;
+ const char **device = uwp_device_capabilities;
while (*device) {
if ((bool)p_preset->get("capabilities/" + String(*device))) {
capabilities_elements += " <DeviceCapability Name=\"" + String(*device) + "\" />\n";
@@ -1008,9 +1012,7 @@ class EditorExportUWP : public EditorExportPlatform {
AppxPackager *packager = (AppxPackager *)p_userdata;
String dst_path = p_path.replace_first("res://", "game/");
- packager->add_file(dst_path, p_data.ptr(), p_data.size(), p_file, p_total, _should_compress_asset(p_path, p_data));
-
- return OK;
+ return packager->add_file(dst_path, p_data.ptr(), p_data.size(), p_file, p_total, _should_compress_asset(p_path, p_data));
}
public:
@@ -1035,13 +1037,13 @@ public:
r_features->push_back("s3tc");
r_features->push_back("etc");
switch ((int)p_preset->get("architecture/target")) {
- case EditorExportUWP::ARM: {
+ case EditorExportPlatformUWP::ARM: {
r_features->push_back("arm");
} break;
- case EditorExportUWP::X86: {
+ case EditorExportPlatformUWP::X86: {
r_features->push_back("32");
} break;
- case EditorExportUWP::X64: {
+ case EditorExportPlatformUWP::X64: {
r_features->push_back("64");
} break;
}
@@ -1105,7 +1107,7 @@ public:
uap++;
}
- const char **device = uwp_device_capabilites;
+ const char **device = uwp_device_capabilities;
while (*device) {
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/" + String(*device).camelcase_to_underscore(false)), false));
device++;
@@ -1123,13 +1125,13 @@ public:
String platform_infix;
switch (arch) {
- case EditorExportUWP::ARM: {
+ case EditorExportPlatformUWP::ARM: {
platform_infix = "arm";
} break;
- case EditorExportUWP::X86: {
+ case EditorExportPlatformUWP::X86: {
platform_infix = "x86";
} break;
- case EditorExportUWP::X64: {
+ case EditorExportPlatformUWP::X64: {
platform_infix = "x64";
} break;
}
@@ -1151,12 +1153,12 @@ public:
if (!FileAccess::exists(custom_debug_binary)) {
dvalid = false;
- err = "\nCustom debug binary not found.";
+ err += TTR("Custom debug template not found.") + "\n";
}
if (!FileAccess::exists(custom_release_binary)) {
rvalid = false;
- err += "\nCustom release binary not found.";
+ err += TTR("Custom release template not found.") + "\n";
}
if (dvalid || rvalid)
@@ -1169,57 +1171,57 @@ public:
if (!_valid_resource_name(p_preset->get("package/unique_name"))) {
valid = false;
- err += "\nInvalid unique name.";
+ err += TTR("Invalid package unique name.") + "\n";
}
if (!_valid_guid(p_preset->get("identity/product_guid"))) {
valid = false;
- err += "\nInvalid product GUID.";
+ err += TTR("Invalid product GUID.") + "\n";
}
if (!_valid_guid(p_preset->get("identity/publisher_guid"))) {
valid = false;
- err += "\nInvalid publisher GUID.";
+ err += TTR("Invalid publisher GUID.") + "\n";
}
if (!_valid_bgcolor(p_preset->get("images/background_color"))) {
valid = false;
- err += "\nInvalid background color.";
+ err += TTR("Invalid background color.") + "\n";
}
if (!p_preset->get("images/store_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/store_logo"))), 50, 50)) {
valid = false;
- err += "\nInvalid Store Logo image dimensions (should be 50x50).";
+ err += TTR("Invalid Store Logo image dimensions (should be 50x50).") + "\n";
}
if (!p_preset->get("images/square44x44_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square44x44_logo"))), 44, 44)) {
valid = false;
- err += "\nInvalid square 44x44 logo image dimensions (should be 44x44).";
+ err += TTR("Invalid square 44x44 logo image dimensions (should be 44x44).") + "\n";
}
if (!p_preset->get("images/square71x71_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square71x71_logo"))), 71, 71)) {
valid = false;
- err += "\nInvalid square 71x71 logo image dimensions (should be 71x71).";
+ 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)) {
valid = false;
- err += "\nInvalid square 150x150 logo image dimensions (should be 150x150).";
+ err += TTR("Invalid square 150x150 logo image dimensions (should be 150x150).") + "\n";
}
if (!p_preset->get("images/square310x310_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/square310x310_logo"))), 310, 310)) {
valid = false;
- err += "\nInvalid square 310x310 logo image dimensions (should be 310x310).";
+ err += TTR("Invalid square 310x310 logo image dimensions (should be 310x310).") + "\n";
}
if (!p_preset->get("images/wide310x150_logo").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/wide310x150_logo"))), 310, 150)) {
valid = false;
- err += "\nInvalid wide 310x150 logo image dimensions (should be 310x150).";
+ err += TTR("Invalid wide 310x150 logo image dimensions (should be 310x150).") + "\n";
}
if (!p_preset->get("images/splash_screen").is_zero() && !_valid_image((Object::cast_to<StreamTexture>((Object *)p_preset->get("images/splash_screen"))), 620, 300)) {
valid = false;
- err += "\nInvalid splash screen image dimensions (should be 620x300).";
+ err += TTR("Invalid splash screen image dimensions (should be 620x300).") + "\n";
}
r_error = err;
@@ -1230,7 +1232,7 @@ public:
String src_appx;
- EditorProgress ep("export", "Exporting for Windows Universal", 7);
+ EditorProgress ep("export", "Exporting for Windows Universal", 7, true);
if (p_debug)
src_appx = p_preset->get("custom_template/debug");
@@ -1265,6 +1267,10 @@ public:
}
}
+ if (!DirAccess::exists(p_path.get_base_dir())) {
+ return ERR_FILE_BAD_PATH;
+ }
+
Error err = OK;
FileAccess *fa_pack = FileAccess::open(p_path, FileAccess::WRITE, &err);
@@ -1276,7 +1282,9 @@ public:
FileAccess *src_f = NULL;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
- ep.step("Creating package...", 0);
+ if (ep.step("Creating package...", 0)) {
+ return ERR_SKIP;
+ }
unzFile pkg = unzOpen2(src_appx.utf8().get_data(), &io);
@@ -1288,7 +1296,9 @@ public:
int ret = unzGoToFirstFile(pkg);
- ep.step("Copying template files...", 1);
+ if (ep.step("Copying template files...", 1)) {
+ return ERR_SKIP;
+ }
EditorNode::progress_add_task("template_files", "Template files", 100);
packager.set_progress_task("template_files");
@@ -1337,14 +1347,19 @@ public:
print_line("ADDING: " + path);
- packager.add_file(path, data.ptr(), data.size(), template_file_no++, template_files_amount, _should_compress_asset(path, data));
+ err = packager.add_file(path, data.ptr(), data.size(), template_file_no++, template_files_amount, _should_compress_asset(path, data));
+ if (err != OK) {
+ return err;
+ }
ret = unzGoToNextFile(pkg);
}
EditorNode::progress_end_task("template_files");
- ep.step("Creating command line...", 2);
+ if (ep.step("Creating command line...", 2)) {
+ return ERR_SKIP;
+ }
Vector<String> cl = ((String)p_preset->get("command_line/extra_args")).strip_edges().split(" ");
for (int i = 0; i < cl.size(); i++) {
@@ -1378,9 +1393,14 @@ public:
print_line(itos(i) + " param: " + cl[i]);
}
- packager.add_file("__cl__.cl", clf.ptr(), clf.size(), -1, -1, false);
+ err = packager.add_file("__cl__.cl", clf.ptr(), clf.size(), -1, -1, false);
+ if (err != OK) {
+ return err;
+ }
- ep.step("Adding project files...", 3);
+ if (ep.step("Adding project files...", 3)) {
+ return ERR_SKIP;
+ }
EditorNode::progress_add_task("project_files", "Project Files", 100);
packager.set_progress_task("project_files");
@@ -1389,7 +1409,9 @@ public:
EditorNode::progress_end_task("project_files");
- ep.step("Closing package...", 7);
+ if (ep.step("Closing package...", 7)) {
+ return ERR_SKIP;
+ }
unzClose(pkg);
@@ -1459,7 +1481,7 @@ public:
virtual void resolve_platform_feature_priorities(const Ref<EditorExportPreset> &p_preset, Set<String> &p_features) {
}
- EditorExportUWP() {
+ EditorExportPlatformUWP() {
Ref<Image> img = memnew(Image(_uwp_logo));
logo.instance();
logo->create_from_image(img);
@@ -1478,7 +1500,7 @@ void register_uwp_exporter() {
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::INT, "export/uwp/debug_algorithm", PROPERTY_HINT_ENUM, "MD5,SHA1,SHA256"));
#endif // WINDOWS_ENABLED
- Ref<EditorExportUWP> exporter;
+ Ref<EditorExportPlatformUWP> exporter;
exporter.instance();
EditorExport::get_singleton()->add_export_platform(exporter);
}
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index ea0193b8ed..f9d22481dd 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -67,22 +67,22 @@ using namespace Windows::Devices::Sensors;
using namespace Windows::ApplicationModel::DataTransfer;
using namespace concurrency;
-int OSUWP::get_video_driver_count() const {
+int OS_UWP::get_video_driver_count() const {
return 2;
}
-Size2 OSUWP::get_window_size() const {
+Size2 OS_UWP::get_window_size() const {
Size2 size;
size.width = video_mode.width;
size.height = video_mode.height;
return size;
}
-int OSUWP::get_current_video_driver() const {
+int OS_UWP::get_current_video_driver() const {
return video_driver_index;
}
-void OSUWP::set_window_size(const Size2 p_size) {
+void OS_UWP::set_window_size(const Size2 p_size) {
Windows::Foundation::Size new_size;
new_size.Width = p_size.width;
@@ -97,7 +97,7 @@ void OSUWP::set_window_size(const Size2 p_size) {
}
}
-void OSUWP::set_window_fullscreen(bool p_enabled) {
+void OS_UWP::set_window_fullscreen(bool p_enabled) {
ApplicationView ^ view = ApplicationView::GetForCurrentView();
@@ -117,12 +117,12 @@ void OSUWP::set_window_fullscreen(bool p_enabled) {
}
}
-bool OSUWP::is_window_fullscreen() const {
+bool OS_UWP::is_window_fullscreen() const {
return ApplicationView::GetForCurrentView()->IsFullScreenMode;
}
-void OSUWP::set_keep_screen_on(bool p_enabled) {
+void OS_UWP::set_keep_screen_on(bool p_enabled) {
if (is_keep_screen_on() == p_enabled) return;
@@ -134,7 +134,7 @@ void OSUWP::set_keep_screen_on(bool p_enabled) {
OS::set_keep_screen_on(p_enabled);
}
-void OSUWP::initialize_core() {
+void OS_UWP::initialize_core() {
last_button_state = 0;
@@ -167,49 +167,49 @@ void OSUWP::initialize_core() {
cursor_shape = CURSOR_ARROW;
}
-bool OSUWP::can_draw() const {
+bool OS_UWP::can_draw() const {
return !minimized;
};
-void OSUWP::set_window(Windows::UI::Core::CoreWindow ^ p_window) {
+void OS_UWP::set_window(Windows::UI::Core::CoreWindow ^ p_window) {
window = p_window;
}
-void OSUWP::screen_size_changed() {
+void OS_UWP::screen_size_changed() {
gl_context->reset();
};
-Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
+Error OS_UWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver) {
main_loop = NULL;
outside = true;
- ContextEGL::Driver opengl_api_type = ContextEGL::GLES_2_0;
+ ContextEGL_UWP::Driver opengl_api_type = ContextEGL_UWP::GLES_2_0;
if (p_video_driver == VIDEO_DRIVER_GLES2) {
- opengl_api_type = ContextEGL::GLES_2_0;
+ opengl_api_type = ContextEGL_UWP::GLES_2_0;
}
bool gl_initialization_error = false;
gl_context = NULL;
while (!gl_context) {
- gl_context = memnew(ContextEGL(window, opengl_api_type));
+ 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/driver_fallback") == "Best") {
+ 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::GLES_2_0;
+ opengl_api_type = ContextEGL_UWP::GLES_2_0;
} else {
gl_initialization_error = true;
break;
@@ -218,15 +218,15 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
}
while (true) {
- if (opengl_api_type == ContextEGL::GLES_3_0) {
+ 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/driver_fallback") == "Best") {
+ if (GLOBAL_GET("rendering/quality/driver/fallback_to_gles2")) {
p_video_driver = VIDEO_DRIVER_GLES2;
- opengl_api_type = ContextEGL::GLES_2_0;
+ opengl_api_type = ContextEGL_UWP::GLES_2_0;
continue;
} else {
gl_initialization_error = true;
@@ -235,7 +235,7 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
}
}
- if (opengl_api_type == ContextEGL::GLES_2_0) {
+ if (opengl_api_type == ContextEGL_UWP::GLES_2_0) {
if (RasterizerGLES2::is_viable() == OK) {
RasterizerGLES2::register_config();
RasterizerGLES2::make_current();
@@ -349,7 +349,7 @@ Error OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_au
return OK;
}
-void OSUWP::set_clipboard(const String &p_text) {
+void OS_UWP::set_clipboard(const String &p_text) {
DataPackage ^ clip = ref new DataPackage();
clip->RequestedOperation = DataPackageOperation::Copy;
@@ -358,7 +358,7 @@ void OSUWP::set_clipboard(const String &p_text) {
Clipboard::SetContent(clip);
};
-String OSUWP::get_clipboard() const {
+String OS_UWP::get_clipboard() const {
if (managed_object->clipboard != nullptr)
return managed_object->clipboard->Data();
@@ -366,25 +366,25 @@ String OSUWP::get_clipboard() const {
return "";
};
-void OSUWP::input_event(const Ref<InputEvent> &p_event) {
+void OS_UWP::input_event(const Ref<InputEvent> &p_event) {
input->parse_input_event(p_event);
};
-void OSUWP::delete_main_loop() {
+void OS_UWP::delete_main_loop() {
if (main_loop)
memdelete(main_loop);
main_loop = NULL;
}
-void OSUWP::set_main_loop(MainLoop *p_main_loop) {
+void OS_UWP::set_main_loop(MainLoop *p_main_loop) {
input->set_main_loop(p_main_loop);
main_loop = p_main_loop;
}
-void OSUWP::finalize() {
+void OS_UWP::finalize() {
if (main_loop)
memdelete(main_loop);
@@ -403,19 +403,19 @@ void OSUWP::finalize() {
joypad = nullptr;
}
-void OSUWP::finalize_core() {
+void OS_UWP::finalize_core() {
NetSocketPosix::cleanup();
}
-void OSUWP::alert(const String &p_alert, const String &p_title) {
+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());
MessageDialog ^ msg = ref new MessageDialog(alert, title);
- UICommand ^ close = ref new UICommand("Close", ref new UICommandInvokedHandler(managed_object, &OSUWP::ManagedType::alert_close));
+ UICommand ^ close = ref new UICommand("Close", ref new UICommandInvokedHandler(managed_object, &OS_UWP::ManagedType::alert_close));
msg->Commands->Append(close);
msg->DefaultCommandIndex = 0;
@@ -424,17 +424,17 @@ void OSUWP::alert(const String &p_alert, const String &p_title) {
msg->ShowAsync();
}
-void OSUWP::ManagedType::alert_close(IUICommand ^ command) {
+void OS_UWP::ManagedType::alert_close(IUICommand ^ command) {
alert_close_handle = false;
}
-void OSUWP::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) {
+void OS_UWP::ManagedType::on_clipboard_changed(Platform::Object ^ sender, Platform::Object ^ ev) {
update_clipboard();
}
-void OSUWP::ManagedType::update_clipboard() {
+void OS_UWP::ManagedType::update_clipboard() {
DataPackageView ^ data = Clipboard::GetContent();
@@ -446,7 +446,7 @@ void OSUWP::ManagedType::update_clipboard() {
}
}
-void OSUWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) {
+void OS_UWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender, AccelerometerReadingChangedEventArgs ^ args) {
AccelerometerReading ^ reading = args->Reading;
@@ -456,7 +456,7 @@ void OSUWP::ManagedType::on_accelerometer_reading_changed(Accelerometer ^ sender
reading->AccelerationZ));
}
-void OSUWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) {
+void OS_UWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender, MagnetometerReadingChangedEventArgs ^ args) {
MagnetometerReading ^ reading = args->Reading;
@@ -466,7 +466,7 @@ void OSUWP::ManagedType::on_magnetometer_reading_changed(Magnetometer ^ sender,
reading->MagneticFieldZ));
}
-void OSUWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) {
+void OS_UWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, GyrometerReadingChangedEventArgs ^ args) {
GyrometerReading ^ reading = args->Reading;
@@ -476,7 +476,7 @@ void OSUWP::ManagedType::on_gyroscope_reading_changed(Gyrometer ^ sender, Gyrome
reading->AngularVelocityZ));
}
-void OSUWP::set_mouse_mode(MouseMode p_mode) {
+void OS_UWP::set_mouse_mode(MouseMode p_mode) {
if (p_mode == MouseMode::MOUSE_MODE_CAPTURED) {
@@ -501,41 +501,41 @@ void OSUWP::set_mouse_mode(MouseMode p_mode) {
SetEvent(mouse_mode_changed);
}
-OSUWP::MouseMode OSUWP::get_mouse_mode() const {
+OS_UWP::MouseMode OS_UWP::get_mouse_mode() const {
return mouse_mode;
}
-Point2 OSUWP::get_mouse_position() const {
+Point2 OS_UWP::get_mouse_position() const {
return Point2(old_x, old_y);
}
-int OSUWP::get_mouse_button_state() const {
+int OS_UWP::get_mouse_button_state() const {
return last_button_state;
}
-void OSUWP::set_window_title(const String &p_title) {
+void OS_UWP::set_window_title(const String &p_title) {
}
-void OSUWP::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
+void OS_UWP::set_video_mode(const VideoMode &p_video_mode, int p_screen) {
video_mode = p_video_mode;
}
-OS::VideoMode OSUWP::get_video_mode(int p_screen) const {
+OS::VideoMode OS_UWP::get_video_mode(int p_screen) const {
return video_mode;
}
-void OSUWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
+void OS_UWP::get_fullscreen_mode_list(List<VideoMode> *p_list, int p_screen) const {
}
-String OSUWP::get_name() {
+String OS_UWP::get_name() const {
return "UWP";
}
-OS::Date OSUWP::get_date(bool utc) const {
+OS::Date OS_UWP::get_date(bool utc) const {
SYSTEMTIME systemtime;
if (utc)
@@ -551,7 +551,7 @@ OS::Date OSUWP::get_date(bool utc) const {
date.dst = false;
return date;
}
-OS::Time OSUWP::get_time(bool utc) const {
+OS::Time OS_UWP::get_time(bool utc) const {
SYSTEMTIME systemtime;
if (utc)
@@ -566,7 +566,7 @@ OS::Time OSUWP::get_time(bool utc) const {
return time;
}
-OS::TimeZoneInfo OSUWP::get_time_zone_info() const {
+OS::TimeZoneInfo OS_UWP::get_time_zone_info() const {
TIME_ZONE_INFORMATION info;
bool daylight = false;
if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT)
@@ -579,11 +579,13 @@ OS::TimeZoneInfo OSUWP::get_time_zone_info() const {
ret.name = info.StandardName;
}
- ret.bias = info.Bias;
+ // Bias value returned by GetTimeZoneInformation is inverted of what we expect
+ // For example on GMT-3 GetTimeZoneInformation return a Bias of 180, so invert the value to get -180
+ ret.bias = -info.Bias;
return ret;
}
-uint64_t OSUWP::get_unix_time() const {
+uint64_t OS_UWP::get_unix_time() const {
FILETIME ft;
SYSTEMTIME st;
@@ -605,14 +607,14 @@ uint64_t OSUWP::get_unix_time() const {
return (*(uint64_t *)&ft - *(uint64_t *)&fep) / 10000000;
};
-void OSUWP::delay_usec(uint32_t p_usec) const {
+void OS_UWP::delay_usec(uint32_t p_usec) const {
int msec = p_usec < 1000 ? 1 : p_usec / 1000;
// no Sleep()
WaitForSingleObjectEx(GetCurrentThread(), msec, false);
}
-uint64_t OSUWP::get_ticks_usec() const {
+uint64_t OS_UWP::get_ticks_usec() const {
uint64_t ticks;
uint64_t time;
@@ -626,13 +628,13 @@ uint64_t OSUWP::get_ticks_usec() const {
return time;
}
-void OSUWP::process_events() {
+void OS_UWP::process_events() {
joypad->process_controllers();
process_key_events();
}
-void OSUWP::process_key_events() {
+void OS_UWP::process_key_events() {
for (int i = 0; i < key_event_pos; i++) {
@@ -653,7 +655,7 @@ void OSUWP::process_key_events() {
key_event_pos = 0;
}
-void OSUWP::queue_key_event(KeyEvent &p_event) {
+void OS_UWP::queue_key_event(KeyEvent &p_event) {
// This merges Char events with the previous Key event, so
// the unicode can be retrieved without sending duplicate events.
if (p_event.type == KeyEvent::MessageType::CHAR_EVENT_MESSAGE && key_event_pos > 0) {
@@ -670,7 +672,7 @@ void OSUWP::queue_key_event(KeyEvent &p_event) {
key_event_buffer[key_event_pos++] = p_event;
}
-void OSUWP::set_cursor_shape(CursorShape p_shape) {
+void OS_UWP::set_cursor_shape(CursorShape p_shape) {
ERR_FAIL_INDEX(p_shape, CURSOR_MAX);
@@ -702,57 +704,67 @@ void OSUWP::set_cursor_shape(CursorShape p_shape) {
cursor_shape = p_shape;
}
-void OSUWP::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
+OS::CursorShape OS_UWP::get_cursor_shape() const {
+
+ return cursor_shape;
+}
+
+void OS_UWP::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
// TODO
}
-Error OSUWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr) {
+Error OS_UWP::execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id, String *r_pipe, int *r_exitcode, bool read_stderr, Mutex *p_pipe_mutex) {
return FAILED;
};
-Error OSUWP::kill(const ProcessID &p_pid) {
+Error OS_UWP::kill(const ProcessID &p_pid) {
return FAILED;
};
-Error OSUWP::set_cwd(const String &p_cwd) {
+Error OS_UWP::set_cwd(const String &p_cwd) {
return FAILED;
}
-String OSUWP::get_executable_path() const {
+String OS_UWP::get_executable_path() const {
return "";
}
-void OSUWP::set_icon(const Ref<Image> &p_icon) {
+void OS_UWP::set_icon(const Ref<Image> &p_icon) {
}
-bool OSUWP::has_environment(const String &p_var) const {
+bool OS_UWP::has_environment(const String &p_var) const {
return false;
};
-String OSUWP::get_environment(const String &p_var) const {
+String OS_UWP::get_environment(const String &p_var) const {
return "";
};
-String OSUWP::get_stdin_string(bool p_block) {
+bool OS_UWP::set_environment(const String &p_var, const String &p_value) const {
+
+ return false;
+}
+
+String OS_UWP::get_stdin_string(bool p_block) {
return String();
}
-void OSUWP::move_window_to_foreground() {
+void OS_UWP::move_window_to_foreground() {
}
-Error OSUWP::shell_open(String p_uri) {
+Error OS_UWP::shell_open(String p_uri) {
return FAILED;
}
-String OSUWP::get_locale() const {
+String OS_UWP::get_locale() const {
#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP // this should work on phone 8.1, but it doesn't
return "en";
@@ -762,39 +774,39 @@ String OSUWP::get_locale() const {
#endif
}
-void OSUWP::release_rendering_thread() {
+void OS_UWP::release_rendering_thread() {
gl_context->release_current();
}
-void OSUWP::make_rendering_thread() {
+void OS_UWP::make_rendering_thread() {
gl_context->make_current();
}
-void OSUWP::swap_buffers() {
+void OS_UWP::swap_buffers() {
gl_context->swap_buffers();
}
-bool OSUWP::has_touchscreen_ui_hint() const {
+bool OS_UWP::has_touchscreen_ui_hint() const {
TouchCapabilities ^ tc = ref new TouchCapabilities();
return tc->TouchPresent != 0 || UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
-bool OSUWP::has_virtual_keyboard() const {
+bool OS_UWP::has_virtual_keyboard() const {
return UIViewSettings::GetForCurrentView()->UserInteractionMode == UserInteractionMode::Touch;
}
-void OSUWP::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect) {
+void OS_UWP::show_virtual_keyboard(const String &p_existing_text, const Rect2 &p_screen_rect) {
InputPane ^ pane = InputPane::GetForCurrentView();
pane->TryShow();
}
-void OSUWP::hide_virtual_keyboard() {
+void OS_UWP::hide_virtual_keyboard() {
InputPane ^ pane = InputPane::GetForCurrentView();
pane->TryHide();
@@ -813,7 +825,7 @@ static String format_error_message(DWORD id) {
return msg;
}
-Error OSUWP::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) {
+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);
@@ -825,14 +837,14 @@ Error OSUWP::open_dynamic_library(const String p_path, void *&p_library_handle,
return OK;
}
-Error OSUWP::close_dynamic_library(void *p_library_handle) {
+Error OS_UWP::close_dynamic_library(void *p_library_handle) {
if (!FreeLibrary((HMODULE)p_library_handle)) {
return FAILED;
}
return OK;
}
-Error OSUWP::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
+Error OS_UWP::get_dynamic_library_symbol_handle(void *p_library_handle, const String p_name, void *&p_symbol_handle, bool p_optional) {
p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
if (!p_symbol_handle) {
if (!p_optional) {
@@ -845,7 +857,7 @@ Error OSUWP::get_dynamic_library_symbol_handle(void *p_library_handle, const Str
return OK;
}
-void OSUWP::run() {
+void OS_UWP::run() {
if (!main_loop)
return;
@@ -869,35 +881,35 @@ void OSUWP::run() {
main_loop->finish();
}
-MainLoop *OSUWP::get_main_loop() const {
+MainLoop *OS_UWP::get_main_loop() const {
return main_loop;
}
-String OSUWP::get_user_data_dir() const {
+String OS_UWP::get_user_data_dir() const {
Windows::Storage::StorageFolder ^ data_folder = Windows::Storage::ApplicationData::Current->LocalFolder;
return String(data_folder->Path->Data()).replace("\\", "/");
}
-bool OSUWP::_check_internal_feature_support(const String &p_feature) {
- return p_feature == "pc" || p_feature == "s3tc";
+bool OS_UWP::_check_internal_feature_support(const String &p_feature) {
+ return p_feature == "pc";
}
-OS::PowerState OSUWP::get_power_state() {
+OS::PowerState OS_UWP::get_power_state() {
return power_manager->get_power_state();
}
-int OSUWP::get_power_seconds_left() {
+int OS_UWP::get_power_seconds_left() {
return power_manager->get_power_seconds_left();
}
-int OSUWP::get_power_percent_left() {
+int OS_UWP::get_power_percent_left() {
return power_manager->get_power_percent_left();
}
-OSUWP::OSUWP() {
+OS_UWP::OS_UWP() {
key_event_pos = 0;
force_quit = false;
@@ -931,7 +943,7 @@ OSUWP::OSUWP() {
_set_logger(memnew(CompositeLogger(loggers)));
}
-OSUWP::~OSUWP() {
+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 491c9bce03..1bb68bc75d 100644
--- a/platform/uwp/os_uwp.h
+++ b/platform/uwp/os_uwp.h
@@ -28,15 +28,15 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef OSUWP_H
-#define OSUWP_H
+#ifndef OS_UWP_H
+#define OS_UWP_H
+#include "context_egl_uwp.h"
#include "core/math/transform_2d.h"
#include "core/os/input.h"
#include "core/os/os.h"
#include "core/ustring.h"
#include "drivers/xaudio2/audio_driver_xaudio2.h"
-#include "gl_context_egl.h"
#include "joypad_uwp.h"
#include "main/input_default.h"
#include "power_uwp.h"
@@ -52,7 +52,7 @@
/**
@author Juan Linietsky <reduzio@gmail.com>
*/
-class OSUWP : public OS {
+class OS_UWP : public OS {
public:
struct KeyEvent {
@@ -95,7 +95,7 @@ private:
VisualServer *visual_server;
int pressrc;
- ContextEGL *gl_context;
+ ContextEGL_UWP *gl_context;
Windows::UI::Core::CoreWindow ^ window;
VideoMode video_mode;
@@ -144,7 +144,7 @@ private:
/* clang-format off */
internal:
ManagedType() { alert_close_handle = false; }
- property OSUWP* os;
+ property OS_UWP* os;
/* clang-format on */
};
ManagedType ^ managed_object;
@@ -195,7 +195,7 @@ public:
virtual MainLoop *get_main_loop() const;
- virtual String get_name();
+ virtual String get_name() const;
virtual Date get_date(bool utc) const;
virtual Time get_time(bool utc) const;
@@ -208,16 +208,18 @@ public:
virtual void delay_usec(uint32_t p_usec) const;
virtual uint64_t get_ticks_usec() const;
- virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false);
+ virtual Error execute(const String &p_path, const List<String> &p_arguments, bool p_blocking, ProcessID *r_child_id = NULL, String *r_pipe = NULL, int *r_exitcode = NULL, bool read_stderr = false, Mutex *p_pipe_mutex = NULL);
virtual Error kill(const ProcessID &p_pid);
virtual bool has_environment(const String &p_var) const;
virtual String get_environment(const String &p_var) const;
+ virtual bool set_environment(const String &p_var, const String &p_value) const;
virtual void set_clipboard(const String &p_text);
virtual String get_clipboard() const;
void set_cursor_shape(CursorShape p_shape);
+ CursorShape get_cursor_shape() const;
virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
void set_icon(const Ref<Image> &p_icon);
@@ -261,8 +263,8 @@ public:
void queue_key_event(KeyEvent &p_event);
- OSUWP();
- ~OSUWP();
+ OS_UWP();
+ ~OS_UWP();
};
#endif
diff --git a/platform/uwp/power_uwp.h b/platform/uwp/power_uwp.h
index d6623f9340..cc19904a62 100644
--- a/platform/uwp/power_uwp.h
+++ b/platform/uwp/power_uwp.h
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PLATFORM_UWP_POWER_UWP_H_
-#define PLATFORM_UWP_POWER_UWP_H_
+#ifndef POWER_UWP_H
+#define POWER_UWP_H
#include "core/os/dir_access.h"
#include "core/os/file_access.h"
@@ -53,4 +53,4 @@ public:
int get_power_percent_left();
};
-#endif /* PLATFORM_UWP_POWER_UWP_H_ */
+#endif // POWER_UWP_H