summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/audio_driver_osx.cpp2
-rw-r--r--platform/osx/audio_driver_osx.h2
-rw-r--r--platform/osx/context_gl_osx.cpp2
-rw-r--r--platform/osx/context_gl_osx.h2
-rw-r--r--platform/osx/detect.py2
-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.cpp12
-rw-r--r--platform/osx/export/export.h2
-rw-r--r--platform/osx/godot_main_osx.mm2
-rw-r--r--platform/osx/godot_osx.h2
-rw-r--r--platform/osx/godot_osx.mm2
-rw-r--r--platform/osx/joypad_osx.cpp (renamed from platform/osx/joystick_osx.cpp)95
-rw-r--r--platform/osx/joypad_osx.h (renamed from platform/osx/joystick_osx.h)38
-rw-r--r--platform/osx/os_osx.h11
-rw-r--r--platform/osx/os_osx.mm130
-rw-r--r--platform/osx/platform_config.h5
-rw-r--r--platform/osx/sem_osx.cpp2
-rw-r--r--platform/osx/sem_osx.h2
20 files changed, 165 insertions, 154 deletions
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index c8e0e17612..00f23687cf 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -9,7 +9,7 @@ files = [
'sem_osx.cpp',
# 'context_gl_osx.cpp',
'dir_access_osx.mm',
- 'joystick_osx.cpp',
+ 'joypad_osx.cpp',
]
env.Program('#bin/godot', files)
diff --git a/platform/osx/audio_driver_osx.cpp b/platform/osx/audio_driver_osx.cpp
index d9d91b22fb..87901f6ec4 100644
--- a/platform/osx/audio_driver_osx.cpp
+++ b/platform/osx/audio_driver_osx.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/audio_driver_osx.h b/platform/osx/audio_driver_osx.h
index 92893c64dc..19b396de57 100644
--- a/platform/osx/audio_driver_osx.h
+++ b/platform/osx/audio_driver_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/context_gl_osx.cpp b/platform/osx/context_gl_osx.cpp
index df1c14c643..d0819bbfb6 100644
--- a/platform/osx/context_gl_osx.cpp
+++ b/platform/osx/context_gl_osx.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/context_gl_osx.h b/platform/osx/context_gl_osx.h
index 565a0ee02a..6a02aa23d1 100644
--- a/platform/osx/context_gl_osx.h
+++ b/platform/osx/context_gl_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 9191f1aabc..ccd86177ab 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -80,10 +80,12 @@ def configure(env):
env.Append(CPPFLAGS=["-DAPPLE_STYLE_KEYS"])
env.Append(CPPFLAGS=['-DUNIX_ENABLED', '-DGLES2_ENABLED', '-DOSX_ENABLED'])
+ env.Append(CPPFLAGS=["-mmacosx-version-min=10.9"])
env.Append(LIBS=['pthread'])
#env.Append(CPPFLAGS=['-F/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-mmacosx-version-min=10.4'])
#env.Append(LINKFLAGS=['-mmacosx-version-min=10.4', '-isysroot', '/Developer/SDKs/MacOSX10.4u.sdk', '-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk'])
env.Append(LINKFLAGS=['-framework', 'Cocoa', '-framework', 'Carbon', '-framework', 'OpenGL', '-framework', 'AGL', '-framework', 'AudioUnit', '-lz', '-framework', 'IOKit', '-framework', 'ForceFeedback'])
+ env.Append(LINKFLAGS=["-mmacosx-version-min=10.9"])
if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h
index d20eee1e2e..c30d380dd3 100644
--- a/platform/osx/dir_access_osx.h
+++ b/platform/osx/dir_access_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm
index 5615858262..476da2635e 100644
--- a/platform/osx/dir_access_osx.mm
+++ b/platform/osx/dir_access_osx.mm
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp
index 30f4c58150..1cb41cede2 100644
--- a/platform/osx/export/export.cpp
+++ b/platform/osx/export/export.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -43,7 +43,7 @@
class EditorExportPlatformOSX : public EditorExportPlatform {
- OBJ_TYPE( EditorExportPlatformOSX,EditorExportPlatform );
+ GDCLASS( EditorExportPlatformOSX,EditorExportPlatform );
String custom_release_package;
String custom_debug_package;
@@ -207,7 +207,7 @@ void EditorExportPlatformOSX::_make_icon(const Image& p_icon,Vector<uint8_t>& ic
while(size>=16) {
Image copy = p_icon;
- copy.convert(Image::FORMAT_RGBA);
+ copy.convert(Image::FORMAT_RGBA8);
copy.resize(size,size);
it->create_from_image(copy);
String path = EditorSettings::get_singleton()->get_settings_path()+"/tmp/icon.png";
@@ -324,8 +324,8 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
String pkg_name;
if (app_name!="")
pkg_name=app_name;
- else if (String(Globals::get_singleton()->get("application/name"))!="")
- pkg_name=String(Globals::get_singleton()->get("application/name"));
+ else if (String(GlobalConfig::get_singleton()->get("application/name"))!="")
+ pkg_name=String(GlobalConfig::get_singleton()->get("application/name"));
else
pkg_name="Unnamed";
@@ -371,7 +371,7 @@ Error EditorExportPlatformOSX::export_project(const String& p_path, bool p_debug
if (file=="Contents/Resources/icon.icns") {
//see if there is an icon
- String iconpath = Globals::get_singleton()->get("application/icon");
+ String iconpath = GlobalConfig::get_singleton()->get("application/icon");
print_line("icon? "+iconpath);
if (iconpath!="") {
Image icon;
diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h
index 8e0b83b457..98e63ff48e 100644
--- a/platform/osx/export/export.h
+++ b/platform/osx/export/export.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm
index 7beb5248b4..8eedd7f6fc 100644
--- a/platform/osx/godot_main_osx.mm
+++ b/platform/osx/godot_main_osx.mm
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/godot_osx.h b/platform/osx/godot_osx.h
index de363d8483..b6f2b06f26 100644
--- a/platform/osx/godot_osx.h
+++ b/platform/osx/godot_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/godot_osx.mm b/platform/osx/godot_osx.mm
index 02a1382b1a..2296fb016f 100644
--- a/platform/osx/godot_osx.mm
+++ b/platform/osx/godot_osx.mm
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/joystick_osx.cpp b/platform/osx/joypad_osx.cpp
index ffb6ac326b..5d25017aa6 100644
--- a/platform/osx/joystick_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_osx.cpp */
+/* joypad_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -26,14 +26,15 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "joystick_osx.h"
+#include "joypad_osx.h"
+
#include <machine/endian.h>
-#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoystick")
+#define GODOT_JOY_LOOP_RUN_MODE CFSTR("GodotJoypad")
-static JoystickOSX* self = NULL;
+static JoypadOSX* self = NULL;
-joystick::joystick() {
+joypad::joypad() {
device_ref = NULL;
ff_device = NULL;
ff_axes = NULL;
@@ -56,7 +57,7 @@ joystick::joystick() {
ff_effect.dwSize = sizeof(ff_effect);
}
-void joystick::free() {
+void joypad::free() {
if (device_ref) {
IOHIDDeviceUnscheduleFromRunLoop(device_ref, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
@@ -68,7 +69,7 @@ void joystick::free() {
}
}
-bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
+bool joypad::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_list) const {
for (int i = 0; i < p_list->size(); i++) {
if (p_cookie == p_list->get(i).cookie) {
return true;
@@ -77,7 +78,7 @@ bool joystick::has_element(IOHIDElementCookie p_cookie, Vector<rec_element> *p_l
return false;
}
-int joystick::get_hid_element_state(rec_element *p_element) const {
+int joypad::get_hid_element_state(rec_element *p_element) const {
int value = 0;
if (p_element && p_element->ref) {
IOHIDValueRef valueRef;
@@ -95,7 +96,7 @@ int joystick::get_hid_element_state(rec_element *p_element) const {
}
return value;
}
-void joystick::add_hid_element(IOHIDElementRef p_element) {
+void joypad::add_hid_element(IOHIDElementRef p_element) {
const CFTypeID elementTypeID = p_element ? CFGetTypeID(p_element) : 0;
if (p_element && (elementTypeID == IOHIDElementGetTypeID())) {
@@ -198,26 +199,26 @@ void joystick::add_hid_element(IOHIDElementRef p_element) {
}
static void hid_element_added(const void *p_value, void *p_parameter) {
- joystick *joy = (joystick*) p_parameter;
+ joypad *joy = (joypad*) p_parameter;
joy->add_hid_element((IOHIDElementRef) p_value);
}
-void joystick::add_hid_elements(CFArrayRef p_array) {
+void joypad::add_hid_elements(CFArrayRef p_array) {
CFRange range = { 0, CFArrayGetCount(p_array) };
CFArrayApplyFunction(p_array, range,hid_element_added,this);
}
-static void joystick_removed_callback(void *ctx, IOReturn result, void *sender) {
+static void joypad_removed_callback(void *ctx, IOReturn result, void *sender) {
int id = (intptr_t) ctx;
self->_device_removed(id);
}
-static void joystick_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
+static void joypad_added_callback(void *ctx, IOReturn res, void *sender, IOHIDDeviceRef ioHIDDeviceObject) {
self->_device_added(res, ioHIDDeviceObject);
}
-static bool is_joystick(IOHIDDeviceRef p_device_ref) {
+static bool is_joypad(IOHIDDeviceRef p_device_ref) {
CFTypeRef refCF = NULL;
int usage_page = 0;
int usage = 0;
@@ -241,32 +242,32 @@ static bool is_joystick(IOHIDDeviceRef p_device_ref) {
return true;
}
-void JoystickOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
+void JoypadOSX::_device_added(IOReturn p_res, IOHIDDeviceRef p_device) {
if (p_res != kIOReturnSuccess || have_device(p_device)) {
return;
}
- joystick new_joystick;
- if (is_joystick(p_device)) {
- configure_joystick(p_device, &new_joystick);
+ joypad new_joypad;
+ if (is_joypad(p_device)) {
+ configure_joypad(p_device, &new_joypad);
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
if (IOHIDDeviceGetService != NULL) {
#endif
const io_service_t ioservice = IOHIDDeviceGetService(p_device);
- if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joystick.config_force_feedback(ioservice)) {
- new_joystick.ffservice = ioservice;
+ if ((ioservice) && (FFIsForceFeedback(ioservice) == FF_OK) && new_joypad.config_force_feedback(ioservice)) {
+ new_joypad.ffservice = ioservice;
}
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
}
#endif
- device_list.push_back(new_joystick);
+ device_list.push_back(new_joypad);
}
- IOHIDDeviceRegisterRemovalCallback(p_device, joystick_removed_callback, (void*) (intptr_t) new_joystick.id);
+ IOHIDDeviceRegisterRemovalCallback(p_device, joypad_removed_callback, (void*) (intptr_t) new_joypad.id);
IOHIDDeviceScheduleWithRunLoop(p_device, CFRunLoopGetCurrent(), GODOT_JOY_LOOP_RUN_MODE);
}
-void JoystickOSX::_device_removed(int p_id) {
+void JoypadOSX::_device_removed(int p_id) {
int device = get_joy_index(p_id);
ERR_FAIL_COND(device == -1);
@@ -289,7 +290,7 @@ static String _hex_str(uint8_t p_byte) {
return ret;
}
-bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_joy) {
+bool JoypadOSX::configure_joypad(IOHIDDeviceRef p_device_ref, joypad* p_joy) {
CFTypeRef refCF = NULL;
@@ -302,7 +303,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
refCF = IOHIDDeviceGetProperty(p_device_ref, CFSTR(kIOHIDManufacturerKey));
}
if ((!refCF) || (!CFStringGetCString((CFStringRef) refCF, c_name, sizeof (c_name), kCFStringEncodingUTF8))) {
- name = "Unidentified Joystick";
+ name = "Unidentified Joypad";
}
name = c_name;
@@ -345,7 +346,7 @@ bool JoystickOSX::configure_joystick(IOHIDDeviceRef p_device_ref, joystick* p_jo
}
#define FF_ERR() { if (ret != FF_OK) { FFReleaseDevice(ff_device); return false; } }
-bool joystick::config_force_feedback(io_service_t p_service) {
+bool joypad::config_force_feedback(io_service_t p_service) {
HRESULT ret = FFCreateDevice(p_service, &ff_device);
ERR_FAIL_COND_V(ret != FF_OK, false);
@@ -367,7 +368,7 @@ bool joystick::config_force_feedback(io_service_t p_service) {
#undef FF_ERR
#define TEST_FF(ff) (features.supportedEffects & (ff))
-bool joystick::check_ff_features() {
+bool joypad::check_ff_features() {
FFCAPABILITIES features;
HRESULT ret = FFDeviceGetForceFeedbackCapabilities(ff_device, &features);
@@ -432,7 +433,7 @@ static int process_hat_value(int p_min, int p_max, int p_value) {
return hat_value;
}
-void JoystickOSX::poll_joysticks() const {
+void JoypadOSX::poll_joypads() const {
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
/* no-op. Pending callbacks will fire. */
}
@@ -454,11 +455,11 @@ static const InputDefault::JoyAxis axis_correct(int p_value, int p_min, int p_ma
return jx;
}
-uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
- poll_joysticks();
+uint32_t JoypadOSX::process_joypads(uint32_t p_last_id){
+ poll_joypads();
for (int i = 0; i < device_list.size(); i++) {
- joystick &joy = device_list[i];
+ joypad &joy = device_list[i];
for (int j = 0; j < joy.axis_elements.size(); j++) {
rec_element &elem = joy.axis_elements[j];
@@ -482,11 +483,11 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
Vector2 strength = input->get_joy_vibration_strength(joy.id);
float duration = input->get_joy_vibration_duration(joy.id);
if (strength.x == 0 && strength.y == 0) {
- joystick_vibration_stop(joy.id, timestamp);
+ joypad_vibration_stop(joy.id, timestamp);
}
else {
float gain = MAX(strength.x, strength.y);
- joystick_vibration_start(joy.id, gain, duration, timestamp);
+ joypad_vibration_start(joy.id, gain, duration, timestamp);
}
}
}
@@ -494,8 +495,8 @@ uint32_t JoystickOSX::process_joysticks(uint32_t p_last_id){
return p_last_id;
}
-void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
- joystick *joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp) {
+ joypad *joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
joy->ff_effect.dwDuration = p_duration * FF_SECONDS;
joy->ff_effect.dwGain = p_magnitude * FF_FFNOMINALMAX;
@@ -503,14 +504,14 @@ void JoystickOSX::joystick_vibration_start(int p_id, float p_magnitude, float p_
FFEffectStart(joy->ff_object, 1, 0);
}
-void JoystickOSX::joystick_vibration_stop(int p_id, uint64_t p_timestamp) {
- joystick* joy = &device_list[get_joy_index(p_id)];
+void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) {
+ joypad* joy = &device_list[get_joy_index(p_id)];
joy->ff_timestamp = p_timestamp;
FFEffectStop(joy->ff_object);
}
-int JoystickOSX::get_free_joy_id() {
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+int JoypadOSX::get_free_joy_id() {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
if (!attached_devices[i]) {
attached_devices[i] = true;
return i;
@@ -519,14 +520,14 @@ int JoystickOSX::get_free_joy_id() {
return -1;
}
-int JoystickOSX::get_joy_index(int p_id) const {
+int JoypadOSX::get_joy_index(int p_id) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].id == p_id) return i;
}
return -1;
}
-bool JoystickOSX::have_device(IOHIDDeviceRef p_device) const {
+bool JoypadOSX::have_device(IOHIDDeviceRef p_device) const {
for (int i = 0; i < device_list.size(); i++) {
if (device_list[i].device_ref == p_device) {
return true;
@@ -561,14 +562,14 @@ static CFDictionaryRef create_match_dictionary(const UInt32 page, const UInt32 u
return retval;
}
-void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
+void JoypadOSX::config_hid_manager(CFArrayRef p_matching_array) const {
CFRunLoopRef runloop = CFRunLoopGetCurrent();
IOReturn ret = IOHIDManagerOpen(hid_manager, kIOHIDOptionsTypeNone);
ERR_FAIL_COND(ret != kIOReturnSuccess);
IOHIDManagerSetDeviceMatchingMultiple(hid_manager, p_matching_array);
- IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joystick_added_callback, NULL);
+ IOHIDManagerRegisterDeviceMatchingCallback(hid_manager, joypad_added_callback, NULL);
IOHIDManagerScheduleWithRunLoop(hid_manager, runloop, GODOT_JOY_LOOP_RUN_MODE);
while (CFRunLoopRunInMode(GODOT_JOY_LOOP_RUN_MODE,0,TRUE) == kCFRunLoopRunHandledSource) {
@@ -576,12 +577,12 @@ void JoystickOSX::config_hid_manager(CFArrayRef p_matching_array) const {
}
}
-JoystickOSX::JoystickOSX()
+JoypadOSX::JoypadOSX()
{
self = this;
input = (InputDefault*)Input::get_singleton();
- for (int i = 0; i < JOYSTICKS_MAX; i++) {
+ for (int i = 0; i < JOYPADS_MAX; i++) {
attached_devices[i] = false;
}
@@ -609,7 +610,7 @@ JoystickOSX::JoystickOSX()
}
}
-JoystickOSX::~JoystickOSX() {
+JoypadOSX::~JoypadOSX() {
for (int i = 0; i < device_list.size(); i++) {
device_list[i].free();
diff --git a/platform/osx/joystick_osx.h b/platform/osx/joypad_osx.h
index 38a4e3b1d3..aafd82880d 100644
--- a/platform/osx/joystick_osx.h
+++ b/platform/osx/joypad_osx.h
@@ -1,11 +1,11 @@
/*************************************************************************/
-/* joystick_osx.h */
+/* joypad_osx.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -26,8 +26,8 @@
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef JOYSTICKOSX_H
-#define JOYSTICKOSX_H
+#ifndef JOYPADOSX_H
+#define JOYPADOSX_H
#ifdef MACOS_10_0_4
#include <IOKit/hidsystem/IOHIDUsageTables.h>
@@ -54,7 +54,7 @@ struct rec_element {
};
};
-struct joystick {
+struct joypad {
IOHIDDeviceRef device_ref;
Vector<rec_element> axis_elements;
@@ -82,44 +82,44 @@ struct joystick {
int get_hid_element_state(rec_element *p_element) const;
void free();
- joystick();
+ joypad();
};
-class JoystickOSX {
+class JoypadOSX {
enum {
- JOYSTICKS_MAX = 16,
+ JOYPADS_MAX = 16,
};
private:
InputDefault *input;
IOHIDManagerRef hid_manager;
- bool attached_devices[JOYSTICKS_MAX];
- Vector<joystick> device_list;
+ bool attached_devices[JOYPADS_MAX];
+ Vector<joypad> device_list;
bool have_device(IOHIDDeviceRef p_device) const;
- bool configure_joystick(IOHIDDeviceRef p_device_ref, joystick *p_joy);
+ bool configure_joypad(IOHIDDeviceRef p_device_ref, joypad *p_joy);
int get_free_joy_id();
int get_joy_index(int p_id) const;
- void poll_joysticks() const;
- void setup_joystick_objects();
+ void poll_joypads() const;
+ void setup_joypad_objects();
void config_hid_manager(CFArrayRef p_matching_array) const;
- void joystick_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
- void joystick_vibration_stop(int p_id, uint64_t p_timestamp);
+ void joypad_vibration_start(int p_id, float p_magnitude, float p_duration, uint64_t p_timestamp);
+ void joypad_vibration_stop(int p_id, uint64_t p_timestamp);
public:
- uint32_t process_joysticks(uint32_t p_last_id);
+ uint32_t process_joypads(uint32_t p_last_id);
void _device_added(IOReturn p_res, IOHIDDeviceRef p_device);
void _device_removed(int p_id);
- JoystickOSX();
- ~JoystickOSX();
+ JoypadOSX();
+ ~JoypadOSX();
};
-#endif // JOYSTICKOSX_H
+#endif // JOYPADOSX_H
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index e23ae49a35..f6559f1f7a 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -31,11 +31,11 @@
#include "os/input.h"
-#include "joystick_osx.h"
+#include "joypad_osx.h"
#include "drivers/unix/os_unix.h"
#include "main/input_default.h"
#include "servers/visual_server.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual/rasterizer.h"
#include "servers/physics_server.h"
#include "servers/audio/audio_server_sw.h"
@@ -58,7 +58,8 @@
class OS_OSX : public OS_Unix {
public:
bool force_quit;
- Rasterizer *rasterizer;
+// rasterizer seems to no longer be given to visual server, its using GLES3 directly?
+ //Rasterizer *rasterizer;
VisualServer *visual_server;
List<String> args;
@@ -77,7 +78,7 @@ public:
SpatialSound2DServerSW *spatial_sound_2d_server;
InputDefault *input;
- JoystickOSX *joystick_osx;
+ JoypadOSX *joypad_osx;
/* objc */
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index cc893cc7a0..5750e19c87 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -38,13 +38,14 @@
#include "servers/visual/visual_server_raster.h"
//#include "drivers/opengl/rasterizer_gl.h"
//#include "drivers/gles2/rasterizer_gles2.h"
+#include "drivers/gles3/rasterizer_gles3.h"
#include "os_osx.h"
#include <stdio.h>
#include <stdlib.h>
#include "print_string.h"
#include "servers/physics/physics_server_sw.h"
-#include "drivers/gles2/rasterizer_instance_gles2.h"
-#include "servers/visual/visual_server_wrap_mt.h"
+// #include "drivers/gles2/rasterizer_instance_gles2.h"
+// #include "servers/visual/visual_server_wrap_mt.h"
#include "main/main.h"
#include "os/keyboard.h"
#include "dir_access_osx.h"
@@ -147,36 +148,36 @@ static int button_mask=0;
- (void)applicationDidHide:(NSNotification *)notification
{
- /* _Godotwindow* window;
-
- for (window = _Godot.windowListHead; window; window = window->next)
- _GodotInputWindowVisibility(window, GL_FALSE);
+ /*
+ _Godotwindow* window;
+ for (window = _Godot.windowListHead; window; window = window->next)
+ _GodotInputWindowVisibility(window, GL_FALSE);
*/
}
- (void)applicationDidUnhide:(NSNotification *)notification
{
/*
- _Godotwindow* window;
+ _Godotwindow* window;
- for (window = _Godot.windowListHead; window; window = window->next)
- {
+ for (window = _Godot.windowListHead; window; window = window->next)
+ {
if ([window_object isVisible])
_GodotInputWindowVisibility(window, GL_TRUE);
- }
- */
+ }
+ */
}
- (void)applicationDidChangeScreenParameters:(NSNotification *) notification
{
- //_GodotInputMonitorChange();
+ //_GodotInputMonitorChange();
}
@end
@interface GodotWindowDelegate : NSObject
{
- // _Godotwindow* window;
+ //_Godotwindow* window;
}
@end
@@ -186,7 +187,7 @@ static int button_mask=0;
- (BOOL)windowShouldClose:(id)sender
{
- //_GodotInputWindowCloseRequest(window);
+ //_GodotInputWindowCloseRequest(window);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_QUIT_REQUEST);
return NO;
@@ -206,38 +207,42 @@ static int button_mask=0;
OS_OSX::singleton->window_size.height=fbRect.size.height*OS_OSX::singleton->display_scale;
- // _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
- // _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
- //_GodotInputWindowDamage(window);
+ /*
+ _GodotInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
+ _GodotInputWindowSize(window, contentRect.size.width, contentRect.size.height);
+ _GodotInputWindowDamage(window);
- //if (window->cursorMode == Godot_CURSOR_DISABLED)
- // centerCursor(window);
+ if (window->cursorMode == Godot_CURSOR_DISABLED)
+ centerCursor(window);
+ */
}
- (void)windowDidMove:(NSNotification *)notification
{
- // [window->nsgl.context update];
+ /*
+ [window->nsgl.context update];
- // int x, y;
- // _GodotPlatformGetWindowPos(window, &x, &y);
- // _GodotInputWindowPos(window, x, y);
+ int x, y;
+ _GodotPlatformGetWindowPos(window, &x, &y);
+ _GodotInputWindowPos(window, x, y);
- //if (window->cursorMode == Godot_CURSOR_DISABLED)
- // centerCursor(window);
+ if (window->cursorMode == Godot_CURSOR_DISABLED)
+ centerCursor(window);
+ */
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
- // _GodotInputWindowFocus(window, GL_TRUE);
- // _GodotPlatformSetCursorMode(window, window->cursorMode);
+ //_GodotInputWindowFocus(window, GL_TRUE);
+ //_GodotPlatformSetCursorMode(window, window->cursorMode);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_IN);
}
- (void)windowDidResignKey:(NSNotification *)notification
{
- // _GodotInputWindowFocus(window, GL_FALSE);
- // _GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL);
+ //_GodotInputWindowFocus(window, GL_FALSE);
+ //_GodotPlatformSetCursorMode(window, Godot_CURSOR_NORMAL);
if (OS_OSX::singleton->get_main_loop())
OS_OSX::singleton->get_main_loop()->notification(MainLoop::NOTIFICATION_WM_FOCUS_OUT);
}
@@ -272,16 +277,18 @@ static int button_mask=0;
+ (void)initialize
{
- if (self == [GodotContentView class])
- {
- /* if (_glfw.ns.cursor == nil)
+ if (self == [GodotContentView class])
{
- NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
- _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
- hotSpot:NSZeroPoint];
- [data release];
- }*/
- }
+ /*
+ if (_glfw.ns.cursor == nil)
+ {
+ NSImage* data = [[NSImage alloc] initWithSize:NSMakeSize(1, 1)];
+ _glfw.ns.cursor = [[NSCursor alloc] initWithImage:data
+ hotSpot:NSZeroPoint];
+ [data release];
+ }
+ */
+ }
}
- (id)init
@@ -986,24 +993,20 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
window_size.width = p_desired.width;
window_size.height = p_desired.height;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && display_scale>1) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
}
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
-// [window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]];
+ //[window_object setTitle:[NSString stringWithUTF8String:"GodotEnginies"]];
[window_object setContentView:window_view];
[window_object setDelegate:window_delegate];
[window_object setAcceptsMouseMovedEvents:YES];
[window_object center];
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
[window_object setRestorable:NO];
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
unsigned int attributeCount = 0;
@@ -1022,10 +1025,8 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
ADD_ATTR(NSOpenGLPFADoubleBuffer);
ADD_ATTR(NSOpenGLPFAClosestPolicy);
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (false/* use gl3*/)
- ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
+ //we now need OpenGL 3 or better, maybe even change this to 3_3Core ?
+ ADD_ATTR2(NSOpenGLPFAOpenGLProfile, NSOpenGLProfileVersion3_2Core);
ADD_ATTR2(NSOpenGLPFAColorSize, colorBits);
@@ -1084,15 +1085,20 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
AudioDriverManagerSW::add_driver(&audio_driver_osx);
+ // only opengl support here...
+ RasterizerGLES3::register_config();
+ RasterizerGLES3::make_current();
- rasterizer = instance_RasterizerGLES2();
-
- visual_server = memnew( VisualServerRaster(rasterizer) );
+ //rasterizer = instance_RasterizerGLES2();
+ //visual_server = memnew( VisualServerRaster(rasterizer) );
+ visual_server = memnew( VisualServerRaster );
+ // FIXME: Reimplement threaded rendering? Or remove?
+ /*
if (get_render_thread_mode()!=RENDER_THREAD_UNSAFE) {
-
visual_server =memnew(VisualServerWrapMT(visual_server,get_render_thread_mode()==RENDER_SEPARATE_THREAD));
}
+ */
visual_server->init();
visual_server->cursor_set_visible(false, 0);
@@ -1123,7 +1129,7 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
physics_2d_server->init();
input = memnew( InputDefault );
- joystick_osx = memnew( JoystickOSX );
+ joypad_osx = memnew( JoypadOSX );
_ensure_data_dir();
@@ -1166,7 +1172,7 @@ void OS_OSX::finalize() {
spatial_sound_2d_server->finish();
memdelete(spatial_sound_2d_server);
- memdelete(joystick_osx);
+ memdelete(joypad_osx);
memdelete(input);
memdelete(sample_manager);
@@ -1176,7 +1182,7 @@ void OS_OSX::finalize() {
visual_server->finish();
memdelete(visual_server);
- memdelete(rasterizer);
+ //memdelete(rasterizer);
physics_server->finish();
memdelete(physics_server);
@@ -1313,7 +1319,7 @@ void OS_OSX::set_window_title(const String& p_title) {
void OS_OSX::set_icon(const Image& p_icon) {
Image img=p_icon;
- img.convert(Image::FORMAT_RGBA);
+ img.convert(Image::FORMAT_RGBA8);
NSBitmapImageRep *imgrep= [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes: NULL
pixelsWide: p_icon.get_width()
pixelsHigh: p_icon.get_height()
@@ -1328,8 +1334,8 @@ void OS_OSX::set_icon(const Image& p_icon) {
uint8_t *pixels = [imgrep bitmapData];
int len = img.get_width()*img.get_height();
- DVector<uint8_t> data = img.get_data();
- DVector<uint8_t>::Read r = data.read();
+ PoolVector<uint8_t> data = img.get_data();
+ PoolVector<uint8_t>::Read r = data.read();
/* Premultiply the alpha channel */
for (int i = 0; i<len ; i++) {
@@ -1731,15 +1737,15 @@ void OS_OSX::run() {
set_window_fullscreen(true);
}
-// uint64_t last_ticks=get_ticks_usec();
+ //uint64_t last_ticks=get_ticks_usec();
-// int frames=0;
-// uint64_t frame=0;
+ //int frames=0;
+ //uint64_t frame=0;
while (!force_quit) {
process_events(); // get rid of pending events
- last_id = joystick_osx->process_joysticks(last_id);
+ last_id = joypad_osx->process_joypads(last_id);
if (Main::iteration()==true)
break;
};
diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h
index f02a4bc444..834d0141a3 100644
--- a/platform/osx/platform_config.h
+++ b/platform/osx/platform_config.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
@@ -27,5 +27,6 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include <alloca.h>
-#define GLES2_INCLUDE_H "GL/glew.h"
+
+#define GLES3_INCLUDE_H "glad/glad.h"
#define PTHREAD_RENAME_SELF
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp
index 6909097fec..ca710d8b1e 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/sem_osx.cpp
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h
index ec5ddac4e0..da2fac434c 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/sem_osx.h
@@ -5,7 +5,7 @@
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
-/* Copyright (c) 2007-2016 Juan Linietsky, Ariel Manzur. */
+/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */