<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description></description><title>kwigbo</title><generator>Tumblr (3.0; @kwigbo)</generator><link>http://kwigbo.com/</link><item><title>Rectangle To Rectangle Collision Detection</title><description>&lt;p&gt;&lt;pre class="brush:cpp"&gt;
- (BOOL) rect:(CGRect) rect collisionWithRect:(CGRect) rectTwo
{
	float rect_x1 = rect.origin.x;
	float rect_x2 = rect_x1+rect.size.width;
	
	float rect_y1 = rect.origin.y;
	float rect_y2 = rect_y1+rect.size.height;
	
	float rect2_x1 = rectTwo.origin.x;
	float rect2_x2 = rect2_x1+rectTwo.size.width;
	
	float rect2_y1 = rectTwo.origin.y;
	float rect2_y2 = rect2_y1+rectTwo.size.height;
	
	if((rect_x2 &gt; rect2_x1 &amp;&amp; rect_x1 &lt; rect2_x2) &amp;&amp;(rect_y2 &gt; rect2_y1 &amp;&amp; rect_y1 &lt; rect2_y2))
		return YES;
	
	return NO;
}
&lt;/pre&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/426700865</link><guid>http://kwigbo.com/post/426700865</guid><pubDate>Thu, 04 Mar 2010 15:02:00 -0500</pubDate><category>snippet</category></item><item><title>Comparison Of XML Parsers For The iPhone SDK</title><description>&lt;p&gt;&lt;a href="http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project"&gt;http://www.raywenderlich.com/553/how-to-chose-the-best-xml-parser-for-your-iphone-project&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/426203901</link><guid>http://kwigbo.com/post/426203901</guid><pubDate>Thu, 04 Mar 2010 08:22:39 -0500</pubDate></item><item><title>iPhone SDK Using Hex Values For UIColor</title><description>&lt;p&gt;Here is a simple category to make using hex values for UIColor easier.&lt;/p&gt;

&lt;pre class="brush:cpp"&gt;
// UIColor+Hex.h

#import &lt;uikit&gt;

@interface UIColor (Hex)

+ (UIColor *) colorWithHex:(uint) hex;

@end
&lt;/uikit&gt;&lt;/pre&gt;

&lt;pre class="brush:cpp"&gt;
// UIColor+Hex.m

#import "UIColor+Hex.h"

@implementation UIColor (Hex)

+ (UIColor *) colorWithHex:(uint) hex
{
	int red, green, blue, alpha;
	
	blue = hex &amp; 0x000000FF;
	green = ((hex &amp; 0x0000FF00) &gt;&gt; 8);
	red = ((hex &amp; 0x00FF0000) &gt;&gt; 16);
	alpha = ((hex &amp; 0xFF000000) &gt;&gt; 24);
	
	return [UIColor colorWithRed:red/255.0f 
                               green:green/255.0f 
                               blue:blue/255.0f 
                               alpha:alpha/255.f];
}

@end
&lt;/pre&gt;</description><link>http://kwigbo.com/post/424088541</link><guid>http://kwigbo.com/post/424088541</guid><pubDate>Wed, 03 Mar 2010 07:43:00 -0500</pubDate><category>snippet</category></item><item><title>iPhone SDK UIAlertView With Activity Indicator</title><description>&lt;p&gt;Looking for a quick and easy way to show an activity indicator? I found the easiest way was to subclass UIAlertView to make a reusable solution. Click read more for the code.&lt;/p&gt;

&lt;!-- more --&gt;

// ActivityAlertView.h
&lt;pre class="brush:cpp;"&gt;
 
@interface ActivityAlertView : UIAlertView
{
	UIActivityIndicatorView *activityView;
}

@property (nonatomic, retain) UIActivityIndicatorView *activityView;

- (void) close;

@end
&lt;/pre&gt;

// ActivityAlertView.m
&lt;pre class="brush:cpp;"&gt;
#import "ActivityAlertView.h"

@implementation ActivityAlertView

@synthesize activityView;

- (id)initWithFrame:(CGRect)frame
{
    if ((self = [super initWithFrame:frame]))
	{
        self.activityView = [[UIActivityIndicatorView alloc] initWithFrame:CGRectMake(125, 80, 30, 30)];
		[self addSubview:activityView];
		activityView.activityIndicatorViewStyle = UIActivityIndicatorViewStyleWhiteLarge;
		[activityView startAnimating];
    }
	
    return self;
}

- (void) close
{
	[self dismissWithClickedButtonIndex:0 animated:YES];
}

