diff options
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/SCsub | 2 | ||||
-rw-r--r-- | platform/uwp/app.cpp | 18 | ||||
-rw-r--r-- | platform/uwp/app.h | 1 | ||||
-rw-r--r-- | platform/uwp/detect.py | 2 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 30 | ||||
-rw-r--r-- | platform/uwp/gl_context_egl.cpp | 14 | ||||
-rw-r--r-- | platform/uwp/joypad_uwp.cpp | 6 | ||||
-rw-r--r-- | platform/uwp/logo.png | bin | 1882 -> 1519 bytes | |||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 20 | ||||
-rw-r--r-- | platform/uwp/os_uwp.h | 3 | ||||
-rw-r--r-- | platform/uwp/power_uwp.cpp | 6 |
11 files changed, 50 insertions, 52 deletions
diff --git a/platform/uwp/SCsub b/platform/uwp/SCsub index bbd329a7e5..f0d69fef33 100644 --- a/platform/uwp/SCsub +++ b/platform/uwp/SCsub @@ -19,7 +19,7 @@ files = [ if "build_angle" in env and env["build_angle"]: cmd = env.AlwaysBuild(env.ANGLE('libANGLE.lib', None)) -prog = env.Program('#bin/godot', files) +prog = env.add_program('#bin/godot', files) if "build_angle" in env and env["build_angle"]: env.Depends(prog, [cmd]) diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index c565999d82..b47b99744e 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -77,15 +77,15 @@ public: return 0; } -App::App() - : mWindowClosed(false), - mWindowVisible(true), - mWindowWidth(0), - mWindowHeight(0), - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mEglSurface(EGL_NO_SURFACE), - number_of_contacts(0) { +App::App() : + mWindowClosed(false), + mWindowVisible(true), + mWindowWidth(0), + mWindowHeight(0), + mEglDisplay(EGL_NO_DISPLAY), + mEglContext(EGL_NO_CONTEXT), + mEglSurface(EGL_NO_SURFACE), + number_of_contacts(0) { } // The first method called when the IFrameworkView is being created. diff --git a/platform/uwp/app.h b/platform/uwp/app.h index e079fa9c9d..b812512a98 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app.h @@ -33,6 +33,7 @@ #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/detect.py b/platform/uwp/detect.py index 434c597449..7cc8afff06 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -136,7 +136,7 @@ def configure(env): env.Append(CPPPATH=['#platform/uwp', '#drivers/windows']) env.Append(CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND']) - env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) + env.Append(CCFLAGS=['/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]) diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index d66bcaa91c..7f86b4ae53 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -137,7 +137,7 @@ class AppxPackager { ZPOS64_T end_of_central_dir_offset; Vector<uint8_t> central_dir_data; - String hash_block(uint8_t *p_block_data, size_t p_block_len); + String hash_block(const uint8_t *p_block_data, size_t p_block_len); void make_block_map(); void make_content_types(); @@ -188,14 +188,14 @@ public: /////////////////////////////////////////////////////////////////////////// -String AppxPackager::hash_block(uint8_t *p_block_data, size_t p_block_len) { +String AppxPackager::hash_block(const uint8_t *p_block_data, size_t p_block_len) { char hash[32]; char base64[45]; sha256_context ctx; sha256_init(&ctx); - sha256_hash(&ctx, p_block_data, p_block_len); + sha256_hash(&ctx, (uint8_t *)p_block_data, p_block_len); sha256_done(&ctx, (uint8_t *)hash); base64_encode(base64, hash, 32); @@ -456,8 +456,8 @@ void AppxPackager::init(FileAccess *p_fa) { package = p_fa; central_dir_offset = 0; end_of_central_dir_offset = 0; - tmp_blockmap_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpblockmap.xml"; - tmp_content_types_file_path = EditorSettings::get_singleton()->get_settings_path() + "/tmp/tmpcontenttypes.xml"; + tmp_blockmap_file_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmpblockmap.xml"); + 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) { @@ -510,8 +510,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t strm.avail_in = block_size; strm.avail_out = strm_out.size(); - strm.next_in = strm_in.ptr(); - strm.next_out = strm_out.ptr(); + strm.next_in = (uint8_t *)strm_in.ptr(); + strm.next_out = strm_out.ptrw(); int total_out_before = strm.total_out; @@ -541,8 +541,8 @@ void AppxPackager::add_file(String p_file_name, const uint8_t *p_buffer, size_t strm.avail_in = 0; strm.avail_out = strm_out.size(); - strm.next_in = strm_in.ptr(); - strm.next_out = strm_out.ptr(); + strm.next_in = (uint8_t *)strm_in.ptr(); + strm.next_out = strm_out.ptrw(); int total_out_before = strm.total_out; @@ -588,7 +588,7 @@ void AppxPackager::finish() { Vector<uint8_t> blockmap_buffer; blockmap_buffer.resize(blockmap_file->get_len()); - blockmap_file->get_buffer(blockmap_buffer.ptr(), blockmap_buffer.size()); + blockmap_file->get_buffer(blockmap_buffer.ptrw(), blockmap_buffer.size()); add_file("AppxBlockMap.xml", blockmap_buffer.ptr(), blockmap_buffer.size(), -1, -1, true); @@ -604,7 +604,7 @@ void AppxPackager::finish() { Vector<uint8_t> types_buffer; types_buffer.resize(types_file->get_len()); - types_file->get_buffer(types_buffer.ptr(), types_buffer.size()); + types_file->get_buffer(types_buffer.ptrw(), types_buffer.size()); add_file("[Content_Types].xml", types_buffer.ptr(), types_buffer.size(), -1, -1, true); @@ -886,7 +886,7 @@ class EditorExportUWP : public EditorExportPlatform { if (!image) return data; - String tmp_path = EditorSettings::get_singleton()->get_settings_path().plus_file("tmp/uwp_tmp_logo.png"); + String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("uwp_tmp_logo.png"); Error err = image->get_data()->save_png(tmp_path); @@ -911,7 +911,7 @@ class EditorExportUWP : public EditorExportPlatform { } data.resize(f->get_len()); - f->get_buffer(data.ptr(), data.size()); + f->get_buffer(data.ptrw(), data.size()); f->close(); memdelete(f); @@ -1301,7 +1301,7 @@ public: if (do_read) { data.resize(info.uncompressed_size); unzOpenCurrentFile(pkg); - unzReadCurrentFile(pkg, data.ptr(), data.size()); + unzReadCurrentFile(pkg, data.ptrw(), data.size()); unzCloseCurrentFile(pkg); } @@ -1341,7 +1341,7 @@ public: // Argc clf.resize(4); - encode_uint32(cl.size(), clf.ptr()); + encode_uint32(cl.size(), clf.ptrw()); for (int i = 0; i < cl.size(); i++) { diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp index dafe5d5e25..2130af6d60 100644 --- a/platform/uwp/gl_context_egl.cpp +++ b/platform/uwp/gl_context_egl.cpp @@ -108,7 +108,8 @@ Error ContextEGL::initialize() { EGL_NONE,*/ // These are the default display attributes, used to request ANGLE's D3D11 renderer. // eglInitialize will only succeed with these attributes if the hardware supports D3D11 Feature Level 10_0+. - EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_PLATFORM_ANGLE_TYPE_ANGLE, + EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, // EGL_ANGLE_DISPLAY_ALLOW_RENDER_TO_BACK_BUFFER is an optimization that can have large performance benefits on mobile devices. // Its syntax is subject to change, though. Please update your Visual Studio templates if you experience compilation issues with it. @@ -117,7 +118,8 @@ Error ContextEGL::initialize() { // EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE is an option that enables ANGLE to automatically call // the IDXGIDevice3::Trim method on behalf of the application when it gets suspended. // Calling IDXGIDevice3::Trim when an application is suspended is a Windows Store application certification requirement. - EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, EGL_TRUE, + EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE, + EGL_TRUE, EGL_NONE, }; @@ -190,10 +192,10 @@ void ContextEGL::cleanup() { } }; -ContextEGL::ContextEGL(CoreWindow ^ p_window) - : mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mEglSurface(EGL_NO_SURFACE) { +ContextEGL::ContextEGL(CoreWindow ^ p_window) : + mEglDisplay(EGL_NO_DISPLAY), + mEglContext(EGL_NO_CONTEXT), + mEglSurface(EGL_NO_SURFACE) { window = p_window; }; diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index 0f84bd55a3..088d232e04 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -54,7 +54,7 @@ void JoypadUWP::process_controllers() { case ControllerType::GAMEPAD_CONTROLLER: { - GamepadReading reading = ((Gamepad ^)joy.controller_reference)->GetCurrentReading(); + GamepadReading reading = ((Gamepad ^) joy.controller_reference)->GetCurrentReading(); int button_mask = (int)GamepadButtons::Menu; for (int j = 0; j < 14; j++) { @@ -161,7 +161,7 @@ void JoypadUWP::joypad_vibration_start(int p_device, float p_weak_magnitude, flo GamepadVibration vibration; vibration.LeftMotor = p_strong_magnitude; vibration.RightMotor = p_weak_magnitude; - ((Gamepad ^)joy.controller_reference)->Vibration = vibration; + ((Gamepad ^) joy.controller_reference)->Vibration = vibration; joy.ff_timestamp = p_timestamp; joy.ff_end_timestamp = p_duration == 0 ? 0 : p_timestamp + (uint64_t)(p_duration * 1000000.0); @@ -175,7 +175,7 @@ void JoypadUWP::joypad_vibration_stop(int p_device, uint64_t p_timestamp) { GamepadVibration vibration; vibration.LeftMotor = 0.0; vibration.RightMotor = 0.0; - ((Gamepad ^)joy.controller_reference)->Vibration = vibration; + ((Gamepad ^) joy.controller_reference)->Vibration = vibration; joy.ff_timestamp = p_timestamp; joy.vibrating = false; diff --git a/platform/uwp/logo.png b/platform/uwp/logo.png Binary files differindex 4376abd563..9017a30636 100644 --- a/platform/uwp/logo.png +++ b/platform/uwp/logo.png diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index acb0ba4bca..1655caf04b 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -28,6 +28,7 @@ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ #include "os_uwp.h" + #include "drivers/gles3/rasterizer_gles3.h" #include "drivers/unix/ip_unix.h" #include "drivers/windows/dir_access_windows.h" @@ -69,7 +70,7 @@ int OSUWP::get_video_driver_count() const { } const char *OSUWP::get_video_driver_name(int p_driver) const { - return "GLES2"; + return "GLES3"; } Size2 OSUWP::get_window_size() const { @@ -178,15 +179,6 @@ void OSUWP::initialize_core() { cursor_shape = CURSOR_ARROW; } -void OSUWP::initialize_logger() { - Vector<Logger *> loggers; - loggers.push_back(memnew(WindowsTerminalLogger)); - // FIXME: Reenable once we figure out how to get this properly in user:// - // instead of littering the user's working dirs (res:// + pwd) with log files (GH-12277) - //loggers.push_back(memnew(RotatedFileLogger("user://logs/log.txt"))); - _set_logger(memnew(CompositeLogger(loggers))); -} - bool OSUWP::can_draw() const { return !minimized; @@ -298,7 +290,7 @@ void OSUWP::initialize(const VideoMode &p_desired, int p_video_driver, int p_aud ref new TypedEventHandler<Gyrometer ^, GyrometerReadingChangedEventArgs ^>(managed_object, &ManagedType::on_gyroscope_reading_changed); } - _ensure_data_dir(); + _ensure_user_data_dir(); if (is_keep_screen_on()) display_request->RequestActive(); @@ -781,7 +773,7 @@ MainLoop *OSUWP::get_main_loop() const { return main_loop; } -String OSUWP::get_data_dir() const { +String OSUWP::get_user_data_dir() const { Windows::Storage::StorageFolder ^ data_folder = Windows::Storage::ApplicationData::Current->LocalFolder; @@ -833,7 +825,9 @@ OSUWP::OSUWP() { AudioDriverManager::add_driver(&audio_driver); - _set_logger(memnew(WindowsTerminalLogger)); + Vector<Logger *> loggers; + loggers.push_back(memnew(WindowsTerminalLogger)); + _set_logger(memnew(CompositeLogger(loggers))); } OSUWP::~OSUWP() { diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index 2931e9b07d..8d69cd53fd 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -157,7 +157,6 @@ protected: virtual int get_audio_driver_count() const; virtual const char *get_audio_driver_name(int p_driver) const; - virtual void initialize_logger(); virtual void initialize_core(); virtual void initialize(const VideoMode &p_desired, int p_video_driver, int p_audio_driver); @@ -226,7 +225,7 @@ public: virtual String get_locale() const; virtual void move_window_to_foreground(); - virtual String get_data_dir() const; + virtual String get_user_data_dir() const; virtual bool _check_internal_feature_support(const String &p_feature); diff --git a/platform/uwp/power_uwp.cpp b/platform/uwp/power_uwp.cpp index 81e97b1391..14fce8b133 100644 --- a/platform/uwp/power_uwp.cpp +++ b/platform/uwp/power_uwp.cpp @@ -30,8 +30,10 @@ #include "power_uwp.h" -PowerUWP::PowerUWP() - : nsecs_left(-1), percent_left(-1), power_state(OS::POWERSTATE_UNKNOWN) { +PowerUWP::PowerUWP() : + nsecs_left(-1), + percent_left(-1), + power_state(OS::POWERSTATE_UNKNOWN) { } PowerUWP::~PowerUWP() { |