<?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>WebProNews &#187; XNA</title>
	<atom:link href="http://www.webpronews.com/tag/xna/feed" rel="self" type="application/rss+xml" />
	<link>http://www.webpronews.com</link>
	<description>Breaking News in Tech, Search, Social, &#38; Business</description>
	<lastBuildDate>Mon, 13 Feb 2012 00:06:57 +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>Assigining a TypeConverter to a Class you Don&#8217;t Own</title>
		<link>http://www.webpronews.com/assigining-a-typeconverter-to-a-class-you-dont-own-2006-10</link>
		<comments>http://www.webpronews.com/assigining-a-typeconverter-to-a-class-you-dont-own-2006-10#comments</comments>
		<pubDate>Thu, 12 Oct 2006 19:43:12 +0000</pubDate>
		<dc:creator>Paul Kinlan </dc:creator>
				<category><![CDATA[Search]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[C  ]]></category>
		<category><![CDATA[Delicious]]></category>
		<category><![CDATA[Digg]]></category>
		<category><![CDATA[TypeConverter]]></category>
		<category><![CDATA[Vector 2]]></category>
		<category><![CDATA[XNA]]></category>
		<category><![CDATA[Yahoo]]></category>

		<guid isPermaLink="false">http://www.webpronews.com/?p=32044</guid>
		<description><![CDATA[I ran into problems with the XNA Beta1, where by I had a class that had a Vector2 struct in.
]]></description>
			<content:encoded><![CDATA[<p>I ran into problems with the XNA Beta1, where by I had a class that had a Vector2 struct in.</p>
<p>The problem with the XNA Vector2 struct is that there is no TypeConverter for it at the moment.  This means that there is no support in the designer.  </p>
<p>I initially solved this problem by assigning a type converter to the public property on my class that used the Vector2. (see below)</p>
<p><code>public class A<br />
{<br />
&nbsp;&#038;nbsp private Vector2 v;<br />
&nbsp;&nbsp;[TypeConverter(typeof(Vector2Converter))]<br />
&nbsp;&nbsp;public Vector2 Vec<br />
&nbsp;&nbsp;{<br />
&nbsp;&nbsp;&nbsp;get{ return v; }<br />
&nbsp;&nbsp;&nbsp;set{ v= value}<br />
&nbsp;&nbsp;}<br />
}</code></p>
<p>However, VS2005, when serializing out to code from the designer, it will not obey the TypeConverter on the property, but will try to use the Type&#8217;s Conveter eventhough the designer will use the TypeConverter on your class to edit the control&#8230; clear as mud? <img src='http://www.webpronews.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>This leads to ugly code in the InitializeCode method that tries to look in the resource file to get the object out.  I didn&#8217;t like this solution because it looks ugly and is hard to maintain.</p>
<p>I solved this problem by forcing the TypeConverter on to the Vector2.  In my classes constructor I called the following code I have created.</p>
<p><code>public static void Register&lt;T, TC&gt;() where TC: TypeConverter<br />
{<br />
&nbsp;&nbsp; Attribute[] attr = new Attribute[1];<br />
&nbsp;&nbsp;TypeConverterAttribute vConv = new TypeConverterAttribute(typeof(TC));<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;attr[0] = vConv;<br />
&nbsp;&nbsp;TypeDescriptor.AddAttributes(typeof(T), attr);<br />
}</code></p>
<p>The above code adds the TypeConverter (TC) to the Type (T) so that the designer can serialize to code correctly using my own TypeConverter.  The main thing it is doing is calling: <b>TypeDescriptor.AddAttributes</b></p>
<p>The solution then allows the Designer to serialize to code and it gets rid of having to serialize the object to a resource file.  The solution would look like the code below.</p>
<p><code>public class A {<br />
&nbsp;&nbsp;  private Vector2 v;<br />
&nbsp; &nbsp; //Enables Designer support, so it can be edited<br />
&nbsp; &nbsp; [TypeConverter(typeof(Vector2Converter))]<br />
&nbsp; &nbsp; public Vector2 Vec {<br />
&nbsp; &nbsp; &nbsp; get{ return v; }<br />
&nbsp; &nbsp; &nbsp; set{ v= value}<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; public A() {<br />
&nbsp; &nbsp; &nbsp; //Enables designer serialization to code<br />
&nbsp; &nbsp; &nbsp; ConverterRegistration.Register<Vector2 , Vector2Converter>();<br />
&nbsp; &nbsp; }<br />
}</code></p>
<p>Tags:  <a href="http://www.kinlan.co.uk/tag/c#" class="bluelink">c#</a>, <a href="http://www.kinlan.co.uk/tag/.net" class="bluelink">.net</a>, <a href="http://www.kinlan.co.uk/tag/TypeConverter" class="bluelink">TypeConverter</a>, <a href="http://www.kinlan.co.uk/tag/XNA" class="bluelink">XNA</a>, <a href="http://www.kinlan.co.uk/tag/Vector2" class="bluelink">Vector2</a></p>
<p>Technorati: </p>
<p>Add to <a href="http://del.icio.us/post"onclick="window.open('http://del.icio.us/post?v=4&#038;partner=wpn&#038;noui&#038;jump=close&#038;url='+encodeURICo  mponent(location.href)+'&#038;title ='+encodeURIComponent(document.title),'delicious','toolbar=no,width=700,height=400'); return   false;" CLASS="printMailTop"><img src=http://images1.ientrymail.com/webpronews/delicious-pic.png border=0> Del.icio.us</a> |   <a  href="javascript:voidwindow.open('http://digg.com/submit?phase=2&#038;url='+encodeURIComponent(window.location.href)+'&#038;ei=UTF-8','  popup','width=520px,height=420px,status=0,location=0,resizable=1,scrollbars=1,left=100,top=50',0)"><img   src=http://images1.ientrymail.com/webpronews/digg-pic.png border=0> Digg</a>  | <a href="javascript:void   window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&#038;u='+encodeURICompo  nent(window.location.href),'popup','width=520px,height=420px,status=0,location=0,resizable=1,scrollbars=1,left=100,top=50',0)   "><img src=http://images1.ientrymail.com/webpronews/yahoo-pic.png border=0> Yahoo! My Web</a> | <a href="javascript:location.href='http://www.furl.net/storeIt.jsp?u='+encodeURIComponent(document.location.href)+'&#038;t='+encodeUR  IComponent(document.title)+' '"><img src=http://images1.ientrymail.com/webpronews/furl-pic.png border=0> Furl</a></p>
<p>Bookmark WebProNews: <a href=http://www.webpronews.com><img src=http://images.ientrymail.com/webpronews/wpn-readit.jpg border=0></a></p>
<p>Paul Kinlan is the author of the popular <a href="http://www.kinlan.co.uk/">C#, .Net Framework blog</a>. Paul is an Analyst Developer working in Southport, England.  Paul has several years experience developing and designing massively scalable enterprise systems on UNIX and Windows based architectures. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.webpronews.com/assigining-a-typeconverter-to-a-class-you-dont-own-2006-10/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XNA Hones C# For Game Programmers</title>
		<link>http://www.webpronews.com/xna-hones-c-for-game-programmers-2006-04</link>
		<comments>http://www.webpronews.com/xna-hones-c-for-game-programmers-2006-04#comments</comments>
		<pubDate>Thu, 06 Apr 2006 18:53:22 +0000</pubDate>
		<dc:creator>WebProNews Staff</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[C  ]]></category>
		<category><![CDATA[Xbox]]></category>
		<category><![CDATA[XNA]]></category>

		<guid isPermaLink="false">http://www.webpronews.com/?p=28316</guid>
		<description><![CDATA[Although it still isn't ready for prime time, Microsoft did give game developers and C# programmers the chance to take a peek at the first pre-release of the XNA Build at the Game Developers Conference last month.
]]></description>
			<content:encoded><![CDATA[<p>Although it still isn&#8217;t ready for prime time, Microsoft did give game developers and C# programmers the chance to take a peek at the first pre-release of the XNA Build at the Game Developers Conference last month.</p>
<p>Microsoft gave out a lot of copies of the XNA Build DVD to GDC 2006 attendees. Then they did something that makes the typical geek wonder why no one else does this either: they made the DVD <a href="http://www.microsoft.com/XNA/March2006DVD-WebVersion/DVD.aspx" class="bluelink">available</a> online for developers to access and install the XNA Build.</p>
<p>They also included source code for <I>MechCommander 2</I> for review. For developers, working with XNA will mean working with C#, aka &#8220;C Sharp,&#8221; Microsoft&#8217;s C variant and answer to Java.</p>
<p>The XNA Framework closely resembles the .Net Framework, but with game development-related libraries. Scott Henson, Director of Microsoft&#8217;s Advanced Technology Group, <a href=http://features.teamxbox.com/xbox/1529/Microsoft-XNA-Demonstration/p1/ class=bluelink>described</a> in a Team Xbox interview what this means for those programmers who develop games for the Xbox 360.</p>
<p>He walked through the process of taking a Windows CE game, Pocket Mahjong, and bringing on a programmer to port the game to other platforms:</p>
<p><i>
<div style=margin-left:10px; margin-right:10px;> While the programmer had little trouble moving the game over to Windows, Henson claimed that it only took a day to accomplish-and then just another day to take the same code to create an identically playing version for Xbox 360. Finally, collaborating with Henson&#8217;s team, they worked to upgrade the art and add richer backing music for the more advanced platforms. The stunner is that they were able to transform the portable game from a very simple version and turn it into fuller-featured entertainment running on Windows and Xbox 360 in less than a week&#8217;s time.</div>
<p></i><br />
Casual games, of course, can be developed and ported in shorter time frames than more involved titles. But it appears that XNA offers a way to make those games available as ports in a narrower time window as well, according to Henson&#8217;s account of the development of <i>Culture</i>, a 3D version of the venerable 2D <i>Life</i> game:</p>
<p><i>
<div style=margin-left:10px; margin-right:10px;>The player fires seeds onto the planet&#8217;s surface, which causes different-colored flowers to grow, and the proximity of like colors to each other changes the growth patterns (either by absorbing the color in the minority or by spawning another of the same color, much like a child added to a family). </p>
<p>Explaining how the program was created, Henson said that the programmer started by building a Windows version using the existing .NET Framework and learning the C# language from scratch. In just a couple of weeks, he had a working version running on the PC. From that start, he was then able to port the software and construct an identical version on Xbox 360-in a single day.</p></div>
<p></i><br />
Ideally a platform that enables speedier creation of games should lead to the development of more games for a console&#8217;s library, in this case the library for the new Xbox 360. That should lead to greater desirability for the console from new users, and then more substantial efforts by big game studios to reach that expanded userbase. </p>
<p>In turn, that should lead to greater demand for C# programmers willing to do game development with the XNA framework. And maybe even a bit of Sony&#8217;s share of the game console market too.</p>
<p>&#8212;</p>
<p>Add to <script language='javascript'> document.write("<a href='http://del.icio.us/post?url="+encodeURIComponent(document.location.href)+"&#038;title="+encodeURIComponent(document.title)+"'>Del.icio.us</a>")</script> | <a href="javascript:void window.open('http://digg.com/submit?phase=2&#038;url='+encodeURIComponent(window.location.href)+'&#038;ei=UTF-8','popup','width=520px,height=420px,status=0,location=0,resizable=1,scrollbars=1,left=100,top=50',0)">DiggThis</a> | <a href="javascript:void window.open('http://myweb2.search.yahoo.com/myresults/bookmarklet?t='+encodeURIComponent(document.title)+'&#038;u='+encodeURIComponent(window.location.href)+'&#038;tag=Xbox,XNA,C#','popup','width=520px,height=420px,status=0,location=0,resizable=1,scrollbars=1,left=100,top=50',0)">Yahoo! My Web</a> | <a href="javascript:void window.open('http://www.prefound.com/group_finds.php?cmd_url='+encodeURIComponent(window.location.href)+'&#038;cmd_title='+encodeURIComponent(document.title),'popup','width=800px,height=500px,status=0,location=0,resizable=1,scrollbars=1,left=100,top=50',0)">PreFound.com</a></p>
<p>Bookmark WebProNews: <a href=http://www.webpronews.com><img src=http://images.ientrymail.com/webpronews/wpn-readit.jpg border=0></a></p>
<p><script language=JavaScript src="http://aj.600z.com/aj/1095/0/vj?z=1&#038;dim=1088&#038;pos=15"></script></p>
<p>David Utter is a staff writer for WebProNews covering technology and business. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.webpronews.com/xna-hones-c-for-game-programmers-2006-04/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using memcached
Database Caching 1/15 queries in 0.006 seconds using memcached
Object Caching 249/281 objects using memcached

Served from: webpronews.com @ 2012-02-12 19:11:00 -->