- (void) dealoc
{
	[activityView release];
	[super dealloc];
}

@end
&lt;/pre&gt;

// Usage
&lt;pre class="brush:cpp;"&gt;
// Show the alert
activityAlert = [[[ActivityAlertView alloc] 
				initWithTitle:@"Doing Something"
				message:@"Please wait..."
				delegate:self cancelButtonTitle:nil 
				otherButtonTitles:nil] autorelease];
	
[activityAlert show];

//Remove the alert
[activityAlert close];
&lt;/pre&gt;</description><link>http://kwigbo.com/post/394670170</link><guid>http://kwigbo.com/post/394670170</guid><pubDate>Wed, 17 Feb 2010 08:31:00 -0500</pubDate></item><item><title>Easy custom UITableView drawing</title><description>&lt;p&gt;Great tutorial from Cocoa with Love&lt;/p&gt;

&lt;p&gt;&lt;a href="http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html"&gt;&lt;a href="http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html"&gt;http://cocoawithlove.com/2009/04/easy-custom-uitableview-drawing.html&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/391188180</link><guid>http://kwigbo.com/post/391188180</guid><pubDate>Mon, 15 Feb 2010 14:05:02 -0500</pubDate><category>tutorials</category><category>iPhoneSDK</category><category>uikit</category></item><item><title>Artifice 2.0.1 Submitted To The App Store</title><description>&lt;p&gt;I submitted a new version of Artifice this weekend. There are a bunch of new things to look forward to.&lt;/p&gt;

&lt;p&gt;AI crash fixed&lt;br/&gt;
New game and continue game screens rebuilt and optimized&lt;br/&gt;
Friends are alphabetized when choosing a friend to challenge&lt;/p&gt;

&lt;p&gt;Double tap game board for settings&lt;br/&gt;
Walk time control&lt;br/&gt;
Drag sensitivity control&lt;/p&gt;

&lt;p&gt;OpenFeint acheivement (Ranks for winning online games)&lt;br/&gt;
OpenFeint Leaderboard (Most online games won)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://artifice.kwigbo.com"&gt;New screen shots added&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/389891904</link><guid>http://kwigbo.com/post/389891904</guid><pubDate>Sun, 14 Feb 2010 20:44:17 -0500</pubDate><category>artifice</category><category>iPhoneSDK</category><category>app store</category></item><item><title>Artifice Crash Bug Fixed</title><description>&lt;p&gt;Some users of Artifice have reported a crash when trying to play against the device AI. I found the cause of this crash and it will be fixed with the next release. I will be submitting a new version to the App Store this weekend. In the meantime there is a workaround. When you go to the choose opponent screen wait till your list of friends is done loading before selecting Device AI. When the list is done loading you should be able to select device AI without a crash. Thanks for your patience and sorry for any inconvenience.&lt;/p&gt;</description><link>http://kwigbo.com/post/381126872</link><guid>http://kwigbo.com/post/381126872</guid><pubDate>Tue, 09 Feb 2010 22:32:49 -0500</pubDate><category>artifice</category><category>iPhoneSDK</category></item><item><title>Finding Memory Leaks In An iPhone App</title><description>&lt;p&gt;Here is a great tutorial from Mobile Orchard on using Instruments to find memory leaks.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/"&gt;http://www.mobileorchard.com/find-iphone-memory-leaks-a-leaks-tool-tutorial/&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/380311842</link><guid>http://kwigbo.com/post/380311842</guid><pubDate>Tue, 09 Feb 2010 13:44:42 -0500</pubDate><category>Instruments</category><category>iPhoneSDK</category></item><item><title>Artifice 2.0 Has Hit The App Store!</title><description>&lt;p&gt;Last night Artifice passed Apple review in record time. At least it’s a record for me. Usually I get rejected the first time for some small thing. This time it got through the review process in 5 days.&lt;/p&gt;</description><link>http://kwigbo.com/post/372334301</link><guid>http://kwigbo.com/post/372334301</guid><pubDate>Fri, 05 Feb 2010 08:48:44 -0500</pubDate><category>artifice</category><category>app store</category></item><item><title>Artifice 2.0 In Review</title><description>&lt;p&gt;The @openfeint multiplayer version of Artifice is now in the hands of Apple reviewers. Hopefully things go well. Everyone who already has downloaded it will get the multiplayer for free. The price will be going up to .99$ when it hits the App Store. Get it now while it’s still free!&lt;/p&gt;

