Projects Jams Discord News
Resources
Unwind Fishbowls Forums
About
Manifesto Our values About
Log In

Colourblind tool - open source single header library

Andrew Reece June 18, 2018

Apologies for the long delay since my previous post - I quit my job, and I've been focusing more on things that will pay the bills...

I'm starting to think about UI a bit more, for which colour is often very important. Something that's fairly easy to do, but often overlooked, is to make sure that colour choices are suitable for colourblind users as well as people with normal colour vision (if that's even done at all). Since about 8% of people are colourblind, it's a significant chunk of your user base to alienate if you get it badly wrong.

I've put together some utilities for evaluating colours and simulating colourblindness for each missing cone. This is as a C header library and some glsl matrices.

Check it out on Github.

Read more

v0.62.0 OpenGL at last

Andrew Reece May 6, 2018

Say goodbye to jaggies, it's smooth sailing (and rasterization) from here on out!

I finally got round to getting my rendering to work on OpenGL. This lets me do things like animation smears really easily.

I'm not sure what the compatibility is like for graphics cards, but if it doesn't work you can hit F6 to toggle software rendering.

Download from the Github repo

Read more

05. Undo, Redo and Units of Interaction

Andrew Reece April 29, 2018

I don't think I'm doing anything revolutionary with my undo system, but hopefully making the reasoning behind it very explicit will elucidate any missing steps in the reader's or my thinking.

A large part of this is trying to define 'units of interaction' for the user and then matching that to what can be robustly determined and stored in the software.

I describe this here as a roughly linear sequence for the sake of clarity. In reality the process was more iterative, and broadly follows Casey Muratori's Semantic Compression approach.

Throughout the article, I use 'units of interaction', 'units of action', 'task units' etc interchangeably.

Contents [ul]

  • Contents
  • Intro
  • Naive undo states
    • Why this is not good enough
  • Actions
  • [li]User Actions [ul] [li]Theory [ul]
  • Action Cycle and Principles
  • Error types
  • [li]Action hierarchy[/

    Read more

    Adding icons and other resources to your executable (Windows & cross-platform)

    Andrew Reece April 18, 2018

    At some point you'll probably want to include some data or resources into the executable itself (e.g. fonts, images etc). This is particularly true for my case, as I'm trying to keep to a portable single-executable model. That means that I can't keep resources in a surrounding folder and load at runtime, and I don't want to assume that the user already happens to have the files on their system.

    Icons are one example of a useful resource that takes an application from looking amateurish to looking like a Real Product (tm).

    This post will show some cross-platform methods of adding resources to your application, and a Windows-only method, with icons as an example.

    Contents [ul]

  • Intro
  • Compiled resources (platform-independent)
    • xxd
    • GIMP
  • [li]Linking (Windows-specific) [ul] [li]Linking icons as resources [ul]
  • RC file text
  • RC to RES
  • Linking the RES to your executable
  • [li]Resource acce

    Read more

    03. Designing, saving and loading a forward-compatible binary file format

    Andrew Reece April 13, 2018

    This is a little out-of-sync, but I've been working on it recently and thought it was worth writing about before I forgot it all.

    I didn't want the filetype to be something users would have to think about, so I put a reasonable amount of effort into making the data forward-compatible and the loader backward-compatible.

    I have no idea how well the following will relate to text-based file formats.

    Contents

    • Header Format
    • Data Array Format
    • Type Enumeration
      • Basics
      • Sizing information
      • Enum Versioning
      • Type Versioning
    • Saving Files
      • Checking the byte output
    • Opening/Loading Files
    • Conclusions

    Header Format

    Most, if not all, binary filetypes begin with a header to provide some metadata about the information to be loaded. There was a bit of back and forth between how the data would be laid out and the header descri

    Read more

    1 year of Geometer - Lessons learnt

    Andrew Reece April 3, 2018

    It's now a little over one year since the first commit on Geometer. The process has taught me a lot, so I thought I'd give a quick overview of some of the things I've learnt, as well as hint at some future blog posts.

    Contents

    • Project strategy
    • Version Control
    • Process of writing code
    • Invalid array indexes
    • Enums
    • Macros
    • Saving and loading binary files
    • Linear memory undo
    • Geometry/maths
    • Complex state-based user input
    • UI Feedback
    • Multiple monitors
    • Resources
    • Common/notable bugs

    Project strategy [ul]

  • It's difficult to find time to work when moving to a new area and starting a new full-time job
  • Weekends always seem like they'll have loads of time, but social/admin obligations often seem to pop up.
  • [li]The most productive time for me seems to be in t

    Read more

    v0.60.9 - Layers, layer thumbnails, smoother cursor snapping

    Andrew Reece March 25, 2018

    Ever wanted to draw shapes on top of your shapes? Well, now you can, with the all-new Geometer!

    Probably the most requested feature to date, you can now draw on multiple layers. Intersections between shapes on different layers can be interacted with as normal. Layers are primarily useful for aiding in construction. Once the additional scaffolding has been finished with, you can clear out the layer.

    I couldn't put it off any longer, I finally added some UI that wasn't directly about drawing: there's now a pop-out drawer with thumbnails of the different layers. I've arbitrarily limited the number of layers to 5 until I implement some scrolling UI or similar.

    Whenever there were multiple points close together, the cursor snapping between them used to be distracting and difficult to follow. I've added some smoothing so that the cursor moves, rather than jumps, between snap points.

    There have been some internal changes to make versioning the file format easier for me and hopeful

    Read more

    Slight pause on Geometer, some debug libraries to share

    Andrew Reece February 22, 2018

    Apologies for the delay since my last post - I had to go away for work, and then I was ill for a while. I didn't feel like jumping straight back into Geometer while not 100% mentally with it, so I worked a bit on extracting some debug things I find useful into standalone libraries. They're (very clearly) influenced to various degrees by Handmade Hero, and I have a few more ideas that I don't think Casey's mentioned that I'll be adding soon.

    Main features

    • live tweaking/watching of variables
    • in-app recompilation
    • dll/library/code reloading
    • a content-agnostic way for organising debug variables of multiple types into a hierarchy
    • no dynamic allocation - the libraries only use static variables and arrays
    Check them out on their GitHub page. I have code examples up there that should give you an idea of how they're used. I've tried to make their use as low-friction as possible.

    Read more

    v0.58 release - Select, move, delete points, better arc drawing

    Andrew Reece January 22, 2018

    Do you ever look around at points strewn about the place and think to yourself, "who put these here?"? Now you can move them to their rightful places or get rid of them altogether.

    Changes in this version:

  • return to LMB-based drawing (with new features)
  • make arc creation more intuitive
  • add the ability to box-select points (RMB-drag)
  • add and remove points from the current selection
  • move points after they are selected (LMB-drag)
  • delete points after they are selected (Delete)
  • reduce filesizes
  • the file format should now be forwards-compatible enough that any saves won't be broken by future versions
  • Download directly or from the GitHub repo.

    Read more

    v0.52.4 release - Infinite undo/redo, SVG export, no unwanted intersections

    Andrew Reece January 8, 2018

    Cast your mind back to previous actions. If only they weren't set in stone. If only they could be returned to and redone with your current knowledge of the task at hand...

    Changes since the previous release

    • New data structure for actions allows infinite undos/redos, including before the file was opened
    • Arrow-key panning now accounts for zoom level
    • Speedup from no longer trying to draw shapes outside the screen
    • Intersections now only appear when moused over or when used as drawing points
    • Ability to export SVG - Ctrl + Shift + E
    • CRC32 check on file open
    • Better shape snapping previews
    • Assorted bug fixes
    • Assorted UI consistency improvements
    Download directly or from the Geometer Github repo

    Read more

    Happy Belated Christmas! Have a (test) sweet, dear.

    Andrew Reece December 29, 2017

    Hi all,

    It's been a lot longer than I was hoping since my last update. I've done some fairly major rearchitecting that will allow for some cool new features, including layers and infinite undo histories that persist beyond the application closing.

    I had just about finished the changes and the latter feature a few days before Christmas when I hit an obscure memory bug. It seems to be originating from some code written months ago, showing up around my hot reloading code or when that's removed, my XInput handling. I went back to my parent's house for the holiday before I was able to track the bug down. Armed only with my work MacBook Pro, I was unable to do any more work directly on Geometer (which is currently Windows-only).

    Instead, as I've only been using asserts for validating behaviour so far, I spent some time working on a single header file test suite.

    Take a look at sweet.h's GitHub repo if you want to use it for yourself.

    Read more

    v0.9 release - New input features: extend segments, perpendicular, snap to shapes...

    Andrew Reece November 26, 2017

    The tools of the ancients have been revealed to us - draw lines, arcs and circles as they were originally intended to be drawn.

    New features:

    • Overlay with controls and help info (toggle with F1)
    • Extending segments
    • Drawing segments at a perpendicular
    • Snapping to shapes
    • Drawing the point equivalent of a shape
    • New file shortcut
    • Better opening of files
    • Cursor change based on current action
    • Store divider lengths as letters
    • Divide/multiply current length by integers with the number keys
    • Swap to previous length with Tab
    • Better drawing previews

    The input method has changed to allow for all the new input methods (hit F1 to see controls). This will probably change again and be consolidated once (if?) the ability to edit shapes and points is added. So don't get too attached!

    [url=https://geometer.handmade.network/static/media/file/geometer/geometer_v0_9.

    Read more

    Quick note - bugs from mistaking points for vectors.

    Andrew Reece October 28, 2017

    A couple of the more time-consuming/confusing bugs to track down have been from mistakenly passing an absolute position (point) instead of a relative position (vector) to functions that use these for drawing or intersection or similar.

    These are a little difficult to track down because by default I'm drawing pretty close to the origin, so the relative positions are often very similar to the absolute ones. As a result, the bugs would appear inconsistently. I was attempting to fix these a little while after writing them, and so didn't have all the intentions behind each passed parameter cached in my brain. When stepping through the debugger, the points being passed didn't raise any red flags and so I didn't pay much attention to them. I thought the source of the problem was elsewhere.

    Once I had fixed the first bug after an embarrassingly long time, the second time a similar bug came up went much quicker. Awareness is your best defence!

    'Best'? Ok, probably not, but it's definit

    Read more

    v0.8 release - Infinite points & shapes; save and open files

    Andrew Reece September 22, 2017

    Go out at night and try to count all the stars in the sky. Go to a beach and try to count the grains of sand. Look to the future and try to count all the possible paths you could take. You will now have the same difficulties in trying to count all the points and shapes that you can draw in Geometer. Draw constructions as large as you can imagine!

    Your drawings can now be saved from being ephemeral wisps, floating in the ether. Save and open functions let you pause and continue your creative process at any time.

    • Ctrl + S to save
    • Ctrl + Shift + S to save as
    • Ctrl + O to open
    • Ctrl + Shift + O to open in new window

    Download directly or from the Geometer GitHub repo.

    Read more

    02. Line Drawing

    Andrew Reece September 12, 2017

    This is (a slightly simplified version of) how I currently draw my fully aliased (sic) lines.

    The code was initially written some time after watching Casey's video discussing the issue, so I can't say how much it was influenced by it. I have a feeling there may be some similarity to Bresenham's algorithm, but I haven't looked at it yet. As in large part my current programming practice in general and this project in particular are more focused on improving my skills than quickly achieving results, I've tried to solve problems at least to a functional level myself, before possibly finding a better version from someone else.

    If you don't want that opportunity spoiled for yourself I recommend you stop reading here, implement an algorithm for drawing straight lines for yourself, then come back and compare techniques.

    All done? Probably not... ah well, read on anyway...

    The Problem: We would like to be able to draw a straight line from any one pixel (A) to any other (B)

    Read more

    01. Overview

    Andrew Reece August 15, 2017

    This post is meant to provide a general overview of the code structure to contextualize later information.

    Platform As with Handmade Hero, I'm using a win32 layer that opens a dll with the platform-independent interaction and rendering code. The dll is watched and reloaded when it gets recompiled.

    Points All the drawing is based on a large array of points, which shapes index into for their constituent components. This allows for easily moving points around both individually by the user and as a group when rotating/panning/zooming the canvas. These are currently alongside a parallel array of bytes that comprise bit flags for the status of the points, e.g. whether it's an intersection and/or the centre of a circle.

    Shapes The main shapes are line segments, circles and arcs. Rays and lines (infinitely long in one and two directions, respectively) might be added later. They are numeric indices into the points array. [ul][li]Line

    Read more

    v0.7.1 Release - Animation and icons

    Andrew Reece August 14, 2017

    No longer shall you be disoriented by rapid changes in the movement or rotation of the canvas. Be smoothly transported from one place to another as if guided by well-oiled bearings. Furthermore, do so under the 'G' banners proudly emblazoned on the taskbar and corner of your window.

    Download directly or from the Geometer Github repo.

    Read more

    v0.7 Release - Canvas panning, rotation and zoom; window resizing

    Andrew Reece August 13, 2017

    The shackles keeping your canvas in place have been cast off! Exercise your newfound freedom by moving around, looking at the world from different angles, and getting up close to really appreciate those pixelly curves.

    Download v0.7 directly or the Geometer GitHub page.

    [ul]

  • Pan with the arrow keys or middle-click + drag or space + left-click + drag.
  • Return to the origin with Home.
  • Zoom with PgUp/PgDown or the scroll wheel.
  • Rotation is achieved by setting the (horizontal, right-facing) x-axis. After selecting a point, Alt + left-click to set the x-axis along the line that would have been drawn.
  • The canvas can now be resized.
  • [li]Alt + Enter to enter and exit full-scr

    Read more

    00. Greetings

    Andrew Reece July 31, 2017

    Hi all, thanks for checking out my project. The software I'm making, 'Geometer', is a desktop application for drawing in a way that emulates traditional construction with compass and straightedge. There's more info on the impetus behind it on the main project page, so I'll try not to repeat myself too much here.

    This is just to provide a brief introduction to me, the project, and what I'll be doing with this blog.

    Me

    I'll get the self-aggrandizing part out of the way so we can focus on the important stuff.

    I'm Andrew, I've just graduated with a BSc in Ergonomics (Human Factors Design) from Loughborough University. I started learning to program a few years ago, when I asked a comp-sci student I knew how I could get into making games. This was initially using Processing, which has the advantage that you can get into graphical content and interaction straight away. School, mediocre self-organisation, and making things in other medium

    Read more