<?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>asteroids | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/asteroids/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>Tue, 13 Dec 2022 10:14:14 +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>asteroids | 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>Update to the Windows eBook</title>
		<link>https://learncgames.com/update-to-the-windows-ebook/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=update-to-the-windows-ebook</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sun, 27 Nov 2022 11:28:17 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Ebook]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[SDL]]></category>
		<category><![CDATA[asteroids]]></category>
		<category><![CDATA[Sounds]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=3101</guid>

					<description><![CDATA[<p>A reader asked me how to setup SDL2 for Windows given recent changes in SDL2. Specifically the files and libsdl projects have been moved from the libsdl.org website to GitHub. You can easily find SDL2 Image, Mixer, TTF etc. However it can still be quite daunting setting up Visual Studio for SDL2. You have to [&#8230;]</p>
The post <a href="https://learncgames.com/update-to-the-windows-ebook/">Update to the Windows eBook</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:45,&quot;href&quot;:&quot;https:\/\/github.com\/David-H-Bolton\/LearnC\/blob\/master\/New%20Instructions%20for%20setting%20up%20SDL2%20files%20on%20Windows.pdf&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20221223025630\/https:\/\/github.com\/David-H-Bolton\/LearnC\/blob\/master\/New%20Instructions%20for%20setting%20up%20SDL2%20files%20on%20Windows.pdf&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 11:15:41&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-02-06 11:15:41&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:46,&quot;href&quot;:&quot;https:\/\/github.com\/libsdl-org\/SDL_mixer&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251216065846\/https:\/\/github.com\/libsdl-org\/SDL_mixer&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 11:15:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 20:59:03&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 22:35:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-16 07:53:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 23:41:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-23 15:31:56&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 07:19:29&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-02 23:11:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 15:02:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-10 06:52:11&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-13 14:42:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-16 22:33:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-20 06:21:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-23 14:10:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 22:00:36&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-30 13:45:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 21:39:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-06 05:31:32&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 13:24:27&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-12 21:15:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-16 05:07:08&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-19 20:57:01&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-23 04:49:54&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-23 04:49:54&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img decoding="async" class="alignleft size-medium wp-image-3102" src="https://learncgames.com/wp-content/uploads/2022/11/configure-sdl-for-vc-300x116.png" alt="Visual Studio configuration" width="300" height="116" srcset="https://learncgames.com/wp-content/uploads/2022/11/configure-sdl-for-vc-300x116.png 300w, https://learncgames.com/wp-content/uploads/2022/11/configure-sdl-for-vc-768x296.png 768w, https://learncgames.com/wp-content/uploads/2022/11/configure-sdl-for-vc.png 904w" sizes="(max-width: 300px) 100vw, 300px" />A reader asked me how to setup SDL2 for Windows given recent changes in SDL2. Specifically the files and libsdl projects have been moved from the libsdl.org website to GitHub. You can easily find SDL2 Image, Mixer, TTF etc.</p>
<p>However it can still be quite daunting setting up Visual Studio for SDL2. You have to download the specific files, then configure the project properties to specify the include paths for header files and then the lib files, both the path to them and identify the ones you want to use.</p>
<p>As I&#8217;m on my new PC, I bit the bullet and went through the process of setting it up. It took just over an hour to configure it.  I&#8217;ve put it into <a title="Link to Setting up Visual Studio for SDL" href="https://github.com/David-H-Bolton/LearnC/blob/master/New%20Instructions%20for%20setting%20up%20SDL2%20files%20on%20Windows.pdf" target="_blank" rel="nofollow noopener">a PDF</a> that&#8217;s a couple of pages long.</p>
<p>So the game works but only after I disabled the sound code; it was failing in the call to <strong>Mix_OpenAudio()</strong>. I think recent work on the SDL Mixer needs some work on my part. I need to sit down and look at the <a title="Link to SDL Mixer page on GitHub" href="https://github.com/libsdl-org/SDL_mixer" target="_blank" rel="nofollow noopener">SDL Mixer page</a> and figure out what&#8217;s failing. Once that&#8217;s done, I&#8217;ll update the files.</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/update-to-the-windows-ebook/">Update to the Windows eBook</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">3101</post-id>	</item>
		<item>
		<title>Nearly finished translating asteroids to C++</title>
		<link>https://learncgames.com/nearly-finished-translating-asteroids-to-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nearly-finished-translating-asteroids-to-c</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 15 Mar 2021 00:00:33 +0000</pubDate>
				<category><![CDATA[C++]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[Other stuff]]></category>
		<category><![CDATA[asteroids]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2883</guid>

					<description><![CDATA[<p>I always wanted to do this and have most of it done. It just needs a bit of polishing plus making it cross-platform. It wasn&#8217;t the hardest  thing I&#8217;ve done although I did start by trying to make the common part for asteroids, player ship, bullets and aliens, the bit that managed position and velocity [&#8230;]</p>
The post <a href="https://learncgames.com/nearly-finished-translating-asteroids-to-c/">Nearly finished translating asteroids to C++</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-2886" src="https://learncgames.com/wp-content/uploads/2021/03/asteroids-300x292.png" alt="Asteroids screenshot" width="300" height="292" srcset="https://learncgames.com/wp-content/uploads/2021/03/asteroids-300x292.png 300w, https://learncgames.com/wp-content/uploads/2021/03/asteroids.png 364w" sizes="(max-width: 300px) 100vw, 300px" />I always wanted to do this and have most of it done. It just needs a bit of polishing plus making it cross-platform. It wasn&#8217;t the hardest  thing I&#8217;ve done although I did start by trying to make the common part for asteroids, player ship, bullets and aliens, the bit that managed position and velocity into a base class.</p>
<p>I then spent a day wrestling with the compiler trying to access this in those methods that used this and in the end found it easier to make it into its own class and had an instance of it in each of the classes. I.e. using composition rather than inheritance.</p>
<p>Rewriting in C++ made things like saving high scores to disk and reloading a bit simpler using C++ strings.  Now I just have to get my main PC up and running and then polish the code and publish it on GitHub.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/nearly-finished-translating-asteroids-to-c/">Nearly finished translating asteroids to C++</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">2883</post-id>	</item>
		<item>
		<title>Amazing multi-platform Asteroids in C#</title>
		<link>https://learncgames.com/amazing-multi-platform-asteroids-in-c/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=amazing-multi-platform-asteroids-in-c</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Sat, 06 Feb 2021 00:00:08 +0000</pubDate>
				<category><![CDATA[Blazor]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[asteroids]]></category>
		<category><![CDATA[cross-platform]]></category>
		<category><![CDATA[wasm]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=2608</guid>

					<description><![CDATA[<p>Asteroids was the first full arcade game I ever wrote in C. Asteroids in C# takes things to a whole new level.  The solution contains 12 projects in all: Three Blazor projects, a WinForms version, a WPF version, a UWP (Universal Windows Platform) and a Xamarin Android Forms version (shown). You can compile and run [&#8230;]</p>
The post <a href="https://learncgames.com/amazing-multi-platform-asteroids-in-c/">Amazing multi-platform Asteroids in C#</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:199,&quot;href&quot;:&quot;https:\/\/github.com\/aesalazar\/AsteroidsWasm&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260114025816\/https:\/\/github.com\/aesalazar\/AsteroidsWasm&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:44:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-10 10:18:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 19:42:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-19 19:32:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-24 02:11:50&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 13:36:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 14:36:43&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 03:15:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 12:44:28&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-25 21:24:22&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-31 16:01:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 03:51:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 00:40:55&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-13 00:41:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-16 23:23:21&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 01:38:43&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 01:38:43&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:200,&quot;href&quot;:&quot;https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/user-interface\/graphics\/skiasharp\/#:~:text=SkiaSharp%20is%20a%202D%20graphics,graphics%2C%20bitmaps%2C%20and%20text.&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20220904010537\/https:\/\/docs.microsoft.com\/en-us\/xamarin\/xamarin-forms\/user-interface\/graphics\/skiasharp\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 12:44:16&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-02-06 12:44:16&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img decoding="async" class="alignleft size-full wp-image-2609" src="https://learncgames.com/wp-content/uploads/2021/02/android-asteroids.png" alt="Android asteroids" width="395" height="838" srcset="https://learncgames.com/wp-content/uploads/2021/02/android-asteroids.png 395w, https://learncgames.com/wp-content/uploads/2021/02/android-asteroids-141x300.png 141w" sizes="(max-width: 395px) 100vw, 395px" />Asteroids was the first full arcade game I ever wrote in C. <a title="Link to C# Asteroids on GitHub" href="https://github.com/aesalazar/AsteroidsWasm" target="_blank" rel="nofollow noopener">Asteroids in C#</a> takes things to a whole new level.  The solution contains 12 projects in all: Three Blazor projects, a WinForms version, a WPF version, a UWP (<em>Universal Windows Platform</em>) and a Xamarin Android Forms version (shown).</p>
<p>You can compile and run any of the projects though you will need to install and setup a suitable SDK and emulated (<em>or a real device</em>) for the Android.</p>
<p>Written by Howard Uman and ported by Ernie Salazar, this is a wireframe asteroids, more true to the original than my own raster version. Out of curiosity, I created an Android 9.0 emulator (<em>I don&#8217;t have a recent Android phone)</em> and compiled then deployed it to the emulator. The screenshot is grabbed directly from the emulator which has a less than ideal screen ratio. This would work better on a tablet.</p>
<p>The structure of the C# Solution is interesting. All of the game code is in the Base project. All of the other platforms just host the main game window. The game uses the <a title="Link to SkiaSharp documentation" href="https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/graphics/skiasharp/#:~:text=SkiaSharp%20is%20a%202D%20graphics,graphics%2C%20bitmaps%2C%20and%20text." target="_blank" rel="nofollow noopener">SkiaSharp</a> graphics framework for Android Forms.</p>
<p>This is a very nice open source project and an excellent way to see how Blazor works in both Wasm and Server mode, not to mention the Android, WinForms/WPF and UWP versions.</p>
<p>I have an interest in Blazor which lets you write C# code that runs in the browser very easily.  With a bit of workj, this should be runnable on a Linux webserver as well. Something for me to try&#8230;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/amazing-multi-platform-asteroids-in-c/">Amazing multi-platform Asteroids in C#</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">2608</post-id>	</item>
	</channel>
</rss>
