<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Jim Kersey</title><link href="https://jimkersey.com/" rel="alternate"></link><link href="https://jimkersey.com/feeds/all.atom.xml" rel="self"></link><id>https://jimkersey.com/</id><updated>2025-12-30T08:19:00-06:00</updated><entry><title>Emacs 101</title><link href="https://jimkersey.com/emacs-101.html" rel="alternate"></link><published>2025-12-30T08:19:00-06:00</published><updated>2025-12-30T08:19:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2025-12-30:/emacs-101.html</id><summary type="html">&lt;p&gt;Emacs has a notoriously steep learning curve, but even after all of these years there are advantages too numerous to name! &lt;/p&gt;
&lt;p&gt;A few:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open source&lt;/li&gt;
&lt;li&gt;Can run in a remote terminal&lt;/li&gt;
&lt;li&gt;No AI unless you add it&lt;/li&gt;
&lt;li&gt;Key bindings are useful in other programs (and sometimes at the OS level …&lt;/li&gt;&lt;/ul&gt;</summary><content type="html">&lt;p&gt;Emacs has a notoriously steep learning curve, but even after all of these years there are advantages too numerous to name! &lt;/p&gt;
&lt;p&gt;A few:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Open source&lt;/li&gt;
&lt;li&gt;Can run in a remote terminal&lt;/li&gt;
&lt;li&gt;No AI unless you add it&lt;/li&gt;
&lt;li&gt;Key bindings are useful in other programs (and sometimes at the OS level)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It is also, by design, extremely configurable. Lately I've given over most of that work to the &lt;a href="https://github.com/doomemacs/doomemacs"&gt;Doom Emacs&lt;/a&gt; configuration framework.&lt;/p&gt;
&lt;p&gt;As far as the basics, these are the commands I use 90% of the time:&lt;/p&gt;
&lt;h3&gt;Opening and closing files&lt;/h3&gt;
&lt;table&gt;&lt;tr&gt;&lt;th&gt;keys&lt;/th&gt;&lt;th&gt;action&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width="100"&gt;C-x C-f&lt;/td&gt;&lt;td&gt;open a file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-x C-s&lt;/td&gt;&lt;td&gt;save the current file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-x k&lt;/td&gt;&lt;td&gt;close the current file (kill buffer)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-x C-c&lt;/td&gt;&lt;td&gt;exit Emacs&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Moving around&lt;/h3&gt;
&lt;table&gt;&lt;tr&gt;&lt;th&gt;keys&lt;/th&gt;&lt;th&gt;action&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width="100"&gt;C-a&lt;/td&gt;&lt;td&gt;beginning of a line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-e&lt;/td&gt;&lt;td&gt;end of a line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-p&lt;/td&gt;&lt;td&gt;move to the previous line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-n&lt;/td&gt;&lt;td&gt;go to the next line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-f&lt;/td&gt;&lt;td&gt;forward one character&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-b&lt;/td&gt;&lt;td&gt;backward one character&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-d&lt;/td&gt;&lt;td&gt;delete one character forward&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Selecting/cutting/pasting&lt;/h3&gt;
&lt;table&gt;&lt;tr&gt;&lt;th&gt;keys&lt;/th&gt;&lt;th&gt;action&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width="100"&gt;C-space&lt;/td&gt;&lt;td&gt;set a mark (then use movement keys to set the region)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-w&lt;/td&gt;&lt;td&gt;cut marked region&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-k&lt;/td&gt;&lt;td&gt;cut to the end of the line&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;alt-w&lt;/td&gt;&lt;td&gt;copy marked text&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-y&lt;/td&gt;&lt;td&gt;paste&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;

&lt;h3&gt;Bonus keys&lt;/h3&gt;
&lt;table&gt;&lt;tr&gt;&lt;th&gt;keys&lt;/th&gt;&lt;th&gt;action&lt;/th&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td width="100"&gt;C-c p ?&lt;/td&gt;&lt;td&gt;find references in a project&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-c p s&lt;/td&gt;&lt;td&gt;search for a string in the project files (requires ripgrep)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-c p a&lt;/td&gt;&lt;td&gt;switch between the currently open .c and .h file&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-x b&lt;/td&gt;&lt;td&gt;switch between open files&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;C-c p f&lt;/td&gt;&lt;td&gt;find file in current project&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</content><category term="programming"></category></entry><entry><title>Positronic Cats - Mortal Cathedrals</title><link href="https://jimkersey.com/work/positronic-cats.html" rel="alternate"></link><published>2024-06-01T00:00:00-05:00</published><updated>2024-06-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2024-06-01:/work/positronic-cats.html</id><content type="html">&lt;p&gt;Album art for The Positronic Cats album &lt;a href="https://thepositroniccats.bandcamp.com/album/mortal-cathedrals"&gt;Mortal Cathedrals&lt;/a&gt;. &lt;/p&gt;</content><category term="work"></category></entry><entry><title>Hooked Up</title><link href="https://jimkersey.com/work/hooked-up.html" rel="alternate"></link><published>2024-05-01T00:00:00-05:00</published><updated>2024-05-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2024-05-01:/work/hooked-up.html</id><content type="html"></content><category term="work"></category></entry><entry><title>The Climb</title><link href="https://jimkersey.com/work/the-climb.html" rel="alternate"></link><published>2024-04-01T00:00:00-05:00</published><updated>2024-04-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2024-04-01:/work/the-climb.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Thoughtscape - Big Brain</title><link href="https://jimkersey.com/work/thoughtscape.html" rel="alternate"></link><published>2024-03-01T00:00:00-06:00</published><updated>2024-03-01T00:00:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2024-03-01:/work/thoughtscape.html</id><content type="html">&lt;p&gt;Variant comic cover art for the 2024 &lt;a href="https://www.kickstarter.com/projects/mattmlpdx/thoughtscape-comics-2024?ref=creator_tab"&gt;Thoughtscape&lt;/a&gt; comic.&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Bent</title><link href="https://jimkersey.com/work/bent.html" rel="alternate"></link><published>2024-02-01T00:00:00-06:00</published><updated>2024-02-01T00:00:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2024-02-01:/work/bent.html</id><content type="html">&lt;p&gt;Cover for &lt;em&gt;Bent&lt;/em&gt;.&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Forklift</title><link href="https://jimkersey.com/work/forklift.html" rel="alternate"></link><published>2023-10-07T00:00:00-05:00</published><updated>2023-10-07T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-07:/work/forklift.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Robot Boss</title><link href="https://jimkersey.com/work/robot-boss.html" rel="alternate"></link><published>2023-10-06T00:00:00-05:00</published><updated>2023-10-06T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-06:/work/robot-boss.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Astronaut in the Living Room</title><link href="https://jimkersey.com/work/astronaut-living-room.html" rel="alternate"></link><published>2023-10-05T00:00:00-05:00</published><updated>2023-10-05T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-05:/work/astronaut-living-room.html</id><content type="html">&lt;p&gt;An Inktober sketch.&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Robot Punch</title><link href="https://jimkersey.com/work/robot-punch.html" rel="alternate"></link><published>2023-10-04T00:00:00-05:00</published><updated>2023-10-04T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-04:/work/robot-punch.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Drone Guy</title><link href="https://jimkersey.com/work/drone-guy.html" rel="alternate"></link><published>2023-10-03T00:00:00-05:00</published><updated>2023-10-03T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-03:/work/drone-guy.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Robot Face</title><link href="https://jimkersey.com/work/robot-face.html" rel="alternate"></link><published>2023-10-02T00:00:00-05:00</published><updated>2023-10-02T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2023-10-02:/work/robot-face.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Development Tools 2023</title><link href="https://jimkersey.com/development-tools-2023.html" rel="alternate"></link><published>2022-12-18T17:19:00-06:00</published><updated>2022-12-18T17:19:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-12-18:/development-tools-2023.html</id><summary type="html">&lt;p&gt;As the year comes to a close and I've been spending my spare time working on an overly-ambitious game programming project, I thought I'd spend a few minutes making an appreciation article for the tools I've been using that make this possible. I was about to add #solodev to a …&lt;/p&gt;</summary><content type="html">&lt;p&gt;As the year comes to a close and I've been spending my spare time working on an overly-ambitious game programming project, I thought I'd spend a few minutes making an appreciation article for the tools I've been using that make this possible. I was about to add #solodev to a Mastodon post I was writing, and I stopped because the fact is: while I may not have a team; this stuff would certainly not be possible without this software.&lt;/p&gt;
&lt;h1&gt;Affinity Studio&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://affinity.serif.com/en-us/"&gt;https://affinity.serif.com/en-us/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Still using Photoshop? I don't blame you, it's a powerhouse with terabytes of tutorials and chances are you have decades of muscle memory; but Affinity's products give me everything I need, without a subscription.&lt;/p&gt;
&lt;h1&gt;Blender&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://blender.org"&gt;https://blender.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I chanced upon this software in the '90s, when it was still closed-source and fit on a floppy disk. &lt;/p&gt;
&lt;h1&gt;Emacs&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://emacs.org"&gt;https://emacs.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An infinity-old text-editing environment.&lt;/p&gt;
&lt;h1&gt;Doom Emacs&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://github.com/doomemacs/doomemacs"&gt;https://github.com/doomemacs/doomemacs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A configuration framework for an infinity-old text editing environment.&lt;/p&gt;
&lt;h1&gt;SDL&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://www.libsdl.org/"&gt;https://www.libsdl.org/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A cross-platform library for making sound and images.&lt;/p&gt;
&lt;h1&gt;QT Designer&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://build-system.fman.io/qt-designer-download"&gt;https://build-system.fman.io/qt-designer-download&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;A user interface designer&lt;/p&gt;
&lt;h1&gt;Python&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://python.org"&gt;https://python.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;An omni-purpose programming language.&lt;/p&gt;
&lt;h1&gt;Enlightenment&lt;/h1&gt;
&lt;p&gt;&lt;a href="https://enlightenment.org"&gt;https://enlightenment.org&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Making my desktop look nice.&lt;/p&gt;</content><category term="programming"></category></entry><entry><title>Pilot</title><link href="https://jimkersey.com/work/pilot.html" rel="alternate"></link><published>2022-10-01T00:00:00-05:00</published><updated>2022-10-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-10-01:/work/pilot.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Write in Python, Read in C</title><link href="https://jimkersey.com/write-in-python-read-in-c.html" rel="alternate"></link><published>2022-09-06T19:19:00-05:00</published><updated>2022-09-06T19:19:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-09-06:/write-in-python-read-in-c.html</id><summary type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;As it is: I'm still trying my hand at game programming at a fairly low level. My current puzzle is creating spritesheets of character animations and importing them in to the engine I'm writing in C. The images come from Blender, I wrote a Python script that takes the …&lt;/p&gt;</summary><content type="html">&lt;h1&gt;Introduction&lt;/h1&gt;
&lt;p&gt;As it is: I'm still trying my hand at game programming at a fairly low level. My current puzzle is creating spritesheets of character animations and importing them in to the engine I'm writing in C. The images come from Blender, I wrote a Python script that takes the individual rendered frames and copies them onto a 1024x1024 .png file. So: For every frame I write I know:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The model name&lt;/li&gt;
&lt;li&gt;The animation name (walk, run, etc.)&lt;/li&gt;
&lt;li&gt;The direction (north, northeast, etc.)&lt;/li&gt;
&lt;li&gt;The frame width and height&lt;/li&gt;
&lt;li&gt;The frame's position on the new sprite sheet (x, y)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;My needs for the entity data were more complicated and I made a super basic json importer, but I figured with the flatness of this data I could do something a little better here.&lt;/p&gt;
&lt;h1&gt;The Python Part&lt;/h1&gt;
&lt;p&gt;My first thought was a pipe-separated list of values to be read by the engine:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;player|walk|north|64|64|0|0
player|walk|north|64|64|64|0
player|walk|north|64|64|128|0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and so on&lt;/p&gt;
&lt;p&gt;But I got self-conscious about all of those strings, and was like, I could keep a file in common with the C and Python code to hold the string tokens, so now it's:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;player = 1
animation = 2
direction = 5

1|2|5|64|64|0|0
1|2|5|64|64|64|0
1|2|5|64|64|128|0
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which is definitely smaller, but technically, I'm still using strings. And there's the pipe separator to deal with.&lt;/p&gt;
&lt;p&gt;I could pad the numbers and get rid of the pipes, but it's still a string. Unless I can somehow save this as a binary file instead of a text file...&lt;/p&gt;
&lt;p&gt;So:&lt;/p&gt;
&lt;p&gt;In Python I convert the integer data into hex, so 1 becomes, well, 1. But 10 is now A and 11 is B and 16 is, well, 10.&lt;/p&gt;
&lt;p&gt;If I can store each number in two hex characters, that gives me plenty of space to work with. Except for the coordinates, which will definitely go above 256, but I could just save the panel numbers and multiply that by the width or height to get the right place on the image.&lt;/p&gt;
&lt;p&gt;Indeed:&lt;/p&gt;
&lt;p&gt;Now we have hexadecimal strings:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;01020540400000&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="mf"&gt;01020540400100&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;span class="mf"&gt;01020540400200&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;(which is kind of a terrible example, since there aren't any of the A-F characters)&lt;/p&gt;
&lt;p&gt;and we really don't need the newlines there either, since this data is totally fixed width:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;010205404000000102054040010001020540400200&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And since it's a long hexadecimal data stream, we can save that as a binary file from Python.&lt;/p&gt;
&lt;p&gt;Great!&lt;/p&gt;
&lt;p&gt;Size-wize, for those 3 entries:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;data.txt: 87 bytes (the original data with pipes and names)
data.bin: 21 bytes (the binarified hex data)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Over a 75% savings! But that's not even the neat part...&lt;/p&gt;
&lt;h1&gt;So what does that mean from C? (the neat part)&lt;/h1&gt;
&lt;p&gt;The thing about C is it has data structures, which are made up of contiguous memory. So if I have, say, a structure that has:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;uint8_t model;
uint8_t animation;
uint8_t direction;
uint8_t width;
uint8_t height;
uint8_t x;
uint8_t y;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;It's going to take up a fixed amount of memory, and each field will be neighbors. So if you were to separate these into pipes, you'd get something like:&lt;/p&gt;
&lt;p&gt;model|animation|direction|width|height|x|y|&lt;/p&gt;
&lt;p&gt;Or, using a hex-representation of the uint8_t (8 bit) data type:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="mf"&gt;00&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And without pipes:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="mf"&gt;00000000000000&lt;/span&gt;&lt;span class="w"&gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which, I hope, should look somewhat familiar.&lt;/p&gt;
&lt;p&gt;Now all that's left is reading that data in from a file and doing some stuff with it. The structure of my animation data in the game is a bunch of linked lists, so my goal here was to read in to a defined data structure and then iterate over that creating the real animation data I need (and linking it within the larger structure).&lt;/p&gt;</content><category term="programming"></category></entry><entry><title>Goggles</title><link href="https://jimkersey.com/work/goggles.html" rel="alternate"></link><published>2022-09-01T00:00:00-05:00</published><updated>2022-09-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-09-01:/work/goggles.html</id><content type="html">&lt;p&gt;&lt;a href="/static/images/work/goggles_poster.jpeg"&gt;&lt;img alt="Posterized" src="/static/images/work/goggles_poster.jpeg"&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Sketchbook</title><link href="https://jimkersey.com/work/sketchbook.html" rel="alternate"></link><published>2022-08-22T00:00:00-05:00</published><updated>2022-08-22T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-08-22:/work/sketchbook.html</id><content type="html">&lt;p&gt;Pages from the sketchbook.&lt;/p&gt;
&lt;p&gt;&lt;a href="/static/images/sketchbook/sketchbook_1.png"&gt;&lt;img alt="Sketchbook: truncated calculators" src="/static/images/thumbs/sketchbook_1.jpg"&gt;&lt;/a&gt;
&lt;a href="/static/images/sketchbook/sketchbook_3.png"&gt;&lt;img alt="Sketchbook page 3" src="/static/images/thumbs/sketchbook_3.jpg"&gt;&lt;/a&gt;
&lt;a href="/static/images/sketchbook/sketchbook_4.png"&gt;&lt;img alt="Sketchbook page 4" src="/static/images/thumbs/sketchbook_4.jpg"&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="work"></category></entry><entry><title>More Adventur and some math</title><link href="https://jimkersey.com/more-adventur-and-some-math.html" rel="alternate"></link><published>2022-08-21T00:00:00-05:00</published><updated>2022-08-21T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-08-21:/more-adventur-and-some-math.html</id><summary type="html">&lt;p&gt;A quick (maybe) update on things. I've gotten the C version of the code in line with the Python/Pygame version, but I need to organize the code a little better. &lt;/p&gt;
&lt;p&gt;I found myself solving a problem that many have solved before: How do you know if the mouse is …&lt;/p&gt;</summary><content type="html">&lt;p&gt;A quick (maybe) update on things. I've gotten the C version of the code in line with the Python/Pygame version, but I need to organize the code a little better. &lt;/p&gt;
&lt;p&gt;I found myself solving a problem that many have solved before: How do you know if the mouse is within a diamond shape?&lt;/p&gt;
&lt;p&gt;The answer comes from the pre-algebra maths: "Calculating the slope of a line" -&amp;gt; y = mx + b&lt;/p&gt;
&lt;p&gt;The tricky part is that you're calculating x based on what's happening in y, and vice versa.&lt;/p&gt;
&lt;p&gt;These are the basic lines we're after:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;y = x/2 + b
x = -2y + b
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;&lt;img alt="Photo" src="/static/images/isometric_math_0.png"&gt;&lt;/p&gt;
&lt;p&gt;For this exercise I'm checking a diamond shape that's 64 pixels wide and 32 pixels tall, so we're looking for what's in the middle of this shape:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Photo" src="/static/images/isometric_math_1.png"&gt;&lt;/p&gt;
&lt;p&gt;If you have point (0, 0), and your mouse is around (5, 5), we'll call those variables (x, y) and (mouse_x, mouse_y). For this scenario at the origin, we can say:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mouse_x &amp;lt; -2 * mouse_y + 32
mouse_x &amp;gt; -2 * mouse_y - 32
mouse_y &amp;gt; mouse_x / 2 - 16
mouse_y &amp;lt; mouse_x / 2 + 16
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is what it looks like in OSX's Grapher app:&lt;/p&gt;
&lt;p&gt;&lt;img alt="Photo" src="/static/images/isometric_math_3.png"&gt;&lt;/p&gt;
&lt;p&gt;That formula works great if you're at the origin, but once you move away from that you need to compensate a little:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;mouse_x - x &amp;lt; -2 * (mouse_y - y) + 32
mouse_x - x &amp;gt; -2 * (mouse_y - y) - 32
mouse_y - y &amp;gt; (mouse_x - x) / 2 - 16
mouse_y - y &amp;lt; (mouse_x - x) / 2 + 16
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;and since we're adding the same stuff twice for each formula, let's do that ahead of time:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;dx = mouse_x - x
dy = mouse_y - y

dx &amp;lt; -2 * dy + 32
dx &amp;gt; -2 * dy - 32
dy &amp;lt; dx / 2 + 16
dy &amp;gt; dx / 2 - 16
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Now: you could simplify even more by getting the absolute value of dx and dy up front:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;dx = abs(mouse_x - x)
dy = abs(mouse_y - y)

dx &amp;lt; -2 * dy + 32
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;So in the code that's drawing the cells, you send the coordinates of the cell you're drawing to see if the mouse is in it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;in_diamond&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;mouse_x&lt;/span&gt;, &lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;mouse_y&lt;/span&gt;, &lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;x&lt;/span&gt;, &lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;y&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; {
    &lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;abs&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;mouse_x&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;x&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;int&lt;/span&gt; &lt;span class="nv"&gt;dy&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nv"&gt;abs&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;mouse_y&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nv"&gt;y&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;dx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nv"&gt;dy&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
}


        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nv"&gt;found_mouse&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nv"&gt;in_diamond&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;mouse_x&lt;/span&gt;, &lt;span class="nv"&gt;mouse_y&lt;/span&gt;, &lt;span class="nv"&gt;tile_x&lt;/span&gt;, &lt;span class="nv"&gt;tile_y&lt;/span&gt;&lt;span class="ss"&gt;))&lt;/span&gt; {
            &lt;span class="nv"&gt;render_mouse&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;renderer&lt;/span&gt;, &lt;span class="nv"&gt;cell_x&lt;/span&gt;, &lt;span class="nv"&gt;cell_y&lt;/span&gt;, &lt;span class="nv"&gt;tile_x&lt;/span&gt;, &lt;span class="nv"&gt;tile_y&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
            &lt;span class="nv"&gt;found_mouse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
            &lt;span class="k"&gt;if&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;mouse_down&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt; {
                &lt;span class="nv"&gt;trigger_mouse&lt;/span&gt;&lt;span class="ss"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;cell_x&lt;/span&gt;, &lt;span class="nv"&gt;cell_y&lt;/span&gt;&lt;span class="ss"&gt;)&lt;/span&gt;&lt;span class="c1"&gt;;&lt;/span&gt;
            }
        }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Which lets the renderer know that it needs to draw the reticle on the cell.&lt;/p&gt;
&lt;p&gt;(my ascii notes)&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;&lt;span class="o"&gt;-----------------------------------------------------------------------------------&lt;/span&gt;
&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            &lt;span class="o"&gt;|&lt;/span&gt;            &lt;span class="o"&gt;/&lt;/span&gt;\ &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;                 &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Iteration&lt;/span&gt; &lt;span class="n"&gt;start&lt;/span&gt; &lt;span class="n"&gt;tile&lt;/span&gt;
  _ _ _ _ _ _     &lt;span class="o"&gt;|&lt;/span&gt;           &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\                   &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt;          &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\                     &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt;         &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\                    &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\                   &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  _
 &lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt;        \&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\ &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="o"&gt;|-&lt;/span&gt; &lt;span class="n"&gt;same&lt;/span&gt;
 &lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;_&lt;span class="o"&gt;|&lt;/span&gt;    &lt;span class="o"&gt;|&lt;/span&gt;         \&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;               &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;6&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;  _&lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="nf"&gt;width&lt;/span&gt;
&lt;span class="nf"&gt;           &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;     &lt;span class="o"&gt;----&lt;/span&gt; \&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="n"&gt;row&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;draw&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;7&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="n"&gt;fig.&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;           &lt;span class="o"&gt;|&lt;/span&gt;           \&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;                    &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;8&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
 &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;D&lt;/span&gt; &lt;span class="n"&gt;Array&lt;/span&gt;        &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;fig.&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;     \&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="o"&gt;/&lt;/span&gt;                     &lt;span class="o"&gt;|&lt;/span&gt;  &lt;span class="m"&gt;9&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
                  &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;Rotated&lt;/span&gt; &lt;span class="m"&gt;45&lt;/span&gt;°  \&lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;            &lt;span class="o"&gt;&amp;lt;-&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="m"&gt;10&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;------------------------------------------------------------------------------------&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;And here's the result: A yellow oval moving from cell to cell in the isometric map:&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/p-hpuWjZHwI" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="566" height="440" frameborder="0"&gt;&lt;/iframe&gt;</content><category term="games"></category></entry><entry><title>Hello, Pelican</title><link href="https://jimkersey.com/hello-pelican.html" rel="alternate"></link><published>2022-08-14T17:19:00-05:00</published><updated>2022-08-14T17:19:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2022-08-14:/hello-pelican.html</id><content type="html">&lt;p&gt;Setting this site up with &lt;a href="https://getpelican.com"&gt;Pelican&lt;/a&gt;, a Python tool for generating websites.&lt;/p&gt;
