summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/export/export.cpp2
-rw-r--r--platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java12
-rw-r--r--platform/iphone/camera_ios.h4
-rw-r--r--platform/iphone/camera_ios.mm63
-rw-r--r--platform/iphone/detect.py1
-rw-r--r--platform/iphone/export/export.cpp37
-rw-r--r--platform/iphone/gl_view.mm2
-rw-r--r--platform/javascript/detect.py6
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/windows/os_windows.cpp16
-rw-r--r--platform/windows/os_windows.h3
-rw-r--r--platform/x11/detect.py6
-rw-r--r--platform/x11/joypad_linux.cpp1
-rw-r--r--platform/x11/os_x11.cpp10
-rw-r--r--platform/x11/power_x11.cpp5
15 files changed, 99 insertions, 71 deletions
diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp
index 0bd82b769f..b37cf642db 100644
--- a/platform/android/export/export.cpp
+++ b/platform/android/export/export.cpp
@@ -594,7 +594,7 @@ class EditorExportPlatformAndroid : public EditorExportPlatform {
if (abi_index != -1) {
exported = true;
String abi = abis[abi_index];
- String dst_path = "lib/" + abi + "/" + p_so.path.get_file();
+ String dst_path = String("lib").plus_file(abi).plus_file(p_so.path.get_file());
Vector<uint8_t> array = FileAccess::get_file_as_array(p_so.path);
Error store_err = store_in_apk(ed, dst_path, array);
ERR_FAIL_COND_V(store_err, store_err);
diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java b/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
index d01f958123..a443a0ad90 100644
--- a/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
+++ b/platform/android/java/src/org/godotengine/godot/input/GodotInputHandler.java
@@ -65,6 +65,14 @@ public class GodotInputHandler implements InputDeviceListener {
godotView.queueEvent(task);
}
+ private boolean isKeyEvent_GameDevice(int source) {
+ // Note that keyboards are often (SOURCE_KEYBOARD | SOURCE_DPAD)
+ if (source == (InputDevice.SOURCE_KEYBOARD | InputDevice.SOURCE_DPAD))
+ return false;
+
+ return (source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD;
+ }
+
public boolean onKeyUp(final int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
return true;
@@ -75,7 +83,7 @@ public class GodotInputHandler implements InputDeviceListener {
};
int source = event.getSource();
- if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
+ if (isKeyEvent_GameDevice(source)) {
final int button = getGodotButton(keyCode);
final int device_id = findJoystickDevice(event.getDeviceId());
@@ -118,7 +126,7 @@ public class GodotInputHandler implements InputDeviceListener {
int source = event.getSource();
//Log.e(TAG, String.format("Key down! source %d, device %d, joystick %d, %d, %d", event.getDeviceId(), source, (source & InputDevice.SOURCE_JOYSTICK), (source & InputDevice.SOURCE_DPAD), (source & InputDevice.SOURCE_GAMEPAD)));
- if ((source & InputDevice.SOURCE_JOYSTICK) == InputDevice.SOURCE_JOYSTICK || (source & InputDevice.SOURCE_DPAD) == InputDevice.SOURCE_DPAD || (source & InputDevice.SOURCE_GAMEPAD) == InputDevice.SOURCE_GAMEPAD) {
+ if (isKeyEvent_GameDevice(source)) {
if (event.getRepeatCount() > 0) // ignore key echo
return true;
diff --git a/platform/iphone/camera_ios.h b/platform/iphone/camera_ios.h
index cf747283e1..ceabdba6a3 100644
--- a/platform/iphone/camera_ios.h
+++ b/platform/iphone/camera_ios.h
@@ -31,12 +31,10 @@
#ifndef CAMERAIOS_H
#define CAMERAIOS_H
-///@TODO this is a near duplicate of CameraOSX, we should find a way to combine those to minimise code duplication!!!!
-// If you fix something here, make sure you fix it there as wel!
-
#include "servers/camera_server.h"
class CameraIOS : public CameraServer {
+private:
public:
CameraIOS();
~CameraIOS();
diff --git a/platform/iphone/camera_ios.mm b/platform/iphone/camera_ios.mm
index 4c11701fdd..5a54eaee9b 100644
--- a/platform/iphone/camera_ios.mm
+++ b/platform/iphone/camera_ios.mm
@@ -241,7 +241,6 @@
class CameraFeedIOS : public CameraFeed {
private:
- bool is_arkit; // if true this feed is updated through ARKit (should only have one and not yet implemented)
AVCaptureDevice *device;
MyCaptureSession *capture_session;
@@ -258,10 +257,6 @@ public:
void deactivate_feed();
};
-bool CameraFeedIOS::get_is_arkit() const {
- return is_arkit;
-};
-
AVCaptureDevice *CameraFeedIOS::get_device() const {
return device;
};
@@ -274,24 +269,16 @@ CameraFeedIOS::CameraFeedIOS() {
void CameraFeedIOS::set_device(AVCaptureDevice *p_device) {
device = p_device;
- if (device == NULL) {
- ///@TODO finish this!
- is_arkit = true;
- name = "ARKit";
+ [device retain];
+
+ // get some info
+ NSString *device_name = p_device.localizedName;
+ name = device_name.UTF8String;
+ position = CameraFeed::FEED_UNSPECIFIED;
+ if ([p_device position] == AVCaptureDevicePositionBack) {
position = CameraFeed::FEED_BACK;
- } else {
- is_arkit = false;
- [device retain];
-
- // get some info
- NSString *device_name = p_device.localizedName;
- name = device_name.UTF8String;
- position = CameraFeed::FEED_UNSPECIFIED;
- if ([p_device position] == AVCaptureDevicePositionBack) {
- position = CameraFeed::FEED_BACK;
- } else if ([p_device position] == AVCaptureDevicePositionFront) {
- position = CameraFeed::FEED_FRONT;
- };
+ } else if ([p_device position] == AVCaptureDevicePositionFront) {
+ position = CameraFeed::FEED_FRONT;
};
};
@@ -308,15 +295,11 @@ CameraFeedIOS::~CameraFeedIOS() {
};
bool CameraFeedIOS::activate_feed() {
- if (is_arkit) {
- ///@TODO to implement;
+ if (capture_session) {
+ // already recording!
} else {
- if (capture_session) {
- // already recording!
- } else {
- // start camera capture
- capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device];
- };
+ // start camera capture
+ capture_session = [[MyCaptureSession alloc] initForFeed:this andDevice:device];
};
return true;
@@ -376,14 +359,14 @@ void CameraIOS::update_feeds() {
// this way of doing things is deprecated but still works,
// rewrite to using AVCaptureDeviceDiscoverySession
- AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeBuiltInTelephotoCamera, AVCaptureDeviceTypeBuiltInDualCamera, AVCaptureDeviceTypeBuiltInTrueDepthCamera] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
+ AVCaptureDeviceDiscoverySession *session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:[NSArray arrayWithObjects:AVCaptureDeviceTypeBuiltInTelephotoCamera, AVCaptureDeviceTypeBuiltInDualCamera, AVCaptureDeviceTypeBuiltInTrueDepthCamera, AVCaptureDeviceTypeBuiltInWideAngleCamera] mediaType:AVMediaTypeVideo position:AVCaptureDevicePositionUnspecified];
// remove devices that are gone..
for (int i = feeds.size() - 1; i >= 0; i--) {
- Ref<CameraFeedIOS> feed = (Ref<CameraFeedIOS>)feeds[i];
+ Ref<CameraFeedIOS> feed(feeds[i]);
- if (feed->get_is_arkit()) {
- // ignore, this is our arkit entry
+ if (feed.is_null()) {
+ // feed not managed by us
} else if (![session.devices containsObject:feed->get_device()]) {
// remove it from our array, this will also destroy it ;)
remove_feed(feed);
@@ -393,9 +376,13 @@ void CameraIOS::update_feeds() {
// add new devices..
for (AVCaptureDevice *device in session.devices) {
bool found = false;
+
for (int i = 0; i < feeds.size() && !found; i++) {
- Ref<CameraFeedIOS> feed = (Ref<CameraFeedIOS>)feeds[i];
- if (feed->get_device() == device) {
+ Ref<CameraFeedIOS> feed(feeds[i]);
+
+ if (feed.is_null()) {
+ // feed not managed by us
+ } else if (feed->get_device() == device) {
found = true;
};
};
@@ -410,9 +397,13 @@ void CameraIOS::update_feeds() {
};
CameraIOS::CameraIOS() {
+ print_line("Requesting Camera permissions");
+
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo
completionHandler:^(BOOL granted) {
if (granted) {
+ print_line("Access to cameras granted!");
+
// Find available cameras we have at this time
update_feeds();
diff --git a/platform/iphone/detect.py b/platform/iphone/detect.py
index daf4f405fd..b448cbe097 100644
--- a/platform/iphone/detect.py
+++ b/platform/iphone/detect.py
@@ -154,6 +154,7 @@ def configure(env):
'-framework', 'Security',
'-framework', 'SystemConfiguration',
'-framework', 'UIKit',
+ '-framework', 'ARKit',
])
# Feature options
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 7ca83320d0..99ce2e8f87 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -95,7 +95,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
Vector<ExportArchitecture> _get_supported_architectures();
Vector<String> _get_preset_architectures(const Ref<EditorExportPreset> &p_preset);
- void _add_assets_to_project(Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets);
+ void _add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<String> &p_assets, bool p_is_framework, Vector<IOSExportAsset> &r_exported_assets);
Error _export_additional_assets(const String &p_out_dir, const Vector<SharedObject> &p_libraries, Vector<IOSExportAsset> &r_exported_assets);
@@ -125,7 +125,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
first = true;
continue;
}
- if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '_')) {
+ if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '-')) {
if (r_error) {
*r_error = vformat(TTR("The character '%s' is not allowed in Identifier."), String::chr(c));
}
@@ -137,7 +137,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
}
return false;
}
- if (first && c == '_') {
+ if (first && c == '-') {
if (r_error) {
*r_error = vformat(TTR("The character '%s' cannot be the first character in a Identifier segment."), String::chr(c));
}
@@ -564,7 +564,7 @@ Error EditorExportPlatformIOS::_walk_dir_recursive(DirAccess *p_da, FileHandler
dirs.push_back(path);
}
} else {
- Error err = p_handler(current_dir + "/" + path, p_userdata);
+ Error err = p_handler(current_dir.plus_file(path), p_userdata);
if (err) {
p_da->list_dir_end();
return err;
@@ -656,7 +656,7 @@ struct ExportLibsData {
String dest_dir;
};
-void EditorExportPlatformIOS::_add_assets_to_project(Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets) {
+void EditorExportPlatformIOS::_add_assets_to_project(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &p_project_data, const Vector<IOSExportAsset> &p_additional_assets) {
Vector<Ref<EditorExportPlugin> > export_plugins = EditorExport::get_singleton()->get_export_plugins();
Vector<String> frameworks;
for (int i = 0; i < export_plugins.size(); ++i) {
@@ -714,7 +714,28 @@ void EditorExportPlatformIOS::_add_assets_to_project(Vector<uint8_t> &p_project_
// Note, frameworks like gamekit are always included in our project.pbxprof file
// even if turned off in capabilities.
- // Frameworks that are used by modules (like arkit) we may need to optionally add here.
+
+ // We do need our ARKit framework
+ if ((bool)p_preset->get("capabilities/arkit")) {
+ String build_id = (++current_id).str();
+ String ref_id = (++current_id).str();
+
+ if (pbx_frameworks_build.length() > 0) {
+ pbx_frameworks_build += ",\n";
+ pbx_frameworks_refs += ",\n";
+ }
+
+ pbx_frameworks_build += build_id;
+ pbx_frameworks_refs += ref_id;
+
+ Dictionary format_dict;
+ format_dict["build_id"] = build_id;
+ format_dict["ref_id"] = ref_id;
+ format_dict["name"] = "ARKit.framework";
+ format_dict["file_path"] = "System/Library/Frameworks/ARKit.framework";
+ format_dict["file_type"] = "wrapper.framework";
+ pbx_files += file_info_format.format(format_dict, "$_");
+ }
String str = String::utf8((const char *)p_project_data.ptr(), p_project_data.size());
str = str.replace("$additional_pbx_files", pbx_files);
@@ -763,7 +784,7 @@ Error EditorExportPlatformIOS::_export_additional_assets(const String &p_out_dir
}
}
- String destination = destination_dir + "/" + asset.get_file();
+ String destination = destination_dir.plus_file(asset.get_file());
Error err = dir_exists ? da->copy_dir(asset, destination) : da->copy(asset, destination);
memdelete(da);
if (err) {
@@ -1045,7 +1066,7 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
print_line("Exporting additional assets");
Vector<IOSExportAsset> assets;
_export_additional_assets(dest_dir + binary_name, libraries, assets);
- _add_assets_to_project(project_file_data, assets);
+ _add_assets_to_project(p_preset, project_file_data, assets);
String project_file_name = dest_dir + binary_name + ".xcodeproj/project.pbxproj";
FileAccess *f = FileAccess::open(project_file_name, FileAccess::WRITE);
if (!f) {
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index 1cb8d0e44e..4641b2c4ac 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -494,7 +494,7 @@ static void clear_touches() {
#ifdef DEBUG_ENABLED
GLenum err = glGetError();
if (err)
- NSLog(@"%x error", err);
+ NSLog(@"DrawView: %x error", err);
#endif
}
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 145ac42863..c6afa02c6d 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -69,9 +69,9 @@ def configure(env):
exec(f.read(), em_config)
except StandardError as e:
raise RuntimeError("Emscripten configuration file '%s' is invalid:\n%s" % (em_config_file, e))
- if 'EMSCRIPTEN_ROOT' not in em_config:
- raise RuntimeError("'EMSCRIPTEN_ROOT' missing in Emscripten configuration file '%s'" % em_config_file)
- env.PrependENVPath('PATH', em_config['EMSCRIPTEN_ROOT'])
+ if 'BINARYEN_ROOT' not in em_config and 'EMSCRIPTEN_ROOT' not in em_config:
+ raise RuntimeError("'BINARYEN_ROOT' or 'EMSCRIPTEN_ROOT' missing in Emscripten configuration file '%s'" % em_config_file)
+ env.PrependENVPath('PATH', em_config.get('BINARYEN_ROOT', em_config.get('EMSCRIPTEN_ROOT')))
env['CC'] = 'emcc'
env['CXX'] = 'em++'
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 9dabbb12fc..8cabc45250 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -570,7 +570,7 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p
if (export_format == "dmg") {
// write it into our application bundle
- file = tmp_app_path_name + "/" + file;
+ file = tmp_app_path_name.plus_file(file);
// write the file, need to add chmod
FileAccess *f = FileAccess::open(file, FileAccess::WRITE);
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 6e6df08f02..e535f6a148 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -843,8 +843,8 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
if (wParam==VK_WIN) TODO wtf is this?
meta_mem=uMsg==WM_KEYDOWN;
*/
-
- } //fallthrough
+ FALLTHROUGH;
+ }
case WM_CHAR: {
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
@@ -1979,6 +1979,17 @@ bool OS_Windows::is_window_always_on_top() const {
return video_mode.always_on_top;
}
+void OS_Windows::set_console_visible(bool p_enabled) {
+ if (console_visible == p_enabled)
+ return;
+ ShowWindow(GetConsoleWindow(), p_enabled ? SW_SHOW : SW_HIDE);
+ console_visible = p_enabled;
+}
+
+bool OS_Windows::is_console_visible() const {
+ return console_visible;
+}
+
bool OS_Windows::get_window_per_pixel_transparency_enabled() const {
if (!is_layered_allowed()) return false;
@@ -3231,6 +3242,7 @@ OS_Windows::OS_Windows(HINSTANCE _hInstance) {
control_mem = false;
meta_mem = false;
minimized = false;
+ console_visible = IsWindowVisible(GetConsoleWindow());
hInstance = _hInstance;
pressrc = 0;
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 4660c16b97..fc8ad1b188 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -210,6 +210,7 @@ protected:
bool maximized;
bool minimized;
bool borderless;
+ bool console_visible;
public:
LRESULT WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
@@ -256,6 +257,8 @@ public:
virtual bool is_window_maximized() const;
virtual void set_window_always_on_top(bool p_enabled);
virtual bool is_window_always_on_top() const;
+ virtual void set_console_visible(bool p_enabled);
+ virtual bool is_console_visible() const;
virtual void request_attention();
virtual void set_borderless_window(bool p_borderless);
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 9365b7eabc..9614104750 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -75,11 +75,7 @@ def get_opts():
def get_flags():
- return [
- ('builtin_freetype', False),
- ('builtin_libpng', False),
- ('builtin_zlib', False),
- ]
+ return []
def configure(env):
diff --git a/platform/x11/joypad_linux.cpp b/platform/x11/joypad_linux.cpp
index 21c3b0ac91..e6328ee14d 100644
--- a/platform/x11/joypad_linux.cpp
+++ b/platform/x11/joypad_linux.cpp
@@ -101,7 +101,6 @@ void JoypadLinux::joy_thread_func(void *p_user) {
JoypadLinux *joy = (JoypadLinux *)p_user;
joy->run_joypad_thread();
}
- return;
}
void JoypadLinux::run_joypad_thread() {
diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp
index 6421dc270f..624efe8815 100644
--- a/platform/x11/os_x11.cpp
+++ b/platform/x11/os_x11.cpp
@@ -146,7 +146,7 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (is_stdout_verbose()) {
WARN_PRINT("IME is disabled");
}
- modifiers = XSetLocaleModifiers("@im=none");
+ XSetLocaleModifiers("@im=none");
WARN_PRINT("Error setting locale modifiers");
}
@@ -1032,9 +1032,7 @@ void OS_X11::set_wm_fullscreen(bool p_enabled) {
}
XSetWMNormalHints(x11_display, x11_window, xsh);
XFree(xsh);
- }
- if (!p_enabled) {
// put back or remove decorations according to the last set borderless state
Hints hints;
Atom property;
@@ -1201,7 +1199,7 @@ Point2 OS_X11::get_window_position() const {
void OS_X11::set_window_position(const Point2 &p_position) {
int x = 0;
int y = 0;
- if (get_borderless_window() == false) {
+ if (!get_borderless_window()) {
//exclude window decorations
XSync(x11_display, False);
Atom prop = XInternAtom(x11_display, "_NET_FRAME_EXTENTS", True);
@@ -2999,7 +2997,7 @@ void OS_X11::alert(const String &p_alert, const String &p_title) {
for (int i = 0; i < path_elems.size(); i++) {
for (unsigned int k = 0; k < sizeof(message_programs) / sizeof(char *); k++) {
- String tested_path = path_elems[i] + "/" + message_programs[k];
+ String tested_path = path_elems[i].plus_file(message_programs[k]);
if (FileAccess::exists(tested_path)) {
program = tested_path;
@@ -3051,8 +3049,6 @@ void OS_X11::alert(const String &p_alert, const String &p_title) {
} else {
print_line(p_alert);
}
-
- return;
}
bool g_set_icon_error = false;
diff --git a/platform/x11/power_x11.cpp b/platform/x11/power_x11.cpp
index 50da6a4967..758bd84114 100644
--- a/platform/x11/power_x11.cpp
+++ b/platform/x11/power_x11.cpp
@@ -202,7 +202,10 @@ void PowerX11::check_proc_acpi_battery(const char *node, bool *have_battery, boo
* We pick the battery that claims to have the most minutes left.
* (failing a report of minutes, we'll take the highest percent.)
*/
- if ((secs < 0) && (this->nsecs_left < 0)) {
+ // -- GODOT start --
+ //if ((secs < 0) && (this->nsecs_left < 0)) {
+ if (this->nsecs_left < 0) {
+ // -- GODOT end --
if ((pct < 0) && (this->percent_left < 0)) {
choose = true; /* at least we know there's a battery. */
}