aboutsummaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorhurikhan2015-02-12 15:58:29 +0100
committerhurikhan2015-02-12 15:58:29 +0100
commita13e180052d2e17275498a2fa78185cc299ace11 (patch)
tree6f9051d0b3d2444ac09c1bbf78f9e395af1782e9 /platform
parentdf7d26ff5b89ce9852813abd370d1357aab1501b (diff)
parentb3a6cc097d5bc60ee6e7ba30b177bed3a8aadc71 (diff)
downloadgodot-a13e180052d2e17275498a2fa78185cc299ace11.tar.gz
godot-a13e180052d2e17275498a2fa78185cc299ace11.tar.zst
godot-a13e180052d2e17275498a2fa78185cc299ace11.zip
Merge remote-tracking branch 'upstream/master' into x11-window-management
Diffstat (limited to 'platform')
-rw-r--r--platform/iphone/app_delegate.mm19
-rwxr-xr-xplatform/iphone/gl_view.h8
-rwxr-xr-xplatform/iphone/gl_view.mm32
-rw-r--r--platform/isim/detect.py2
-rw-r--r--platform/windows/os_windows.cpp7
-rw-r--r--platform/x11/detect.py28
6 files changed, 68 insertions, 28 deletions
diff --git a/platform/iphone/app_delegate.mm b/platform/iphone/app_delegate.mm
index 6ca54286b..fe11b672a 100644
--- a/platform/iphone/app_delegate.mm
+++ b/platform/iphone/app_delegate.mm
@@ -84,13 +84,11 @@ static int frame_count = 0;
switch (frame_count) {
case 0: {
-
- int backingWidth;
- int backingHeight;
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
- glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
-
- iphone_main(backingWidth, backingHeight, gargc, gargv);
+ int backingWidth;
+ int backingHeight;
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+
OS::VideoMode vm;
vm.fullscreen = true;
@@ -198,6 +196,13 @@ static int frame_count = 0;
//glView.autoresizesSubviews = YES;
//[glView setAutoresizingMask:UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleWidth];
+ int backingWidth;
+ int backingHeight;
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_WIDTH_OES, &backingWidth);
+ glGetRenderbufferParameterivOES(GL_RENDERBUFFER_OES, GL_RENDERBUFFER_HEIGHT_OES, &backingHeight);
+
+ iphone_main(backingWidth, backingHeight, gargc, gargv);
+
view_controller = [[ViewController alloc] init];
view_controller.view = glView;
window.rootViewController = view_controller;
diff --git a/platform/iphone/gl_view.h b/platform/iphone/gl_view.h
index 8ae7c2f87..a5b1b8731 100755
--- a/platform/iphone/gl_view.h
+++ b/platform/iphone/gl_view.h
@@ -34,6 +34,8 @@
#import <MediaPlayer/MediaPlayer.h>
#import <AVFoundation/AVFoundation.h>
+#define USE_CADISPLAYLINK 1 //iOS version 3.1+ is required
+
@protocol GLViewDelegate;
@interface GLView : UIView<UIKeyInput>
@@ -51,8 +53,14 @@
// OpenGL name for the depth buffer that is attached to viewFramebuffer, if it exists (0 if it does not exist)
GLuint depthRenderbuffer;
+#if USE_CADISPLAYLINK
+ // CADisplayLink available on 3.1+ synchronizes the animation timer & drawing with the refresh rate of the display, only supports animation intervals of 1/60 1/30 & 1/15
+ CADisplayLink *displayLink;
+#else
// An animation timer that, when animation is started, will periodically call -drawView at the given rate.
NSTimer *animationTimer;
+#endif
+
NSTimeInterval animationInterval;
// Delegate to do our drawing, called by -drawView, which can be called manually or via the animation timer.
diff --git a/platform/iphone/gl_view.mm b/platform/iphone/gl_view.mm
index bee01d3c7..0625361b9 100755
--- a/platform/iphone/gl_view.mm
+++ b/platform/iphone/gl_view.mm
@@ -413,7 +413,19 @@ static void clear_touches() {
return;
active = TRUE;
printf("start animation!\n");
+#if USE_CADISPLAYLINK
+ // Approximate frame rate
+ // assumes device refreshes at 60 fps
+ int frameInterval = (int) floor(animationInterval * 60.0f);
+
+ displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(drawView)];
+ [displayLink setFrameInterval:frameInterval];
+
+ // Setup DisplayLink in main thread
+ [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes];
+#else
animationTimer = [NSTimer scheduledTimerWithTimeInterval:animationInterval target:self selector:@selector(drawView) userInfo:nil repeats:YES];
+#endif
if (video_playing)
{
@@ -427,8 +439,13 @@ static void clear_touches() {
return;
active = FALSE;
printf("******** stop animation!\n");
+#if USE_CADISPLAYLINK
+ [displayLink invalidate];
+ displayLink = nil;
+#else
[animationTimer invalidate];
animationTimer = nil;
+#endif
clear_touches();
if (video_playing)
@@ -441,7 +458,11 @@ static void clear_touches() {
{
animationInterval = interval;
+#if USE_CADISPLAYLINK
+ if(displayLink)
+#else
if(animationTimer)
+#endif
{
[self stopAnimation];
[self startAnimation];
@@ -451,6 +472,17 @@ static void clear_touches() {
// Updates the OpenGL view when the timer fires
- (void)drawView
{
+#if USE_CADISPLAYLINK
+ // Pause the CADisplayLink to avoid recursion
+ [displayLink setPaused: YES];
+
+ // Process all input events
+ while(CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource);
+
+ // We are good to go, resume the CADisplayLink
+ [displayLink setPaused: NO];
+#endif
+
if (!active) {
printf("draw view not active!\n");
return;
diff --git a/platform/isim/detect.py b/platform/isim/detect.py
index 8d60e30d2..bd0fd2fea 100644
--- a/platform/isim/detect.py
+++ b/platform/isim/detect.py
@@ -22,7 +22,7 @@ def get_opts():
return [
('ISIMPLATFORM', 'name of the iphone platform', 'iPhoneSimulator'),
('ISIMPATH', 'the path to iphone toolchain', '/Applications/Xcode.app/Contents/Developer/Platforms/${ISIMPLATFORM}.platform'),
- ('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}7.1.sdk'),
+ ('ISIMSDK', 'path to the iphone SDK', '$ISIMPATH/Developer/SDKs/${ISIMPLATFORM}.sdk'),
('game_center', 'Support for game center', 'yes'),
('store_kit', 'Support for in-app store', 'yes'),
('ios_gles22_override', 'Force GLES2.0 on iOS', 'yes'),
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 4fa061886..915e1a609 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -593,10 +593,11 @@ LRESULT OS_Windows::WndProc(HWND hWnd,UINT uMsg, WPARAM wParam, LPARAM lParam) {
ERR_BREAK(key_event_pos >= KEY_EVENT_BUFFER_SIZE);
+ // Make sure we don't include modifiers for the modifier key itself.
KeyEvent ke;
- ke.mod_state.shift=shift_mem;
- ke.mod_state.alt=alt_mem;
- ke.mod_state.control=control_mem;
+ ke.mod_state.shift= (wParam != VK_SHIFT) ? shift_mem : false;
+ ke.mod_state.alt= (! (wParam == VK_MENU && (uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN))) ? alt_mem : false;
+ ke.mod_state.control= (wParam != VK_CONTROL) ? control_mem : false;
ke.mod_state.meta=meta_mem;
ke.uMsg=uMsg;
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index 6adba510e..0601c5998 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -76,24 +76,23 @@ def configure(env):
else:
env["bits"]="32"
-
env.Append(CPPPATH=['#platform/x11'])
if (env["use_llvm"]=="yes"):
- env["CC"]="clang"
- env["CXX"]="clang++"
- env["LD"]="clang++"
- if (env["use_sanitizer"]=="yes"):
- env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
- env.Append(LINKFLAGS=['-fsanitize=address'])
- env.extra_suffix=".llvms"
- else:
- env.extra_suffix=".llvm"
+ if 'clang++' not in env['CXX']:
+ env["CC"]="clang"
+ env["CXX"]="clang++"
+ env["LD"]="clang++"
+ env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
+ env.extra_suffix=".llvm"
+
if (env["colored"]=="yes"):
if sys.stdout.isatty():
env.Append(CXXFLAGS=["-fcolor-diagnostics"])
-
-
+ if (env["use_sanitizer"]=="yes"):
+ env.Append(CXXFLAGS=['-fsanitize=address','-fno-omit-frame-pointer'])
+ env.Append(LINKFLAGS=['-fsanitize=address'])
+ env.extra_suffix+="s"
#if (env["tools"]=="no"):
# #no tools suffix
@@ -147,11 +146,6 @@ def configure(env):
env.Append(LINKFLAGS=['-m64','-L/usr/lib/i686-linux-gnu'])
- if (env["CXX"]=="clang++"):
- env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
- env["CC"]="clang"
- env["LD"]="clang++"
-
import methods
env.Append( BUILDERS = { 'GLSL120' : env.Builder(action = methods.build_legacygl_headers, suffix = 'glsl.h',src_suffix = '.glsl') } )