summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/iphone/gl_view.h2
-rw-r--r--platform/iphone/gl_view.mm36
-rw-r--r--platform/iphone/godot_iphone.cpp2
-rw-r--r--platform/iphone/in_app_store.mm2
-rw-r--r--platform/iphone/ios.h1
-rw-r--r--platform/iphone/ios.mm16
-rw-r--r--platform/iphone/os_iphone.cpp14
-rw-r--r--platform/iphone/os_iphone.h3
-rw-r--r--platform/javascript/os_javascript.cpp2
-rw-r--r--platform/osx/camera_osx.mm8
-rw-r--r--platform/osx/crash_handler_osx.mm4
-rw-r--r--platform/osx/detect.py3
-rw-r--r--platform/osx/joypad_osx.cpp2
-rw-r--r--platform/osx/os_osx.h3
-rw-r--r--platform/osx/os_osx.mm16
-rw-r--r--platform/windows/detect.py2
-rw-r--r--platform/windows/os_windows.cpp5
-rw-r--r--platform/windows/os_windows.h3
18 files changed, 61 insertions, 63 deletions
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 4fb721f159..e3c9d212f0 100644
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -79,8 +79,6 @@
@property(strong, nonatomic) AVPlayer *avPlayer;
@property(strong, nonatomic) AVPlayerLayer *avPlayerLayer;
-// Old videoplayer properties
-@property(strong, nonatomic) MPMoviePlayerController *moviePlayerController;
@property(strong, nonatomic) UIWindow *backgroundWindow;
@property(nonatomic) UITextAutocorrectionType autocorrectionType;
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index dfca2e3dd7..2ac158e6d3 100644
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -729,40 +729,4 @@ static void clear_touches() {
_stop_video();
}
-/*
-- (void)moviePlayBackDidFinish:(NSNotification*)notification {
-
-
- NSNumber* reason = [[notification userInfo] objectForKey:MPMoviePlayerPlaybackDidFinishReasonUserInfoKey];
- switch ([reason intValue]) {
- case MPMovieFinishReasonPlaybackEnded:
- //NSLog(@"Playback Ended");
- break;
- case MPMovieFinishReasonPlaybackError:
- //NSLog(@"Playback Error");
- video_found_error = true;
- break;
- case MPMovieFinishReasonUserExited:
- //NSLog(@"User Exited");
- video_found_error = true;
- break;
- default:
- //NSLog(@"Unsupported reason!");
- break;
- }
-
- MPMoviePlayerController *player = [notification object];
-
- [[NSNotificationCenter defaultCenter]
- removeObserver:self
- name:MPMoviePlayerPlaybackDidFinishNotification
- object:player];
-
- [_instance.moviePlayerController stop];
- [_instance.moviePlayerController.view removeFromSuperview];
-
- video_playing = false;
-}
-*/
-
@end
diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp
index db93db5021..992da2818b 100644
--- a/platform/iphone/godot_iphone.cpp
+++ b/platform/iphone/godot_iphone.cpp
@@ -47,7 +47,7 @@ int iphone_main(int, int, int, char **, String);
int iphone_main(int width, int height, int argc, char **argv, String data_dir) {
- int len = strlen(argv[0]);
+ size_t len = strlen(argv[0]);
while (len--) {
if (argv[0][len] == '/') break;
diff --git a/platform/iphone/in_app_store.mm b/platform/iphone/in_app_store.mm
index 490e84c571..8eef430621 100644
--- a/platform/iphone/in_app_store.mm
+++ b/platform/iphone/in_app_store.mm
@@ -92,7 +92,7 @@ void InAppStore::_bind_methods() {
PoolStringArray localized_prices;
PoolStringArray currency_codes;
- for (int i = 0; i < [products count]; i++) {
+ for (NSUInteger i = 0; i < [products count]; i++) {
SKProduct *product = [products objectAtIndex:i];
diff --git a/platform/iphone/ios.h b/platform/iphone/ios.h
index 91c4725b35..ef45fc7ac3 100644
--- a/platform/iphone/ios.h
+++ b/platform/iphone/ios.h
@@ -42,6 +42,7 @@ class iOS : public Object {
public:
static void alert(const char *p_alert, const char *p_title);
+ String get_model() const;
String get_rate_url(int p_app_id) const;
iOS();
diff --git a/platform/iphone/ios.mm b/platform/iphone/ios.mm
index 686422ceb2..6e986df493 100644
--- a/platform/iphone/ios.mm
+++ b/platform/iphone/ios.mm
@@ -29,6 +29,7 @@
/*************************************************************************/
#include "ios.h"
+#include <sys/sysctl.h>
#import <UIKit/UIKit.h>
@@ -42,6 +43,21 @@ void iOS::alert(const char *p_alert, const char *p_title) {
[alert show];
}
+String iOS::get_model() const {
+ // [[UIDevice currentDevice] model] only returns "iPad" or "iPhone".
+ size_t size;
+ sysctlbyname("hw.machine", NULL, &size, NULL, 0);
+ char *model = (char *)malloc(size);
+ if (model == NULL) {
+ return "";
+ }
+ sysctlbyname("hw.machine", model, &size, NULL, 0);
+ NSString *platform = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];
+ free(model);
+ const char *str = [platform UTF8String];
+ return String(str != NULL ? str : "");
+}
+
String iOS::get_rate_url(int p_app_id) const {
String templ = "itms-apps://ax.itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?type=Purple+Software&id=APP_ID";
String templ_iOS7 = "itms-apps://itunes.apple.com/app/idAPP_ID";
diff --git a/platform/iphone/os_iphone.cpp b/platform/iphone/os_iphone.cpp
index 353078c51c..83b0660ef7 100644
--- a/platform/iphone/os_iphone.cpp
+++ b/platform/iphone/os_iphone.cpp
@@ -47,8 +47,6 @@
#include "semaphore_iphone.h"
-#include "ios.h"
-
#include <dlfcn.h>
int OSIPhone::get_video_driver_count() const {
@@ -184,7 +182,8 @@ Error OSIPhone::initialize(const VideoMode &p_desired, int p_video_driver, int p
Engine::get_singleton()->add_singleton(Engine::Singleton("ICloud", icloud));
//icloud->connect();
#endif
- Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", memnew(iOS)));
+ ios = memnew(iOS);
+ Engine::get_singleton()->add_singleton(Engine::Singleton("iOS", ios));
return OK;
};
@@ -507,6 +506,15 @@ String OSIPhone::get_name() const {
return "iOS";
};
+String OSIPhone::get_model_name() const {
+
+ String model = ios->get_model();
+ if (model != "")
+ return model;
+
+ return OS_Unix::get_model_name();
+}
+
Size2 OSIPhone::get_window_size() const {
return Vector2(video_mode.width, video_mode.height);
diff --git a/platform/iphone/os_iphone.h b/platform/iphone/os_iphone.h
index 804ba0b1af..63799bbae8 100644
--- a/platform/iphone/os_iphone.h
+++ b/platform/iphone/os_iphone.h
@@ -41,6 +41,7 @@
#include "game_center.h"
#include "icloud.h"
#include "in_app_store.h"
+#include "ios.h"
#include "main/input_default.h"
#include "servers/audio_server.h"
#include "servers/visual/rasterizer.h"
@@ -72,6 +73,7 @@ private:
#ifdef ICLOUD_ENABLED
ICloud *icloud;
#endif
+ iOS *ios;
MainLoop *main_loop;
@@ -178,6 +180,7 @@ public:
void set_data_dir(String p_dir);
virtual String get_name() const;
+ virtual String get_model_name() const;
Error shell_open(String p_uri);
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index b0661cb4dd..652f6a1ce1 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -837,7 +837,7 @@ void OS_JavaScript::set_clipboard(const String &p_text) {
var text = UTF8ToString($0);
if (!navigator.clipboard || !navigator.clipboard.writeText)
return 1;
- navigator.clipboard.writeText(text).catch(e => {
+ navigator.clipboard.writeText(text).catch(function(e) {
// Setting OS clipboard is only possible from an input callback.
console.error("Setting OS clipboard is only possible from an input callback for the HTML5 plafrom. Exception:", e);
});
diff --git a/platform/osx/camera_osx.mm b/platform/osx/camera_osx.mm
index f13cf76beb..af09eec2eb 100644
--- a/platform/osx/camera_osx.mm
+++ b/platform/osx/camera_osx.mm
@@ -150,8 +150,8 @@
{
// do Y
- int new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 0);
- int new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 0);
+ size_t new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 0);
+ size_t new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 0);
if ((width[0] != new_width) || (height[0] != new_height)) {
width[0] = new_width;
@@ -168,8 +168,8 @@
{
// do CbCr
- int new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 1);
- int new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 1);
+ size_t new_width = CVPixelBufferGetWidthOfPlane(pixelBuffer, 1);
+ size_t new_height = CVPixelBufferGetHeightOfPlane(pixelBuffer, 1);
if ((width[1] != new_width) || (height[1] != new_height)) {
width[1] = new_width;
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index e19fdf1b9f..015859b3c0 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -95,7 +95,7 @@ static void handle_crash(int sig) {
if (strings) {
void *load_addr = (void *)load_address();
- for (int i = 1; i < size; i++) {
+ for (size_t i = 1; i < size; i++) {
char fname[1024];
Dl_info info;
@@ -142,7 +142,7 @@ static void handle_crash(int sig) {
}
}
- fprintf(stderr, "[%d] %ls\n", i, output.c_str());
+ fprintf(stderr, "[%zu] %ls\n", i, output.c_str());
}
free(strings);
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 881ed05025..7882253e7a 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -91,6 +91,9 @@ def configure(env):
env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
env['AS'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-as"
env.Append(CPPDEFINES=['__MACPORTS__']) #hack to fix libvpx MM256_BROADCASTSI128_SI256 define
+ else:
+ env['CC'] = 'clang'
+ env['CXX'] = 'clang++'
detect_darwin_sdk_path('osx', env)
env.Append(CCFLAGS=['-isysroot', '$MACOS_SDK_PATH'])
diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp
index fa124dac11..4edf347f61 100644
--- a/platform/osx/joypad_osx.cpp
+++ b/platform/osx/joypad_osx.cpp
@@ -578,7 +578,7 @@ JoypadOSX::JoypadOSX() {
const size_t n_elements = sizeof(vals) / sizeof(vals[0]);
CFArrayRef array = okay ? CFArrayCreate(kCFAllocatorDefault, vals, n_elements, &kCFTypeArrayCallBacks) : NULL;
- for (int i = 0; i < n_elements; i++) {
+ for (size_t i = 0; i < n_elements; i++) {
if (vals[i]) {
CFRelease((CFTypeRef)vals[i]);
}
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index f1f37e24d2..09a871f26c 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -31,6 +31,8 @@
#ifndef OS_OSX_H
#define OS_OSX_H
+#define BitMap _QDBitMap // Suppress deprecated QuickDraw definition.
+
#include "camera_osx.h"
#include "core/os/input.h"
#include "crash_handler_osx.h"
@@ -50,6 +52,7 @@
#include <ApplicationServices/ApplicationServices.h>
#include <CoreVideo/CoreVideo.h>
+#undef BitMap
#undef CursorShape
class OS_OSX : public OS_Unix {
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 51ae264cf7..15885e1266 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -620,7 +620,7 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
NSArray *filenames = [pboard propertyListForType:NSFilenamesPboardType];
Vector<String> files;
- for (int i = 0; i < filenames.count; i++) {
+ for (NSUInteger i = 0; i < filenames.count; i++) {
NSString *ns = [filenames objectAtIndex:i];
char *utfs = strdup([ns UTF8String]);
String ret;
@@ -1502,7 +1502,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
[window_object setContentView:window_view];
[window_object setDelegate:window_delegate];
[window_object setAcceptsMouseMovedEvents:YES];
- [window_object center];
+ [(NSWindow *)window_object center];
[window_object setRestorable:NO];
@@ -2338,12 +2338,12 @@ void OS_OSX::set_current_screen(int p_screen) {
};
Point2 OS_OSX::get_native_screen_position(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float display_scale = _display_scale([screenArray objectAtIndex:p_screen]);
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
// Return the top-left corner of the screen, for OS X the y starts at the bottom
@@ -2362,12 +2362,12 @@ Point2 OS_OSX::get_screen_position(int p_screen) const {
}
int OS_OSX::get_screen_dpi(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
NSDictionary *description = [[screenArray objectAtIndex:p_screen] deviceDescription];
NSSize displayPixelSize = [[description objectForKey:NSDeviceSize] sizeValue];
@@ -2381,12 +2381,12 @@ int OS_OSX::get_screen_dpi(int p_screen) const {
}
Size2 OS_OSX::get_screen_size(int p_screen) const {
- if (p_screen == -1) {
+ if (p_screen < 0) {
p_screen = get_current_screen();
}
NSArray *screenArray = [NSScreen screens];
- if (p_screen < [screenArray count]) {
+ if ((NSUInteger)p_screen < [screenArray count]) {
float displayScale = _display_scale([screenArray objectAtIndex:p_screen]);
// Note: Use frame to get the whole screen size
NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame];
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index f4390a9882..9a2b2bcb98 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -350,7 +350,7 @@ def configure_mingw(env):
env.Append(CPPDEFINES=[('WINVER', env['target_win_version']), ('_WIN32_WINNT', env['target_win_version'])])
env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser', 'imm32', 'bcrypt', 'avrt', 'uuid'])
- env.Append(CPPDEFINES=['MINGW_ENABLED'])
+ env.Append(CPPDEFINES=['MINGW_ENABLED', ('MINGW_HAS_SECURE_API', 1)])
# resrc
env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 81b8d08b3d..6544314825 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -288,15 +288,16 @@ void OS_Windows::_drag_event(float p_x, float p_y, int idx) {
if (curr->get() == Vector2(p_x, p_y))
return;
- curr->get() = Vector2(p_x, p_y);
-
Ref<InputEventScreenDrag> event;
event.instance();
event->set_index(idx);
event->set_position(Vector2(p_x, p_y));
+ event->set_relative(Vector2(p_x, p_y) - curr->get());
if (main_loop)
input->accumulate_input_event(event);
+
+ curr->get() = Vector2(p_x, p_y);
};
LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) {
diff --git a/platform/windows/os_windows.h b/platform/windows/os_windows.h
index 915d025e3b..683896886b 100644
--- a/platform/windows/os_windows.h
+++ b/platform/windows/os_windows.h
@@ -81,7 +81,9 @@ class OS_Windows : public OS {
KEY_EVENT_BUFFER_SIZE = 512
};
+#ifdef STDOUT_FILE
FILE *stdo;
+#endif
struct KeyEvent {
@@ -107,7 +109,6 @@ class OS_Windows : public OS {
VisualServer *visual_server;
CameraWindows *camera_server;
int pressrc;
- HDC hDC; // Private GDI Device Context
HINSTANCE hInstance; // Holds The Instance Of The Application
HWND hWnd;
Point2 last_pos;