GSamples

C++ Gateware CMake CI/CD Open Source
PlatformsWindows, Mac, Linux
LicenseUnlicense (public domain)
The GBlitter sample, a slime sprite spinning over grass tiles

Contributions

Audio — GSound and GMusic Input — GInput, GBufferedInput and GController Math — GMatrix, GVector and GQuaternion System — GConcurrent, GDaemon, GFile and GLog
Core — GLogic and GThreadShared Graphics — GBlitter Cross-platform validation on Windows, Mac and Linux An offset bit read fix in the GMusic library

Purpose
  • Small, self-contained programs showing how each Gateware interface is meant to be used. Only the code needed for that library, nothing else.
  •  
  • Grouped by level: Audio, Core, Graphics, Input, Math and System. Each builds with CMake, with Gateware as a submodule.
  •  
  • Two surface samples already existed. I wrote the rest, one interface at a time.
The GInput sample polling key states and mouse position
Audio, and a Bug
  • GSound and GMusic need a running app to keep playing, and there was no way to ask whether a track had finished. The samples idle with sleep and yield instead.
  •  
  • The audio file I picked exposed an offset bit read in GMusic. That fix went into the library, not just the sample.
  •  
  • Testing on all three platforms is what caught it.
The GMusic sample, keeping the program alive while a track plays
Threading Samples
  • GDaemon, GThreadShared and GConcurrent taught me the most.
  •  
  • My first GDaemon sample hung event responders off a daemon, which isn't what daemons are for.
  •  
  • The rewrite runs Fibonacci on one daemon while a second toggles it on and off, both reporting status on an interval.
Two daemons, one iterating Fibonacci and one toggling it
Rendering and Tooling
  • GBlitter draws a slime sprite spinning over grass tiles, loaded from TGA files.
  •  
  • GFile and GLogic double as groundwork for automated stress-test analysis.
  •  
  • Three platforms meant a lot of CMake. Every sample ships through the same CI/CD pipeline as the rest of Gateware.
The GBlitter sample, a slime sprite spinning over grass tiles

The GBlitter sample, blitting a slime sprite over TGA grass tiles.

Slime sprite spinning over grass tiles

GInput polling key states, mouse position and delta each frame.

GInput sample source

GMusic holding the program open so a track can finish playing.

GMusic sample source

One daemon iterating Fibonacci while a second toggles it on and off.

GDaemon sample source