takunomi-blog/posts/SDL2 on MacOS with SDL2_image.html
2018-06-06 20:59:41 +02:00

60 lines
2.7 KiB
HTML

<video width="426" height="240" controls="true">
<source src="../images/2018-06-06/a.mp4">
</video>
<p><time datetime="2018-06-06">2018&#8211;06&#8211;06</time></p>
<p><em>Above is a video from Craig Forresters Leilani&#8217;s Island. I&#8217;m pretty sure it&#8217;s made in SDL2 + C/C++. Even if it isn&#8217;t&#8230; look at that shit, it&#8217;s amazing.</em></p>
<p>Twitter: <a href="https://twitter.com/ishisoft">@ishisoft</a></p>
<p>YouTube Video: <a href="https://www.youtube.com/watch?v=SbqW2iOcvL4">Gameplay</a></p>
<h3 id="straythoughts">Stray Thoughts</h3>
<p>After the tutorial part.</p>
<h3 id="theactualarticle">The Actual Article</h3>
<p>SDL2 is the answer for someone reading a coding tutorial for C or C++ and thinking</p>
<blockquote>
<p>&#8220;CLI output is cool, but I want to make programs that run inside Windows and have graphics.&#8221;</p>
</blockquote>
<p><a href="https://medium.com/@edkins.sarah/set-up-sdl2-on-your-mac-without-xcode-6b0c33b723f7">This beautiful tutorial by Sarah Edkins</a> gives most of the info needed. She skips mentioning what &#8220;brew&#8221; actually <em>is</em>. (Home)brew is a way to install and keep tabs on command-line programs on OSX. If you don&#8217;t have it, you&#8217;ll need it, and in either case, you&#8217;ll want it.</p>
<p>Just follow her tutorial.</p>
<p>Now that that&#8217;s done, some other things I had to google and I want to spare you from:</p>
<ul>
<li>You&#8217;re gonna need more than <strong>bmp</strong> files in your program, so you&#8217;re gonna need <strong>SDL2_image.h</strong>. You install that like you installed SDL2: brew, then copy the files into the same folders as before.</li>
</ul>
<pre><code class="```Bash"> Brew install SDL2_image
</code></pre>
<ul>
<li>You&#8217;ll have to update the make-file to refer to the <code>.h</code> file. After</li>
</ul>
<pre><code class="```Bash"> -l SDL2-2.0.0
</code></pre>
<p>add</p>
<pre><code class="```Bash"> -l SDL2_image
</code></pre>
<p>Notice that the hyphen-plus-l is added again. This is vital. Also remember that you can use <code>\ </code> to make new lines.</p>
<h3 id="aforementionedstraythoughts">Aforementioned stray thoughts</h3>
<p>With what little sparetime I have, it felt kinda good to sit down for a few hours the other night, just to spend time on a project that didn&#8217;t look like it would amount to anything but me feeling good about what I&#8217;d done.</p>
<p>I&#8217;d wanted to give SDL2 with plain C another go. Why? The usual reasons of wanting to feel like I&#8217;d made something myself, and gain some knowledge of C. After setting everything up, and doing a few parts of LazyFoos tutorials, it occured to me that if I shared this little evening, I could save some people some trouble.</p>