Skip to content

Instantly share code, notes, and snippets.

View Clancey's full-sized avatar

James Clancey Clancey

View GitHub Profile
using System;
using MonoTouch.Dialog;
using MonoTouch.UIKit;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.CoreAnimation;
public class ButtonElement : Element
{
using FarseerPhysics.Dynamics;
using FarseerPhysics.Factories;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using System;
namespace FarseerPhysics.HelloWorld
{
/// <summary>
@Clancey
Clancey / MonoTouch.Facebook.Authorization
Created April 8, 2011 01:58
MonoTouch.Facebook.Authorization
/*
* MonoTouch.Facebook.Authorization
*
* Developed by: Redth
* Updated: 2010-05-13
*
* About:
*
* This is just a simple UIViewController to help you with logging users into Facebook on MonoTouch.
* You end up calling it with something like:
@Clancey
Clancey / gist:963345
Created May 9, 2011 20:39
My testflight post build script
//After build
Command : cp -r ${ProjectDir}/bin/iPhone/Release/MyAppName.app toZip/Payload
Working Directory: ${SolutionDir}
//AfterBuild
Command : zip -r ../MyApp.ipa *
WorkingDirectory: ${SolutionDir}/toZip
var recognizerLeft = new UISwipeGestureRecognizer (this, new Selector ("swipeLeft"));
recognizerLeft.Direction = UISwipeGestureRecognizerDirection.Left;
AddGestureRecognizer (recognizerLeft);
[Export("swipeLeft")]
public void swipeLeft (UISwipeGestureRecognizer sender)
{
...
}
public static NSSTring ToNSString(this string str)
{
return new NSString(str);
}
public void Begin(SpriteSortMode sortMode, BlendState blendState, SamplerState samplerState, DepthStencilState depthStencilState, RasterizerState rasterizerState, Effect effect, Matrix transformMatrix)
{
_sortMode = sortMode;
_blendState = blendState ?? BlendState.AlphaBlend;
_depthStencilState = depthStencilState ?? DepthStencilState.None;
_samplerState = samplerState ?? SamplerState.LinearClamp;
_rasterizerState = rasterizerState ?? RasterizerState.CullCounterClockwise;
if(effect != null)
/* ios version
NSDictionary *contextDict = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:NO] forKey:@"kCIContextUseSoftwareRenderer"];
CIContext *ciContext = [CIContext contextWithOptions:contextDict];
NSDictionary *detectorDict = [NSDictionary dictionaryWithObject:@"CIDetectorAccuracyHigh" forKey:@"CIDetectorAccuracy"];
CIDetector *detector = [CIDetector detectorOfType:@"CIDetectorTypeFace" context:ciContext options:detectorDict];
// Works
NSURL *urlToFile = [NSURL fileURLWithPath:@"/Users/Clancey/Downloads/IMG_0540.jpg"];
CIImage *ciImage = [CIImage imageWithContentsOfURL:urlToFile];
CIDetector *ciDetector = [CIDetector detectorOfType:CIDetectorTypeFace
context:nil
options:nil];
NSArray *features = [ciDetector featuresInImage:ciImage];
//Fails
string imageFile = "/Users/Clancey/Downloads/IMG_0540.jpg";
static IntPtr CoreImage_libraryHandle = Dlfcn.dlopen ("/System/Library/Frameworks/CoreImage.framework/CoreImage", 0);
static NSString _TypeFace;
public static NSString TypeFace {
get {
if (_TypeFace == null)
_TypeFace = Dlfcn.GetStringConstant (CoreImage_libraryHandle, "CIDetectorTypeFace");
return _TypeFace;
}
}