Add a reference diagram of the 19 glyphs of Scribe
authorCarl Worth <cworth@cworth.org>
Sat, 20 Jun 2020 17:28:34 +0000 (10:28 -0700)
committerCarl Worth <cworth@cworth.org>
Sat, 20 Jun 2020 17:28:34 +0000 (10:28 -0700)
Trying my hand at using the <svg> element within HTML for the first
time. It's actually quite nice and I might start using it more
frequently rather than trying to fight browser layout mechanisms when
I'm trying to draw something very explicit, (like a board game).

scribe/scribe.css
scribe/scribe.jsx

index 6b1e5a642a54d2d582bfee477a5ac884371dcbdd..c3852b1c2790e2436bbe89d01a2beae19de4272e 100644 (file)
 .square.open:hover {
     background-color: var(--accent-color-bright);
 }
+
+.glyphs {
+    padding-top: 0.5em;
+    display: grid;
+    grid-template-columns: 1fr 1fr 1fr 1fr 1fr;
+    grid-column-gap: 0.5em;
+    grid-row-gap: 0.25em;
+}
+
+.glyph-and-name {
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+}
+
+.glyph {
+    width: 8vw;
+    height: 8vw;
+}
index 78155949f782174a6ff40d2a80c7b5948f715868..7b68ff05afe8ac16d78b74d6b74d49b7f4fe73cf 100644 (file)
@@ -165,6 +165,39 @@ function PlayerInfo(props) {
   );
 }
 
+function Glyph(props) {
+
+  const glyph_dots = [];
+
+  for (let row = 0; row < 3; row++) {
+    for (let col = 0; col < 3; col++) {
+      if (props.squares[3 * row + col]) {
+        let cy = 10 + 20 * row;
+        let cx = 10 + 20 * col;
+        glyph_dots.push(
+          <circle
+            cx={cx}
+            cy={cy}
+            r="8"
+          />
+        );
+      }
+    }
+  }
+
+  return (<div className="glyph-and-name">
+            {props.name}
+            <div className="glyph">
+              <svg viewBox="0 0 60 60">
+                <g fill="#287789">
+                  {glyph_dots}
+                </g>
+              </svg>
+            </div>
+          </div>
+         );
+}
+
 function Square(props) {
   let className = "square";
 
@@ -415,6 +448,122 @@ class Game extends React.Component {
             onClick={(i,j) => this.handle_click(i, j, first_move)}
           />
         </div>
+      </div>,
+      <div key="glyphs" className="glyphs">
+        <Glyph
+          name="Single"
+          squares={[1,0,0,
+                    0,0,0,
+                    0,0,0]}
+        />
+        <Glyph
+          name="Double"
+          squares={[1,1,0,
+                    0,0,0,
+                    0,0,0]}
+        />
+        <Glyph
+          name="Line"
+          squares={[1,1,1,
+                    0,0,0,
+                    0,0,0]}
+        />
+        <Glyph
+          name="Pipe"
+          squares={[0,0,1,
+                    1,1,1,
+                    0,0,0]}
+        />
+        <Glyph
+          name="Squat-T"
+          squares={[1,1,1,
+                    0,1,0,
+                    0,0,0]}
+        />
+        <Glyph
+          name="4-block"
+          squares={[1,1,0,
+                    1,1,0,
+                    0,0,0]}
+        />
+        <Glyph
+          name="T"
+          squares={[1,1,1,
+                    0,1,0,
+                    0,1,0]}
+                />
+        <Glyph
+          name="Cross"
+          squares={[0,1,0,
+                    1,1,1,
+                    0,1,0]}
+        />
+        <Glyph
+          name="6-block"
+          squares={[1,1,1,
+                    1,1,1,
+                    0,0,0]}
+        />
+        <Glyph
+          name="Bomber"
+          squares={[1,1,1,
+                    0,1,1,
+                    0,0,1]}
+        />
+        <Glyph
+          name="Chair"
+          squares={[0,0,1,
+                    1,1,1,
+                    1,0,1]}
+        />
+        <Glyph
+          name="J"
+          squares={[0,0,1,
+                    1,0,1,
+                    1,1,1]}
+        />
+        <Glyph
+          name="Earring"
+          squares={[0,1,1,
+                    1,0,1,
+                    1,1,1]}
+        />
+        <Glyph
+          name="House"
+          squares={[0,1,0,
+                    1,1,1,
+                    1,1,1]}
+        />
+        <Glyph
+          name="H"
+          squares={[1,0,1,
+                    1,1,1,
+                    1,0,1]}
+        />
+        <Glyph
+          name="U"
+          squares={[1,0,1,
+                    1,0,1,
+                    1,1,1]}
+        />
+        <Glyph
+          name="Ottoman"
+          squares={[1,1,1,
+                    1,1,1,
+                    1,0,1]}
+        />
+        <Glyph
+          name="O"
+          squares={[1,1,1,
+                    1,0,1,
+                    1,1,1]}
+        />
+        <Glyph
+          name="9-block"
+          squares={[1,1,1,
+                    1,1,1,
+                    1,1,1]}
+        />
       </div>
     ];
   }