&lt;p&gt;&lt;a href="http://artifice.kwigbo.com"&gt;Get Artifice&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/367160282</link><guid>http://kwigbo.com/post/367160282</guid><pubDate>Tue, 02 Feb 2010 12:10:36 -0500</pubDate><category>artifice</category><category>app store</category><category>iPhoneSDK</category></item><item><title>Last Round Of Beta Testing For Artifice</title><description>&lt;p&gt;Ok, I missed my initial submission date due to real life getting in the way. Good news is that I have the final beta version in the hands of my testers. As long as I get good feedback from them I will submit it to the App Store next Monday.&lt;/p&gt;</description><link>http://kwigbo.com/post/357871525</link><guid>http://kwigbo.com/post/357871525</guid><pubDate>Thu, 28 Jan 2010 08:21:25 -0500</pubDate><category>artifice</category><category>iPhoneSDK</category><category>cocos2d</category></item><item><title>iPhoneSDK Get Version Number From Info.plist</title><description>&lt;p&gt;&lt;pre class="brush:cpp;"&gt;
NSString* version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleVersionKey];
&lt;/pre&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/353636644</link><guid>http://kwigbo.com/post/353636644</guid><pubDate>Mon, 25 Jan 2010 22:00:00 -0500</pubDate><category>snippet</category></item><item><title>Copyright Infringement?</title><description>&lt;p&gt;The App Store shows more signs of unfair practices. I know surprise surprise, this time Apple is pulling apps from the App Store based on false allegations of copyright infringement. Here are two stories that are worth the time to read.&lt;/p&gt;

&lt;p&gt;&lt;a target="_blank" href="http://rawtoastdesign.blogspot.com/2010/01/apple-reveals-big-loophole-and-shows.html"&gt;App Vault Gets Pulled From The App Store&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a target="_blank" href="http://codeminion.com/blogs/maciek/2009/10/where-is-stoneloops-or-how-to-get-rid-of-your-competition-in-the-apple-appstore/"&gt;Stone Loops Gets Pulled From The App Store&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;&lt;a target="_blank" href="http://www.thepetitionsite.com/1/open-competition-in-app-store"&gt;Sign The Petition To Stop This Unfair Practice!&lt;/a&gt;&lt;/h3&gt;</description><link>http://kwigbo.com/post/352595728</link><guid>http://kwigbo.com/post/352595728</guid><pubDate>Mon, 25 Jan 2010 08:43:55 -0500</pubDate><category>App Store</category></item><item><title>Artifice AI Complete</title><description>&lt;p&gt;I just finished up the AI for Artifice. I have a few bugs to hunt down before I can release. I should be able to submit to the App Store by Wednesday.&lt;/p&gt;</description><link>http://kwigbo.com/post/351381657</link><guid>http://kwigbo.com/post/351381657</guid><pubDate>Sun, 24 Jan 2010 16:57:32 -0500</pubDate></item><item><title>Artifice AI Almost Done</title><description>&lt;p&gt;I am going to be working on the final piece of Artifice this weekend. I will hopefully be able to submit it to the App Store by Sunday night. Multiplayer will be a free update for all current users.&lt;/p&gt;</description><link>http://kwigbo.com/post/346677415</link><guid>http://kwigbo.com/post/346677415</guid><pubDate>Thu, 21 Jan 2010 19:45:47 -0500</pubDate><category>artifice</category><category>cocos2d</category><category>iphone</category></item><item><title>Pusher Source Code</title><description>&lt;p&gt;Back by popular demand, another project that I had open source. Here is the tile based game shell that I had available on my site before. The cocos2d version is not up to date.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://kwigbo.s3.amazonaws.com/source/Pusher.zip"&gt;Pusher Source&lt;/a&gt;&lt;br/&gt;&lt;a href="http://kwigbo.s3.amazonaws.com/source/Tiled_TGA.zip"&gt;Tiled with TGA plugin for editing maps&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/335053103</link><guid>http://kwigbo.com/post/335053103</guid><pubDate>Thu, 14 Jan 2010 21:28:00 -0500</pubDate><category>Pusher</category><category>cocos2d</category><category>iPhoneSDK</category><category>source code</category></item><item><title>Amazon S3 Image Gallery Manager</title><description>&lt;p&gt;In an attempt to keep up with Flex/Flash I decided to build something using the beta of Flash Builder 4. The project I chose was an Amazon S3 image manager made for the Adobe AIR platform. I also decided to use the &lt;a target="_blank" href="http://mate.asfusion.com/"&gt;Mate&lt;/a&gt; framework to see how it compares to &lt;a target="_blank" href="http://puremvc.org/"&gt;PureMVC&lt;/a&gt;.&lt;br/&gt;&lt;!-- more --&gt;&lt;/p&gt;

