diff options
Diffstat (limited to 'platform')
170 files changed, 378 insertions, 124 deletions
diff --git a/platform/android/audio_driver_jandroid.cpp b/platform/android/audio_driver_jandroid.cpp index 1f05d6cd9b..7545ee88d0 100644 --- a/platform/android/audio_driver_jandroid.cpp +++ b/platform/android/audio_driver_jandroid.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_driver_jandroid.h" #include "os/os.h" diff --git a/platform/android/audio_driver_jandroid.h b/platform/android/audio_driver_jandroid.h index 5cd8eb8e0c..763f0e9b5a 100644 --- a/platform/android/audio_driver_jandroid.h +++ b/platform/android/audio_driver_jandroid.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef AUDIO_DRIVER_ANDROID_H #define AUDIO_DRIVER_ANDROID_H diff --git a/platform/android/audio_driver_opensl.cpp b/platform/android/audio_driver_opensl.cpp index f0218e13bd..87a7d04e01 100644 --- a/platform/android/audio_driver_opensl.cpp +++ b/platform/android/audio_driver_opensl.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_driver_opensl.h" #include <string.h> diff --git a/platform/android/audio_driver_opensl.h b/platform/android/audio_driver_opensl.h index 9dc74c6c8a..2022bad02a 100644 --- a/platform/android/audio_driver_opensl.h +++ b/platform/android/audio_driver_opensl.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef AUDIO_DRIVER_OPENSL_H #define AUDIO_DRIVER_OPENSL_H diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template index 13b4d3b6c7..89189ef1a0 100644 --- a/platform/android/build.gradle.template +++ b/platform/android/build.gradle.template @@ -20,7 +20,7 @@ allprojects { } dependencies { - compile 'com.android.support:support-v4:23.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java + compile 'com.android.support:support-v4:27.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java $$GRADLE_DEPENDENCIES$$ } diff --git a/platform/android/dir_access_android.cpp b/platform/android/dir_access_android.cpp index c6e11ec505..402da4527e 100644 --- a/platform/android/dir_access_android.cpp +++ b/platform/android/dir_access_android.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef ANDROID_NATIVE_ACTIVITY #include "dir_access_android.h" #include "file_access_android.h" diff --git a/platform/android/dir_access_android.h b/platform/android/dir_access_android.h index 970202b5cc..085d7160cd 100644 --- a/platform/android/dir_access_android.h +++ b/platform/android/dir_access_android.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef DIR_ACCESS_ANDROID_H #define DIR_ACCESS_ANDROID_H diff --git a/platform/android/dir_access_jandroid.cpp b/platform/android/dir_access_jandroid.cpp index 6abab3edf6..5601dcc763 100644 --- a/platform/android/dir_access_jandroid.cpp +++ b/platform/android/dir_access_jandroid.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef ANDROID_NATIVE_ACTIVITY #include "dir_access_jandroid.h" diff --git a/platform/android/dir_access_jandroid.h b/platform/android/dir_access_jandroid.h index 4a9112fb27..8dc52ab9c8 100644 --- a/platform/android/dir_access_jandroid.h +++ b/platform/android/dir_access_jandroid.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef DIR_ACCESS_JANDROID_H #define DIR_ACCESS_JANDROID_H diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 922a53621f..b26d2a3aa4 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "export.h" #include "editor/editor_export.h" diff --git a/platform/android/export/export.h b/platform/android/export/export.h index eb18e04863..9d66626866 100644 --- a/platform/android/export/export.h +++ b/platform/android/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_android_exporter(); diff --git a/platform/android/file_access_android.cpp b/platform/android/file_access_android.cpp index d958ef8294..c2eed50e4c 100644 --- a/platform/android/file_access_android.cpp +++ b/platform/android/file_access_android.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "file_access_android.h" #include "print_string.h" diff --git a/platform/android/file_access_android.h b/platform/android/file_access_android.h index f44c19f963..03f4c59521 100644 --- a/platform/android/file_access_android.h +++ b/platform/android/file_access_android.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef FILE_ACCESS_ANDROID_H #define FILE_ACCESS_ANDROID_H diff --git a/platform/android/file_access_jandroid.cpp b/platform/android/file_access_jandroid.cpp index 4285a136a2..1a9d3af4ea 100644 --- a/platform/android/file_access_jandroid.cpp +++ b/platform/android/file_access_jandroid.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef ANDROID_NATIVE_ACTIVITY #include "file_access_jandroid.h" diff --git a/platform/android/file_access_jandroid.h b/platform/android/file_access_jandroid.h index c537f2f01a..72f81ee02e 100644 --- a/platform/android/file_access_jandroid.h +++ b/platform/android/file_access_jandroid.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef FILE_ACCESS_JANDROID_H #define FILE_ACCESS_JANDROID_H diff --git a/platform/android/globals/global_defaults.cpp b/platform/android/globals/global_defaults.cpp index 4a7dd07090..a315f80452 100644 --- a/platform/android/globals/global_defaults.cpp +++ b/platform/android/globals/global_defaults.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "global_defaults.h" #include "project_settings.h" diff --git a/platform/android/globals/global_defaults.h b/platform/android/globals/global_defaults.h index 412942eb88..99da2dd527 100644 --- a/platform/android/globals/global_defaults.h +++ b/platform/android/globals/global_defaults.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_android_global_defaults(); diff --git a/platform/android/godot_android.cpp b/platform/android/godot_android.cpp index 1643be7763..64715b3683 100644 --- a/platform/android/godot_android.cpp +++ b/platform/android/godot_android.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef ANDROID_NATIVE_ACTIVITY #include "engine.h" diff --git a/platform/android/java/src/org/godotengine/godot/Dictionary.java b/platform/android/java/src/org/godotengine/godot/Dictionary.java index b7ced69d0e..de6b4af568 100644 --- a/platform/android/java/src/org/godotengine/godot/Dictionary.java +++ b/platform/android/java/src/org/godotengine/godot/Dictionary.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import java.util.HashMap; diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java index d6e060f8d5..b5b0afb9e0 100644 --- a/platform/android/java/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/src/org/godotengine/godot/Godot.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import android.R; @@ -827,7 +828,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC //@Override public boolean dispatchTouchEvent (MotionEvent event) { public boolean gotTouchEvent(final MotionEvent event) { - super.onTouchEvent(event); final int evcount = event.getPointerCount(); if (evcount == 0) return true; @@ -841,6 +841,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC arr[i * 3 + 1] = (int)event.getX(i); arr[i * 3 + 2] = (int)event.getY(i); } + final int pointer_idx = event.getPointerId(event.getActionIndex()); //System.out.printf("gaction: %d\n",event.getAction()); final int action = event.getAction() & MotionEvent.ACTION_MASK; @@ -861,13 +862,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC */ } break; case MotionEvent.ACTION_POINTER_UP: { - final int indexPointUp = event.getActionIndex(); - final int pointer_idx = event.getPointerId(indexPointUp); GodotLib.touch(4, pointer_idx, evcount, arr); //System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; case MotionEvent.ACTION_POINTER_DOWN: { - int pointer_idx = event.getActionIndex(); GodotLib.touch(3, pointer_idx, evcount, arr); //System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx)); } break; diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java index a3fed28c6f..4701bac9df 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderAlarmReceiver.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import com.google.android.vending.expansion.downloader.DownloaderClientMarshaller; diff --git a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java index 9da705409b..3a94354843 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java +++ b/platform/android/java/src/org/godotengine/godot/GodotDownloaderService.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import android.content.Context; diff --git a/platform/android/java/src/org/godotengine/godot/GodotIO.java b/platform/android/java/src/org/godotengine/godot/GodotIO.java index 2382288ca8..a95c508d21 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotIO.java +++ b/platform/android/java/src/org/godotengine/godot/GodotIO.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import java.util.HashMap; import java.util.Locale; diff --git a/platform/android/java/src/org/godotengine/godot/GodotLib.java b/platform/android/java/src/org/godotengine/godot/GodotLib.java index 9deb9dcb35..45eb188327 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotLib.java +++ b/platform/android/java/src/org/godotengine/godot/GodotLib.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; // Wrapper for native library diff --git a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java index 7db0ef1b18..6b7f7a283e 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java +++ b/platform/android/java/src/org/godotengine/godot/GodotPaymentV3.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import android.app.Activity; diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java index db7daa1307..0222758c2b 100644 --- a/platform/android/java/src/org/godotengine/godot/GodotView.java +++ b/platform/android/java/src/org/godotengine/godot/GodotView.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot; import android.content.Context; import android.graphics.PixelFormat; @@ -109,7 +110,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener { @Override public boolean onTouchEvent(MotionEvent event) { - + super.onTouchEvent(event); return activity.gotTouchEvent(event); }; diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java index df62ac5a01..53fcf5ef70 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotEditText.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.input; import android.content.Context; import android.util.AttributeSet; diff --git a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java index eb3075fdfc..1102ab7450 100644 --- a/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java +++ b/platform/android/java/src/org/godotengine/godot/input/GodotTextInputWrapper.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.input; import android.content.Context; import android.text.Editable; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java index f78e454d93..afe5f81b6d 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ConsumeTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import com.android.vending.billing.IInAppBillingService; diff --git a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java index 747eea5e5c..8b48193ae2 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/GenericConsumeTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import com.android.vending.billing.IInAppBillingService; diff --git a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java index b49244cf09..766989f953 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/HandlePurchaseTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java index 05e634c13c..40cdeea72e 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsCache.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import android.content.Context; diff --git a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java index 8086489897..da6d66ae88 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PaymentsManager.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import android.app.Activity; diff --git a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java index a31b6ed9f2..e1d9bcee65 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/PurchaseTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java index 6ab6673183..e00e37f9d1 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ReleaseAllConsumablesTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import java.util.ArrayList; diff --git a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java index c10008c4e1..1eb9d001e0 100644 --- a/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java +++ b/platform/android/java/src/org/godotengine/godot/payments/ValidateTask.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.payments; import org.json.JSONException; diff --git a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java index cdaf60bded..f34511137e 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/Crypt.java +++ b/platform/android/java/src/org/godotengine/godot/utils/Crypt.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.utils; import java.security.MessageDigest; diff --git a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java index 7bd8fb63b2..7216d8b5a4 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java +++ b/platform/android/java/src/org/godotengine/godot/utils/CustomSSLSocketFactory.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.utils; import java.io.IOException; import java.net.Socket; diff --git a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java index ae1233674e..b84f5cce2e 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java +++ b/platform/android/java/src/org/godotengine/godot/utils/HttpRequester.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.utils; import java.io.BufferedReader; diff --git a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java index 7df98fab85..2368766afa 100644 --- a/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java +++ b/platform/android/java/src/org/godotengine/godot/utils/RequestParams.java @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + package org.godotengine.godot.utils; import java.util.ArrayList; diff --git a/platform/android/java_class_wrapper.cpp b/platform/android/java_class_wrapper.cpp index 1d03c3671a..80a32452a5 100644 --- a/platform/android/java_class_wrapper.cpp +++ b/platform/android/java_class_wrapper.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "java_class_wrapper.h" #include "thread_jandroid.h" diff --git a/platform/android/java_class_wrapper.h b/platform/android/java_class_wrapper.h index 4b374bc216..648c147ca8 100644 --- a/platform/android/java_class_wrapper.h +++ b/platform/android/java_class_wrapper.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef JAVA_CLASS_WRAPPER_H #define JAVA_CLASS_WRAPPER_H diff --git a/platform/android/java_glue.cpp b/platform/android/java_glue.cpp index 25aee74c46..4e9e4f6260 100644 --- a/platform/android/java_glue.cpp +++ b/platform/android/java_glue.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef ANDROID_NATIVE_ACTIVITY #include "java_glue.h" diff --git a/platform/android/java_glue.h b/platform/android/java_glue.h index fb997e950b..d433b5f0d8 100644 --- a/platform/android/java_glue.h +++ b/platform/android/java_glue.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef ANDROID_NATIVE_ACTIVITY #ifndef JAVA_GLUE_H diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp index 1542f4a5e4..23811f963a 100644 --- a/platform/android/os_android.cpp +++ b/platform/android/os_android.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_android.h" #include "core/io/file_access_buffered_fa.h" @@ -443,25 +444,27 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> } touch.clear(); } - } break; - case 3: { // add tuchi - - ERR_FAIL_INDEX(p_pointer, p_points.size()); + case 3: { // add touch - TouchPos tp = p_points[p_pointer]; - touch.push_back(tp); + for (int i = 0; i < p_points.size(); i++) { + if (p_points[i].id == p_pointer) { + TouchPos tp = p_points[i]; + touch.push_back(tp); - Ref<InputEventScreenTouch> ev; - ev.instance(); + Ref<InputEventScreenTouch> ev; + ev.instance(); - ev->set_index(tp.id); - ev->set_pressed(true); - ev->set_position(tp.pos); - input->parse_input_event(ev); + ev->set_index(tp.id); + ev->set_pressed(true); + ev->set_position(tp.pos); + input->parse_input_event(ev); + break; + } + } } break; - case 4: { + case 4: { // remove touch for (int i = 0; i < touch.size(); i++) { if (touch[i].id == p_pointer) { @@ -473,10 +476,10 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos> ev->set_position(touch[i].pos); input->parse_input_event(ev); touch.remove(i); - i--; + + break; } } - } break; } } diff --git a/platform/android/os_android.h b/platform/android/os_android.h index c0ab2acd2e..7ace7b5200 100644 --- a/platform/android/os_android.h +++ b/platform/android/os_android.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_ANDROID_H #define OS_ANDROID_H diff --git a/platform/android/platform_config.h b/platform/android/platform_config.h index 3b3ea3930c..299d8563dd 100644 --- a/platform/android/platform_config.h +++ b/platform/android/platform_config.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> #include <malloc.h> diff --git a/platform/android/thread_jandroid.cpp b/platform/android/thread_jandroid.cpp index 29c4e7301c..e85813605f 100644 --- a/platform/android/thread_jandroid.cpp +++ b/platform/android/thread_jandroid.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "thread_jandroid.h" #include "core/safe_refcount.h" diff --git a/platform/android/thread_jandroid.h b/platform/android/thread_jandroid.h index 37b3b38408..2bb64f3db2 100644 --- a/platform/android/thread_jandroid.h +++ b/platform/android/thread_jandroid.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef THREAD_POSIX_H #define THREAD_POSIX_H diff --git a/platform/haiku/audio_driver_media_kit.cpp b/platform/haiku/audio_driver_media_kit.cpp index f687339fec..278a994c54 100644 --- a/platform/haiku/audio_driver_media_kit.cpp +++ b/platform/haiku/audio_driver_media_kit.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_driver_media_kit.h" #ifdef MEDIA_KIT_ENABLED diff --git a/platform/haiku/audio_driver_media_kit.h b/platform/haiku/audio_driver_media_kit.h index 844ab4c60e..a09403e7d6 100644 --- a/platform/haiku/audio_driver_media_kit.h +++ b/platform/haiku/audio_driver_media_kit.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "servers/audio_server.h" #ifdef MEDIA_KIT_ENABLED diff --git a/platform/haiku/context_gl_haiku.cpp b/platform/haiku/context_gl_haiku.cpp index 9332e93389..41df17d2d1 100644 --- a/platform/haiku/context_gl_haiku.cpp +++ b/platform/haiku/context_gl_haiku.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "context_gl_haiku.h" #if defined(OPENGL_ENABLED) diff --git a/platform/haiku/context_gl_haiku.h b/platform/haiku/context_gl_haiku.h index 193c1e77f9..74f09984f2 100644 --- a/platform/haiku/context_gl_haiku.h +++ b/platform/haiku/context_gl_haiku.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CONTEXT_GL_HAIKU_H #define CONTEXT_GL_HAIKU_H diff --git a/platform/haiku/godot_haiku.cpp b/platform/haiku/godot_haiku.cpp index d207d36606..b042d81650 100644 --- a/platform/haiku/godot_haiku.cpp +++ b/platform/haiku/godot_haiku.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_haiku.h" diff --git a/platform/haiku/haiku_application.cpp b/platform/haiku/haiku_application.cpp index d7fa505b79..4f5e3e42a2 100644 --- a/platform/haiku/haiku_application.cpp +++ b/platform/haiku/haiku_application.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "haiku_application.h" HaikuApplication::HaikuApplication() : diff --git a/platform/haiku/haiku_application.h b/platform/haiku/haiku_application.h index 4408f466fb..f92969bbb1 100644 --- a/platform/haiku/haiku_application.h +++ b/platform/haiku/haiku_application.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef HAIKU_APPLICATION_H #define HAIKU_APPLICATION_H diff --git a/platform/haiku/haiku_direct_window.cpp b/platform/haiku/haiku_direct_window.cpp index cf33e42220..b234a2ff91 100644 --- a/platform/haiku/haiku_direct_window.cpp +++ b/platform/haiku/haiku_direct_window.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <UnicodeChar.h> #include "haiku_direct_window.h" diff --git a/platform/haiku/haiku_direct_window.h b/platform/haiku/haiku_direct_window.h index 0bdcb51ca1..55c2f5fccc 100644 --- a/platform/haiku/haiku_direct_window.h +++ b/platform/haiku/haiku_direct_window.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef HAIKU_DIRECT_WINDOW_H #define HAIKU_DIRECT_WINDOW_H diff --git a/platform/haiku/haiku_gl_view.cpp b/platform/haiku/haiku_gl_view.cpp index e47dc2f726..a40cbe5765 100644 --- a/platform/haiku/haiku_gl_view.cpp +++ b/platform/haiku/haiku_gl_view.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "haiku_gl_view.h" #include "main/main.h" diff --git a/platform/haiku/haiku_gl_view.h b/platform/haiku/haiku_gl_view.h index e67f3e6b0a..1a694dc13b 100644 --- a/platform/haiku/haiku_gl_view.h +++ b/platform/haiku/haiku_gl_view.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef HAIKU_GL_VIEW_H #define HAIKU_GL_VIEW_H diff --git a/platform/haiku/key_mapping_haiku.cpp b/platform/haiku/key_mapping_haiku.cpp index 62671b0cc3..28a282e25c 100644 --- a/platform/haiku/key_mapping_haiku.cpp +++ b/platform/haiku/key_mapping_haiku.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <InterfaceDefs.h> #include "key_mapping_haiku.h" diff --git a/platform/haiku/key_mapping_haiku.h b/platform/haiku/key_mapping_haiku.h index 5a1b9f9134..917151bc4a 100644 --- a/platform/haiku/key_mapping_haiku.h +++ b/platform/haiku/key_mapping_haiku.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef KEY_MAPPING_HAIKU_H #define KEY_MAPPING_HAIKU_H diff --git a/platform/haiku/os_haiku.cpp b/platform/haiku/os_haiku.cpp index 2d1d976399..97fab5ca0d 100644 --- a/platform/haiku/os_haiku.cpp +++ b/platform/haiku/os_haiku.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_haiku.h" #include "drivers/gles3/rasterizer_gles3.h" @@ -114,7 +115,7 @@ Error OS_Haiku::initialize(const VideoMode &p_desired, int p_video_driver, int p visual_server = memnew(VisualServerRaster(rasterizer)); - ERR_FAIL_COND(!visual_server, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE); // TODO: enable multithreaded VS /* diff --git a/platform/haiku/os_haiku.h b/platform/haiku/os_haiku.h index 9af15eefc0..615ae682ef 100644 --- a/platform/haiku/os_haiku.h +++ b/platform/haiku/os_haiku.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_HAIKU_H #define OS_HAIKU_H diff --git a/platform/haiku/platform_config.h b/platform/haiku/platform_config.h index 5a7bc3db23..bbd72dfeb6 100644 --- a/platform/haiku/platform_config.h +++ b/platform/haiku/platform_config.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> // for ifaddrs.h needed in drivers/unix/ip_unix.cpp diff --git a/platform/iphone/app_delegate.h b/platform/iphone/app_delegate.h index 11656ca1f3..f14864b5b7 100644 --- a/platform/iphone/app_delegate.h +++ b/platform/iphone/app_delegate.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import "gl_view.h" #import "view_controller.h" #import <UIKit/UIKit.h> diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm index 96f542c170..5c3799ab09 100644 --- a/platform/iphone/app_delegate.mm +++ b/platform/iphone/app_delegate.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import "app_delegate.h" #include "core/project_settings.h" diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 99d44f3b5e..e3119814f4 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -407,7 +407,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name); if (err) { memdelete(da); - String err_str = String("Failed to export loading screen: ") + loading_screen_file; + String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file; ERR_PRINT(err_str.utf8().get_data()); return err; } diff --git a/platform/iphone/export/export.h b/platform/iphone/export/export.h index f67c34a626..ea79973290 100644 --- a/platform/iphone/export/export.h +++ b/platform/iphone/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_iphone_exporter(); diff --git a/platform/iphone/game_center.h b/platform/iphone/game_center.h index bf7ec1f93e..9a62cccb1a 100644 --- a/platform/iphone/game_center.h +++ b/platform/iphone/game_center.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef GAME_CENTER_ENABLED #ifndef GAME_CENTER_H diff --git a/platform/iphone/game_center.mm b/platform/iphone/game_center.mm index 958158c254..57ff79f7bc 100644 --- a/platform/iphone/game_center.mm +++ b/platform/iphone/game_center.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef GAME_CENTER_ENABLED #include "game_center.h" diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm index f0dafacd03..69116c64c6 100644 --- a/platform/iphone/gl_view.mm +++ b/platform/iphone/gl_view.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import "gl_view.h" #include "core/os/keyboard.h" diff --git a/platform/iphone/globals/global_defaults.cpp b/platform/iphone/globals/global_defaults.cpp index 97a7ec1678..ccc90665c5 100644 --- a/platform/iphone/globals/global_defaults.cpp +++ b/platform/iphone/globals/global_defaults.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "global_defaults.h" #include "project_settings.h" diff --git a/platform/iphone/globals/global_defaults.h b/platform/iphone/globals/global_defaults.h index f58659ebff..3e3c220f4a 100644 --- a/platform/iphone/globals/global_defaults.h +++ b/platform/iphone/globals/global_defaults.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_iphone_global_defaults(); diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp index 440dae5da5..dacbf42087 100644 --- a/platform/iphone/godot_iphone.cpp +++ b/platform/iphone/godot_iphone.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_iphone.h" #include "ustring.h" diff --git a/platform/iphone/icloud.h b/platform/iphone/icloud.h index d2514919ba..52bb1131a0 100644 --- a/platform/iphone/icloud.h +++ b/platform/iphone/icloud.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef ICLOUD_ENABLED #ifndef ICLOUD_H diff --git a/platform/iphone/icloud.mm b/platform/iphone/icloud.mm index db4d86b812..7508a480ce 100644 --- a/platform/iphone/icloud.mm +++ b/platform/iphone/icloud.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef ICLOUD_ENABLED #include "icloud.h" diff --git a/platform/iphone/in_app_store.h b/platform/iphone/in_app_store.h index 28f23d77e1..7d53eaae20 100644 --- a/platform/iphone/in_app_store.h +++ b/platform/iphone/in_app_store.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef STOREKIT_ENABLED #ifndef IN_APP_STORE_H diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm index 3399a64732..9bb3d7d3fa 100644 --- a/platform/iphone/in_app_store.mm +++ b/platform/iphone/in_app_store.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef STOREKIT_ENABLED #include "in_app_store.h" diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h index aca0ac54a9..5e77683949 100644 --- a/platform/iphone/ios.h +++ b/platform/iphone/ios.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef IOS_H #define IOS_H diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm index 48104b9c4f..7eb4f495f7 100644 --- a/platform/iphone/ios.mm +++ b/platform/iphone/ios.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "ios.h" #import <UIKit/UIKit.h> diff --git a/platform/iphone/main.m b/platform/iphone/main.m index dfe468dc13..0f0810f28f 100644 --- a/platform/iphone/main.m +++ b/platform/iphone/main.m @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import "app_delegate.h" #import <UIKit/UIKit.h> diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp index d420f95e33..c284ab6905 100644 --- a/platform/iphone/os_iphone.cpp +++ b/platform/iphone/os_iphone.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef IPHONE_ENABLED #include "os_iphone.h" diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h index 611bc2d4cb..2e4458aeed 100644 --- a/platform/iphone/os_iphone.h +++ b/platform/iphone/os_iphone.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef IPHONE_ENABLED #ifndef OS_IPHONE_H diff --git a/platform/iphone/platform_config.h b/platform/iphone/platform_config.h index 373c70d822..d205c7da83 100644 --- a/platform/iphone/platform_config.h +++ b/platform/iphone/platform_config.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> #define GLES3_INCLUDE_H <ES3/gl.h> diff --git a/platform/iphone/platform_refcount.h b/platform/iphone/platform_refcount.h index 90e716e4e4..94e4e5fa3b 100644 --- a/platform/iphone/platform_refcount.h +++ b/platform/iphone/platform_refcount.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "safe_refcount.h" #ifdef IPHONE_ENABLED diff --git a/platform/iphone/sem_iphone.cpp b/platform/iphone/sem_iphone.cpp index 04eb6e9332..ec1337d63f 100644 --- a/platform/iphone/sem_iphone.cpp +++ b/platform/iphone/sem_iphone.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "sem_iphone.h" #include <fcntl.h> diff --git a/platform/iphone/sem_iphone.h b/platform/iphone/sem_iphone.h index 8311538419..ebd4e4ee43 100644 --- a/platform/iphone/sem_iphone.h +++ b/platform/iphone/sem_iphone.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef SEM_IPHONE_H #define SEM_IPHONE_H diff --git a/platform/iphone/view_controller.h b/platform/iphone/view_controller.h index cd08be3aa7..31c4f0daf3 100644 --- a/platform/iphone/view_controller.h +++ b/platform/iphone/view_controller.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import <GameKit/GameKit.h> #import <UIKit/UIKit.h> diff --git a/platform/iphone/view_controller.mm b/platform/iphone/view_controller.mm index f6487ea6c8..cdaae0cb81 100644 --- a/platform/iphone/view_controller.mm +++ b/platform/iphone/view_controller.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #import "view_controller.h" #include "os_iphone.h" diff --git a/platform/javascript/api/api.cpp b/platform/javascript/api/api.cpp index fe3b20b7a0..b377ca4e52 100644 --- a/platform/javascript/api/api.cpp +++ b/platform/javascript/api/api.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "api.h" #include "engine.h" #include "javascript_eval.h" diff --git a/platform/javascript/api/api.h b/platform/javascript/api/api.h index ab3e47ec31..5f22f082e9 100644 --- a/platform/javascript/api/api.h +++ b/platform/javascript/api/api.h @@ -27,5 +27,6 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_javascript_api(); void unregister_javascript_api(); diff --git a/platform/javascript/api/javascript_eval.h b/platform/javascript/api/javascript_eval.h index d39d97f7c5..05f7c9f38a 100644 --- a/platform/javascript/api/javascript_eval.h +++ b/platform/javascript/api/javascript_eval.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef JAVASCRIPT_EVAL_H #define JAVASCRIPT_EVAL_H diff --git a/platform/javascript/audio_driver_javascript.cpp b/platform/javascript/audio_driver_javascript.cpp index acf6ef87ba..5bf345e6cd 100644 --- a/platform/javascript/audio_driver_javascript.cpp +++ b/platform/javascript/audio_driver_javascript.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "audio_driver_javascript.h" #include <emscripten.h> diff --git a/platform/javascript/audio_driver_javascript.h b/platform/javascript/audio_driver_javascript.h index d44e2c51e6..d78ab8eea4 100644 --- a/platform/javascript/audio_driver_javascript.h +++ b/platform/javascript/audio_driver_javascript.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef AUDIO_DRIVER_JAVASCRIPT_H #define AUDIO_DRIVER_JAVASCRIPT_H diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py index 8472c3ccab..8c7a904bca 100644 --- a/platform/javascript/detect.py +++ b/platform/javascript/detect.py @@ -49,8 +49,14 @@ def configure(env): ## Build type if (env["target"] == "release"): - env.Append(CCFLAGS=['-O3']) - env.Append(LINKFLAGS=['-O3']) + # Use -Os to prioritize optimizing for reduced file size. This is + # particularly valuable for the web platform because it directly + # decreases download time. + # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about + # 100 KiB over -Os, which does not justify the negative impact on + # run-time performance. + env.Append(CCFLAGS=['-Os']) + env.Append(LINKFLAGS=['-Os']) elif (env["target"] == "release_debug"): env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED']) diff --git a/platform/javascript/dom_keys.h b/platform/javascript/dom_keys.h index cfd55dfc90..4edca63c6d 100644 --- a/platform/javascript/dom_keys.h +++ b/platform/javascript/dom_keys.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef DOM_KEYS_H #define DOM_KEYS_H diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index dc4bdc7efb..bca1851f40 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -138,13 +138,17 @@ } var actualCanvas = this.rtenv.canvas; - var context = false; + var testContext = false; + var testCanvas; try { - context = actualCanvas.getContext('webgl2') || actualCanvas.getContext('experimental-webgl2'); + testCanvas = document.createElement('canvas'); + testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2'); } catch (e) {} - if (!context) { + if (!testContext) { throw new Error("WebGL 2 not available"); } + testCanvas = null; + testContext = null; // canvas can grab focus on click if (actualCanvas.tabIndex < 0) { diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp index ab7aa96372..61f55beb4e 100644 --- a/platform/javascript/export/export.cpp +++ b/platform/javascript/export/export.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "editor/editor_node.h" #include "editor_export.h" #include "io/zip_io.h" @@ -277,7 +278,7 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese splash.instance(); Error err = splash->load(splash_path); if (err) { - EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image."); + EditorNode::get_singleton()->show_warning(TTR("Could not read boot splash image file:") + "\n" + splash_path + "\n" + TTR("Using default boot splash image.")); splash.unref(); } } diff --git a/platform/javascript/export/export.h b/platform/javascript/export/export.h index 756c3ef9fa..2835d0723f 100644 --- a/platform/javascript/export/export.h +++ b/platform/javascript/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_javascript_exporter(); diff --git a/platform/javascript/http_client_javascript.cpp b/platform/javascript/http_client_javascript.cpp index f23867cc60..1cd2719723 100644 --- a/platform/javascript/http_client_javascript.cpp +++ b/platform/javascript/http_client_javascript.cpp @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "http_request.h" #include "io/http_client.h" diff --git a/platform/javascript/http_request.h b/platform/javascript/http_request.h index 2ca48bfd00..b5ff46d7fe 100644 --- a/platform/javascript/http_request.h +++ b/platform/javascript/http_request.h @@ -3,7 +3,7 @@ /*************************************************************************/ /* This file is part of: */ /* GODOT ENGINE */ -/* http://www.godotengine.org */ +/* https://godotengine.org */ /*************************************************************************/ /* Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) */ @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef HTTP_REQUEST_H #define HTTP_REQUEST_H diff --git a/platform/javascript/javascript_eval.cpp b/platform/javascript/javascript_eval.cpp index 9abea29a93..2ef88345f6 100644 --- a/platform/javascript/javascript_eval.cpp +++ b/platform/javascript/javascript_eval.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef JAVASCRIPT_EVAL_ENABLED #include "api/javascript_eval.h" diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp index 973f8f500c..e85fe0800f 100644 --- a/platform/javascript/javascript_main.cpp +++ b/platform/javascript/javascript_main.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "emscripten.h" #include "io/resource_loader.h" #include "main/main.h" @@ -64,7 +65,7 @@ int main(int argc, char *argv[]) { FS.mkdir('/userfs'); FS.mount(IDBFS, {}, '/userfs'); FS.syncfs(true, function(err) { - Module['ccall']('main_after_fs_sync', null, ['string'], [err ? err.message : ""]) + ccall('main_after_fs_sync', null, ['string'], [err ? err.message : ""]) }); ); /* clang-format on */ diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index 665280df96..b10ef821dd 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_javascript.h" #include "core/engine.h" @@ -429,7 +430,7 @@ Error OS_JavaScript::initialize(const VideoMode &p_desired, int p_video_driver, attributes.antialias = false; attributes.majorVersion = 2; EMSCRIPTEN_WEBGL_CONTEXT_HANDLE ctx = emscripten_webgl_create_context(NULL, &attributes); - ERR_FAIL_COND(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(emscripten_webgl_make_context_current(ctx) != EMSCRIPTEN_RESULT_SUCCESS, ERR_UNAVAILABLE); video_mode = p_desired; // can't fulfil fullscreen request due to browser security @@ -565,7 +566,7 @@ void OS_JavaScript::set_css_cursor(const char *p_cursor) { /* clang-format off */ EM_ASM_({ - Module.canvas.style.cursor = Module.UTF8ToString($0); + Module.canvas.style.cursor = UTF8ToString($0); }, p_cursor); /* clang-format on */ } @@ -575,7 +576,7 @@ const char *OS_JavaScript::get_css_cursor() const { char cursor[16]; /* clang-format off */ EM_ASM_INT({ - Module.stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16); + stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16); }, cursor); /* clang-format on */ return cursor; @@ -781,6 +782,9 @@ void OS_JavaScript::set_cursor_shape(CursorShape p_shape) { set_css_cursor(godot2dom_cursor(cursor_shape)); } +void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) { +} + void OS_JavaScript::main_loop_begin() { if (main_loop) @@ -788,7 +792,7 @@ void OS_JavaScript::main_loop_begin() { /* clang-format off */ EM_ASM_ARGS({ - const send_notification = Module.cwrap('send_notification', null, ['number']); + const send_notification = cwrap('send_notification', null, ['number']); const notifs = arguments; (['mouseover', 'mouseleave', 'focus', 'blur']).forEach(function(event, i) { Module.canvas.addEventListener(event, send_notification.bind(null, notifs[i])); @@ -985,6 +989,7 @@ bool OS_JavaScript::is_userfs_persistent() const { } OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_user_data_dir_func) { + set_cmdline(p_execpath, get_cmdline_args()); main_loop = NULL; gl_extensions = NULL; @@ -997,6 +1002,10 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us idbfs_available = false; time_to_save_sync = -1; + + Vector<Logger *> loggers; + loggers.push_back(memnew(StdLogger)); + _set_logger(memnew(CompositeLogger(loggers))); } OS_JavaScript::~OS_JavaScript() { diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h index eaf8465be9..ce4763ab64 100644 --- a/platform/javascript/os_javascript.h +++ b/platform/javascript/os_javascript.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_JAVASCRIPT_H #define OS_JAVASCRIPT_H @@ -127,6 +128,7 @@ public: virtual bool is_userfs_persistent() const; virtual void set_cursor_shape(CursorShape p_shape); + virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot); void main_loop_begin(); bool main_loop_iterate(); diff --git a/platform/javascript/platform_config.h b/platform/javascript/platform_config.h index 413fea20d8..af4cf07393 100644 --- a/platform/javascript/platform_config.h +++ b/platform/javascript/platform_config.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> diff --git a/platform/osx/crash_handler_osx.h b/platform/osx/crash_handler_osx.h index 51e0a3ffcb..5d93afb22d 100644 --- a/platform/osx/crash_handler_osx.h +++ b/platform/osx/crash_handler_osx.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CRASH_HANDLER_OSX_H #define CRASH_HANDLER_OSX_H diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm index c4b5204e1a..d757674a9b 100644 --- a/platform/osx/crash_handler_osx.mm +++ b/platform/osx/crash_handler_osx.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_osx.h" #include "project_settings.h" diff --git a/platform/osx/detect.py b/platform/osx/detect.py index 2e686fbee4..bb601abd40 100644 --- a/platform/osx/detect.py +++ b/platform/osx/detect.py @@ -76,7 +76,7 @@ def configure(env): mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local") mpclangver = env["macports_clang"] env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang" - env["LD"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" + env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++" env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar" env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib" @@ -110,7 +110,7 @@ def configure(env): if (env["CXX"] == "clang++"): env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env["CC"] = "clang" - env["LD"] = "clang++" + env["LINK"] = "clang++" ## Dependencies diff --git a/platform/osx/dir_access_osx.h b/platform/osx/dir_access_osx.h index eec3016eaa..e01ff2fe4d 100644 --- a/platform/osx/dir_access_osx.h +++ b/platform/osx/dir_access_osx.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef DIR_ACCESS_OSX_H #define DIR_ACCESS_OSX_H diff --git a/platform/osx/dir_access_osx.mm b/platform/osx/dir_access_osx.mm index a187083dd1..cf66cab060 100644 --- a/platform/osx/dir_access_osx.mm +++ b/platform/osx/dir_access_osx.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "dir_access_osx.h" #if defined(UNIX_ENABLED) || defined(LIBC_FILEIO_ENABLED) diff --git a/platform/osx/export/export.cpp b/platform/osx/export/export.cpp index 657a899367..c4efa1f0ff 100644 --- a/platform/osx/export/export.cpp +++ b/platform/osx/export/export.cpp @@ -359,6 +359,11 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } if (err == OK) { + print_line("Creating " + tmp_app_path_name + "/Contents/Frameworks"); + err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Frameworks"); + } + + if (err == OK) { print_line("Creating " + tmp_app_path_name + "/Contents/Resources"); err = tmp_app_path->make_dir_recursive(tmp_app_path_name + "/Contents/Resources"); } @@ -502,10 +507,23 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p if (use_dmg()) { String pack_path = tmp_app_path_name + "/Contents/Resources/" + pkg_name + ".pck"; - err = save_pack(p_preset, pack_path); + Vector<SharedObject> shared_objects; + Error err = save_pack(p_preset, pack_path, &shared_objects); // see if we can code sign our new package String identity = p_preset->get("codesign/identity"); + + if (err == OK) { + DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + for (int i = 0; i < shared_objects.size(); i++) { + da->copy(shared_objects[i].path, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file()); + if (err == OK && identity != "") { + err = _code_sign(p_preset, tmp_app_path_name + "/Contents/Frameworks/" + shared_objects[i].path.get_file()); + } + } + memdelete(da); + } + if (err == OK && identity != "") { ep.step("Code signing bundle", 2); @@ -541,7 +559,9 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p } else { String pack_path = EditorSettings::get_singleton()->get_cache_dir().plus_file(pkg_name + ".pck"); - Error err = save_pack(p_preset, pack_path); + + Vector<SharedObject> shared_objects; + Error err = save_pack(p_preset, pack_path, &shared_objects); if (err == OK) { zipOpenNewFileInZip(dst_pkg_zip, @@ -567,11 +587,32 @@ Error EditorExportPlatformOSX::export_project(const Ref<EditorExportPreset> &p_p break; zipWriteInFileInZip(dst_pkg_zip, buf, r); } + zipCloseFileInZip(dst_pkg_zip); memdelete(pf); } else { err = ERR_CANT_OPEN; } + + //add shared objects + for (int i = 0; i < shared_objects.size(); i++) { + Vector<uint8_t> file = FileAccess::get_file_as_array(shared_objects[i].path); + ERR_CONTINUE(file.empty()); + + zipOpenNewFileInZip(dst_pkg_zip, + (pkg_name + ".app/Contents/Frameworks/").plus_file(shared_objects[i].path.get_file()).utf8().get_data(), + NULL, + NULL, + 0, + NULL, + 0, + NULL, + Z_DEFLATED, + Z_DEFAULT_COMPRESSION); + + zipWriteInFileInZip(dst_pkg_zip, file.ptr(), file.size()); + zipCloseFileInZip(dst_pkg_zip); + } } } } diff --git a/platform/osx/export/export.h b/platform/osx/export/export.h index ccb96022f9..08294fc33c 100644 --- a/platform/osx/export/export.h +++ b/platform/osx/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_osx_exporter(); diff --git a/platform/osx/godot_main_osx.mm b/platform/osx/godot_main_osx.mm index 156b4c02f2..9d1a5566c9 100644 --- a/platform/osx/godot_main_osx.mm +++ b/platform/osx/godot_main_osx.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_osx.h" diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index bc65aa8149..20ceadca9d 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "joypad_osx.h" #include <machine/endian.h> diff --git a/platform/osx/joypad_osx.h b/platform/osx/joypad_osx.h index 78ee4581d5..addbefc5ad 100644 --- a/platform/osx/joypad_osx.h +++ b/platform/osx/joypad_osx.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef JOYPADOSX_H #define JOYPADOSX_H diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h index 2a71de12e9..3648d41604 100644 --- a/platform/osx/os_osx.h +++ b/platform/osx/os_osx.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_OSX_H #define OS_OSX_H @@ -138,6 +139,8 @@ public: virtual void alert(const String &p_alert, const String &p_title = "ALERT!"); + virtual Error open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path = false); + virtual void set_cursor_shape(CursorShape p_shape); virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot); diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm index a16391c30f..939f75859c 100644 --- a/platform/osx/os_osx.mm +++ b/platform/osx/os_osx.mm @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_osx.h" #include "dir_access_osx.h" @@ -38,6 +39,8 @@ #include "servers/visual/visual_server_raster.h" #include "version_generated.gen.h" +#include <mach-o/dyld.h> + #include <Carbon/Carbon.h> #import <Cocoa/Cocoa.h> #include <IOKit/IOCFPlugIn.h> @@ -48,6 +51,7 @@ #include <os/log.h> #endif +#include <dlfcn.h> #include <fcntl.h> #include <libproc.h> #include <stdio.h> @@ -57,25 +61,31 @@ #include <unistd.h> #if MAC_OS_X_VERSION_MAX_ALLOWED < 101200 +#define NSEventMaskAny NSAnyEventMask +#define NSEventTypeKeyDown NSKeyDown +#define NSEventTypeKeyUp NSKeyUp +#define NSEventModifierFlagShift NSShiftKeyMask +#define NSEventModifierFlagCommand NSCommandKeyMask +#define NSEventModifierFlagControl NSControlKeyMask +#define NSEventModifierFlagOption NSAlternateKeyMask +#define NSWindowStyleMaskTitled NSTitledWindowMask +#define NSWindowStyleMaskResizable NSResizableWindowMask +#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask +#define NSWindowStyleMaskClosable NSClosableWindowMask #define NSWindowStyleMaskBorderless NSBorderlessWindowMask #endif static NSRect convertRectToBacking(NSRect contentRect) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) - return [OS_OSX::singleton->window_view convertRectToBacking:contentRect]; - else -#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - return contentRect; + return [OS_OSX::singleton->window_view convertRectToBacking:contentRect]; } static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) { - state->set_shift((p_osx_state & NSShiftKeyMask)); - state->set_control((p_osx_state & NSControlKeyMask)); - state->set_alt((p_osx_state & NSAlternateKeyMask)); - state->set_metakey((p_osx_state & NSCommandKeyMask)); + state->set_shift((p_osx_state & NSEventModifierFlagShift)); + state->set_control((p_osx_state & NSEventModifierFlagControl)); + state->set_alt((p_osx_state & NSEventModifierFlagOption)); + state->set_metakey((p_osx_state & NSEventModifierFlagCommand)); } static int mouse_x = 0; @@ -103,7 +113,7 @@ static Vector2 get_mouse_pos(NSEvent *event) { // special case handling of command-period, which is traditionally a special // shortcut in macOS and doesn't arrive at our regular keyDown handler. - if ([event type] == NSKeyDown) { + if ([event type] == NSEventTypeKeyDown) { if (([event modifierFlags] & NSEventModifierFlagCommand) && [event keyCode] == 0x2f) { Ref<InputEventKey> k; @@ -121,7 +131,7 @@ static Vector2 get_mouse_pos(NSEvent *event) { // From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost // This works around an AppKit bug, where key up events while holding // down the command key don't get sent to the key window. - if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask)) + if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand)) [[self keyWindow] sendEvent:event]; else [super sendEvent:event]; @@ -187,7 +197,6 @@ static Vector2 get_mouse_pos(NSEvent *event) { return NO; } -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - (void)windowDidEnterFullScreen:(NSNotification *)notification { OS_OSX::singleton->zoomed = true; } @@ -195,7 +204,6 @@ static Vector2 get_mouse_pos(NSEvent *event) { - (void)windowDidExitFullScreen:(NSNotification *)notification { OS_OSX::singleton->zoomed = false; } -#endif // MAC_OS_X_VERSION_MAX_ALLOWED - (void)windowDidChangeBackingProperties:(NSNotification *)notification { if (!OS_OSX::singleton) @@ -389,8 +397,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; - (void)cancelComposition { [self unmarkText]; - NSInputManager *currentInputManager = [NSInputManager currentInputManager]; - [currentInputManager markedTextAbandoned:self]; + NSTextInputContext *currentInputContext = [NSTextInputContext currentInputContext]; + [currentInputContext discardMarkedText]; } - (void)insertText:(id)aString { @@ -419,8 +427,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 }; NSCharacterSet *ctrlChars = [NSCharacterSet controlCharacterSet]; NSCharacterSet *wsnlChars = [NSCharacterSet whitespaceAndNewlineCharacterSet]; if ([characters rangeOfCharacterFromSet:ctrlChars].length && [characters rangeOfCharacterFromSet:wsnlChars].length == 0) { - NSInputManager *currentInputManager = [NSInputManager currentInputManager]; - [currentInputManager markedTextAbandoned:self]; + NSTextInputContext *currentInputContext = [NSTextInputContext currentInputContext]; + [currentInputContext discardMarkedText]; [self cancelComposition]; return; } @@ -506,7 +514,7 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) { } - (void)mouseDown:(NSEvent *)event { - if (([event modifierFlags] & NSControlKeyMask)) { + if (([event modifierFlags] & NSEventModifierFlagControl)) { mouse_down_control = true; _mouseDownEvent(event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true); } else { @@ -807,29 +815,29 @@ static int translateKey(unsigned int key) { int mod = [event modifierFlags]; if (key == 0x36 || key == 0x37) { - if (mod & NSCommandKeyMask) { - mod &= ~NSCommandKeyMask; + if (mod & NSEventModifierFlagCommand) { + mod &= ~NSEventModifierFlagCommand; k->set_pressed(true); } else { k->set_pressed(false); } } else if (key == 0x38 || key == 0x3c) { - if (mod & NSShiftKeyMask) { - mod &= ~NSShiftKeyMask; + if (mod & NSEventModifierFlagShift) { + mod &= ~NSEventModifierFlagShift; k->set_pressed(true); } else { k->set_pressed(false); } } else if (key == 0x3a || key == 0x3d) { - if (mod & NSAlternateKeyMask) { - mod &= ~NSAlternateKeyMask; + if (mod & NSEventModifierFlagOption) { + mod &= ~NSEventModifierFlagOption; k->set_pressed(true); } else { k->set_pressed(false); } } else if (key == 0x3b || key == 0x3e) { - if (mod & NSControlKeyMask) { - mod &= ~NSControlKeyMask; + if (mod & NSEventModifierFlagControl) { + mod &= ~NSEventModifierFlagControl; k->set_pressed(true); } else { k->set_pressed(false); @@ -889,20 +897,12 @@ inline void sendPanEvent(double dx, double dy, int modifierFlags) { - (void)scrollWheel:(NSEvent *)event { double deltaX, deltaY; -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) { - deltaX = [event scrollingDeltaX]; - deltaY = [event scrollingDeltaY]; + deltaX = [event scrollingDeltaX]; + deltaY = [event scrollingDeltaY]; - if ([event hasPreciseScrollingDeltas]) { - deltaX *= 0.03; - deltaY *= 0.03; - } - } else -#endif // MAC_OS_X_VERSION_MAX_ALLOWED - { - deltaX = [event deltaX]; - deltaY = [event deltaY]; + if ([event hasPreciseScrollingDeltas]) { + deltaX *= 0.03; + deltaY *= 0.03; } if ([event phase] != NSEventPhaseNone || [event momentumPhase] != NSEventPhaseNone) { @@ -1004,7 +1004,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a if (p_desired.borderless_window) { styleMask = NSWindowStyleMaskBorderless; } else { - styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0); + styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (p_desired.resizable ? NSWindowStyleMaskResizable : 0); } window_object = [[GodotWindow alloc] @@ -1013,7 +1013,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a backing:NSBackingStoreBuffered defer:NO]; - ERR_FAIL_COND(window_object == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(window_object == nil, ERR_UNAVAILABLE); window_view = [[GodotContentView alloc] init]; @@ -1029,7 +1029,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a window_size.width = p_desired.width * displayScale; window_size.height = p_desired.height * displayScale; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && displayScale > 1.0) { + if (displayScale > 1.0) { [window_view setWantsBestResolutionOpenGLSurface:YES]; //if (current_videomode.resizable) [window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary]; @@ -1041,8 +1041,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a [window_object setAcceptsMouseMovedEvents:YES]; [window_object center]; - if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) - [window_object setRestorable:NO]; + [window_object setRestorable:NO]; unsigned int attributeCount = 0; @@ -1100,11 +1099,11 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a #undef ADD_ATTR2 pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes]; - ERR_FAIL_COND(pixelFormat == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(pixelFormat == nil, ERR_UNAVAILABLE); context = [[NSOpenGLContext alloc] initWithFormat:pixelFormat shareContext:nil]; - ERR_FAIL_COND(context == nil, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(context == nil, ERR_UNAVAILABLE); [context setView:window_view]; @@ -1202,34 +1201,42 @@ public: switch (p_type) { case ERR_WARNING: - os_log_info(OS_LOG_DEFAULT, - "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.", - p_function, err_details, p_file, p_line); + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { + os_log_info(OS_LOG_DEFAULT, + "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.", + p_function, err_details, p_file, p_line); + } logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function, err_details); logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line); break; case ERR_SCRIPT: - os_log_error(OS_LOG_DEFAULT, - "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", - p_function, err_details, p_file, p_line); + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { + os_log_error(OS_LOG_DEFAULT, + "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", + p_function, err_details, p_file, p_line); + } logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line); break; case ERR_SHADER: - os_log_error(OS_LOG_DEFAULT, - "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", - p_function, err_details, p_file, p_line); + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { + os_log_error(OS_LOG_DEFAULT, + "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", + p_function, err_details, p_file, p_line); + } logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line); break; case ERR_ERROR: default: - os_log_error(OS_LOG_DEFAULT, - "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", - p_function, err_details, p_file, p_line); + if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) { + os_log_error(OS_LOG_DEFAULT, + "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.", + p_function, err_details, p_file, p_line); + } logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details); logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line); break; @@ -1258,6 +1265,28 @@ void OS_OSX::alert(const String &p_alert, const String &p_title) { [window release]; } +Error OS_OSX::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { + + String path = p_path; + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dylib files from within the executable path + path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); + } + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dylib files from a standard macOS location + path = get_executable_path().get_base_dir().plus_file("../Frameworks").plus_file(p_path.get_file()); + } + + p_library_handle = dlopen(path.utf8().get_data(), RTLD_NOW); + if (!p_library_handle) { + ERR_EXPLAIN("Can't open dynamic library: " + p_path + ". Error: " + dlerror()); + ERR_FAIL_V(ERR_CANT_OPEN); + } + return OK; +} + void OS_OSX::set_cursor_shape(CursorShape p_shape) { if (cursor_shape == p_shape) @@ -1742,9 +1771,8 @@ float OS_OSX::_display_scale(id screen) const { if ([screen respondsToSelector:@selector(backingScaleFactor)]) { return fmax(1.0, [screen backingScaleFactor]); } - } else { - return 1.0; } + return 1.0; } Point2 OS_OSX::get_native_window_position() const { @@ -1803,10 +1831,14 @@ void OS_OSX::set_window_size(const Size2 p_size) { CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight]; if (menuBarHeight != 0.f) { size.y += menuBarHeight; -#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101104 } else { - size.y += [[NSStatusBar systemStatusBar] thickness]; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 + if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12) { +#else + { #endif + size.y += [[NSStatusBar systemStatusBar] thickness]; + } } } @@ -1819,36 +1851,27 @@ void OS_OSX::set_window_size(const Size2 p_size) { void OS_OSX::set_window_fullscreen(bool p_enabled) { if (zoomed != p_enabled) { -#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070 [window_object toggleFullScreen:nil]; -#else - [window_object performZoom:nil]; -#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ } zoomed = p_enabled; }; bool OS_OSX::is_window_fullscreen() const { -#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070 - if ([window_object respondsToSelector:@selector(isZoomed)]) - return [window_object isZoomed]; -#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/ - return zoomed; }; void OS_OSX::set_window_resizable(bool p_enabled) { if (p_enabled) - [window_object setStyleMask:[window_object styleMask] | NSResizableWindowMask]; + [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable]; else - [window_object setStyleMask:[window_object styleMask] & ~NSResizableWindowMask]; + [window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable]; }; bool OS_OSX::is_window_resizable() const { - return [window_object styleMask] & NSResizableWindowMask; + return [window_object styleMask] & NSWindowStyleMaskResizable; }; void OS_OSX::set_window_minimized(bool p_enabled) { @@ -1903,7 +1926,7 @@ void OS_OSX::set_borderless_window(bool p_borderless) { if (p_borderless) { [window_object setStyleMask:NSWindowStyleMaskBorderless]; } else { - [window_object setStyleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask]; + [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable]; // Force update of the window styles NSRect frameRect = [window_object frame]; @@ -2027,7 +2050,7 @@ void OS_OSX::process_events() { while (true) { NSEvent *event = [NSApp - nextEventMatchingMask:NSAnyEventMask + nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES]; @@ -2219,7 +2242,7 @@ OS_OSX::OS_OSX() { [apple_menu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; menu_item = [apple_menu addItemWithTitle:NSLocalizedString(@"Hide Others", nil) action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menu_item setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)]; + [menu_item setKeyEquivalentModifierMask:(NSEventModifierFlagOption | NSEventModifierFlagCommand)]; [apple_menu addItemWithTitle:NSLocalizedString(@"Show all", nil) action:@selector(unhideAllApplications:) keyEquivalent:@""]; diff --git a/platform/osx/platform_config.h b/platform/osx/platform_config.h index a3715e7e4e..1b497cebef 100644 --- a/platform/osx/platform_config.h +++ b/platform/osx/platform_config.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> #define GLES3_INCLUDE_H "glad/glad.h" diff --git a/platform/osx/sem_osx.cpp b/platform/osx/sem_osx.cpp index 2e7da62e5b..92f749322e 100644 --- a/platform/osx/sem_osx.cpp +++ b/platform/osx/sem_osx.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "sem_osx.h" #include <fcntl.h> diff --git a/platform/osx/sem_osx.h b/platform/osx/sem_osx.h index 0b9bbdfa76..ce31e966b7 100644 --- a/platform/osx/sem_osx.h +++ b/platform/osx/sem_osx.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef SEM_OSX_H #define SEM_OSX_H diff --git a/platform/register_platform_apis.h b/platform/register_platform_apis.h index 3ac3b319da..1c50eb95e3 100644 --- a/platform/register_platform_apis.h +++ b/platform/register_platform_apis.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef REGISTER_APIS_H #define REGISTER_APIS_H diff --git a/platform/server/detect.py b/platform/server/detect.py index ffec2af933..72c9c770e3 100644 --- a/platform/server/detect.py +++ b/platform/server/detect.py @@ -59,7 +59,7 @@ def configure(env): if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" - env["LD"] = "clang++" + env["LINK"] = "clang++" env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.extra_suffix = ".llvm" + env.extra_suffix diff --git a/platform/server/godot_server.cpp b/platform/server/godot_server.cpp index 8e4742a1b0..3e48f0bf7f 100644 --- a/platform/server/godot_server.cpp +++ b/platform/server/godot_server.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_server.h" diff --git a/platform/server/os_server.cpp b/platform/server/os_server.cpp index e8d076322c..370a347399 100644 --- a/platform/server/os_server.cpp +++ b/platform/server/os_server.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + //#include "servers/visual/visual_server_raster.h" //#include "servers/visual/rasterizer_dummy.h" #include "os_server.h" @@ -67,7 +68,7 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int spatial_sound_2d_server = memnew(SpatialSound2DServerSW); spatial_sound_2d_server->init(); - ERR_FAIL_COND(!visual_server, ERR_UNAVAILABLE); + ERR_FAIL_COND_V(!visual_server, ERR_UNAVAILABLE); visual_server->init(); @@ -77,6 +78,7 @@ Error OS_Server::initialize(const VideoMode &p_desired, int p_video_driver, int return OK; } + void OS_Server::finalize() { if (main_loop) diff --git a/platform/server/os_server.h b/platform/server/os_server.h index 6739375468..7abb4565d5 100644 --- a/platform/server/os_server.h +++ b/platform/server/os_server.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_SERVER_H #define OS_SERVER_H diff --git a/platform/server/platform_config.h b/platform/server/platform_config.h index 413fea20d8..af4cf07393 100644 --- a/platform/server/platform_config.h +++ b/platform/server/platform_config.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <alloca.h> diff --git a/platform/uwp/app.cpp b/platform/uwp/app.cpp index 4468c18eba..5ff62b38f9 100644 --- a/platform/uwp/app.cpp +++ b/platform/uwp/app.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + // // This file demonstrates how to initialize EGL in a Windows Store app, using ICoreWindow. // diff --git a/platform/uwp/app.h b/platform/uwp/app.h index 0641ea1b8c..c23270b8ba 100644 --- a/platform/uwp/app.h +++ b/platform/uwp/app.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #pragma once #include <string> diff --git a/platform/uwp/export/export.h b/platform/uwp/export/export.h index 8e248b1969..bd759c8647 100644 --- a/platform/uwp/export/export.h +++ b/platform/uwp/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_uwp_exporter(); diff --git a/platform/uwp/gl_context_egl.cpp b/platform/uwp/gl_context_egl.cpp index 2dde05a01f..88c9c8d687 100644 --- a/platform/uwp/gl_context_egl.cpp +++ b/platform/uwp/gl_context_egl.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "gl_context_egl.h" #include "EGL/eglext.h" diff --git a/platform/uwp/gl_context_egl.h b/platform/uwp/gl_context_egl.h index 55fd7ce705..527baf1054 100644 --- a/platform/uwp/gl_context_egl.h +++ b/platform/uwp/gl_context_egl.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CONTEXT_EGL_H #define CONTEXT_EGL_H diff --git a/platform/uwp/joypad_uwp.h b/platform/uwp/joypad_uwp.h index 442f805b1f..98202cce9e 100644 --- a/platform/uwp/joypad_uwp.h +++ b/platform/uwp/joypad_uwp.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef JOYPAD_UWP_H #define JOYPAD_UWP_H diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index 96f9c895bc..d00da3dbcd 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_uwp.h" #include "drivers/gles3/rasterizer_gles3.h" diff --git a/platform/uwp/os_uwp.h b/platform/uwp/os_uwp.h index ad12b6286f..95afdab469 100644 --- a/platform/uwp/os_uwp.h +++ b/platform/uwp/os_uwp.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OSUWP_H #define OSUWP_H diff --git a/platform/uwp/platform_config.h b/platform/uwp/platform_config.h index 0a21339237..606795479b 100644 --- a/platform/uwp/platform_config.h +++ b/platform/uwp/platform_config.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <malloc.h> diff --git a/platform/uwp/thread_uwp.cpp b/platform/uwp/thread_uwp.cpp index 79d244dd61..25cd29190f 100644 --- a/platform/uwp/thread_uwp.cpp +++ b/platform/uwp/thread_uwp.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "thread_uwp.h" #include "os/memory.h" diff --git a/platform/uwp/thread_uwp.h b/platform/uwp/thread_uwp.h index 24ae5ec22a..89081f3b2b 100644 --- a/platform/uwp/thread_uwp.h +++ b/platform/uwp/thread_uwp.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef THREAD_UWP_H #define THREAD_UWP_H diff --git a/platform/windows/context_gl_win.cpp b/platform/windows/context_gl_win.cpp index 6875d23dfa..8b57fdd9ce 100644 --- a/platform/windows/context_gl_win.cpp +++ b/platform/windows/context_gl_win.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2008 diff --git a/platform/windows/context_gl_win.h b/platform/windows/context_gl_win.h index d30f842f4b..e7578a1aeb 100644 --- a/platform/windows/context_gl_win.h +++ b/platform/windows/context_gl_win.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #if defined(OPENGL_ENABLED) || defined(GLES_ENABLED) // Author: Juan Linietsky <reduzio@gmail.com>, (C) 2008 diff --git a/platform/windows/crash_handler_win.cpp b/platform/windows/crash_handler_win.cpp index 50b4f2d811..804c2d44eb 100644 --- a/platform/windows/crash_handler_win.cpp +++ b/platform/windows/crash_handler_win.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_windows.h" #include "project_settings.h" diff --git a/platform/windows/crash_handler_win.h b/platform/windows/crash_handler_win.h index 6f170fb958..95b1468197 100644 --- a/platform/windows/crash_handler_win.h +++ b/platform/windows/crash_handler_win.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CRASH_HANDLER_WIN_H #define CRASH_HANDLER_WIN_H diff --git a/platform/windows/ctxgl_procaddr.cpp b/platform/windows/ctxgl_procaddr.cpp index dfb15cc358..434eeea16e 100644 --- a/platform/windows/ctxgl_procaddr.cpp +++ b/platform/windows/ctxgl_procaddr.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef OPENGL_ENABLED #include "ctxgl_procaddr.h" #include <GL/gl.h> diff --git a/platform/windows/ctxgl_procaddr.h b/platform/windows/ctxgl_procaddr.h index 168f808285..cd229fb8db 100644 --- a/platform/windows/ctxgl_procaddr.h +++ b/platform/windows/ctxgl_procaddr.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CTXGL_PROCADDR_H #define CTXGL_PROCADDR_H diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 489bac50f5..bd05d5605d 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -265,7 +265,7 @@ def configure(env): env['CXX'] = mingw_prefix + "g++" env['AR'] = mingw_prefix + "gcc-ar" env['RANLIB'] = mingw_prefix + "gcc-ranlib" - env['LD'] = mingw_prefix + "g++" + env['LINK'] = mingw_prefix + "g++" env["x86_libtheora_opt_gcc"] = True if env['use_lto']: diff --git a/platform/windows/export/export.cpp b/platform/windows/export/export.cpp index d5c2cf7992..97544c18f5 100644 --- a/platform/windows/export/export.cpp +++ b/platform/windows/export/export.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "editor/editor_export.h" #include "editor/editor_settings.h" #include "os/file_access.h" diff --git a/platform/windows/export/export.h b/platform/windows/export/export.h index 78421928ff..7f62e8955c 100644 --- a/platform/windows/export/export.h +++ b/platform/windows/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_windows_exporter(); diff --git a/platform/windows/godot_win.cpp b/platform/windows/godot_win.cpp index 20e351c47c..80f53dd1a1 100644 --- a/platform/windows/godot_win.cpp +++ b/platform/windows/godot_win.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "main/main.h" #include "os_windows.h" #include <locale.h> diff --git a/platform/windows/joypad.cpp b/platform/windows/joypad.cpp index 4a3936b175..796531fe24 100644 --- a/platform/windows/joypad.cpp +++ b/platform/windows/joypad.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "joypad.h" #include <oleauto.h> #include <wbemidl.h> diff --git a/platform/windows/joypad.h b/platform/windows/joypad.h index f3d24bce85..0d14480733 100644 --- a/platform/windows/joypad.h +++ b/platform/windows/joypad.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef JOYPAD_H #define JOYPAD_H diff --git a/platform/windows/key_mapping_win.cpp b/platform/windows/key_mapping_win.cpp index bb90cb661a..69dd385354 100644 --- a/platform/windows/key_mapping_win.cpp +++ b/platform/windows/key_mapping_win.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "key_mapping_win.h" #include <stdio.h> diff --git a/platform/windows/key_mapping_win.h b/platform/windows/key_mapping_win.h index 2daf3f4f01..8d6461f27d 100644 --- a/platform/windows/key_mapping_win.h +++ b/platform/windows/key_mapping_win.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef KEY_MAPPING_WINDOWS_H #define KEY_MAPPING_WINDOWS_H diff --git a/platform/windows/lang_table.h b/platform/windows/lang_table.h index 614fbd8ae9..1a966b502a 100644 --- a/platform/windows/lang_table.h +++ b/platform/windows/lang_table.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef LANG_TABLE_H #define LANG_TABLE_H diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp index a48ae8cc8c..4f4b225b14 100644 --- a/platform/windows/os_windows.cpp +++ b/platform/windows/os_windows.cpp @@ -416,6 +416,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) /*mm->get_button_mask()|=(wParam&MK_XBUTTON1)?(1<<5):0; mm->get_button_mask()|=(wParam&MK_XBUTTON2)?(1<<6):0;*/ mm->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); + mm->set_global_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); if (mouse_mode == MOUSE_MODE_CAPTURED) { @@ -1633,6 +1634,13 @@ void OS_Windows::_update_window_style(bool repaint) { Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_handle, bool p_also_set_library_path) { + String path = p_path; + + if (!FileAccess::exists(path)) { + //this code exists so gdnative can load .dll files from within the executable path + path = get_executable_path().get_base_dir().plus_file(p_path.get_file()); + } + typedef DLL_DIRECTORY_COOKIE(WINAPI * PAddDllDirectory)(PCWSTR); typedef BOOL(WINAPI * PRemoveDllDirectory)(DLL_DIRECTORY_COOKIE); @@ -1643,10 +1651,10 @@ Error OS_Windows::open_dynamic_library(const String p_path, void *&p_library_han DLL_DIRECTORY_COOKIE cookie; if (p_also_set_library_path && has_dll_directory_api) { - cookie = add_dll_directory(p_path.get_base_dir().c_str()); + cookie = add_dll_directory(path.get_base_dir().c_str()); } - p_library_handle = (void *)LoadLibraryExW(p_path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0); + p_library_handle = (void *)LoadLibraryExW(path.c_str(), NULL, (p_also_set_library_path && has_dll_directory_api) ? LOAD_LIBRARY_SEARCH_DEFAULT_DIRS : 0); if (p_also_set_library_path && has_dll_directory_api) { remove_dll_directory(cookie); diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h index 1863642f39..c24e35e929 100644 --- a/platform/windows/os_windows.h +++ b/platform/windows/os_windows.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_WINDOWS_H #define OS_WINDOWS_H #include "context_gl_win.h" diff --git a/platform/windows/platform_config.h b/platform/windows/platform_config.h index 6c26a8228d..10ec9110d1 100644 --- a/platform/windows/platform_config.h +++ b/platform/windows/platform_config.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <malloc.h> //#else //#include <alloca.h> diff --git a/platform/x11/context_gl_x11.cpp b/platform/x11/context_gl_x11.cpp index b232f36a46..20f2212861 100644 --- a/platform/x11/context_gl_x11.cpp +++ b/platform/x11/context_gl_x11.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "context_gl_x11.h" #ifdef X11_ENABLED diff --git a/platform/x11/context_gl_x11.h b/platform/x11/context_gl_x11.h index efebd3f78d..c969f0044d 100644 --- a/platform/x11/context_gl_x11.h +++ b/platform/x11/context_gl_x11.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CONTEXT_GL_X11_H #define CONTEXT_GL_X11_H diff --git a/platform/x11/crash_handler_x11.cpp b/platform/x11/crash_handler_x11.cpp index f0eb8a6d5b..43b9051ea7 100644 --- a/platform/x11/crash_handler_x11.cpp +++ b/platform/x11/crash_handler_x11.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef DEBUG_ENABLED #define CRASH_HANDLER_ENABLED 1 #endif diff --git a/platform/x11/crash_handler_x11.h b/platform/x11/crash_handler_x11.h index 36ab29b597..49ca0df9a8 100644 --- a/platform/x11/crash_handler_x11.h +++ b/platform/x11/crash_handler_x11.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef CRASH_HANDLER_X11_H #define CRASH_HANDLER_X11_H diff --git a/platform/x11/detect.py b/platform/x11/detect.py index cb45fed1be..478b42f9f7 100644 --- a/platform/x11/detect.py +++ b/platform/x11/detect.py @@ -109,7 +109,7 @@ def configure(env): if ('clang++' not in env['CXX']): env["CC"] = "clang" env["CXX"] = "clang++" - env["LD"] = "clang++" + env["LINK"] = "clang++" env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND']) env.extra_suffix = ".llvm" + env.extra_suffix diff --git a/platform/x11/export/export.cpp b/platform/x11/export/export.cpp index 3a8786f296..904aceaca0 100644 --- a/platform/x11/export/export.cpp +++ b/platform/x11/export/export.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "export.h" #include "editor/editor_export.h" diff --git a/platform/x11/export/export.h b/platform/x11/export/export.h index 152a64df86..ac44cef8f7 100644 --- a/platform/x11/export/export.h +++ b/platform/x11/export/export.h @@ -27,4 +27,5 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + void register_x11_exporter(); diff --git a/platform/x11/godot_x11.cpp b/platform/x11/godot_x11.cpp index c7d7bb643b..3241cbcbf9 100644 --- a/platform/x11/godot_x11.cpp +++ b/platform/x11/godot_x11.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include <limits.h> #include <locale.h> #include <stdlib.h> diff --git a/platform/x11/key_mapping_x11.cpp b/platform/x11/key_mapping_x11.cpp index 5e15768d66..423e2737ee 100644 --- a/platform/x11/key_mapping_x11.cpp +++ b/platform/x11/key_mapping_x11.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "key_mapping_x11.h" /***** SCAN CODE CONVERSION ******/ diff --git a/platform/x11/key_mapping_x11.h b/platform/x11/key_mapping_x11.h index 022affcbea..62dfcf3a4d 100644 --- a/platform/x11/key_mapping_x11.h +++ b/platform/x11/key_mapping_x11.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef KEY_MAPPING_X11_H #define KEY_MAPPING_X11_H diff --git a/platform/x11/os_x11.cpp b/platform/x11/os_x11.cpp index 5ca3ad45b8..e4165e2fe3 100644 --- a/platform/x11/os_x11.cpp +++ b/platform/x11/os_x11.cpp @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #include "os_x11.h" #include "drivers/gles3/rasterizer_gles3.h" #include "errno.h" @@ -522,6 +523,8 @@ Error OS_X11::initialize(const VideoMode &p_desired, int p_video_driver, int p_a _window_changed(&xevent); } } + + return OK; } void OS_X11::xim_destroy_callback(::XIM im, ::XPointer client_data, diff --git a/platform/x11/os_x11.h b/platform/x11/os_x11.h index 2bf2f3cf26..f7bc0b73e0 100644 --- a/platform/x11/os_x11.h +++ b/platform/x11/os_x11.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifndef OS_X11_H #define OS_X11_H diff --git a/platform/x11/platform_config.h b/platform/x11/platform_config.h index 0ad94803c2..58d6b210ee 100644 --- a/platform/x11/platform_config.h +++ b/platform/x11/platform_config.h @@ -27,6 +27,7 @@ /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */ /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /*************************************************************************/ + #ifdef __linux__ #include <alloca.h> #endif |