Skip to content

regb/sgl-starter-project

Repository files navigation

Starter Project for SGL

This is a sample project for getting started with the Scala Game Library (SGL), a cross-platform game engine for the Scala programming language.

How to run

To use it, you will need SBT, git, a working Scala Native setup (install required software from the official documentation.

Then you need to compile and publish SGL locally:

git clone git@github.com:regb/scala-game-library.git
cd scala-game-library
sbt publishLocal

Once SGL is published locally, you should be able to play with the starter project. Go to the root directory (of this repository, not the scala-game-library). And run:

sbt desktop/run

This will start the sample app running on the JVM. You can run it natively with:

sbt native/run

And you can compile it to Javascript and run it in the browser with:

sbt html5/fastOptJS

All you need to run it is a <canvas id="scalavator_canvas"> tag and a script tag loading the compiled game. Here's an example.

Where to go from there

You can read the tutorial explaining the starter project step-by-step. It provides insights on how SGL works and the follow-up articles show how to use more advanced features of SGL.

You can play around with the game code in ScalavatorGame.scala using the ScalaDoc of SGL to figure out the API (it should have been published locally as well). Just edit the code, and run sbt desktop/run to see the result.

You can take a look at the Scalavator game which is one possible evolution from this starter project into a complete game with graphics, that runs on multiple platforms.

About

A simple starter project to use SGL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published