<?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>raspberry-pi | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/raspberry-pi/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>Sun, 18 Dec 2022 19:52:34 +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>raspberry-pi | 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>Raspberry Pi Sound issues- trying to fix it</title>
		<link>https://learncgames.com/raspberry-pi-sound-issues-trying-to-fix-it/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=raspberry-pi-sound-issues-trying-to-fix-it</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Mon, 19 Dec 2022 00:00:02 +0000</pubDate>
				<category><![CDATA[bugs]]></category>
		<category><![CDATA[C]]></category>
		<category><![CDATA[Ebook]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[raspberry-pi]]></category>
		<category><![CDATA[sound]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=3145</guid>

					<description><![CDATA[<p>In working through my Linux/Raspberry Pi eBook(Yes &#8211; the second eBook!), I&#8217;m up to the chapter where sounds are introduced using the SDL_mixer library. And I&#8217;ve hit two sets of problems. It sometimes refuses to initialize the sound code.  This code below hits the LogError line: int success=Mix_OpenAudio(22050, AUDIO_S16LSB, 2, 8192); if (success==-1 ) { [&#8230;]</p>
The post <a href="https://learncgames.com/raspberry-pi-sound-issues-trying-to-fix-it/">Raspberry Pi Sound issues- trying to fix it</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;:38,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/openclipart-vectors-30363\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=158394&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20251230124419\/https:\/\/pixabay.com\/users\/openclipart-vectors-30363\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 11:14:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-11 00:49:37&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-15 09:57:58&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-22 03:49:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-27 11:03:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 08:58:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 04:10:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-14 23:28:01&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-23 04:24:55&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 18:05:22&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-04 12:46:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 07:36:36&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-12 11:45:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-20 08:36:45&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-20 08:36:45&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:39,&quot;href&quot;:&quot;https:\/\/pixabay.com\/\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=158394&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 11:14:54&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-11 00:49:37&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-15 09:57:57&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-22 03:49:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-27 11:03:50&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-04 08:58:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-10 04:10:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-14 23:28:01&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-23 04:24:56&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-26 18:05:20&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-04 12:46:30&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 07:36:39&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-12 11:45:04&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-19 12:07:41&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-19 12:07:41&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_3146" aria-describedby="caption-attachment-3146" style="width: 295px" class="wp-caption alignleft"><img fetchpriority="high" decoding="async" class="size-medium wp-image-3146" src="https://learncgames.com/wp-content/uploads/2022/12/loudspeaker-295x300.png" alt="Loudpeaker" width="295" height="300" srcset="https://learncgames.com/wp-content/uploads/2022/12/loudspeaker-295x300.png 295w, https://learncgames.com/wp-content/uploads/2022/12/loudspeaker.png 630w" sizes="(max-width: 295px) 100vw, 295px" /><figcaption id="caption-attachment-3146" class="wp-caption-text">Image by <a href="https://pixabay.com/users/openclipart-vectors-30363/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=158394">OpenClipart-Vectors</a> from <a href="https://pixabay.com//?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=158394">Pixabay</a></figcaption></figure>
<p>In working through my Linux/Raspberry Pi eBook(<em>Yes &#8211; the second eBook!)</em>, I&#8217;m up to the chapter where sounds are introduced using the SDL_mixer library. And I&#8217;ve hit two sets of problems.</p>
<p>It sometimes refuses to initialize the sound code.  This code below hits the LogError line:</p>
<pre><code class="language-c" data-line=""></code></pre>
<pre><code class="language-c" data-line="">	int success=Mix_OpenAudio(22050, AUDIO_S16LSB, 2, 8192);
	if (success==-1 ) {
		LogError(&quot;InitSetup failed to init audio&quot;);
	}</code></pre>
<pre><code class="language-c" data-line=""></code></pre>
<p>The other day it was working but not today. Now I have updated the Pi&#8217;s code (<em>sudo apt update</em> <em>etc</em>) but I wouldn&#8217;t have expected that to break it. I&#8217;ve been looking on the internet and find the whole thing a bit complicated.</p>
<p>I&#8217;ve got my Pi running 64-bit Raspberry Pi OS. I&#8217;ve changed the output device to headphones which plug into the headphone socket. If I run the VLC media player and tell it to play into the headphones, it will happily play the .wav files I&#8217;ve got for the asteroids game.</p>
<p>But if I run <strong>speaker-test</strong>, a terminal application with this command line</p>
<pre>speaker-test -c2 -twav -l7 plughw:1,0</pre>
<p>I get</p>
<pre>speaker-test 1.2.4

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
WAV file(s)
Setting of hwparams failed: Invalid argument</pre>
<p>By running this command:</p>
<pre><code class="language-c" data-line="">aplay -L
</code></pre>
<p>I got 71 lines of output but of these these below are the most important</p>
<pre>output
<strong>hw</strong>:CARD=<strong>Headphones</strong>,DEV=0
    bcm2835 Headphones, bcm2835 Headphones
</pre>
<p>and the speaker-test command using the device parameter &#8211;<strong>Dhw:Headphones</strong> now worked. I&#8217;ve highlighted the bits in the aplay output needed to identify the device.</p>
<p>The new command  is</p>
<pre>speaker-test -c2 -twav -l7 -Dhw:Headphones</pre>
<p>I can now hear a female voice saying <strong>front left</strong> then <strong>front right</strong> a few times in my headphones.</p>
<p>So my Pi&#8217;s sound device is working; I just have to figure why SDL_mixer isn&#8217;t always. I&#8217;ll keep looking.</p>
<p><strong>And the second problem</strong> which only occurs when the mixer is working, is when you play a lot of sounds. The <strong>PlayASound()</strong> function checks the result. On Windows it never had a problem but on Raspberry Pi, when you blow up a lot of asteroids say at one time, it plays a number of explosions then returns an error for each explosion after that. I think there&#8217;s only so many channels; that&#8217;s an easy fix; just ignore the error and return as if it succeeded.</p>The post <a href="https://learncgames.com/raspberry-pi-sound-issues-trying-to-fix-it/">Raspberry Pi Sound issues- trying to fix it</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">3145</post-id>	</item>
		<item>
		<title>Restarting the Raspberry PI C Games tutorials</title>
		<link>https://learncgames.com/restarting-the-raspberry-pi-c-games-tutorials/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=restarting-the-raspberry-pi-c-games-tutorials</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 27 Oct 2020 00:00:59 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Ebook]]></category>
		<category><![CDATA[raspberry-pi]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=1671</guid>

					<description><![CDATA[<p>I believe that the Raspberry PI, especially the 4B is a great and very low cost machine for not only running games but for developing them as well. Of course, if you have a PC, Linux or Mac then you can use that as a development machine but if you haven&#8217;t, it costs less than [&#8230;]</p>
The post <a href="https://learncgames.com/restarting-the-raspberry-pi-c-games-tutorials/">Restarting the Raspberry PI C Games tutorials</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignleft size-medium wp-image-1672" src="https://learncgames.com/wp-content/uploads/2020/10/raspberry-Pi4-264x300.png" alt="Raspberry Pi 4" width="264" height="300" srcset="https://learncgames.com/wp-content/uploads/2020/10/raspberry-Pi4-264x300.png 264w, https://learncgames.com/wp-content/uploads/2020/10/raspberry-Pi4.png 365w" sizes="(max-width: 264px) 100vw, 264px" />I believe that the Raspberry PI, especially the 4B is a great and very low cost machine for not only running games but for developing them as well. Of course, if you have a PC, Linux or Mac then you can use that as a development machine but if you haven&#8217;t, it costs less than £100 (when you count the system, case, cables, SD-Card) to get up and running.</p>
<p>So I&#8217;m reworking my original eBook for the Raspberry Pi, using software running on the Pi and developing a 2nd ebook. Along the way I&#8217;ll publish longer excerpts from it here. Probably one a week.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/restarting-the-raspberry-pi-c-games-tutorials/">Restarting the Raspberry PI C Games tutorials</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">1671</post-id>	</item>
		<item>
		<title>Building Asteroids on a Raspberry-Pi</title>
		<link>https://learncgames.com/building-asteroids-on-a-raspberry-pi/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=building-asteroids-on-a-raspberry-pi</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Thu, 16 Apr 2020 23:00:08 +0000</pubDate>
				<category><![CDATA[Clang]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[raspberry-pi]]></category>
		<category><![CDATA[Visual Studio Code]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=393</guid>

					<description><![CDATA[<p>Silly me completely forgot that Raspberry Pis have a different CPU architecture compared to my PC. You just get used to something working on Linux and it was only after copying and it didn&#8217;t run that I realised my mistake. So I now have to recompile Asteroids (from Chapter-48.zip). I&#8217;ve had a Raspberry-Pi 3 B+ [&#8230;]</p>
The post <a href="https://learncgames.com/building-asteroids-on-a-raspberry-pi/">Building Asteroids on a Raspberry-Pi</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;:14,&quot;href&quot;:&quot;https:\/\/github.com\/David-H-Bolton\/LearnCOnLinux&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250213114627\/https:\/\/github.com\/David-H-Bolton\/LearnCOnLinux&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 10:35:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-09 16:40:14&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 18:24:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-15 22:16:31&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-18 22:19:30&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-21 22:22:05&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-25 04:17:24&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-28 04:17:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-03 04:22:25&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-06 04:38:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-09 08:48:04&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 09:17:10&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-15 10:18:26&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-18 12:43:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-21 15:14:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-24 15:19:12&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-27 16:38:15&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-30 19:05:39&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 19:29:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-05 21:51:33&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-08 22:18:13&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-11 22:18:38&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-14 22:20:58&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-18 07:27:41&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-21 10:16:46&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-21 10:16:46&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:776,&quot;href&quot;:&quot;https:\/\/www.raspberrypi.org&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206074141\/https:\/\/www.raspberrypi.org\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 18:26:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-12 19:38:42&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-17 14:11:57&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-20 16:20:16&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-02-27 16:31:00&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-04 20:45:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-12 10:13:18&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-22 12:23:53&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-03-26 11:03:49&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-02 19:15:44&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-09 10:42:47&quot;,&quot;http_code&quot;:206},{&quot;date&quot;:&quot;2026-04-12 13:35:43&quot;,&quot;http_code&quot;:206}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-12 13:35:43&quot;,&quot;http_code&quot;:206},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:777,&quot;href&quot;:&quot;https:\/\/sourceforge.net\/projects\/win32diskimager&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260201042202\/https:\/\/sourceforge.net\/projects\/win32diskimager\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 18:26:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-12 19:38:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 14:11:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 16:20:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-27 16:30:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 20:45:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-12 10:13:19&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 12:23:51&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 11:03:47&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-02 19:15:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-09 10:42:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 13:35:42&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-12 13:35:42&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:733,&quot;href&quot;:&quot;https:\/\/winscp.net\/eng\/index.php&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206023418\/https:\/\/winscp.net\/eng\/index.php&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 18:05:03&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-11 00:52:02&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-17 14:11:57&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-20 16:20:16&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-24 11:22:36&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-02-27 16:30:50&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-04 16:16:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-09 06:32:10&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-12 10:13:21&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-17 10:22:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-22 12:23:52&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-03-26 11:03:48&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-02 19:15:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-08 00:14:44&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-12 13:35:43&quot;,&quot;http_code&quot;:200},{&quot;date&quot;:&quot;2026-04-20 16:12:23&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-20 16:12:23&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:673,&quot;href&quot;:&quot;http:\/\/code.headmelted.com&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20201201232800\/http:\/\/code.headmelted.com\/&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 17:24:11&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-12 19:38:44&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-17 05:26:17&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-20 16:20:56&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-02-27 16:30:51&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-04 20:45:44&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-08 11:39:35&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-11 18:06:24&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-15 04:58:03&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-22 17:26:41&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-03-28 14:01:53&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-02 19:15:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-09 10:42:45&quot;,&quot;http_code&quot;:404},{&quot;date&quot;:&quot;2026-04-12 13:35:41&quot;,&quot;http_code&quot;:404}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-12 13:35:41&quot;,&quot;http_code&quot;:404},&quot;process&quot;:&quot;done&quot;}]'></div>
<p><img decoding="async" class="alignleft size-medium wp-image-394" src="https://learncgames.com/wp-content/uploads/2020/04/raspi-asteroids-300x262.png" alt="My asteroids running on a Raspberry-Pi 3B+" width="300" height="262" srcset="https://learncgames.com/wp-content/uploads/2020/04/raspi-asteroids-300x262.png 300w, https://learncgames.com/wp-content/uploads/2020/04/raspi-asteroids-768x671.png 768w, https://learncgames.com/wp-content/uploads/2020/04/raspi-asteroids.png 1024w" sizes="(max-width: 300px) 100vw, 300px" />Silly me completely forgot that Raspberry Pis have a different CPU architecture compared to my PC. You just get used to something working on Linux and it was only after copying and it didn&#8217;t run that I realised my mistake. So I now have to recompile Asteroids (from <a href="https://github.com/David-H-Bolton/LearnCOnLinux" target="_blank" rel="noopener noreferrer">Chapter-48.zip</a>).</p>
<p>I&#8217;ve had a Raspberry-Pi 3 B+ for a year and wanted to run the Linux asteroids on it, now that I have it working on Ubuntu.</p>
<p>To do that I had to setup  Pi, running Raspbian downloaded from the <a href="https://www.raspberrypi.org/" target="_blank" rel="noopener noreferrer">Raspberry Pi website</a> onto my Windows PC and then I used <a href="https://sourceforge.net/projects/win32diskimager/" target="_blank" rel="noopener noreferrer">Win32 DiskImager</a> (free Windows software) to burn the Raspbian OS onto a SD Card. Raspberry-Pis boot from SD Cards and the better and faster the SD card, the quicker the OS runs. Get a class 10 with A1 SD Card if you can.</p>
<p>After the Pi booted and Raspbian was installed and configured I had to enable SSH on the Pi; it&#8217;s disabled by default.</p>
<p>So now my PC was talking to the Pi using the excellent free <a href="https://winscp.net/eng/index.php" target="_blank" rel="noopener noreferrer">WinSCP</a>.  I copied all the files over, including the masks, sounds and images folders and all the source code and my exe built on Ubuntu which was the wrong file type. (<em>Trying to run Intel code on an ARM- good luck with that!)</em></p>
<p>Now it turns out that the Raspbian version I installed (I&#8217;d gone for the Raspbian Buster with desktop and recommended software-2.5 GB download) included the non-dev version of SDL2. But as I needed to recompile the whole program, I had to install Visual Studio Code, Clang and the dev versions of SDL2, image and mixer.</p>
<h3>Visual Studio Code on Arm?</h3>
<p><img loading="lazy" decoding="async" class="alignleft size-medium wp-image-397" src="https://learncgames.com/wp-content/uploads/2020/04/VSCode-Raspberry-pi-300x245.png" alt="Haedmelted VS Code running on Raspberry Pi 3b+" width="300" height="245" srcset="https://learncgames.com/wp-content/uploads/2020/04/VSCode-Raspberry-pi-300x245.png 300w, https://learncgames.com/wp-content/uploads/2020/04/VSCode-Raspberry-pi-1024x835.png 1024w, https://learncgames.com/wp-content/uploads/2020/04/VSCode-Raspberry-pi-768x626.png 768w, https://learncgames.com/wp-content/uploads/2020/04/VSCode-Raspberry-pi.png 1029w" sizes="auto, (max-width: 300px) 100vw, 300px" />Microsoft don&#8217;t do an official version for Raspberry-Pi or other ARM boards. However I discovered that a developer called Jay Rodgers has taken their source code (VS Code is open source) and  you can get a version <a href="http://code.headmelted.com/" target="_blank" rel="noopener noreferrer">from his site</a>. It&#8217;s very usable on the Pi. Almost but not quite identical.</p>
<p>After installing the dev versions of libsdl2, image and mixer, I was almost able to compile it. I&#8217;d installed Clang but unlike the version on Ubuntu which was Clang-6, the version on Raspbian (based on Debian Buster) is Clang-7.</p>
<p>This means you have to edit the tasks.json file in the hidden .vscode folder. On line 25 where it says <strong>&#8220;command&#8221;</strong>: change the path to <strong>&#8220;/usr/bin/clang-7&#8221;.</strong></p>
<p>That built ok, but when I ran it, it stopped with an error in the <strong>errorlog.txt</strong> file. For some reason, it failed loading the file <strong>&#8220;masks/am2.msk&#8221;</strong>.  Now I&#8217;d had no errors copying files from Windows to the Pi. This had been a very intermittent problem when copying several files in one go from Windows 10 to Ubuntu running under Hyper-V. Occasionally it would come up with some weird error but usually copied OK on the second go.</p>
<p>Despite several attempts, I could not get it to load that mask so as a temp fix I commented the line out. This means that one of the four asteroids sizes can never collide with anything. But it now ran.</p>
<p>However, I&#8217;m only getting about 25-27 fps with it in the early levels, not the 60 fps that I get on Ubuntu on other hardware. Given that the bulk of the work is blitting graphics, I suspect the GPU is just a bit under powered. Apparently on the Raspberry Pi 4, the GPU is newer and twice as fast as on the 3B+ so I&#8217;ll have to try it on a 4 when I get one. But the game works and is just about playable.</p>
<p>Now I&#8217;ll have to try and figure out why it won&#8217;t load that one mask. This has the makings of an interesting bug&#8230;</p>
<p>&nbsp;</p>The post <a href="https://learncgames.com/building-asteroids-on-a-raspberry-pi/">Building Asteroids on a Raspberry-Pi</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">393</post-id>	</item>
	</channel>
</rss>
