<?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>meandmark.com</title>
	<atom:link href="http://meandmark.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://meandmark.com/blog</link>
	<description></description>
	<lastBuildDate>Tue, 15 May 2012 17:56:31 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Setting Up OCUnit Unit Testing in Xcode 4</title>
		<link>http://meandmark.com/blog/2012/05/setting-up-ocunit-unit-testing-in-xcode-4/</link>
		<comments>http://meandmark.com/blog/2012/05/setting-up-ocunit-unit-testing-in-xcode-4/#comments</comments>
		<pubDate>Tue, 15 May 2012 17:56:05 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[unit testing]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=461</guid>
		<description><![CDATA[Xcode ships with OCUnit, which allows you to unit test Objective-C code. This post shows you how to setup Xcode 4 so you can unit test Cocoa and iOS applications. Create an Appropriate Project The easiest way to add unit testing support in Xcode 4 is to create a project that uses the Cocoa or [...]]]></description>
			<content:encoded><![CDATA[<p>Xcode ships with OCUnit, which allows you to unit test Objective-C code. This post shows you how to setup Xcode 4 so you can unit test Cocoa and iOS applications.</p>
<h3>Create an Appropriate Project</h3>
<p>The easiest way to add unit testing support in Xcode 4 is to create a project that uses the Cocoa or Cocoa Touch frameworks, such as a Cocoa or iOS application. When you select an appropriate project and click the Next button, you should see an Include Unit Tests checkbox.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/05/Xcode4NewProjectIncludeUnitTests.png" alt="Xcode4NewProjectIncludeUnitTests" width="600" height="404" border="0" /></p>
<p>When you select the Include Unit Tests checkbox, Xcode adds a unit test bundle target and a unit testing class to your project. Xcode also does most of the setup work for you. It configures the necessary build settings for unit testing and adds a target dependency so your application target builds when you build the unit test target.</p>
<h3>Running Unit Tests After Building Your Project</h3>
<p>Adding a unit test bundle when you create an Xcode project takes care of most of the build settings for you. There is one build setting you may have to setup manually. If you want Xcode to run your unit tests when you build the project, you must set the Test After Build build setting to YES. My <a href="http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/">Xcode 4: Accessing Build Settings</a> post has detailed information on accessing build settings.</p>
<h3>Adding Unit Test Classes to Your Project</h3>
<p>While Xcode adds a test case class to your project when you create a new project and select the Include Unit Tests checkbox, you&#8217;ll eventually need to add more classes for unit testing. Choose File &gt; New &gt; File to add a unit testing class to your project. Select either Cocoa under Mac OS X or Cocoa Touch under iOS on the left side of the New File Assistant. Select Objective-C test case class from the list of file templates. Click the Next button. Enter the name of your class in the Class text field. The name of the class is also the name of the file. Click the Next button. Choose a location to save the file. Click the Create button to create the file.</p>
<p>Make sure the class you create is added to the unit test target, not the application target.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/05/AddFileToUnitTestTarget.png" alt="AddFileToUnitTestTarget" width="327" height="143" border="0" /></p>
<p>If you mistakenly add the unit test class to the wrong target, select the file from the project navigator and open the file inspector by choosing View &gt; Utilities &gt; Show File Inspector. Use the checkboxes in the Target Membership section to ensure the unit test class is a member of the unit testing target, not the application target. </p>
<h3>Configuring Your Scheme for Testing</h3>
<p>Click the name of the scheme in the Scheme menu and choose Edit Scheme to open the scheme editor. Select the Test step from the left side of the scheme editor.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/05/SchemeEditorUnitTesting.png" alt="SchemeEditorUnitTesting" width="600" height="407" border="0" /></p>
<p>The scheme editor allows you to choose a build configuration to use for unit testing, the debugger to use to debug unit tests, and the unit tests to run. Xcode is setup initially to run all unit tests.</p>
<h3>Running Unit Tests</h3>
<p>Xcode provides three ways of running unit tests. If you set the Test After Build build setting to YES, choosing Product &gt; Build for Testing builds your project and runs the unit tests. The results of the unit tests appear in the build results window, which you can access from the log navigator. Choose View &gt; Navigators &gt; Show Log Navigator to show the log navigator. Select a build from the log navigator to show the build results window. </p>
<p>The second way to run your unit tests is to choose Product &gt; Test (or click the Run button and choose Test). When you choose Product &gt; Test, Xcode builds your project and runs the tests. Use the log navigator to view the results of the unit tests. The final way to run your unit tests is to choose Product &gt; Perform Action &gt; Test Without Building, which runs unit tests without building the project.</p>
<h3>Adding Unit Test Support to an Existing Project</h3>
<p>To add unit test support to an existing project, you must add a unit test target to your project. Select the name of your project from the project navigator to open the project editor. Click the Add Target button at the bottom of the editor. Select the Other group under either Mac OS X or iOS. Select Unit Testing Bundle (either Cocoa or Cocoa Touch) from the target list.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/05/AddUnitTestTarget.png" alt="AddUnitTestTarget" width="600" height="404" border="0" /></p>
<p>Click the Next button. Enter a name for your target in the Product Name text field. Click the Finish button to finish creating the unit test target.</p>
<p>Adding a unit test target to an existing Xcode project requires more setup work than creating a new project does. You must add a target dependency to the unit test target. You also must configure build settings for the unit test bundle.</p>
<h3>Adding Target Dependencies</h3>
<p>Adding a target dependency allows Xcode to build your application when you build the unit test target. Select the unit test target from the project editor. Click the Build Phases button at the top of the project editor. Click the disclosure triangle next to the Target Dependencies build phase. Click the + button to add a dependency. Select the application target from the target list.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/05/UnitTestTargetDependency.png" alt="UnitTestTargetDependency" width="186" height="106" border="0" /></p>
<h3>Configuring the Unit Test Bundle</h3>
<p>If you are unit testing an application, you must configure the unit test bundle. There are two build settings you must configure: Bundle Loader and Test Host. The Bundle Loader build setting is in the Linking collection, and the Test Host build setting is in the Unit Testing collection. You must set the value of these build settings to the location of the application&#8217;s executable file. For an application named MyApp, the value of the Bundle Loader and Test Host build settings would be the following:</p>
<pre>$(BUILT_PRODUCTS_DIR)/MyApp.app/Contents/MacOS/MyApp (Mac)</pre>
<pre>$(BUILT_PRODUCTS_DIR)/MyApp.app/MyApp (iOS)</pre>
<p>iOS applications running in the simulator should leave the Test Host build setting blank. The simulator does not support application-hosted unit tests. If you set the Test Host build setting, you will get a warning when building the unit testing target and the tests will not run.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/05/setting-up-ocunit-unit-testing-in-xcode-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Downloading Xcode Without Using the Mac App Store</title>
		<link>http://meandmark.com/blog/2012/05/downloading-xcode-without-using-the-mac-app-store/</link>
		<comments>http://meandmark.com/blog/2012/05/downloading-xcode-without-using-the-mac-app-store/#comments</comments>
		<pubDate>Fri, 11 May 2012 19:13:37 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=452</guid>
		<description><![CDATA[I have read many posts on Apple&#8217;s free developer forums from people having problems downloading and installing Xcode from the App Store. If you are having similar problems, there is an alternative to using the App Store. You can download Xcode from the following URL: https://developer.apple.com/downloads/index.action You can also use this URL to download older [...]]]></description>
			<content:encoded><![CDATA[<p>I have read many posts on Apple&#8217;s free developer forums from people having problems downloading and installing Xcode from the App Store. If you are having similar problems, there is an alternative to using the App Store. You can download Xcode from the following URL:</p>
<p><a href="https://developer.apple.com/downloads/index.action">https://developer.apple.com/downloads/index.action</a></p>
<p>You can also use this URL to download older versions of Xcode.</p>
<p>If you don&#8217;t have an ADC account, you will need to sign up for one to download Xcode from the URL I listed. You can get an ADC account for free.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/05/downloading-xcode-without-using-the-mac-app-store/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 4: Opening the Welcome Window</title>
		<link>http://meandmark.com/blog/2012/04/xcode-4-opening-the-welcome-window/</link>
		<comments>http://meandmark.com/blog/2012/04/xcode-4-opening-the-welcome-window/#comments</comments>
		<pubDate>Thu, 05 Apr 2012 19:14:35 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=448</guid>
		<description><![CDATA[When you launch Xcode, the default behavior is to open a welcome window. The following screenshot shows a cropped version of the welcome window: You can tell Xcode not to open the welcome window by deselecting the checkbox at the bottom of the welcome window. Suppose you deselect the checkbox and decide later you want [...]]]></description>
			<content:encoded><![CDATA[<p>When you launch Xcode, the default behavior is to open a welcome window. The following screenshot shows a cropped version of the welcome window:</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/04/Xcode-Welcome-Window-Cropped.png" border="0" alt="Xcode Welcome Window Cropped" width="459" height="517" /></p>
<p>You can tell Xcode not to open the welcome window by deselecting the checkbox at the bottom of the welcome window. Suppose you deselect the checkbox and decide later you want to open the welcome window. How do you open it?</p>
<p>In Xcode 4 choose Window &gt; Welcome to Xcode to open the welcome window.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/04/xcode-4-opening-the-welcome-window/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Custom Orthographic Projection With Pyglet</title>
		<link>http://meandmark.com/blog/2012/02/creating-a-custom-orthographic-projection-with-pyglet/</link>
		<comments>http://meandmark.com/blog/2012/02/creating-a-custom-orthographic-projection-with-pyglet/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 02:02:02 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[pyglet]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=441</guid>
		<description><![CDATA[When you create a pyglet window, pyglet sets up an OpenGL orthographic projection for the window. The size of the projection matches the size of the window. If the window is 640 pixels wide and 480 pixels wide, the orthographic projection is 640 units wide and 480 units high. Pyglet&#8217;s default behavior works well in [...]]]></description>
			<content:encoded><![CDATA[<p>When you create a pyglet window, pyglet sets up an OpenGL orthographic projection for the window. The size of the projection matches the size of the window. If the window is 640 pixels wide and 480 pixels wide, the orthographic projection is 640 units wide and 480 units high. Pyglet&#8217;s default behavior works well in many cases, but there are situations where you may want to create an orthographic projection with different dimensions. If you&#8217;re writing a tile-based game, it is convenient to size the projection in tiles instead of pixels. How do you create a custom orthographic projection?</p>
<p>Override pyglet&#8217;s on_resize() method for the window and make a call to glOrtho(). The following code provides an example of creating a custom-sized orthographic projection:</p>
<pre>@window.event</pre>
<pre>def on_resize(width, height):<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glViewport(0, 0, width, height)<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glMatrixMode(gl.GL_PROJECTION)<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glLoadIdentity()<span style="white-space: pre;"> </span><span style="white-space: pre;"> </span></pre>
<pre></pre>
<pre><span style="white-space: pre;">	</span>projectionWidth = 24<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>projectionHeight = 16<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glOrtho(0, projectionWidth, 0, projectionHeight, -1, 1)<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glMatrixMode(gl.GL_MODELVIEW)<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>glLoadIdentity()<span style="white-space: pre;"> </span></pre>
<pre><span style="white-space: pre;">	</span>return pyglet.event.EVENT_HANDLED</pre>
<p>My example copies what the default on_resize() method does, but I supply a custom width and height to glOrtho().</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/02/creating-a-custom-orthographic-projection-with-pyglet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Xcode 4.3 Changes</title>
		<link>http://meandmark.com/blog/2012/02/xcode-4-3-changes/</link>
		<comments>http://meandmark.com/blog/2012/02/xcode-4-3-changes/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 18:58:28 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>
		<category><![CDATA[xcode book]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=439</guid>
		<description><![CDATA[Apple recently released Xcode 4.3. I did not notice many changes in Xcode 4.3, not enough for me to update Xcode Tools Sensei. This post details what changed in Xcode 4.3. The Xcode Tools Are Packaged in a Single Application The biggest change in Xcode 4.3 is how Xcode is installed and packaged. Previous versions of [...]]]></description>
			<content:encoded><![CDATA[<p>Apple recently released Xcode 4.3. I did not notice many changes in Xcode 4.3, not enough for me to update <em>Xcode Tools Sensei</em>. This post details what changed in Xcode 4.3.</p>
<h3>The Xcode Tools Are Packaged in a Single Application</h3>
<p>The biggest change in Xcode 4.3 is how Xcode is installed and packaged. Previous versions of Xcode required you to run an installer that installed the Xcode Tools in /Developer or another directory. Xcode 4.3 works like a typical Mac application, where the Xcode Tools appear as a single application in the Finder and install in your Applications folder. Xcode 4.3 is easier to install, uninstall, and update.</p>
<h4>Launching Other Developer Tools</h4>
<p>Since Xcode 4.3 is a single application you may be wondering how to launch the other tools that come with Xcode, such as Instruments. Launch them from Xcode by choosing Xcode &gt; Open Developer Tool. Choose the tool you want to launch from the submenu. If the tool you want to launch is not in the submenu, choose More Developer Tools. Choosing More Developer Tools takes you to Apple&#8217;s developer downloads page, where you can download and install additional tools. If you want to run the Mac OpenGL developer tools that I cover in Chapter 11 of <em>Xcode Tools Sensei</em>, you must choose More Developer Tools and install the Graphics Tools for Xcode package from Apple&#8217;s developer page. Download the disk image and drag the applications to your Applications folder.</p>
<p>I don&#8217;t know how to add tools to Xcode&#8217;s Open Developer Tool menu. I downloaded the Graphics Tools for Xcode package and copied the applications to the Contents/Applications folder inside Xcode&#8217;s application bundle, but the applications did not appear in the Open Developer Tool menu. I asked about adding tools to the Open Developer Tool menu on Apple&#8217;s paid developer forums, but I have not received any answers.</p>
<p><strong>Update (February 22, 2012)</strong></p>
<p>I received an answer on Apple&#8217;s developer forums to my question on adding tools to the Open Developer Tool menu. You can read the solution by reading user18861&#8242;s answer to the following question on the Ask Different website:</p>
<p><a href="http://apple.stackexchange.com/questions/40662/in-xcode-4-3-where-do-i-put-the-additional-tools">In Xcode 4.3, where do I put the additional tools?</a></p>
<p>When the answer mentions /Applications and /Resources, it means the Applications and Resources folders inside Xcode&#8217;s application bundle.</p>
<h4>Installing Command-Line Tools</h4>
<p>Xcode 4.3 does not initially install a copy of command-line tools that allow you to compile programs from the Terminal. You can install the command-line tools from Xcode&#8217;s Downloads preferences.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/02/Xcode4InstallCommandLineTools.png" border="0" alt="Xcode4InstallCommandLineTools" width="600" height="199" /></p>
<h4>Accessing File and Project Templates</h4>
<p>Because Xcode 4.3 does not reside in a Developer folder, you must open the Xcode 4.3 application bundle to access things like Apple&#8217;s file and project templates. Select Xcode from the Finder, right-click, and choose Show Package Contents to examine the application bundle. The most interesting directory in Xcode&#8217;s application bundle is the following directory:</p>
<pre>Contents/Developer</pre>
<h3>Auto Layout</h3>
<p>Cocoa application projects created with Xcode 4.3 enable auto layout. If you don&#8217;t want to use auto layout, select the xib file from the project navigator, open the file inspector, and deselect the Use Auto Layout checkbox.</p>
<h3>ARC Conversion</h3>
<p>In Xcode 4.3 you can use Xcode&#8217;s ARC migration tool to convert an existing project that uses garbage collection. Xcode 4.2 could not convert a project to ARC if the project used garbage collection.</p>
<h3>Developer Mode</h3>
<p>When you build your first project in Xcode 4.3 an alert may open asking if you want to enter developer mode. Entering developer mode lets you do things like debug your project without Xcode asking you for your user account&#8217;s password.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/02/xcode-4-3-changes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Pyglet on 64-bit Macs</title>
		<link>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/</link>
		<comments>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 19:03:25 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Game Development]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[pyglet]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=434</guid>
		<description><![CDATA[Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the pyglet site, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn&#8217;t work with 64-bit applications. Not working with 64-bit applications is a [...]]]></description>
			<content:encoded><![CDATA[<p>Pyglet is a technology to write cross-platform OpenGL games and applications in Python. If you go to the <a href="http://www.pyglet.org">pyglet site</a>, you will find installers for Mac OS X and Windows. The current Mac version of the installer, 1.1.4, uses Carbon, which means it doesn&#8217;t work with 64-bit applications. Not working with 64-bit applications is a problem if you&#8217;re running Mac OS X 10.6 and later. Version 1.2 uses Cocoa and works with 64-bit applications, but an installer is not currently available because 1.2 is still in development. Until an installer for 1.2 becomes available, you will have to install pyglet from source code to use version 1.2.</p>
<h3>Install Mercurial</h3>
<p>The source code for pyglet is in a Mercurial repository. If you do not have Mercurial installed on your computer, you must install it to be able to install pyglet 1.2. Installers for Mac OS X and Windows are available at the <a href="http://mercurial.selenic.com">Mercurial site</a>.</p>
<h3>Clone the Repository</h3>
<p>Cloning the pyglet repository gives you a copy of the source code so you can install pyglet. Launch the Terminal application, navigate to where you want the source code to reside, and run the following command:</p>
<pre>hg clone https://pyglet.googlecode.com/hg/ pyglet</pre>
<p>There is a space before pyglet in the last part of the URL. You should see a pyglet folder after cloning the repository.</p>
<h3>Install Pyglet</h3>
<p>After cloning the repository, it&#8217;s time to install pyglet. In the Terminal application go to the pyglet folder and run the following command:</p>
<pre>python setup.py install</pre>
<p>Now pyglet should be installed and you can start coding.</p>
<h3>Install AVbin</h3>
<p>Installing pyglet alone has one limitation. It can play only uncompressed audio files. To play compressed audio files, such as MP3 and Ogg Vorbis files, with pyglet, you must install the AVbin library, which is what pyglet uses to play compressed audio. There are multiple versions available for Mac OS X, Windows, and Linux on the <a href="http://avbin.github.com/AVbin/Download.html">AVbin download page</a>. Those of you running Mac OS X 10.6 and later should download a version that supports 64-bit Intel.</p>
<p>After downloading AVbin, you must install it from the Terminal application. Navigate to the avbin folder (the latest name of the folder on Mac OS X is avbin-darwin-x86-64-v8) and enter the following command:</p>
<pre>sudo bash install.sh</pre>
<p>Running the installation script installs AVbin and lets you play compressed audio files with pyglet.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/installing-pyglet-on-64-bit-macs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using SDL with Xcode 4</title>
		<link>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/</link>
		<comments>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 19:31:36 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[SDL]]></category>
		<category><![CDATA[Xcode]]></category>
		<category><![CDATA[xcode 4]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=432</guid>
		<description><![CDATA[Apple changed the format for project templates in Xcode 4. The format change means the Xcode templates that ship with the Mac version of SDL don&#8217;t work in Xcode 4. If you have both Xcode 3 and 4 installed on your Mac, you can create a project that uses SDL in Xcode 3 and open [...]]]></description>
			<content:encoded><![CDATA[<p>Apple changed the format for project templates in Xcode 4. The format change means the Xcode templates that ship with the Mac version of SDL don&#8217;t work in Xcode 4. If you have both Xcode 3 and 4 installed on your Mac, you can create a project that uses SDL in Xcode 3 and open it in Xcode 4. But if you&#8217;re running Xcode 10.7 and don&#8217;t have Xcode 3 installed, you&#8217;re stuck with Xcode 4 and can&#8217;t use the SDL project templates. But you can use Xcode 4 to create SDL applications without too much hassle.</p>
<h3>Create a Cocoa Application Project</h3>
<p>When you create a project in Xcode, select the Cocoa Application project, as you can see in the following screenshot:</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep1.png" border="0" alt="Xcode4CocoaProjectStep1" width="600" height="404" /></p>
<p>The Mac OS X version of SDL is written with Cocoa so a Cocoa application project is the closest template to the old SDL project templates. Click the Next button to move to the next step where you name the project.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/Xcode4CocoaProjectStep2.png" border="0" alt="Xcode4CocoaProjectStep2" width="600" height="404" /></p>
<p>Deselect the Create Document-Based Application, Use Core Data, and Use Automatic Reference Counting checkboxes. SDL games don&#8217;t use Core Data or Apple&#8217;s NSDocument class. Automatic Reference Counting is for Objective-C code, which most of you won&#8217;t use if you&#8217;re using SDL. If you want to unit test your game with OCUnit, select the Include Unit Tests checkbox. My <a href="http://meandmark.com/blog/2010/11/using-xcode-to-unit-test-sdl-games-written-in-c/">Using Xcode to Unit Test SDL Games Written in C++</a> post has detailed information on using OCUnit to unit test C++ code.</p>
<p>Click the Next button to move on to the final step of creating a project. Pick a location to save the project and click the Create button. If you want to place your project in a local git repository, select the checkbox to create the repository.</p>
<h3>Remove Unwanted Files from the Project</h3>
<p>Apple&#8217;s Cocoa application project template contains files that are not needed for SDL games. You can remove the xib file and source code files from the project: any files ending in .xib, .m, and .h. In Xcode 4.2 you would delete the following files: main.m, MainMenu.xib, AppDelegate.h, and AppDelegate.m. Select a file and choose Edit &gt; Delete to delete the file from the project. An alert opens. If you click the Delete button, Xcode deletes the file instead of moving it to the Trash. Clicking the Remove Reference button is the safer option. My <a href="http://meandmark.com/blog/2011/05/xcode-4-removing-files-from-a-project/">Xcode 4: Removing Files from a Project</a> post has additional information on removing files from a project.</p>
<h3>Add the SDL Framework to the Project</h3>
<p>Now it&#8217;s time to add the SDL framework to the project. Select the project file from the project navigator to open the project editor. Select your target from the left side of the project editor. Click the Summary button at the top of the editor to see a list of linked frameworks. Click the + button to add a framework. More information on adding frameworks is in my <a href="http://meandmark.com/blog/2011/03/xcode-4-adding-a-framework-to-your-project/">Xcode 4: Adding a Framework to Your Project</a> post. Click the + button to add any additional frameworks, such as OpenGL, SDL_image, and SDL_mixer.</p>
<h3>Add SDLMain to the Project</h3>
<p>The Mac version of SDL uses two files, SDLMain.m and SDLMain.h, that contain glue code for running SDL code on Mac OS X. The SDL project templates include these files, but in Xcode 4 you must add them to your project. Choose File &gt; Add Files to ProjectName to add the files. After adding the SDLMain files to the project, you can start coding.</p>
<h3>Add Search Paths</h3>
<p>When I tried to build a SDL project with Xcode 4, I got a build error saying that the file SDL.h was not found. The solution was to add the following search path to the Header Search Paths build setting:</p>
<p>/Library/Frameworks/SDL.framework/Headers</p>
<p>You may also need to add a search path to the Framework Search Paths build setting, but I didn&#8217;t need to add a path. You may also need to specify additional search paths if you use additional frameworks, such as SDL_image and SDL_mixer. My <a href="http://meandmark.com/blog/2011/03/xcode-4-accessing-build-settings/">Xcode 4: Accessing Build Settings</a> post has detailed information on accessing build settings in Xcode 4.</p>
<h3>Copy the SDL Framework to Your Application Bundle</h3>
<p>The SDL Xcode project templates copy the SDL framework to your application bundle. Copying the framework to the application bundle allows someone to play your SDL game without having SDL installed. If you want the SDL framework added to your application bundle, add a Copy Files build phase to your target and add the SDL framework to the build phase.</p>
<ol>
<li>Select the project file from the project navigator to open the project editor.</li>
<li>Select the target from the left side of the project editor.</li>
<li>Click the Build Phases button at the top of the editor.</li>
<li>Click the Add Build Phase button at the bottom of the editor.</li>
<li>Choose Add Copy Files from the menu.</li>
<li>Drag the SDL framework from the project navigator to the table in the Copy Files build phase.</li>
<li>Choose Frameworks from the Destination menu.</li>
</ol>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/SDLCopyFilesBuildPhase.png" border="0" alt="SDLCopyFilesBuildPhase" width="600" height="163" /></p>
<p>If you have additional frameworks to copy to the application bundle, repeat Step 6 for those frameworks. Don&#8217;t copy Apple&#8217;s frameworks to the application bundle; every Mac has Apple&#8217;s frameworks installed. Only copy third-party frameworks, such as SDL_image and SDL_mixer.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/using-sdl-with-xcode-4/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Accessing Local git Repositories in Redmine</title>
		<link>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/</link>
		<comments>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/#comments</comments>
		<pubDate>Fri, 06 Jan 2012 19:21:30 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[scm]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[redmine]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=427</guid>
		<description><![CDATA[For those of you who don&#8217;t know what it is, Redmine is a tool for managing software projects and tracking bugs and other issues. One of Redmine&#8217;s features is its integration with version control systems. Suppose you have a bug in your software. You fix the bug and commit the fix to the repository. You [...]]]></description>
			<content:encoded><![CDATA[<p>For those of you who don&#8217;t know what it is, <a href="http://www.redmine.org">Redmine</a> is a tool for managing software projects and tracking bugs and other issues. One of Redmine&#8217;s features is its integration with version control systems. Suppose you have a bug in your software. You fix the bug and commit the fix to the repository. You can associate the revision number of your code fix with the bug in Redmine so you know which revision fixed the bug. Redmine supports several version controls, but I&#8217;m focusing on git because git is the only one I tested.</p>
<p>Configuring a repository is not difficult in Redmine. Create a project, go to its Settings section, and click the Repository tab. But the instructions to configure the repository are misleading for local git repositories. They tell you to enter the path to the repository. If you enter the path to your local git repository, such as the following:</p>
<pre>/path/to/repository</pre>
<p>You will get a 404 error when you try to access the repository in Redmine. You must enter the path to the repository&#8217;s .git folder for Redmine to be able to access it.</p>
<pre>/path/to/repository/.git</pre>
<p>If you enter the wrong repository path, discover the 404 error, and go back to correct the error by adding .git to the path, you will notice that Redmine does not let you modify the repository path. You must delete the reference to the repository and recreate it.</p>
<p><img src="http://meandmark.com/blog/wp-content/uploads/2012/01/RedmineGitConfiguration.png" border="0" alt="RedmineGitConfiguration" width="600" height="180" /></p>
<p>Click the Delete button, which is in the bottom right corner of the screenshot, to delete the reference to the repository. After deleting the reference, choose a version control system from the SCM menu and reenter the path to the repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/accessing-local-git-repositories-in-redmine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding Items to NSTextView&#8217;s Contextual Menu</title>
		<link>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/</link>
		<comments>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/#comments</comments>
		<pubDate>Tue, 03 Jan 2012 20:36:28 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[cocoa]]></category>
		<category><![CDATA[Mac Development]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=424</guid>
		<description><![CDATA[When you add a text view to your application using Interface Builder you get access to the text view&#8217;s default contextual menu. You can open the contextual menu in your application by right-clicking (or control-clicking) in the text view. This menu lets you do things like cut, copy, paste, and check the document for spelling [...]]]></description>
			<content:encoded><![CDATA[<p>When you add a text view to your application using Interface Builder you get access to the text view&#8217;s default contextual menu. You can open the contextual menu in your application by right-clicking (or control-clicking) in the text view. This menu lets you do things like cut, copy, paste, and check the document for spelling errors. If you&#8217;ve read Aaron Hillegass&#8217;s Cocoa programming book you know how to replace the default contextual menu, but you may want to use the default menu and add some menu items to it. If you&#8217;re writing an HTML editor, you may want to add a menu item to wrap HTML tags around selected text. This post shows you how to add a menu item to NSTextView&#8217;s contextual menu.</p>
<h3>Accessing the Contextual Menu</h3>
<p>The first step to adding an item to a text view&#8217;s contextual menu is to access the menu. You can access NSTextView&#8217;s default contextual menu using the menu: method.</p>
<pre>IBOutlet NSTextView* textView;</pre>
<pre>NSMenu* textViewContextualMenu = [textView menu];</pre>
<h3>Adding a Menu Item to the Contextual Menu</h3>
<p>After you get access to the contextual menu, call NSMenu&#8217;s addItemWithTitle: method to add a menu item to the contextual menu. You must supply three pieces of information: the name of the menu item, the action, and the keyboard equivalent for the menu item. The action is the method that gets called when the user chooses the menu item. The following example adds a Tags menu item to the contextual menu with no keyboard equivalent:</p>
<pre>- (IBAction)createTag:(id)sender;</pre>
<pre>NSMenuItem* tagsMenuItem = [textViewContextualMenu addItemWithTitle:@"Tags" action:@selector(createTag:) keyEquivalent:@""];</pre>
<p>If you want to place a menu item in a specific place in the contextual menu, call NSMenu&#8217;s insertItemWithTitle: method. This method works similarly to the addItemWithTitle: method, but there is an additional argument to specify: the index (location in the menu) where you want to insert the menu item.</p>
<h3>Adding a Submenu</h3>
<p>Sometimes you need to add a submenu to a menu item. In the example I&#8217;ve been using in this article, you may decide to add a menu of tags as a submenu of the Tags menu so the user can add a specific tag. Call the contextual menu&#8217;s setSubmenu: method to add a submenu. Supply the menu to add and the menu item where you&#8217;re adding the menu. The following example adds a menu of tags to the Tags menu item:</p>
<pre>IBOutlet NSMenu* tagsMenu;</pre>
<pre>[textViewContextualMenu setSubmenu:tagsMenu forItem:tagsMenuItem];</pre>
<p>The example assumes you created a menu in Interface Builder. Add a NSMenu object to the xib file, and add items to the NSMenu object. Creating a menu in Interface Builder is generally easier than creating a menu programmatically, but you can create the menu in your source code if you want. Refer to the <em>NSMenu Class Reference</em>, which is part of Apple&#8217;s documentation, to learn more about creating a menu in code. Searching for NSMenu in Xcode&#8217;s documentation window should be enough to find the class reference.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2012/01/adding-items-to-nstextviews-contextual-menu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Interface Instrument</title>
		<link>http://meandmark.com/blog/2011/12/user-interface-instrument/</link>
		<comments>http://meandmark.com/blog/2011/12/user-interface-instrument/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 17:00:26 +0000</pubDate>
		<dc:creator>mark</dc:creator>
				<category><![CDATA[Instruments]]></category>

		<guid isPermaLink="false">http://meandmark.com/blog/?p=422</guid>
		<description><![CDATA[The User Interface instrument records the user interaction with your Mac application and lets you replay the recording. This instrument records every event that occurs when you run the application. Choose the UI Recorder template to use the User Interface instrument. Before You Trace User Interface recording requires the Enable access for assistive devices checkbox [...]]]></description>
			<content:encoded><![CDATA[<p>The User Interface instrument records the user interaction with your Mac application and lets you replay the recording. This instrument records every event that occurs when you run the application. Choose the UI Recorder template to use the User Interface instrument.</p>
<h2>Before You Trace</h2>
<p>User Interface recording requires the Enable access for assistive devices checkbox to be selected in the Universal Access section of Apple&#8217;s System Preferences. The System Preferences application should be in your Applications folder.</p>
<h2>User Interface Instrument Results</h2>
<p>When you finish a trace with the User Interface instrument, it shows the following information for each event:</p>
<ul>
<li>Sample number.</li>
<li>A thumbnail image of where the event happened.</li>
<li>Triggers, whose purpose escapes me. For me it always shows an image of a menu with Triggers as the menu choice.</li>
<li>The type of event, such as mouse button down, mouse moved, and key down.<span style="white-space: pre;"> </span></li>
<li>Key, which tells you the key that was pressed for a keyboard event.<span style="white-space: pre;"> </span></li>
<li>Title, which is the title of the view where the event occurred: window, view, control, menu, etc. <span style="white-space: pre;"> </span></li>
<li>Location, which tells you the location of the event. Mouse button events are the most common events to have a location.</li>
</ul>
<p>Don’t worry if you see lots of samples with blank values in the Key, Title, and Location columns. That’s normal behavior. In the track pane mouse events are blue, keyboard events are green, and system events are yellow.</p>
<h2>Replaying what the User Interface Instrument Recorded</h2>
<p>To replay a sequence you recorded, you must first finish a trace by clicking the Stop button. The Record button now has the title Drive and Record. Click the Drive and Record button to replay the recording. Instruments creates a new run and replays the event sequence.</p>
]]></content:encoded>
			<wfw:commentRss>http://meandmark.com/blog/2011/12/user-interface-instrument/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