&lt;p&gt;The application allows you to load a bucket from S3 and manage multiple buckets to load. Through the interface you can create and delete directories and delete and upload images. When you delete an image you can have it copied to your desktop in order to upload it to a different directory. When uploading, the application will warn you if you have files already existing with the same name. There is also a thumbnail generator that allows you to choose a 100x100 section of the image to be uploaded as a thumbnail. You can navigate the images and directories via the thumbnail panel at the bottom. Clicking on a thumb will launch the full size version of the image. The images can be dragged around and you can also zoom in and out.&lt;/p&gt;

&lt;p&gt;I have to say I am very impressed with the &lt;a target="_blank" href="http://mate.asfusion.com/"&gt;Mate&lt;/a&gt; framework. I feel like I have to write a lot less code to fit in with the framework. This leaves more time to focus on coding the functionality of the application. With &lt;a target="_blank" href="http://puremvc.org/"&gt;PureMVC&lt;/a&gt; I always feel like I spend so much time writing code just to fit into framework.&lt;/p&gt;

&lt;p&gt;&lt;a target="_blank" href="http://kwigbo.s3.amazonaws.com/s3Gallery/S3GalleryManager.air"&gt;Download S3GalleryManager.air&lt;/a&gt;&lt;br/&gt;&lt;a target="_blank" href="http://kwigbo.s3.amazonaws.com/s3Gallery/S3GalleryManager.zip"&gt;Download S3GalleryManager Full Source&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/334912040</link><guid>http://kwigbo.com/post/334912040</guid><pubDate>Thu, 14 Jan 2010 19:55:00 -0500</pubDate><category>AIR</category><category>AS3</category><category>Amazon S3</category><category>Flash Builder</category><category>Mate</category><category>source code</category></item><item><title>iPhone SDK Custom UIAlertView Background Color</title><description>&lt;p&gt;Have you ever wanted to use a UIAlertView but you hate the default blue color? Ever wonder why they don’t have a simple way to change the color of the alerts? I had these questions and the only answer I found was to subclass UIAlertView and override the drawRect method. This is my first attempt at using Quartz so if anyone knows a better way to draw it let me know via the contact form.&lt;/p&gt;

&lt;!-- more --&gt;

Set the color (Default is black with a grey stroke)
&lt;pre class="brush:cpp"&gt;
[CustomAlert setBackgroundColor:[UIColor blueColor] withStrokeColor:[UIColor greenColor]];
&lt;/pre&gt;

CustomAlert.h
&lt;pre class="brush:cpp"&gt;
#import &lt;uikit&gt;

@interface CustomAlert : UIAlertView
{

}

+ (void) setBackgroundColor:(UIColor *) background withStrokeColor:(UIColor *) stroke;

@end
&lt;/uikit&gt;&lt;/pre&gt;

CustomAlert.m
&lt;pre class="brush:cpp"&gt;
#import "CustomAlert.h"

@interface CustomAlert (Private)

- (void) drawRoundedRect:(CGRect) rect inContext:(CGContextRef) context withRadius:(CGFloat) radius;

@end

static UIColor *fillColor = nil;
static UIColor *borderColor = nil;

@implementation CustomAlert

+ (void) setBackgroundColor:(UIColor *) background withStrokeColor:(UIColor *) stroke
{
	if(fillColor != nil)
	{
		[fillColor release];
		[borderColor release];
	}
	
	fillColor = [background retain];
	borderColor = [stroke retain];
}

- (id)initWithFrame:(CGRect)frame
{
    if((self = [super initWithFrame:frame]))
	{
        if(fillColor == nil)
		{
			fillColor = [[UIColor blackColor] retain];
			borderColor = [[UIColor colorWithHue:0.625 saturation:0.0 brightness:0.8 alpha:0.8] retain];
		}
    }
	
    return self;
}

