2017 Crystal Keys

    • C++➕, Keyboards⌨️, New, Open Source, Programs📈, Tutorial

⏱️Overview

This is the last version of my program for showing pressed keys. It now also shows keyboard layouts.

📜History

The oldest version of it was useful already in 2005, when I was first tinkering with my first keyboards, later named CK1 and CK2. Program showed a list with the Virtual Key and Scan Code values of pressed (held) keys (and their names). It was useful for adding my extra keys on regular keyboards. First by finding which matrix combinations (shorting row and column) give key presses besides the present keyboard keys. Next for finding their codes and using them for binding in e.g. my audio player.

❌Why Qt and QML failed

I previously did the same program using Qt and QML for GUI. Just to get a bit familiar with it and get my own opinion. The repository with it is here. I finally abandoned it after realizing that I would need extra 55 MB in over 100 extra files just to start the program anywhere else. That’s insane ?, surely for such a tiny program. Maybe a huge editing tool or other big application could benefit from Qt (and QML) and hide that size in its own resources. But definitely none of my own programs. Even my Track Editor, but for slightly different reason: to not add Qt as extra dependency for building, when we already have MyGui.

⌨️Layouts

Now my keyboards CK3 and CK4 have different layouts. Hence drawing keyboard layout is a nice feature and visual addition to the list of pressed keys.

There already is a website where you can edit keyboard layouts, for many other keyboards including ergonomic ones, link here. So I decided to save time and not create my own and just used the output from it. It saves layouts in JSON format. Thus I needed a library for C++ that parses .json files. I decided to go with JSMN which is small and fast(est), at just doing what I needed and not much more.

🪟Program

The program is simple and it was easy to code, right after getting familiar with SFML and ImGui. Which I already used in my previous program Color Center.

Graphics and Gui turned out to be good, even if simply one colored and rectangular. The look wasn’t important here anyway, rather to code and use it fast. I made it basically in 2 days. But of course using parsing code and basic application with Gui from the other 2 programs and pressed keys detection from my older program.

Additionally it features a very fast scaling of the layout through slider and can also fit window to it. And a combobox to change layout for other keyboards.

📂Sources

Located here. Including Windows Releases.
Should also work fine on GNU/Linux, after building from sources.

📖Tutorials

The first 3 versions of the program were aimed to be educational and can serve as basic tutorials for simple applications like this one.

Namely cross-platform C++ programs using SFML, built with CMake. With possible interface using ImGui and settings saved in XML with TinyXML2.

See archives in Releases, or use Git to get tags 0.1, 0.3 and 0.5.

Other resources for learning are in SFML tutorials.