1
0
mirror of https://github.com/thes3m/XNI synced 2024-12-26 13:26:06 +01:00

adding input

git-svn-id: http://xni.googlecode.com/svn/XNI@32 ac433895-eea3-a490-d80a-17149a75e588
This commit is contained in:
Matej Jan 2010-09-30 19:03:48 +00:00
parent 54923fd932
commit cb41b574bf
12 changed files with 272 additions and 0 deletions

View File

@ -0,0 +1,20 @@
typedef enum {
TouchLocationStateInvalid,
TouchLocationStateMoved,
TouchLocationStatePressed,
TouchLocationStateReleased
} TouchLocationState;
typedef enum {
GestureTypeNone = 0,
GestureTypeTap = 1,
GestureTypeDoubleTap = 2,
GestureTypeHold = 4,
GestureTypeHorizontalDrag = 8,
GestureTypeVerticalDrag = 16,
GestureTypeFreeDrag = 32,
GestureTypePinch = 64,
GestureTypeFlick = 128,
GestureTypeDragComplete = 256,
GestureTypePinchComplete = 512
} GestureType;

View File

@ -0,0 +1,30 @@
//
// GestureSample.h
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Retronator.Xni.Framework.classes.h"
#import "Retronator.Xni.Framework.Input.Touch.classes.h"
@interface GestureSample : NSObject {
Vector2 *delta;
Vector2 *delta2;
GestureType gestureType;
Vector2 *position;
Vector2 *position2;
NSTimeInterval timestamp;
}
@property (nonatomic, readonly) Vector2 *delta;
@property (nonatomic, readonly) Vector2 *delta2;
@property (nonatomic, readonly) GestureType gestureType;
@property (nonatomic, readonly) Vector2 *position;
@property (nonatomic, readonly) Vector2 *position2;
@property (nonatomic, readonly) NSTimeInterval timestamp;
@end

View File

@ -0,0 +1,21 @@
//
// GestureSample.m
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "GestureSample.h"
@implementation GestureSample
@synthesize delta;
@synthesize delta2;
@synthesize gestureType;
@synthesize position;
@synthesize position2;
@synthesize timestamp;
@end

View File

@ -0,0 +1,5 @@
#import "Enums.h"
@class TouchPanel, TouchCollection, TouchLocation;
@class GestureSample;

View File

@ -0,0 +1,7 @@
#import "Enums.h"
#import "TouchPanel.h"
#import "TouchCollection.h"
#import "TouchLocation.h"
#import "GestureSample.h"

View File

@ -0,0 +1,22 @@
//
// TouchCollection.h
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Retronator.Xni.Framework.Input.Touch.classes.h"
@interface TouchCollection : NSObject {
NSMutableArray *collection;
}
- (int) count;
- (TouchLocation*)objectAtIndex:(NSUInteger)index;
- (void)addObject:(TouchLocation*)anObject;
- (void)insertObject:(TouchLocation*)anObject atIndex:(NSUInteger)index;
@end

View File

@ -0,0 +1,40 @@
//
// TouchCollection.m
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "TouchCollection.h"
#import "Retronator.Xni.Framework.Input.Touch.h"
@implementation TouchCollection
- (id) init
{
self = [super init];
if (self != nil) {
collection = [[NSMutableArray alloc] init];
}
return self;
}
- (int) count {
return [collection count];
}
- (TouchLocation*)objectAtIndex:(NSUInteger)index {
return (TouchLocation*)[collection objectAtIndex:index];
}
- (void)addObject:(TouchLocation*)anObject {
[collection addObject:anObject];
}
- (void)insertObject:(TouchLocation*)anObject atIndex:(NSUInteger)index {
[collection insertObject:anObject atIndex:index];
}
@end

View File

@ -0,0 +1,24 @@
//
// TouchLocation.h
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Retronator.Xni.Framework.classes.h"
#import "Retronator.Xni.Framework.Input.Touch.classes.h"
@interface TouchLocation : NSObject {
int id;
Vector2 *position;
TouchLocationState state;
}
@property (nonatomic, readonly) int id;
@property (nonatomic, readonly) Vector2 *position;
@property (nonatomic, readonly) TouchLocationState state;
@end

View File

@ -0,0 +1,18 @@
//
// TouchLocation.m
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "TouchLocation.h"
@implementation TouchLocation
@synthesize id;
@synthesize position;
@synthesize state;
@end

View File

@ -0,0 +1,34 @@
//
// TouchPanel.h
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "Retronator.Xni.Framework.classes.h"
#import "Retronator.Xni.Framework.Input.Touch.classes.h"
@interface TouchPanel : NSObject {
}
+ (int) getDisplayWidth;
+ (void) setDisplayWidth:(int)value;
+ (int) getDisplayHeight;
+ (void) setDisplayHeight:(int)value;
+ (DisplayOrientation) getDisplayOrientation;
+ (void) setDisplayOrientation:(DisplayOrientation)value;
+ (GestureType) getEnabledGestures;
+ (void) setEnabledGestures:(GestureType)value;
+ (BOOL) isGestureAvailable;
+ (TouchCollection*) getState;
+ (GestureSample*) readGesture;
@end

View File

@ -0,0 +1,51 @@
//
// TouchPanel.m
// XNI
//
// Created by Matej Jan on 29.9.10.
// Copyright 2010 Retronator. All rights reserved.
//
#import "TouchPanel.h"
#import "Retronator.Xni.Framework.Input.Touch.h"
@implementation TouchPanel
+ (int) getDisplayWidth {
}
+ (void) setDisplayWidth:(int)value{
}
+ (int) getDisplayHeight{
}
+ (void) setDisplayHeight:(int)value{
}
+ (DisplayOrientation) getDisplayOrientation{
}
+ (void) setDisplayOrientation:(DisplayOrientation)value{
}
+ (GestureType) getEnabledGestures{
}
+ (void) setEnabledGestures:(GestureType)value{
}
+ (BOOL) isGestureAvailable{
}
+ (TouchCollection*) getState{
}
+ (GestureSample*) readGesture{
}
@end