- (void)drawRect:(CGRect)rect
{	
	CGContextRef context = UIGraphicsGetCurrentContext();
	
	CGContextClearRect(context, rect);
	CGContextSetAllowsAntialiasing(context, true);
	CGContextSetLineWidth(context, 0.0);
	CGContextSetAlpha(context, 0.8); 
	CGContextSetLineWidth(context, 2.0);
	CGContextSetStrokeColorWithColor(context, [borderColor CGColor]);
	CGContextSetFillColorWithColor(context, [fillColor CGColor]);
	
	// Draw background
	CGFloat backOffset = 2;
	CGRect backRect = CGRectMake(rect.origin.x + backOffset, rect.origin.y + backOffset, rect.size.width - backOffset*2, rect.size.height - backOffset*2);
	[self drawRoundedRect:backRect inContext:context withRadius:8];
	CGContextDrawPath(context, kCGPathFillStroke);
	
	// Clip Context
	CGRect clipRect = CGRectMake(backRect.origin.x + backOffset-1, backRect.origin.y + backOffset-1, backRect.size.width - (backOffset-1)*2, backRect.size.height - (backOffset-1)*2);
	[self drawRoundedRect:clipRect inContext:context withRadius:8];
	CGContextClip (context);
	
	//Draw highlight
	CGGradientRef glossGradient;
	CGColorSpaceRef rgbColorspace;
	size_t num_locations = 2;
	CGFloat locations[2] = { 0.0, 1.0 };
	CGFloat components[8] = { 1.0, 1.0, 1.0, 0.35, 1.0, 1.0, 1.0, 0.06 };
	rgbColorspace = CGColorSpaceCreateDeviceRGB();
	glossGradient = CGGradientCreateWithColorComponents(rgbColorspace, components, locations, num_locations);
	
	CGRect ovalRect = CGRectMake(-130, -115, (rect.size.width*2), rect.size.width/2);
	
	CGPoint start = CGPointMake(rect.origin.x, rect.origin.y);
	CGPoint end = CGPointMake(rect.origin.x, rect.size.height/5);
	
	CGContextSetAlpha(context, 1.0); 
	CGContextAddEllipseInRect(context, ovalRect);
	CGContextClip (context);
	
	CGContextDrawLinearGradient(context, glossGradient, start, end, 0);
	
	CGGradientRelease(glossGradient);
	CGColorSpaceRelease(rgbColorspace); 
}

- (void) drawRoundedRect:(CGRect) rrect inContext:(CGContextRef) context withRadius:(CGFloat) radius
{
	CGContextBeginPath (context);
	
	CGFloat minx = CGRectGetMinX(rrect), midx = CGRectGetMidX(rrect), maxx = CGRectGetMaxX(rrect);
	CGFloat miny = CGRectGetMinY(rrect), midy = CGRectGetMidY(rrect), maxy = CGRectGetMaxY(rrect);
	
	CGContextMoveToPoint(context, minx, midy);
	CGContextAddArcToPoint(context, minx, miny, midx, miny, radius);
	CGContextAddArcToPoint(context, maxx, miny, maxx, midy, radius);
	CGContextAddArcToPoint(context, maxx, maxy, midx, maxy, radius);
	CGContextAddArcToPoint(context, minx, maxy, minx, midy, radius);
	CGContextClosePath(context);
}

- (void)dealloc
{
    [super dealloc];
}

@end
&lt;/pre&gt;</description><link>http://kwigbo.com/post/318396305</link><guid>http://kwigbo.com/post/318396305</guid><pubDate>Tue, 05 Jan 2010 13:26:00 -0500</pubDate><category>Quartz</category><category>UIKit</category><category>iPhoneSDK</category><category>snippet</category></item><item><title>Sound Effect Generator</title><description>&lt;p&gt;&lt;a target="_blank" href="http://www.superflashbros.net/as3sfxr/"&gt;&lt;a href="http://www.superflashbros.net/as3sfxr/"&gt;http://www.superflashbros.net/as3sfxr/&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://kwigbo.com/post/305046166</link><guid>http://kwigbo.com/post/305046166</guid><pubDate>Mon, 28 Dec 2009 17:42:00 -0500</pubDate><category>tools</category></item><item><title>Artifice Multiplayer Ready For Beta Testing</title><description>&lt;p&gt;Tonight I successfully implemented multiplayer in Artifice using OpenFeint challenges. I am pretty sure I am not using challenges the way they were intended. In the OpenFeint sense of things, all challenges are declined. The challenge system is simply used to pass the game data from player to player. This allows for the use of the push notifications system without actually ever using a challenge beyond the passing of data. I will be putting it in the hands of my beta testers tomorrow.&lt;/p&gt;</description><link>http://kwigbo.com/post/285563748</link><guid>http://kwigbo.com/post/285563748</guid><pubDate>Tue, 15 Dec 2009 22:30:00 -0500</pubDate><category>artifice</category></item></channel></rss>
