Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jnordberg committed Dec 21, 2012
0 parents commit c65c791
Show file tree
Hide file tree
Showing 30 changed files with 2,089 additions and 0 deletions.
113 changes: 113 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#########################
# .gitignore file for Xcode4 / OS X Source projects
#
# NB: if you are storing "built" products, this WILL NOT WORK,
# and you should use a different .gitignore (or none at all)
# This file is for SOURCE projects, where there are many extra
# files that we want to exclude
#
# For updates, see: http://stackoverflow.com/questions/49478/git-ignore-file-for-xcode-projects
#########################

#####
# OS X temporary files that should never be committed

.DS_Store
*.swp
*.lock
profile


####
# Xcode temporary files that should never be committed
#
# NB: NIB/XIB files still exist even on Storyboard projects, so we want this...

*~.nib


####
# Xcode build files -
#
# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "DerivedData"

DerivedData/

# NB: slash on the end, so we only remove the FOLDER, not any files that were badly named "build"

build/


#####
# Xcode private settings (window sizes, bookmarks, breakpoints, custom executables, smart groups)
#
# This is complicated:
#
# SOMETIMES you need to put this file in version control.
# Apple designed it poorly - if you use "custom executables", they are
# saved in this file.
# 99% of projects do NOT use those, so they do NOT want to version control this file.
# ..but if you're in the 1%, comment out the line "*.pbxuser"

*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
# NB: also, whitelist the default ones, some projects need to use these
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3


####
# Xcode 4 - semi-personal settings, often included in workspaces
#
# You can safely ignore the xcuserdata files - but do NOT ignore the files next to them
#

xcuserdata


####
# XCode 4 workspaces - more detailed
#
# Workspaces are important! They are a core feature of Xcode - don't exclude them :)
#
# Workspace layout is quite spammy. For reference:
#
# (root)/
# (project-name).xcodeproj/
# project.pbxproj
# project.xcworkspace/
# contents.xcworkspacedata
# xcuserdata/
# (your name)/xcuserdatad/
# xcuserdata/
# (your name)/xcuserdatad/
#
#
#
# Xcode 4 workspaces - SHARED
#
# This is UNDOCUMENTED (google: "developer.apple.com xcshareddata" - 0 results
# But if you're going to kill personal workspaces, at least keep the shared ones...
#
#
!xcshareddata


####
# Xcode 4 - Deprecated classes
#
# Allegedly, if you manually "deprecate" your classes, they get moved here.
#
# We're using source-control, so this is a "feature" that we do not want!

*.moved-aside


####
# UNKNOWN: recommended by others, but I can't discover what these files are
#
# ...none. Everything is now explained.
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[submodule "KGNoise"]
path = KGNoise
url = https://github.com/kgn/KGNoise.git
[submodule "CeedGL"]
path = CeedGL
url = https://github.com/rsebbe/CeedGL.git
1 change: 1 addition & 0 deletions CeedGL
Submodule CeedGL added at 62f04e
10 changes: 10 additions & 0 deletions FingerMgmt.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions FingerMgmt/Classes/AppDelegate.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// AppDelegate.h
// FingerMgmt
//
// Created by Johan Nordberg on 2012-12-14.
// Copyright (c) 2012 FFFF00 Agents AB. All rights reserved.
//

#import "TrackpadView.h"

@interface AppDelegate : NSObject <NSApplicationDelegate>

@property (assign) IBOutlet NSWindow *window;
@property (assign) IBOutlet TrackpadView *trackpadView;

@end
71 changes: 71 additions & 0 deletions FingerMgmt/Classes/AppDelegate.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
//
// AppDelegate.m
// FingerMgmt
//
// Created by Johan Nordberg on 2012-12-14.
// Copyright (c) 2012 FFFF00 Agents AB. All rights reserved.
//

#import "AppDelegate.h"
#import "TouchPoint.h"

// header for MultitouchSupport.framework
#import "MultiTouch.h"

static int touchCallback(int device, mtTouch *data, int num_fingers, double timestamp, int frame) {

// create TouchPoint objects for all touches
NSMutableArray *points = [[NSMutableArray alloc] initWithCapacity:num_fingers];
for (int i = 0; i < num_fingers; i++) {
TouchPoint *point = [[TouchPoint alloc] initWithTouch:&data[i]];
[points addObject:point];
}

// forward array of TouchPoints to AppDelegate on the main thread
AppDelegate *delegate = (AppDelegate *)[NSApp delegate];
[delegate performSelectorOnMainThread:@selector(didTouchWithPoints:) withObject:points waitUntilDone:NO];

// no idea what the return code should be, guessing 0 for success
return 0;
}

@implementation AppDelegate

- (void)applicationDidFinishLaunching:(NSNotification *)notification {

// get a list of all multitouch devices
NSArray *deviceList = (NSArray *)CFBridgingRelease(MTDeviceCreateList());
for (int i = 0; i < [deviceList count]; i++) {
// start sending touches to callback
MTDeviceRef device = (__bridge MTDeviceRef)[deviceList objectAtIndex:i];
MTRegisterContactFrameCallback(device, touchCallback);
MTDeviceStart(device, 0);
}

}

- (void)didTouchWithPoints:(NSArray *)points {
self.trackpadView.touchView.touchPoints = points;
}

/*
This was just annoying
- (void)applicationDidBecomeActive:(NSNotification *)notification {
CGPoint pos;
pos.x = _window.frame.origin.x + (_window.frame.size.width / 2);
pos.y = _window.frame.origin.y + (_window.frame.size.height / 2);
CGDisplayHideCursor(kCGNullDirectDisplay);
CGDisplayMoveCursorToPoint(kCGDirectMainDisplay, pos);
CGAssociateMouseAndMouseCursorPosition(false);
}
- (void)applicationWillResignActive:(NSNotification *)notification {
CGDisplayShowCursor(kCGNullDirectDisplay);
CGAssociateMouseAndMouseCursorPosition(true);
}
*/

@end
38 changes: 38 additions & 0 deletions FingerMgmt/Classes/CeedGL+Additions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
//
// CeedGL+Additions.h
// FingerMgmt
//
// Created by Johan Nordberg on 2012-12-18.
// Copyright (c) 2012 FFFF00 Agents AB. All rights reserved.
//

#import <CeedGL/CeedGL.h>

@interface GLProgram (Additions)

+ (GLProgram *)programNamed:(NSString *)name;

@end

@interface GLShader (Additions)

+ (GLShader *)fragmentShaderNamed:(NSString *)name;
+ (GLShader *)vertexShaderNamed:(NSString *)name;

@end


@interface GLTexture (Additions)

+ (GLTexture *)textureNamed:(NSString *)name;
+ (GLTexture *)textureWithImage:(NSImage *)image;

@end


@interface NSString (Additions)

+ (NSString *)stringWithContentsOfResource:(NSString *)resource ofType:(NSString *)type encoding:(NSStringEncoding)encoding;
+ (NSString *)stringWithContentsOfResource:(NSString *)resource ofType:(NSString *)type;

@end
Loading

0 comments on commit c65c791

Please sign in to comment.