summaryrefslogtreecommitdiff
path: root/platform/uwp/os_uwp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/uwp/os_uwp.cpp')
-rw-r--r--platform/uwp/os_uwp.cpp53
1 files changed, 51 insertions, 2 deletions
diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp
index 3018ac0bef..603a918cca 100644
--- a/platform/uwp/os_uwp.cpp
+++ b/platform/uwp/os_uwp.cpp
@@ -5,8 +5,8 @@
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
+/* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2014-2018 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 */
@@ -651,6 +651,10 @@ 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) {
+ // 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) {
return FAILED;
@@ -745,6 +749,51 @@ void OSUWP::hide_virtual_keyboard() {
pane->TryHide();
}
+static String format_error_message(DWORD id) {
+
+ LPWSTR messageBuffer = NULL;
+ size_t size = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
+ NULL, id, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&messageBuffer, 0, NULL);
+
+ String msg = "Error " + itos(id) + ": " + String(messageBuffer, size);
+
+ LocalFree(messageBuffer);
+
+ return msg;
+}
+
+Error OSUWP::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);
+
+ if (!p_library_handle) {
+ ERR_EXPLAIN("Can't open dynamic library: " + full_path + ". Error: " + format_error_message(GetLastError()));
+ ERR_FAIL_V(ERR_CANT_OPEN);
+ }
+ return OK;
+}
+
+Error OSUWP::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) {
+ p_symbol_handle = (void *)GetProcAddress((HMODULE)p_library_handle, p_name.utf8().get_data());
+ if (!p_symbol_handle) {
+ if (!p_optional) {
+ ERR_EXPLAIN("Can't resolve symbol " + p_name + ". Error: " + String::num(GetLastError()));
+ ERR_FAIL_V(ERR_CANT_RESOLVE);
+ } else {
+ return ERR_CANT_RESOLVE;
+ }
+ }
+ return OK;
+}
+
void OSUWP::run() {
if (!main_loop)