summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/audio_driver_osx.cpp2
-rw-r--r--platform/osx/audio_driver_osx.h2
-rw-r--r--platform/osx/detect.py10
-rw-r--r--platform/osx/dir_access_osx.h2
-rw-r--r--platform/osx/dir_access_osx.mm2
-rw-r--r--platform/osx/export/export.cpp2
-rw-r--r--platform/osx/export/export.h2
-rw-r--r--platform/osx/godot_main_osx.mm2
-rw-r--r--platform/osx/joypad_osx.cpp12
-rw-r--r--platform/osx/joypad_osx.h2
-rw-r--r--platform/osx/os_osx.h10
-rw-r--r--platform/osx/os_osx.mm72
-rw-r--r--platform/osx/platform_config.h2
-rw-r--r--platform/osx/power_osx.cpp2
-rw-r--r--platform/osx/power_osx.h2
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
17 files changed, 97 insertions, 33 deletions
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index da5cd8f65e..8c5a734f76 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h
index 4576100690..ac178b89f3 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/platform/osx/audio_driver_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index d9891dda61..d3ebdfe992 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -12,7 +12,7 @@ def get_name():
def can_build():
- if (sys.platform == "darwin" or os.environ.has_key("OSXCROSS_ROOT")):
+ if (sys.platform == "darwin" or ("OSXCROSS_ROOT" in os.environ)):
return True
return False
@@ -65,10 +65,14 @@ def configure(env):
else: # osxcross build
root = os.environ.get("OSXCROSS_ROOT", 0)
- if env["bits"] == "64":
+ if env["bits"] == "fat":
basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
- else:
+ env.Append(CCFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ env.Append(LINKFLAGS=['-arch', 'i386', '-arch', 'x86_64'])
+ elif env["bits"] == "32":
basecmd = root + "/target/bin/i386-apple-" + env["osxcross_sdk"] + "-"
+ else: # 64-bit, default
+ basecmd = root + "/target/bin/x86_64-apple-" + env["osxcross_sdk"] + "-"
env['CC'] = basecmd + "cc"
env['CXX'] = basecmd + "c++"
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index 6dcff3898c..c988dfe425 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 37ba0e6b19..6e8ceb5e19 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 03f424de8d..7f749030ec 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index 50604f068f..bb87c8a6b7 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/export/export.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 0bf678f9b7..83d782cc2f 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index 1a4b3a460e..ab323ad410 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -217,10 +217,9 @@ static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDe
}
static bool is_joypad(IOHIDDeviceRef p_device_ref) {
- CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
- refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey));
+ CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDPrimaryUsagePageKey));
if (refCF) {
CFNumberGetValue((CFNumberRef)refCF, kCFNumberSInt32Type, &usage_page);
}
@@ -289,13 +288,11 @@ static String _hex_str(uint8_t p_byte) {
bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
- CFTypeRef refCF = NULL;
-
p_joy->device_ref = p_device_ref;
/* get device name */
String name;
char c_name[256];
- refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey));
+ CFTypeRef refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDProductKey));
if (!refCF) {
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
@@ -334,8 +331,7 @@ bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy) {
input->joy_connection_changed(id, true, name, guid);
}
- CFArrayRef array = NULL;
- array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
+ CFArrayRef array = IOHIDDeviceCopyMatchingElements(p_device_ref, NULL, kIOHIDOptionsTypeNone);
if (array) {
p_joy->add_hid_elements(array);
CFRelease(array);
diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h
index bfbc523cff..e271f4b947 100644
--- a/platform/osx/joypad_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 56e6802eeb..ebaebd84ce 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -160,6 +160,8 @@ public:
virtual MainLoop *get_main_loop() const;
+ virtual String get_system_dir(SystemDir p_dir) const;
+
virtual bool can_draw() const;
virtual void set_clipboard(const String &p_text);
@@ -187,9 +189,9 @@ public:
virtual int get_screen_count() const;
virtual int get_current_screen() const;
virtual void set_current_screen(int p_screen);
- virtual Point2 get_screen_position(int p_screen = 0) const;
- virtual Size2 get_screen_size(int p_screen = 0) const;
- virtual int get_screen_dpi(int p_screen = 0) const;
+ virtual Point2 get_screen_position(int p_screen = -1) const;
+ virtual Size2 get_screen_size(int p_screen = -1) const;
+ virtual int get_screen_dpi(int p_screen = -1) const;
virtual Point2 get_window_position() const;
virtual void set_window_position(const Point2 &p_position);
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 6d8a6eca66..f502fb9a9c 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -137,6 +137,11 @@ static bool mouse_down_control = false;
//_GodotInputMonitorChange();
}
+- (void)showAbout:(id)sender {
+ if (OS_OSX::singleton->get_main_loop())
+ OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_ABOUT);
+}
+
@end
@interface GodotWindowDelegate : NSObject {
@@ -1322,6 +1327,46 @@ MainLoop *OS_OSX::get_main_loop() const {
return main_loop;
}
+String OS_OSX::get_system_dir(SystemDir p_dir) const {
+
+ NSSearchPathDirectory id = 0;
+
+ switch (p_dir) {
+ case SYSTEM_DIR_DESKTOP: {
+ id = NSDesktopDirectory;
+ } break;
+ case SYSTEM_DIR_DOCUMENTS: {
+ id = NSDocumentDirectory;
+ } break;
+ case SYSTEM_DIR_DOWNLOADS: {
+ id = NSDownloadsDirectory;
+ } break;
+ case SYSTEM_DIR_MOVIES: {
+ id = NSMoviesDirectory;
+ } break;
+ case SYSTEM_DIR_MUSIC: {
+ id = NSMusicDirectory;
+ } break;
+ case SYSTEM_DIR_PICTURES: {
+ id = NSPicturesDirectory;
+ } break;
+ }
+
+ String ret;
+ if (id) {
+
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(id, NSUserDomainMask, YES);
+ if (paths && [paths count] >= 1) {
+
+ char *utfs = strdup([[paths firstObject] UTF8String]);
+ ret.parse_utf8(utfs);
+ free(utfs);
+ }
+ }
+
+ return ret;
+}
+
bool OS_OSX::can_draw() const {
return true;
@@ -1428,6 +1473,10 @@ void OS_OSX::set_current_screen(int p_screen) {
};
Point2 OS_OSX::get_screen_position(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1444,6 +1493,10 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
}
int OS_OSX::get_screen_dpi(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1464,6 +1517,10 @@ int OS_OSX::get_screen_dpi(int p_screen) const {
}
Size2 OS_OSX::get_screen_size(int p_screen) const {
+ if (p_screen == -1) {
+ p_screen = get_current_screen();
+ }
+
NSArray *screenArray = [NSScreen screens];
if (p_screen < [screenArray count]) {
float displayScale = 1.0;
@@ -1514,9 +1571,14 @@ Point2 OS_OSX::get_window_position() const {
void OS_OSX::set_window_position(const Point2 &p_position) {
- Point2 size = p_position;
- size /= display_scale;
- [window_object setFrame:NSMakeRect(size.x, size.y, [window_object frame].size.width, [window_object frame].size.height) display:YES];
+ Size2 scr = get_screen_size();
+ NSPoint pos;
+
+ pos.x = p_position.x / display_scale;
+ // For OS X the y starts at the bottom
+ pos.y = (scr.height - p_position.y) / display_scale;
+
+ [window_object setFrameTopLeftPoint:pos];
_update_window();
};
@@ -1897,7 +1959,7 @@ OS_OSX::OS_OSX() {
// Setup Apple menu
NSMenu *apple_menu = [[NSMenu alloc] initWithTitle:@""];
title = [NSString stringWithFormat:NSLocalizedString(@"About %@", nil), nsappname];
- [apple_menu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
+ [apple_menu addItemWithTitle:title action:@selector(showAbout:) keyEquivalent:@""];
[apple_menu addItem:[NSMenuItem separatorItem]];
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index 487077e651..d2474fcfc7 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/power_osx.cpp b/platform/osx/power_osx.cpp
index 2ef1a65ff1..24591e48b1 100644
--- a/platform/osx/power_osx.cpp
+++ b/platform/osx/power_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h
index 6d984ec466..692c850d7c 100644
--- a/platform/osx/power_osx.h
+++ b/platform/osx/power_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp
index b1eeccfec5..f75ac181bf 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/sem_osx.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h
index 3025318c4b..2b408b00de 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/sem_osx.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */