<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Mac / iPhone App Development &#187; Uncategorized</title>
	<atom:link href="http://benreeves.co.uk/category/uncategorized/feed/" rel="self" type="application/rss+xml" />
	<link>http://benreeves.co.uk</link>
	<description>Home of a Small Time Developer</description>
	<lastBuildDate>Wed, 26 May 2010 14:24:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>SieveHash &#8211; An alternative hash table implementation</title>
		<link>http://benreeves.co.uk/sievehash-an-alternative-hash-table-implementation/</link>
		<comments>http://benreeves.co.uk/sievehash-an-alternative-hash-table-implementation/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 16:20:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://benreeves.co.uk/?p=239</guid>
		<description><![CDATA[A fast and efficient C hash table implementation, which in many cases can beat google dense hash map, the STL Tr1 hash map and khash The semi-interesting part is the way it handles collisions. When Sievehash encounters a collision is makes another hash table smaller than it&#8217;s parent. Each new key is dropped through the [...]]]></description>
			<content:encoded><![CDATA[<p>A fast and efficient C hash table implementation, which in many cases can beat google dense hash map, the STL Tr1 hash map and khash</p>
<p>The semi-interesting part is the way it handles collisions. When Sievehash encounters a collision is makes another hash table smaller than it&#8217;s parent. Each new key is dropped through the Seive until an empty spot is found and becomes it&#8217;s new home, forming a structure like a Seive.</p>
<p>Similar to most hash tables, when any table reaches the specified load factor all keys will be copied to a new larger table.</p>
<p>Sieve Hash Library: <a href="http://benreeves.co.uk/wp-content/uploads/2010/02/SieveHash.h">SieveHash.h</a></p>
<p>Hash test package: <a href="http://benreeves.co.uk/wp-content/uploads/2010/03/HashTests.zip">HashTests</a></p>
<pre>*** Starting String Test: STL TR1
- Insert Took: 2.751855
- Lookup Took: 2.694130
} Test Took: 8.425282
*** Starting String Test: SieveHash
- Insert Took: 4.447270
- Lookup Took: 2.972444
} Test Took: 10.369791
*** Starting String Test: KHash CPP
- Insert Took: 2.676008
- Lookup Took: 3.056431
} Test Took: 8.704912
*** Starting String Test: Google Dense Hash Test
- Insert Took: 5.109226
- Lookup Took: 4.746739
} Test Took: 12.817609</pre>
<pre>WARNING: This is not meant for production code, it is for testing purposes only.</pre>
]]></content:encoded>
			<wfw:commentRss>http://benreeves.co.uk/sievehash-an-alternative-hash-table-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cocos2d iphone tutorial</title>
		<link>http://benreeves.co.uk/cocos2d-iphone-tutorial/</link>
		<comments>http://benreeves.co.uk/cocos2d-iphone-tutorial/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 00:26:52 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.benreeves.co.uk/?p=172</guid>
		<description><![CDATA[Cocos2d is a popular 2d framework for developing iphone games, including physics and particle support.  Here&#8217;s a quick introduction to getting cocos2d for the iphone up and running for your next project. Download the latest source from: http://code.google.com/p/cocos2d-iphone/downloads/list I recommend you stick with the stable releases, unless there is a specific feature your require from [...]]]></description>
			<content:encoded><![CDATA[<p>Cocos2d is a popular 2d framework for developing iphone games, including physics and particle support.  Here&#8217;s a quick introduction to getting cocos2d for the iphone up and running for your next project.</p>
<p>Download the latest source from:</p>
<p><a href="http://code.google.com/p/cocos2d-iphone/downloads/list">http://code.google.com/p/cocos2d-iphone/downloads/list</a></p>
<p>I recommend you stick with the stable releases, unless there is a specific feature your require from a new version.</p>
<p>Unzip the folder and the template installation script:</p>
<pre>$ ./install_template.sh</pre>
<p>This will make a series of cocos-2d templates available from XCode.  Launch/restart xcode and choose File-&gt;New Project-&gt;cocos2d Application build and run the new application in the simulator and it should look something like this:</p>
<p style="text-align: center;"><a href="http://www.benreeves.co.uk/wp-content/uploads/2010/01/Screen-shot-2010-01-27-at-00.04.39.png"><img class="size-full wp-image-173  aligncenter" title="Hello World cocos2d" src="http://www.benreeves.co.uk/wp-content/uploads/2010/01/Screen-shot-2010-01-27-at-00.04.39.png" alt="" width="539" height="290" /></a></p>
<p style="text-align: left;">Were going to build on this template to add a main menu</p>
<p style="text-align: left;">First download the test image and add it to the new xcode project (Make sure it is copied into the application directory)</p>
<p style="text-align: center;"><a style="text-decoration: none;" href="http://www.benreeves.co.uk/wp-content/uploads/2010/01/MainMenuBackground.png"><img class="size-thumbnail wp-image-177  aligncenter" title="MainMenuBackground" src="http://www.benreeves.co.uk/wp-content/uploads/2010/01/MainMenuBackground-150x150.png" alt="" width="150" height="150" /></a></p>
<p style="text-align: left;">Create a new class name MenuScene and add the following code to the header file:</p>
<pre lang="objc">#import
#import "cocos2d.h"

@interface MenuScene : Scene
{

}

@end

@interface MenuLayer : Layer
{
}

-(void)startGame: (id)sender;
-(void)help: (id)sender;

@end</pre>
<p>The add the following to the .m file:</p>
<pre lang="objc">#import "MenuScene"

@implementation MenuScene

- (id) init
{
    self = [super init];
    if (self != nil) {
        Sprite * bg = [Sprite spriteWithFile:@"MainMenuBackground.png"];
        [bg setPosition:ccp(160, 240)];
        [self addChild:bg z:0];
        [self addChild:[MenuLayer node] z:1];
    }
    return self;
}

@end

@implementation MenuLayer

- (id) init
{
    self = [super init];
    if (self != nil)
	{
        [MenuItemFont setFontSize:24];
        [MenuItemFont setFontName:@"Helvetica"];

        MenuItem *start = [MenuItemFont itemFromString:@"Start Game"
												target:self
											  selector:@selector(startGame:)];

        MenuItem *help = [MenuItemFont itemFromString:@"Help"
											   target:self
											 selector:@selector(help:)];

        Menu *menu = [Menu menuWithItems:start, help, nil];
		menu.color = ccc3(0, 0, 0);

        [menu alignItemsVertically];
        [self addChild:menu];
    }
    return self;
}

-(void)startGame: (id)sender
{
    NSLog(@"start game");
}

-(void)help: (id)sender {
    NSLog(@"help");
}

@end</pre>
<p>Finally modify the app delegate (CocosTestAppDelegate.m) to include MenuScene.h</p>
<pre lang="objc">#import "MainMenuScene.h"</pre>
<p>and replace the line:</p>
<pre lang="objc">[[Director sharedDirector] runWithScene: [HelloWorld scene]];</pre>
<p>with:</p>
<pre lang="objc">[[Director sharedDirector] runWithScene: [MenuScene node]];</pre>
<p>also remove the line:</p>
<pre lang="objc">[[Director sharedDirector] setDeviceOrientation:CCDeviceOrientationLandscapeLeft];</pre>
<p>Compile and run the project and you should end up with a menu and two clickable buttons:</p>
<p style="text-align: center;"><a style="text-decoration: none;" href="http://www.benreeves.co.uk/wp-content/uploads/2010/01/Screen-shot-2010-01-27-at-00.24.19.png"><img class="size-medium wp-image-178  aligncenter" title="Result" src="http://www.benreeves.co.uk/wp-content/uploads/2010/01/Screen-shot-2010-01-27-at-00.24.19-161x300.png" alt="" width="161" height="300" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://benreeves.co.uk/cocos2d-iphone-tutorial/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

