src/video/uikit/SDL_uikitview.m
changeset 11831 c3446901fc1c
parent 11811 5d94cb6b24d3
child 11845 cf80a56f6d8d
equal deleted inserted replaced
11830:a01af1a724b3 11831:c3446901fc1c
    22 
    22 
    23 #if SDL_VIDEO_DRIVER_UIKIT
    23 #if SDL_VIDEO_DRIVER_UIKIT
    24 
    24 
    25 #include "SDL_uikitview.h"
    25 #include "SDL_uikitview.h"
    26 
    26 
       
    27 #include "SDL_hints.h"
    27 #include "../../events/SDL_mouse_c.h"
    28 #include "../../events/SDL_mouse_c.h"
    28 #include "../../events/SDL_touch_c.h"
    29 #include "../../events/SDL_touch_c.h"
    29 #include "../../events/SDL_events_c.h"
    30 #include "../../events/SDL_events_c.h"
    30 
    31 
    31 #import "SDL_uikitappdelegate.h"
    32 #import "SDL_uikitappdelegate.h"
    40 }
    41 }
    41 
    42 
    42 - (instancetype)initWithFrame:(CGRect)frame
    43 - (instancetype)initWithFrame:(CGRect)frame
    43 {
    44 {
    44     if ((self = [super initWithFrame:frame])) {
    45     if ((self = [super initWithFrame:frame])) {
    45         /* Apple TV Remote touchpad swipe gestures. */
       
    46 #if TARGET_OS_TV
    46 #if TARGET_OS_TV
    47         UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    47         if (SDL_GetHintBoolean(SDL_HINT_APPLE_TV_REMOTE_SWIPES_AS_ARROW_KEYS, SDL_TRUE)) {
    48         swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    48             /* Apple TV Remote touchpad swipe gestures. */
    49         [self addGestureRecognizer:swipeUp];
    49             UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    50 
    50             swipeUp.direction = UISwipeGestureRecognizerDirectionUp;
    51         UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    51             [self addGestureRecognizer:swipeUp];
    52         swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
    52 
    53         [self addGestureRecognizer:swipeDown];
    53             UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    54 
    54             swipeDown.direction = UISwipeGestureRecognizerDirectionDown;
    55         UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    55             [self addGestureRecognizer:swipeDown];
    56         swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    56 
    57         [self addGestureRecognizer:swipeLeft];
    57             UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    58 
    58             swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft;
    59         UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
    59             [self addGestureRecognizer:swipeLeft];
    60         swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
    60 
    61         [self addGestureRecognizer:swipeRight];
    61             UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)];
       
    62             swipeRight.direction = UISwipeGestureRecognizerDirectionRight;
       
    63             [self addGestureRecognizer:swipeRight];
       
    64         }
    62 #endif
    65 #endif
    63 
    66 
    64         self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    67         self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    65         self.autoresizesSubviews = YES;
    68         self.autoresizesSubviews = YES;
    66 
    69