<?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>classes | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/classes/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Mon, 20 Apr 2020 09:39:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>classes | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>C++ Asteroids is progressing</title>
		<link>https://learncgames.com/c-asteroids-is-progressing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=c-asteroids-is-progressing</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 27 Apr 2020 23:00:08 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Ebook]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[classes]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=477</guid>

					<description><![CDATA[<p>This is a screenshot of it as it stands and yes those asteroids are moving! It looks identical to the C version; the only difference is the code, not the appearance. What makes it interesting is the structure. The Player and Asteroids classes both inherit from a Common base class that has all the position [&#8230;]</p>
The post <a href="https://learncgames.com/c-asteroids-is-progressing/">C++ Asteroids is progressing</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="alignleft size-medium wp-image-478" src="https://learncgames.com/wp-content/uploads/2020/04/c__asteroids-300x226.png" alt="C++ Asteroids" width="300" height="226" srcset="https://learncgames.com/wp-content/uploads/2020/04/c__asteroids-300x226.png 300w, https://learncgames.com/wp-content/uploads/2020/04/c__asteroids.png 604w" sizes="(max-width: 300px) 100vw, 300px" />This is a screenshot of it as it stands and yes those asteroids are moving! It looks identical to the C version; the only difference is the code, not the appearance.</p>
<p>What makes it interesting is the structure. The Player and Asteroids classes both inherit from a Common base class that has all the position and move data.</p>
<p>It took a bit of time to get the overall architecture right. There&#8217;s a Game class which manages everything; the Player, Asteroid and Lib classes.  But Asteroids and Player classes also use the Lib class so  it took a bit of faffing around to make them all play happily together.</p>
<p>This is the biggest difference between C++ and C; the classes and how they all fit together. My biggest source of frustration has been arm wrestling with the C++ compiler; it sometimes seems as if never get easier! Sometimes a wrongly placed semicolon can generate hundreds of compile errors&#8230;</p>
<p>It took half a day to get it right and bullets should fit in much easier. Mind you I&#8217;ve had to incorporate two static variables in the Common class. One is a copy of the SDL renderer; this is needed to draw things on screen. The other is a pointer to the Game class so that I can access the DebugFlag state.  This is used to show debug information but I may be able to move the flag itself into the Common base class and change it through a call on a Player method. So long as it is static then changing it for the Player also changes it for the Asteroids and Bullets.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/c-asteroids-is-progressing/">C++ Asteroids is progressing</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">477</post-id>	</item>
	</channel>
</rss>
