<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Thomas Barrett</title>
    <description>The latest articles on DEV Community by Thomas Barrett (@tsbarrett89).</description>
    <link>https://dev.to/tsbarrett89</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F396722%2Fdcc75d2a-16b2-4210-ae4e-8b34d71d0791.png</url>
      <title>DEV Community: Thomas Barrett</title>
      <link>https://dev.to/tsbarrett89</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tsbarrett89"/>
    <language>en</language>
    <item>
      <title>Discovering CSS Grid Layout - part 1 - Character Sheet beginning</title>
      <dc:creator>Thomas Barrett</dc:creator>
      <pubDate>Tue, 02 Jun 2020 05:11:08 +0000</pubDate>
      <link>https://dev.to/tsbarrett89/discovering-css-grid-layout-part-1-character-sheet-beginning-32em</link>
      <guid>https://dev.to/tsbarrett89/discovering-css-grid-layout-part-1-character-sheet-beginning-32em</guid>
      <description>&lt;p&gt;For a long time I put off learning CSS Grid Layout. I know flex-box and am able to achieve my layout goals with it, and therefore had no pressing need for grid. This attitude is one of the many mental traps I lay for myself, and so this morning I determined to recognize it and avoid slipping into it.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://css-tricks.com/" rel="noopener noreferrer"&gt;CSS-tricks&lt;/a&gt; served me well when learning &lt;a href="https://css-tricks.com/snippets/css/a-guide-to-flexbox/" rel="noopener noreferrer"&gt;flexbox&lt;/a&gt; so I turned to their guide for &lt;a href="https://css-tricks.com/snippets/css/complete-guide-grid/" rel="noopener noreferrer"&gt;CSS-Grid&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I decided to try and recreate an RPG character sheet, as it relies on a structured layout, and I am likely to reuse the experience when I work on another planned future project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdwxkvhdoj%2Fimage%2Fupload%2Fv1591070685%2Fblog%2520images%2FCharacter_Sheet_-_Form_Fillable_anu6ew.pdf" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fres.cloudinary.com%2Fdwxkvhdoj%2Fimage%2Fupload%2Fv1591070685%2Fblog%2520images%2FCharacter_Sheet_-_Form_Fillable_anu6ew.pdf" alt="character-sheet"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Grid layout consists of two layers, a parent and its children, just like with flexbox. You can have grids inside of grids, and even a flexbox inside of a grid. But at its simplest form the grid has two types of elements, the parent and its children. The parent container in css needs&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;display: grid;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This is going to allow all the other CSS Grid properties to be used on either the parent or children. For the character sheet I first wanted to establish a parent element that was centered on the page and filled the entire height.&lt;/p&gt;

&lt;p&gt;In addition to the 'display' property there are two more necessary properties to place on the parent element 'grid-template-columns' and 'grid-template-rows'. These are going to establish your columns and rows. Syntax looks like this&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;grid-template-columns: [1st-grid-line-name] 1st-column-width [2nd-grid-line-name] 2nd-column-width [last-grid-line-name]&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;grid-template-rows follow the same syntax. If you don't put 'grid-line-names' in then grid will automatically give each line a positive and negative number (take a look at the &lt;a href="https://css-tricks.com/snippets/css/complete-guide-grid/#prop-grid-template-columns-rows" rel="noopener noreferrer"&gt;CSS-Tricks Grid guide&lt;/a&gt; for a better explanation). I don't mind using the automated numbers myself so you won't see them in my code examples.&lt;/p&gt;

&lt;p&gt;I created a character sheet div and used the following CSS to center it and take up the entire height.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;body {&lt;br&gt;
        display: grid;&lt;br&gt;
        grid-template-columns: 1fr 18fr 1fr;&lt;br&gt;
        grid-template-rows: 1fr;&lt;br&gt;
    }&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;fr? What is fr? Oh right, I'm supposed to be the one explaining. fr is a unit that will allow you to set a size as a fraction of the remaining free space of a container. The key is the 'remaining'. If you set one of the columns to a non-flexible width (such as px) it will break up what is remaining into the fractional parts. In the above example I have not set any non-flexible widths, but I am breaking the entire width of the body into 20 parts (1 + 18 + 1) and assigning the first column to have 1/20 (5%), the middle column to have 18/20 (90%), and the third and final column to have the last 1/20 (5%).&lt;/p&gt;

&lt;p&gt;For my rows I am establishing a single row which will take up 1/1 (100%) of the body's height.&lt;/p&gt;

&lt;p&gt;Now all I need to do is tell the character sheet (body's child) div to occupy the middle column. but how? The 'grid-area' property. Now there are a few different properties you can use to set a child's area of the grid, but I like that grid-area clearly defines the four lines that will contain each child element. Here's the syntax&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;grid-area: row-start / column-start / row-end / column-end;&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;This is where you need the grid line names. Again I just use the auto generated ones (numbers starting at 1). Here is my code on the child of body (character-sheet) placing it inside the middle column, remember I only established one row.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.character-sheet {&lt;br&gt;
       grid-area: 1 / 2 / 2 / 3;&lt;br&gt;
   }&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;There we go, one character sheet centered with CSS grid. Well, sort of, really its just a div I named character sheet, I better get something inside. Now the process starts all over. A new grid needs to be established with character sheet as the parent, and each of the sections as children. Tune into part 2 to see how it's done.&lt;/p&gt;

&lt;p&gt;-Thomas Barrett&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Simple Math Adventure Game with PixiJS</title>
      <dc:creator>Thomas Barrett</dc:creator>
      <pubDate>Sat, 30 May 2020 06:56:47 +0000</pubDate>
      <link>https://dev.to/tsbarrett89/simple-math-adventure-game-with-pixijs-4fn3</link>
      <guid>https://dev.to/tsbarrett89/simple-math-adventure-game-with-pixijs-4fn3</guid>
      <description>&lt;p&gt;Last weekend I wanted to learn more about animations, specifically with the intent to build a game. A quick google search of "best framework for javascript game" brought up a few options, but Pixi.js caught my eye. A fleeting memory of the name crossed my mind and so I followed the link.&lt;/p&gt;

&lt;p&gt;I quickly found a list of &lt;a href="https://www.pixijs.com/tutorials"&gt;tutorials&lt;/a&gt; and jumped into &lt;a href="https://www.youtube.com/playlist?list=PL08jItIqOb2oGcyrgREbrm_b9OW7TE1ji"&gt;CJ Gammon's youtube videos&lt;/a&gt;. After scratching my head a bit I decided to try &lt;a href="https://github.com/kittykatattack/learningPixi"&gt;kittykatattack's tutorial&lt;/a&gt; instead. I followed along, taking in a little at a time, and then trying it out in my own way, and going back to the videos when I needed them.&lt;/p&gt;

&lt;p&gt;My experience with animations is limited so I can't make any comparisons, but I was pleased by what I could accomplish with Pixi rather quickly. Within a couple hours (over 2 nights) I had a promising start to a choose your own adventure type game, but I recalled that this type of game would lean heavily on the story, and in the end my aim was to strengthen my coding ability. While I was contemplating where to further my experiment and showing off to my wife she said something that stuck, "It looks like a kid's game." At first I was a little annoyed (that pesky ego of course), but once that moment passed ("moment" === "day") and I took another look I saw what she meant. The icons and artwork I had found all had a soft, welcoming, look and an idea began to emerge.&lt;/p&gt;

&lt;p&gt;Since the beginning of school shutdown I struggled to juggle my work and homeschooling. This here might be an opportunity to combine the two. I set off to build a dungeon adventure game that incorporated basic math. Over this last week I spent my nights working on it and feel content with the result. There were plenty of bugs (and still are) but I was able to produce a working game that allows players to choose their adventurer and then solve addition equations to earn action points. Adventurers use the action points to move through a dungeon while avoiding arrows until they reach the other side.&lt;/p&gt;

&lt;p&gt;Here is the &lt;a href="https://github.com/tsbarrett89/pixi-practice"&gt;github repo&lt;/a&gt;&lt;br&gt;
And &lt;a href="https://dungeon-adventures.netlify.app"&gt;deployed site&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There is still much to do (especially in organizing and commenting my code), but if you see any glaring issues or just have a suggestion please let me know.&lt;/p&gt;

&lt;p&gt;-Thomas Barrett&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>pixijs</category>
    </item>
    <item>
      <title>Blog Intent</title>
      <dc:creator>Thomas Barrett</dc:creator>
      <pubDate>Wed, 27 May 2020 20:59:40 +0000</pubDate>
      <link>https://dev.to/tsbarrett89/blog-intent-1m7a</link>
      <guid>https://dev.to/tsbarrett89/blog-intent-1m7a</guid>
      <description>&lt;p&gt;As I am new to web development, I reached out for help in my journey yesterday to Sam Julien. The focus of the conversation was my &lt;a href="https://thomasbarrett.dev"&gt;portfolio&lt;/a&gt;, but in general I sought advice in my efforts to land that first tech job. During the conversation Sam suggested I start a blog. Nothing special, just a written record of my journey that I can share and reflect on. Today marks the beginning of that record.&lt;/p&gt;

&lt;p&gt;My intent will be to write every other day, at least, about anything related to my journey. That may be about learning Pixijs, or how to improve my resume, or a new person I met and what I took from the interaction.&lt;/p&gt;

&lt;p&gt;I imagine this will reach a rather small audience, initially, but I do ask anyone interested to help by holding me accountable. If I have not posted recently, please ask my why. Too often I convince myself that I am wasting time because I see no results. The problem is that often means I stop spending time on things that matter before the results are visible, but that does not mean they are not present.&lt;/p&gt;

&lt;p&gt;-Thomas Barrett&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
