<?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>KillerCodingNinjaBunny</title>
	<atom:link href="http://hazelmckendrick.com/feed" rel="self" type="application/rss+xml" />
	<link>http://hazelmckendrick.com</link>
	<description>Life, Linux and Lines of Code</description>
	<lastBuildDate>Wed, 10 Mar 2010 17:36:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Search For A Star Competition</title>
		<link>http://hazelmckendrick.com/journal/search-for-a-star-competition</link>
		<comments>http://hazelmckendrick.com/journal/search-for-a-star-competition#comments</comments>
		<pubDate>Wed, 10 Mar 2010 17:34:37 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Aardvark Swift]]></category>
		<category><![CDATA[Asteroids]]></category>
		<category><![CDATA[competition]]></category>
		<category><![CDATA[Search for a Star]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1859</guid>
		<description><![CDATA[Shortly before Christmas, students in my class were invited to participate in Aardvark Swift&#8217;s Search For A Star, a games related programming competition split over several knock-out rounds.  
Although the first round was taking place on the day before an exam, myself and two other students from Abertay took part. This round involved answering [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/03/521027252_cffd1603f7.jpg"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/03/521027252_cffd1603f7-300x201.jpg" alt="" title="521027252_cffd1603f7" width="300" height="201" class="alignleft size-medium wp-image-1862" /></a>Shortly before Christmas, students in my class were invited to participate in <a href="http://www.aswift.com/html/minisites/index.jsp?minisiteId=177&#038;pageId=180">Aardvark Swift&#8217;s Search For A Star</a>, a games related programming competition split over several knock-out rounds.  </p>
<p>Although the first round was taking place on the day before an exam, myself and two other students from Abertay took part. This round involved answering ten programming questions: 9 based on the C++ language and a final question focussing more on object oriented design.  </p>
<p>I wasn&#8217;t sure what to expect beforehand (other than a vague notion that reversing a string in place might be involved) but found actually sitting the test to be quite a relief!  Although I wasn&#8217;t 100% sure all my answers were spot on, there weren&#8217;t any concepts which I was unfamiliar with.  It certainly increased my confidence (or at least reduced my sheer terror) concerning programming tests I might face when applying for a job.</p>
<p>I was pleasantly surprised to be told that I was one of the eleven programmers who had reached the second round, a more open-ended programming task.  For this we were given an uncompleted and incorrect Asteroids like game, and tasked with fixing and improving it within seven days.  Working with someone else&#8217;s code was an interesting exercise, and I aimed to uphold their programming style and standards as much as possible.  I hadn&#8217;t touched DirectX or DirectInput in some time, but I didn&#8217;t find it hard to get back into; nothing in the codebase was particularly surprising or unfamiliar.</p>
<p>The only downside of the problem was the short timespan, as I also had coursework deadlines and continued work with Digital Colony and on my dissertation to contend with.  I successfully submitted a corrected and improved application, however it would have been nice to dedicate more of my time.  I&#8217;m still waiting on the results of this stage, so I will of course update the blog when I hear back.  Since I worked on someone else&#8217;s codebase I&#8217;m unsure whether posting screenshots of the application is acceptable, however I may also follow up with those at a later date after seeking permission.</p>
<p><i>Image used under Creative Commons license from <a href="http://www.flickr.com/photos/pchee/521027252/">Computer Science Geek</a>.</i></p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/search-for-a-star-competition/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comms Library Progress</title>
		<link>http://hazelmckendrick.com/journal/comms-library-progress</link>
		<comments>http://hazelmckendrick.com/journal/comms-library-progress#comments</comments>
		<pubDate>Sun, 28 Feb 2010 21:09:02 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[dissertation]]></category>
		<category><![CDATA[multithreading]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1847</guid>
		<description><![CDATA[Unfortunately my honours project is not particularly visual, so it can be hard to update this blog with my progress when I have nothing I can really show.  However, progress is being made. The first component of the project, a communications and network library, was completed almost a week ago.
The most useful thing I [...]]]></description>
			<content:encoded><![CDATA[<p>Unfortunately my honours project is not particularly visual, so it can be hard to update this blog with my progress when I have nothing I can really show.  However, progress <i>is</i> being made. The first component of the project, a communications and network library, was completed almost a week ago.</p>
<p>The most useful thing I can share is the class diagram this was based on.  It&#8217;s rough, it doesn&#8217;t detail methods or member data, and it&#8217;s far from beautiful, but perfection is an easy trap to fall into.  I thought it was better to have a functioning library and an ugly diagram than a work of art demonstrating a library which I then would have no time to create.<br />
<img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/CommsLibClass1.png" alt="" title="CommsLibClass" width="669" height="348" class="aligncenter size-full wp-image-1852" /></p>
<p>The current phase of the project is far more interesting in my opinion, and thankfully should result in something slightly more visually interesting.  It concerns the division of the world, hierarchically, into microcells.  This spatial partitioning, and more importantly the assignment of work to specific processors is fast becoming the major focus of the project, and I hope to follow up with more on that topic shortly.</p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/comms-library-progress/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Progress Meeting Two</title>
		<link>http://hazelmckendrick.com/journal/progress-meeting-two</link>
		<comments>http://hazelmckendrick.com/journal/progress-meeting-two#comments</comments>
		<pubDate>Tue, 09 Feb 2010 10:49:07 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[dissertation]]></category>
		<category><![CDATA[Gantt Chart]]></category>
		<category><![CDATA[MPI]]></category>
		<category><![CDATA[Pathfinding]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1829</guid>
		<description><![CDATA[In preparation for my second honours project meeting I was asked to report my progress by under several headings.  Additionally, I have prepared an updated Gantt chart reflecting the changes mentioned. 

Progress

As intended, A* path-finding for characters is complete.
A better visual demonstration of this will be required later.
Several example applications were created to test [...]]]></description>
			<content:encoded><![CDATA[<p>In preparation for my second honours project meeting I was asked to report my progress by under several headings.  Additionally, I have prepared an updated <a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/plugin-GanttChart.pdf">Gantt chart</a> reflecting the changes mentioned. </p>
<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/gantt.png"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/gantt-1024x467.png" alt="" title="gantt" width="650" height="300" class="aligncenter size-large wp-image-1833" /></a></p>
<h2>Progress</h2>
<ul>
<li>As intended, A* path-finding for characters is complete.</li>
<li>A better visual demonstration of this will be required later.</li>
<li>Several example applications were created to test MPI.NET.</li>
<li>A communications library has been started.</li>
<li>Supervisor has been met once, will be met again later on the 9th.</li>
</ul>
<h2>Problems</h2>
<ul>
<li>MPI install completed.</li>
<li>However, using MPI.NET over multiple networked computers will not be possible with the<br />
currently installed OS. This misunderstanding was caused by misleading documentation,<br />
but mainly the inability to test the situation until the library was already installed.</li>
<li>Alternatives are installing Pure MPI.net, or writing a more substantial communication<br />
library.</li>
<li>Pure MPI.net may still not work without administrator privileges, and could take some time<br />
to install.</li>
<li>A more substantial library can in some parts be based on my networking coursework, and as<br />
such this option was chosen and the Gantt chart modified to reflect it.</li>
</ul>
<h2>Aims</h2>
<ul>
<li>Communication library should be complete and tested.</li>
<li>Decision should be made concerning whether MPI.NET will still be used locally.</li>
<li>Cell based world and storage for this should be in progress, ready to start adding characters<br />
to navigate it.</li>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/progress-meeting-two/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Global Game Jam 2010</title>
		<link>http://hazelmckendrick.com/journal/global-game-jam-2010</link>
		<comments>http://hazelmckendrick.com/journal/global-game-jam-2010#comments</comments>
		<pubDate>Thu, 04 Feb 2010 15:01:20 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Game Jam]]></category>
		<category><![CDATA[GGJ]]></category>
		<category><![CDATA[Glasgow Caledonian]]></category>
		<category><![CDATA[Panda Dragoon]]></category>
		<category><![CDATA[SGJ]]></category>
		<category><![CDATA[Unity]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1794</guid>
		<description><![CDATA[Over the weekend, almost 50 developers in Scotland and over 1500 crazy people worldwide opted to forgo luxuries like sleep and rest by taking part in Global Game Jam.  Perhaps unsurprisingly, you&#8217;re reading this because I was one of them. 
Scottish Game Jam, the branch of the event in which I participated, was hosted [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/timthumb.png"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/timthumb.png" alt="" title="timthumb" width="630" height="250" class="aligncenter size-full wp-image-1804" /></a><br />
Over the weekend, almost 50 developers in Scotland and over 1500 crazy people worldwide opted to forgo luxuries like sleep and rest by taking part in <a href="http://globalgamejam.org/">Global Game Jam</a>.  Perhaps unsurprisingly, you&#8217;re reading this because I was one of them. </p>
<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/hurt.jpg"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/hurt-300x158.jpg" alt="" title="hurt" width="300" height="158" class="alignleft size-medium wp-image-1806" /></a><a href="http://www.jonsykes.com/sgj/">Scottish Game Jam</a>, the branch of the event in which I participated, was hosted at <a href="http://www.gcal.ac.uk/">Glasgow Caledonian University</a>, organised by the fantastic <a href="http://www.romanakhan.com/">Romana Khan</a>.  Nine teams took part in the Saltire Centre, an impressive (though bright) space, loading up on caffeine and sleeping on couches (if at all).</p>
<p>My team <a href="http://www.jonsykes.com/sgj/?p=187">&#8220;Frat Boys from the Hood&#8221;</a> consisted of Abi, Jess, Andrew and myself from Abertay joined by Alex, a third year student from Glasgow Calendonian.  Working on a theme of deception and constraints mandating that we must include &#8220;a sink, a wink or a rink&#8221;, we built the 2d side-scroller <a href="http://globalgamejam.org/2010/panda-dragoon-bees-ice">&#8220;Panda Dragoon: Bees on Ice&#8221;</a> with the aid of the <a href="http://unity3d.com/">Unity</a> engine.</p>
<p>The game places our panda protagonist in a black and white world, fighting deceptive and equally monochrome foes.  Gliding through an ice rink, the player must switch between black and white in order to see enemies of the opposite colour.  However, switching also empowers these enemies—the player must be cautious—causing them to change form and cause increasing damage.  Luckily, the player is equipped to defeat these creatures by firing bees from its mouth.  The aim is to progress as far as possible as the game increases in speed, achieving a maximum score.</p>
<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/screen2.jpg"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/screen2-300x177.jpg" alt="" title="screen2" width="300" height="177" class="alignright size-medium wp-image-1812" /></a>Although the event overall was non-competitive in nature, Scottish Game Jam welcomed judges from Denki and Real Time Worlds to critique the resulting applications and to decide on a winning game.</p>
<p>Much to our surprise <b>We Won!</b></p>
<p>It was really reassuring to make such a self indulgent game, for ourselves and not for a nominated target audience, and yet have four out of five judges award it their highest score.  Obviously the game has flaws, we made it in <i>48 hours</i>, but with another week of tweaking at some point hopefully we can create something compelling and genuinely <i>fun</i>.</p>
<p>Overall, I had a fantastic time and would encourage any developer, especially artists, to take part next year.  It&#8217;s amazing how much you can learn and achieve in just two days.</p>
<p><a href="http://globalgamejam.org/2010/panda-dragoon-bees-ice">Download and play The Game.</a><br />
<a href="http://globalgamejam.org/">Global Game Jam</a><br />
<a href="http://www.jonsykes.com/sgj/">Scottish Game Jam</a></p>
<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/02/bees.jpg"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/02/bees.jpg" alt="" title="bees" width="650" height="220" class="aligncenter size-full wp-image-1808" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/global-game-jam-2010/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Coding Coder Art</title>
		<link>http://hazelmckendrick.com/journal/coding-coder-art</link>
		<comments>http://hazelmckendrick.com/journal/coding-coder-art#comments</comments>
		<pubDate>Fri, 22 Jan 2010 20:46:26 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[Texture Generation]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1775</guid>
		<description><![CDATA[ Starting work on a 3D project as of yet lacking in assets, I was considering cracking open Paint.Net to create some default textures.  However, being a programmer rather than an artist, I figured I&#8217;d better investigate some alternatives.  I reduced my work, and made even more hideous coder art in the process!
I [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hazelmckendrick.com/wp-content/uploads/2010/01/ca.bmp"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/01/ca.bmp" alt="" title="art" width="150" height="150" class="alignleft size-full wp-image-1780" /></a> Starting work on a 3D project as of yet lacking in assets, I was considering cracking open Paint.Net to create some default textures.  However, being a programmer rather than an artist, I figured I&#8217;d better investigate some alternatives.  I reduced my work, and made even more hideous coder art in the process!</p>
<p>I ended up trying two options: .Net Graphics support (which uses GDI) and everyone&#8217;s favourite image manipulation tool <a href="http://www.imagemagick.org/script/index.php">ImageMagick</a>.  My aim was to create bright an horrible images, to ensure they don&#8217;t remain in the project by mistake, with text on them to show what object my many cubes and spheres represent. </p>
<p>First up, my C# script.  It created the fantastic texture you see above, and can be run from a windows command line as<br />
<code> > DefaultTexGen.exe Text_To_Write FilenameToCreate.bmp</code></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Text</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Drawing</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Drawing.Imaging</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">using</span> <span style="color: #008080;">System.Drawing.Text</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #008080; font-style: italic;">//creates a default texture with text on it</span>
<span style="color: #0600FF;">namespace</span> DefaultTexGen
<span style="color: #000000;">&#123;</span>
    <span style="color: #FF0000;">class</span> Program
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//check whether arguments were passed</span>
            <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>args.<span style="color: #0000FF;">Length</span> <span style="color: #008000;">&lt;</span> <span style="color: #FF0000;">2</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Please run with arguments for image text and output file name.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                return<span style="color: #008000;">;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//get name and output file from arguments</span>
            <span style="color: #FF0000;">string</span> name <span style="color: #008000;">=</span> args<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">0</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">string</span> file <span style="color: #008000;">=</span> args<span style="color: #000000;">&#91;</span><span style="color: #FF0000;">1</span><span style="color: #000000;">&#93;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//set width and height (square), could get these from args too</span>
            <span style="color: #FF0000;">int</span> dimension <span style="color: #008000;">=</span> <span style="color: #FF0000;">256</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//create the bitmap</span>
            Bitmap genmap <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Bitmap<span style="color: #000000;">&#40;</span>dimension, dimension<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//apply the colour and text</span>
            FillTexture<span style="color: #000000;">&#40;</span>genmap<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            WriteText<span style="color: #000000;">&#40;</span>name, genmap<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//output bitmap</span>
            genmap.<span style="color: #0000FF;">Save</span><span style="color: #000000;">&#40;</span>file<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Image &quot;</span> <span style="color: #008000;">+</span> file <span style="color: #008000;">+</span> <span style="color: #666666;">&quot; created.&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #000000;">&#125;</span>
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>This relies on two further functions.  The first of these colours the image with a simple gradient, but could be replaced with any colouring function.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #008080; font-style: italic;">//fill a bitmap with a random gradient</span>
        <span style="color: #008080; font-style: italic;">//could replace with other colouring function</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> FillTexture<span style="color: #000000;">&#40;</span>Bitmap _target<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//set random r,g,b values between 0 and 1</span>
            Random rand <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Random<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">float</span> rCol <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>rand.<span style="color: #0000FF;">NextDouble</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">float</span> gCol <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>rand.<span style="color: #0000FF;">NextDouble</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">float</span> bCol <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">float</span><span style="color: #000000;">&#41;</span>rand.<span style="color: #0000FF;">NextDouble</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//fill each pixel</span>
            <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> x <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> x <span style="color: #008000;">&lt;</span> _target.<span style="color: #0000FF;">Width</span><span style="color: #008000;">;</span> x<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #0600FF;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span> y <span style="color: #008000;">=</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span> y <span style="color: #008000;">&lt;</span> _target.<span style="color: #0000FF;">Height</span><span style="color: #008000;">;</span> y<span style="color: #008000;">++</span><span style="color: #000000;">&#41;</span>
                <span style="color: #000000;">&#123;</span>
                    Color pixColour <span style="color: #008000;">=</span> Color.<span style="color: #0000FF;">FromArgb</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">255</span> <span style="color: #008000;">*</span> rCol<span style="color: #000000;">&#41;</span>, Math.<span style="color: #0000FF;">Min</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">255</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>x <span style="color: #008000;">*</span> gCol<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>, Math.<span style="color: #0000FF;">Min</span><span style="color: #000000;">&#40;</span><span style="color: #FF0000;">255</span>, <span style="color: #000000;">&#40;</span><span style="color: #FF0000;">int</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#40;</span>y <span style="color: #008000;">*</span> bCol<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                    _target.<span style="color: #0000FF;">SetPixel</span><span style="color: #000000;">&#40;</span>x, y, pixColour<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #000000;">&#125;</span>
            <span style="color: #000000;">&#125;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>The second actually writes the text to the image.  It calculates a font size to fit the given string onto the texture.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;">        <span style="color: #008080; font-style: italic;">//Fit and write text to a bitmap</span>
        <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> WriteText<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span> _text, Bitmap _target<span style="color: #000000;">&#41;</span>
        <span style="color: #000000;">&#123;</span>
            <span style="color: #008080; font-style: italic;">//calculate the font size to fit the text to the image</span>
            <span style="color: #008080; font-style: italic;">//pixel width in monospaced Courier New = 0.833 point size</span>
            <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">float</span> fontReduce <span style="color: #008000;">=</span> 0.833f<span style="color: #008000;">;</span>
            <span style="color: #0600FF;">const</span> <span style="color: #FF0000;">float</span> edgePadding <span style="color: #008000;">=</span> <span style="color: #FF0000;">20</span><span style="color: #008000;">;</span>
            <span style="color: #FF0000;">float</span> size <span style="color: #008000;">=</span> <span style="color: #000000;">&#40;</span><span style="color: #000000;">&#40;</span>_target.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">-</span> edgePadding<span style="color: #000000;">&#41;</span> <span style="color: #008000;">/</span> _text.<span style="color: #0000FF;">Length</span><span style="color: #000000;">&#41;</span> <span style="color: #008000;">/</span> fontReduce<span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//set the max font size to 25</span>
            size <span style="color: #008000;">=</span> Math.<span style="color: #0000FF;">Min</span><span style="color: #000000;">&#40;</span>size, <span style="color: #FF0000;">35</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">//set up font and graphics</span>
            StringFormat format <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> StringFormat<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            format.<span style="color: #0000FF;">Alignment</span> <span style="color: #008000;">=</span> StringAlignment.<span style="color: #0000FF;">Center</span><span style="color: #008000;">;</span>
            Font font <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Font<span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;Courier New&quot;</span>, size<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
            Graphics graphics <span style="color: #008000;">=</span> Graphics.<span style="color: #0000FF;">FromImage</span><span style="color: #000000;">&#40;</span>_target<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
            graphics.<span style="color: #0000FF;">DrawString</span><span style="color: #000000;">&#40;</span>_text, font, Brushes.<span style="color: #0000FF;">Black</span>, _target.<span style="color: #0000FF;">Width</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">2</span>, _target.<span style="color: #0000FF;">Height</span> <span style="color: #008000;">/</span> <span style="color: #FF0000;">3</span>, format<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
        <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>I&#8217;ll be honest, the second solution (with Imagemagick) is simpler, more flexible, and creates better looking textures.<br />
As an example:<br />
<code>convert -size 256x256 plasma:tomato-steelblue -font Arial -pointsize 20 -draw "text 10,20 Default_Texture" TextureToCreate.jpg</code><br />
Produces the following image:<br />
<a href="http://hazelmckendrick.com/wp-content/uploads/2010/01/tex.jpg"><img src="http://hazelmckendrick.com/wp-content/uploads/2010/01/tex.jpg" alt="" title="tex" width="256" height="256" class="aligncenter size-full wp-image-1790" /></a></p>
<p>Creating a batch/shell script to calculate the correct font size and run this command should be trivial, leading to some disgusting, but useful, textures.</p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/coding-coder-art/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Next Level Dundee Showcase Video</title>
		<link>http://hazelmckendrick.com/journal/next-level-dundee-showcase-video</link>
		<comments>http://hazelmckendrick.com/journal/next-level-dundee-showcase-video#comments</comments>
		<pubDate>Mon, 18 Jan 2010 18:35:34 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Next Level]]></category>
		<category><![CDATA[Team Be]]></category>
		<category><![CDATA[YinYangYou]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1773</guid>
		<description><![CDATA[If you&#8217;ve seen some of the videos of YinYangYou on the site, hopefully you&#8217;ll enjoy seeing the other projects which were completed as part of Next Level Dundee.  Here&#8217;s a Showcase of what was created; bear in mind we only had a week!

]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve seen some of the videos of YinYangYou on the site, hopefully you&#8217;ll enjoy seeing the other projects which were completed as part of Next Level Dundee.  Here&#8217;s a Showcase of what was created; bear in mind we only had a week!</p>
<p><object width="600" height="398"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=8813941&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=8813941&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=1&amp;show_portrait=0&amp;color=00adef&amp;fullscreen=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="600" height="398"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/next-level-dundee-showcase-video/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Proposal</title>
		<link>http://hazelmckendrick.com/journal/project-proposal</link>
		<comments>http://hazelmckendrick.com/journal/project-proposal#comments</comments>
		<pubDate>Fri, 08 Jan 2010 17:07:46 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Honours Project]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1767</guid>
		<description><![CDATA[	Fundamental to computer hardware and software developments, Moore&#8217;s law states that the number of transistors that can be fitted onto an integrated circuit increases exponentially over time.  From the 1970s to the present day, this has for the most part held true, with the number of transistors doubling approximately every two years.  While [...]]]></description>
			<content:encoded><![CDATA[<p>	<i>Fundamental to computer hardware and software developments, Moore&#8217;s law states that the number of transistors that can be fitted onto an integrated circuit increases exponentially over time.  From the 1970s to the present day, this has for the most part held true, with the number of transistors doubling approximately every two years.  While previously this could be related to gains in CPU clock speeds, leading directly to speed increases for sequential programs, in a 2004 paper Sutter demonstrated that this is no longer possible; &#8216;The free lunch is over&#8217;.</i></p>
<p>That&#8217;s right, I&#8217;ve completed my project proposal.  For formatting reasons, I&#8217;ve uploaded the rest of the document <a href='http://hazelmckendrick.com/wp-content/uploads/2010/01/Proposal.pdf'>as a PDF</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/project-proposal/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Final Proposal Outline</title>
		<link>http://hazelmckendrick.com/journal/final-proposal-outline</link>
		<comments>http://hazelmckendrick.com/journal/final-proposal-outline#comments</comments>
		<pubDate>Sat, 02 Jan 2010 13:48:14 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[dissertation]]></category>
		<category><![CDATA[draft]]></category>
		<category><![CDATA[Feedback]]></category>
		<category><![CDATA[Proposal]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1762</guid>
		<description><![CDATA[I completed a further proposal outline, reviewed by my supervisor and classmates, which I am expanding into a final proposal for the commencement of term next week.
I added a lot of content to this draft, and was unsure exactly what was appropriate to mention and what would not be suitable (either by being too simple [...]]]></description>
			<content:encoded><![CDATA[<p>I completed a further proposal outline, reviewed by my supervisor and classmates, which I am expanding into a final proposal for the commencement of term next week.</p>
<p>I added a lot of content to this draft, and was unsure exactly what was appropriate to mention and what would not be suitable (either by being too simple or more relevant in my final dissertation), so I&#8217;m glad this was cleared up.  Changes are also to be made to the overall structure of the proposal.  Finally, I&#8217;ll attempt to reduce the number of references and leave some of them for my dissertation, as apparently half a dozen references would be a more suitable amount for a proposal.  I think this reduction will largely occur naturally when I restructure the proposal, however.</p>
<p>Here&#8217;s the <a href='http://hazelmckendrick.com/wp-content/uploads/2010/01/proposal-outline-2.pdf'>second outline draft</a>, the finished proposal should be up within the next week.</p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/final-proposal-outline/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project Proposal Draft</title>
		<link>http://hazelmckendrick.com/journal/project-proposal-draft</link>
		<comments>http://hazelmckendrick.com/journal/project-proposal-draft#comments</comments>
		<pubDate>Sun, 13 Dec 2009 13:53:23 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Honours Project]]></category>
		<category><![CDATA[dissertation]]></category>
		<category><![CDATA[draft]]></category>
		<category><![CDATA[Feedback]]></category>
		<category><![CDATA[meeting]]></category>
		<category><![CDATA[Proposal]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1744</guid>
		<description><![CDATA[For my first group meeting with my supervisor Dr. Henry Fortuna and fellow students Dave and Drew, we were asked to prepare an outline of our project proposal. 
Here&#8217;s my initial outline, which I am expanding on for our next meeting and will redraft into a complete proposal over Christmas.
We discussed a number of points, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/world.png"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/world-300x297.png" alt="world" title="world" width="150" height="150" class="alignright size-medium wp-image-1749" /></a>For my first group meeting with my supervisor Dr. Henry Fortuna and fellow students <a href="http://bigdavedev.com/honours-blog/">Dave</a> and <a href="http://deaghonours.blog.co.uk/">Drew</a>, we were asked to prepare an outline of our project proposal. </p>
<p><a href='http://hazelmckendrick.com/wp-content/uploads/2009/12/ProjectProposalOutline1.pdf'>Here&#8217;s my initial outline</a>, which I am expanding on for our next meeting and will redraft into a complete proposal over Christmas.</p>
<p>We discussed a number of points, most of them common to each of our proposals.  As well as this, Dr Ozveren gave further advice during his lecture on Thursday which will be addressed in my redraft.</p>
<ul>
<li>In terms of structure, &#8220;Motivation&#8221; deals with too many points and could become condescending to someone who is familiar with the topic.  Splitting the proposal to deal with literature review under its own subheading will help to address this and to emphasise the research work which has taken place.</li>
<li>The basic outline did not make it clear which points were taken or referencing literature and which were my own, obviously this is vital in the final proposal and as such should be demonstrated in the redraft.</li>
<li>The section &#8220;Addressing the Question&#8221; might be better separated into &#8220;Issues&#8221;, &#8220;Methodology&#8221; and &#8220;Evaluation&#8221;</li>
<li>The proposal should also include objectives and milestones, and optionally constraints, assumptions and risks.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/project-proposal-draft/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>YinYangYou at Dundee Winter Light Night</title>
		<link>http://hazelmckendrick.com/journal/yinyangyou-at-dundee-winter-light-night</link>
		<comments>http://hazelmckendrick.com/journal/yinyangyou-at-dundee-winter-light-night#comments</comments>
		<pubDate>Wed, 02 Dec 2009 18:41:22 +0000</pubDate>
		<dc:creator>Hazel</dc:creator>
				<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://hazelmckendrick.com/?p=1710</guid>
		<description><![CDATA[Last Friday night, YinYangYou was projected onto a giant canvas in the street so members of the public could play the  game against each other.  It was probably the biggest and loudest I&#8217;m likely to see a game I&#8217;ve worked on, and suffice to say was awesome.
The display was one of many attractions [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270389.JPG"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270389-172x300.jpg" alt="PB270389" title="PB270389" width="142" height="230" class="alignright size-medium wp-image-1705" /></a>Last Friday night, <a href="http://hazelmckendrick.com/demos/xna-game-yinyangyou">YinYangYou</a> was projected onto a giant canvas in the street so members of the public could play the  game against each other.  It was probably the biggest and loudest I&#8217;m likely to see a game I&#8217;ve worked on, and suffice to say was <b><u>awesome</u></b>.</p>
<p>The display was one of many attractions and events arranged around the city for <a href="http://www.dundee.com/winter-light-night.html">Dundee Winter Light Night</a> which, judging from the huge crowds, was a great success.  Despite the freezing cold, plenty of visitors came to try YinYangYou and it was fantastic to see even young children be able to pick up and play the game.  Hopefully the Winter Light Night will be organised again next year, perhaps with other student made games taking part.</p>
<p>&nbsp;<br />
<div id="attachment_1709" class="wp-caption alignleft" style="width: 160px"><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270432.JPG"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270432-150x150.jpg" alt="Banner ad in the center of town." title="PB270432" width="150" height="150" class="size-thumbnail wp-image-1709" /></a><p class="wp-caption-text">Banner ad in the center of town.</p></div> <div id="attachment_1707" class="wp-caption alignleft" style="width: 160px"><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270402.JPG"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270402-150x150.jpg" alt="Me!" title="Me" width="150" height="150" class="size-thumbnail wp-image-1707" /></a><p class="wp-caption-text">Me!</p></div> <div id="attachment_1706" class="wp-caption alignleft" style="width: 160px"><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270392.JPG"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270392-150x150.jpg" alt="The game from above in the Overgate center." title="PB270392" width="150" height="150" class="size-thumbnail wp-image-1706" /></a><p class="wp-caption-text">The game from above in the Overgate center.</p></div> <div id="attachment_1708" class="wp-caption alignleft" style="width: 160px"><a href="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270415.JPG"><img src="http://hazelmckendrick.com/wp-content/uploads/2009/12/PB270415-150x150.jpg" alt="The projection and players" title="" width="150" height="150" class="size-thumbnail wp-image-1708" /></a><p class="wp-caption-text">The projection and players</p></div></p>
<p><center><object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/mxvICBtPOaU&#038;hl=en_GB&#038;fs=1&#038;rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/mxvICBtPOaU&#038;hl=en_GB&#038;fs=1&#038;rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></center></p>
]]></content:encoded>
			<wfw:commentRss>http://hazelmckendrick.com/journal/yinyangyou-at-dundee-winter-light-night/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
