GameTimer in C

Last Update: 10/25/2020

This is a simple timer app I wrote in C for Android. It bears some resemblance to a chess clock in concept, but behaves slightly differently.

Project and code are available on my GitLab instance:

GitLab page for gametimer-c-android

Usage

The timer is designed to be used by two people, and would work well for any two-person game such as Battleship or Scrabble. The app is a simple white-on-black interface, designed to be placed between the two players. There is a countdown facing each person, and a checkmark button to switch whose turn it is. The player currently in-turn will see their clock counting down, and it will be reset whenever the checkmark is pressed to signal the next person's turn. Settings for the time duration exist, as well as buttons for stopping/starting gameplay and resetting the time.

GIF of timer in use

Technical Work

Normally, I would have no interest in learning Java or writing an Android app. However, I found an excellent framework on GitHub that allows a person to write primitive Android apps in C. The project is called rawdrawandroid, and is by a user cnlohr.

cnlohr's rawdrawandroid on GitHub

This I found significantly more exciting - I enjoy learning and writing C, and the framework allows one to produce very minimal apps - in many ways, it is more analogous to writing for an embedded system than an Android device.

The framework itself provides only some primitive functions in terms of graphical capabilities. For example, functions for drawing rectangles, lines, and crude fonts are included, as well as polygons (although I could only seem to get triangles to work using the polygon function) and individual pixels.

From these, I constructed button functions, hardcoded a basic bitmap font, and made a function for drawing circles. From here, I was able to construct the entire UI in a comfortable level of abstraction that kept things relatively simple, but facilitated reusing portions like checkmarks and circles without too much tedium.

Installation

One of the defining differences between iOS and Android is that, with Android, I can compile and install my app on my own device, without any app store or license. The process of setting up the build environment is a little tricky, mostly requiring some instructions from the rawdrawandroid project page (the C bindings use Android Studio in order to build the app).

Next Steps

With the app virtually complete, I would like to set up automated builds using my GitLab instance, so that a non-developer would be able to download the app and install it without going through the whole build process.

Back to Projects