&lt;p&gt;In the process of transferring stuff over from other sites, so it'll look like I'm posting from the past for a while.&lt;/p&gt;</content><category term="meta"></category></entry><entry><title>The Amok Bros. 2021</title><link href="https://jimkersey.com/work/amok-bros-2021-cover.html" rel="alternate"></link><published>2021-08-22T00:00:00-05:00</published><updated>2021-08-22T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2021-08-22:/work/amok-bros-2021-cover.html</id><content type="html">&lt;p&gt;Speculative cover for the 2021 run of &lt;em&gt;The Amok Bros.&lt;/em&gt;&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Linux setup</title><link href="https://jimkersey.com/linux-setup.html" rel="alternate"></link><published>2021-06-26T00:00:00-05:00</published><updated>2021-06-26T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2021-06-26:/linux-setup.html</id><summary type="html">&lt;p&gt;All of the things I remember/forget to do when setting up a new machine&lt;/p&gt;
&lt;p&gt;(A work in progress, safety not guaranteed)&lt;/p&gt;
&lt;h2&gt;Install Bhodi Linux&lt;/h2&gt;
&lt;p&gt;Current version: 6.0&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bodhilinux.com"&gt;Bhodi Linux Homepage&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Enlightenment settings&lt;/h2&gt;
&lt;h3&gt;Make alt-tab switch between all open windows&lt;/h3&gt;
&lt;p&gt;(not just the ones on your current desktop)&lt;/p&gt;
&lt;p&gt;Settings …&lt;/p&gt;</summary><content type="html">&lt;p&gt;All of the things I remember/forget to do when setting up a new machine&lt;/p&gt;
&lt;p&gt;(A work in progress, safety not guaranteed)&lt;/p&gt;
&lt;h2&gt;Install Bhodi Linux&lt;/h2&gt;
&lt;p&gt;Current version: 6.0&lt;/p&gt;
&lt;p&gt;&lt;a href="https://bodhilinux.com"&gt;Bhodi Linux Homepage&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;Enlightenment settings&lt;/h2&gt;
&lt;h3&gt;Make alt-tab switch between all open windows&lt;/h3&gt;
&lt;p&gt;(not just the ones on your current desktop)&lt;/p&gt;
&lt;p&gt;Settings -&amp;gt; Windows -&amp;gt; Window Switcher -&amp;gt;&lt;/p&gt;
&lt;p&gt;[X] Windows from other desks
[X] Windows from other screens&lt;/p&gt;
&lt;h2&gt;Bash settings&lt;/h2&gt;
&lt;h3&gt;Change CapsLock to a control key&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;setxkbmap -layout us -option ctrl:nocaps&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Set up an ssh key&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;ssh-keygen -t ed25519 -C "&lt;your email address&gt;"&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Infinite bash history&lt;/h3&gt;
&lt;p&gt;Placeholder&lt;/p&gt;
&lt;h3&gt;Notes on bash history&lt;/h3&gt;
&lt;p&gt;Putting a space before a command keeps the line from being added to your history&lt;/p&gt;
&lt;h3&gt;Disable trackpad (if it bugs you)&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;synclient TouchpadOff=1&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;Pyenv and Pyenv-virtualenv&lt;/h2&gt;
&lt;h3&gt;Install dependencies&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo apt install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl git&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Install Pyenv&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;cd ~/
git clone https://github.com/pyenv/pyenv.git ~/.pyenv&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Install Pyenv-virtualenv&lt;/h3&gt;
&lt;p&gt;Placeholder&lt;/p&gt;
&lt;h3&gt;Install Pycharm&lt;/h3&gt;
&lt;p&gt;https://www.jetbrains.com/pycharm/download/#section=linux&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;tar -xzf pycharm-professional-2021.1.1.tar.gz
sudo mv pycharm-2021.1.1 /opt/pycharm  &lt;br&gt;
/opt/pycharm/bin/pycharm.sh &amp;amp;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Install geckodriver for front-end automated tests&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;wget https://github.com/mozilla/geckodriver/releases/download/v0.24.0/geckodriver-v0.24.0-linux32.tar.gz
tar -xzf geckodriver-v0.24.0-linux32.tar.gz
sudo mv geckodriver /usr/local/bin/geckodriver&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h3&gt;Install Postgresql&lt;/h3&gt;
&lt;blockquote&gt;
&lt;p&gt;sudo apt-get install postgresql&lt;/p&gt;
&lt;/blockquote&gt;</content><category term="linux"></category></entry><entry><title>Adventur</title><link href="https://jimkersey.com/adventur.html" rel="alternate"></link><published>2020-06-26T00:00:00-05:00</published><updated>2020-06-26T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2020-06-26:/adventur.html</id><content type="html">&lt;p&gt;Adventur got a bit overwhelming, so I scaled back and started work on &lt;a href="https://canaryrpg.com" target="_new"&gt;Canary&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;As it is, it's an isometric rpg, written in C and SDL with a Python/Qt world editor.&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/pfoh1nE9yXU" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="566" height="440" frameborder="0"&gt;&lt;/iframe&gt;

