Skip to content

Scala Native and Raylib come together to entertain a toddler hell bent on destroying my keyboard

Notifications You must be signed in to change notification settings

indoorvivants/little-fingers

Repository files navigation

Little Fingers

A simple Scala 3 Native application that uses Raylib to render a window where letters are animated when pressed. Written for a post in my blog. The purpose of this "game" is to distract my toddler who is adamant he needs to smash random keys. I also learned quite a lot making it.

Blog post | Tweet

CleanShot 2024-02-01 at 22 31 59

Important: The exact state of repository as described in the blogpost is at this commit. Since then, Raylib released 5.5 and introduced some breaking changes, so the bindings were updated to reflect that, and Scala Native was updated to 0.5.x

Getting started

To run this, you will need to install Scala CLI. This project is only tested on Mac OS and Linux. Instructions and adjustment for Windows are welcome, as long as they're accompanied by a Github Actions workflow.

The project contains a build script that goes like this (all of this should be transparent to you and will be bootstrap from just having scala-cli):

  1. Invoke Scala CLI which
  2. invokes coursier CLI which
  3. invokes sn-vcpkg CLI which
  4. installs dependencies by invoking vcpkg CLI and then
  5. invokes scala-cli with correct compilation and linking flags which
  6. produces the binary

Absolutely scrumptious madness.

Run:

./build.sc app-debug
./build.sc app-release

to build a little-fingers binary in debug or release configuration

Regenerating bindings

To do this, first obtain and setup the bindgen CLI: https://sn-bindgen.indoorvivants.com/quickstart/index.html

./build.sc bindings

About

Scala Native and Raylib come together to entertain a toddler hell bent on destroying my keyboard

Topics

Resources

Stars

Watchers

Forks