&lt;p&gt;&lt;img src="/static/images/adventur_ss_1.jpg" width="500" alt="screenshot of the isometric engine in action, which is a bunch of walls, a few worker robots, and a random person"&gt;&lt;/p&gt;
&lt;p&gt;Prototype engine running in Python using Pygame.&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/VyGewu4Rh4Y" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="566" height="440" frameborder="0"&gt;&lt;/iframe&gt;

&lt;p&gt;Older experiment (with LibGDX)&lt;/p&gt;
&lt;iframe src="https://www.youtube-nocookie.com/embed/4ZrIGnO1YJg" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen="" width="566" height="440" frameborder="0"&gt;&lt;/iframe&gt;</content><category term="games"></category></entry><entry><title>Thumbs Up</title><link href="https://jimkersey.com/work/thumbs-up.html" rel="alternate"></link><published>2016-11-22T00:00:00-06:00</published><updated>2016-11-22T00:00:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2016-11-22:/work/thumbs-up.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Dust Bunny Mafia - Dustraker</title><link href="https://jimkersey.com/work/dustraker.html" rel="alternate"></link><published>2016-05-18T00:00:00-05:00</published><updated>2016-05-18T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2016-05-18:/work/dustraker.html</id><content type="html">&lt;p&gt;Fan art for &lt;a href="https://comics.dustbunnymafia.com"&gt;&lt;em&gt;Dust Bunny Mafia&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Pencils, with the blue construction lines and red/teal title roughs, before inking:&lt;/p&gt;
&lt;p&gt;&lt;a href="/static/images/work/dustraker_pencils.jpg"&gt;&lt;img alt="Dustraker pencil sketch" src="/static/images/work/dustraker_pencils.jpg"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Final&lt;/p&gt;
&lt;p&gt;&lt;a href="/static/images/work/dustraker_final.png"&gt;&lt;img alt="Dustraker final" src="/static/images/work/dustraker_final.png"&gt;&lt;/a&gt;&lt;/p&gt;</content><category term="work"></category></entry><entry><title>Dungeon</title><link href="https://jimkersey.com/dungeon.html" rel="alternate"></link><published>2014-07-05T00:00:00-05:00</published><updated>2014-07-05T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2014-07-05:/dungeon.html</id><content type="html">&lt;p&gt;Use your arrow keys to move, hit 'Tab' to see the map!&lt;/p&gt;
&lt;p&gt;&lt;center&gt;&lt;/p&gt;
&lt;p class="game_frame"&gt;&lt;iframe src="/static/games/dungeon/index.html" style="width: 420px; height:350px; border: 0px;"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&lt;/center&gt;&lt;/p&gt;
&lt;p&gt;Github: Coming soon!&lt;/p&gt;
&lt;p&gt;Another Javascript game that could probably use a bit of work.&lt;/p&gt;</content><category term="games"></category></entry><entry><title>The Living Room</title><link href="https://jimkersey.com/work/living-room.html" rel="alternate"></link><published>2013-06-01T00:00:00-05:00</published><updated>2013-06-01T00:00:00-05:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2013-06-01:/work/living-room.html</id><content type="html"></content><category term="work"></category></entry><entry><title>Doctor Robot</title><link href="https://jimkersey.com/doctor-robot.html" rel="alternate"></link><published>2012-01-24T00:00:00-06:00</published><updated>2012-01-24T00:00:00-06:00</updated><author><name>Jim Kersey</name></author><id>tag:jimkersey.com,2012-01-24:/doctor-robot.html</id><summary type="html">&lt;p&gt;Directions: Use arrow keys to move, 'x' to shoot, and 'z' to jump (or use the jetpack if you have fuel).&lt;/p&gt;
&lt;p&gt;Hint: &lt;b&gt;Duck!&lt;/b&gt; (Down Arrow)&lt;/p&gt;
&lt;p&gt;&lt;center&gt;&lt;/p&gt;
&lt;p class="game_frame"&gt;&lt;iframe src="/static/games/doctor_robot/doctor_robot.html" style="width: 420px; height:340px; border: 0px;"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&lt;/center&gt;&lt;/p&gt;
&lt;p&gt;I wrote this to kind of see if I could put the video game stuff I'd learned to good use with Javascript.&lt;/p&gt;
&lt;p&gt;The maps are …&lt;/p&gt;</summary><content type="html">&lt;p&gt;Directions: Use arrow keys to move, 'x' to shoot, and 'z' to jump (or use the jetpack if you have fuel).&lt;/p&gt;
&lt;p&gt;Hint: &lt;b&gt;Duck!&lt;/b&gt; (Down Arrow)&lt;/p&gt;
&lt;p&gt;&lt;center&gt;&lt;/p&gt;
&lt;p class="game_frame"&gt;&lt;iframe src="/static/games/doctor_robot/doctor_robot.html" style="width: 420px; height:340px; border: 0px;"&gt;&lt;/iframe&gt;&lt;/p&gt;
&lt;p&gt;&lt;/center&gt;&lt;/p&gt;
&lt;p&gt;I wrote this to kind of see if I could put the video game stuff I'd learned to good use with Javascript.&lt;/p&gt;
&lt;p&gt;The maps are just comma-separated integers, there's an app called 'SpriteSomething' on the iPad that will let you make game tiles and then 'paint' with them to export a .csv file.  It's still on the app store (TODO: add link).&lt;/p&gt;
&lt;p&gt;Source on Github: &lt;a href="https://github.com/jkersey/DoctorRobotJS"&gt;https://github.com/jkersey/DoctorRobotJS&lt;/a&gt;&lt;/p&gt;</content><category term="games"></category></entry></feed>