Installation & Usage
Get started with S2D CLI by installing the tool and creating your first S2D project.
🔗 Prerequisites
Before installing S2D CLI, ensure you have the following installed:
- Java 11 or later - Required for Scala and sbt
- Scala 3.3.6 - The language version used by S2D
- sbt 1.11.2 or scala-cli - Build tools for Scala projects
- Git - Required for cloning library dependencies
Platform-specific requirements:
- Windows: No additional setup required - libraries included automatically
- Linux: Install SDL2, GLEW development packages
- macOS: Install SDL2, GLEW via Homebrew
🔗 Installation
S2D CLI is distributed via Coursier. This is the recommended and only supported installation method:
Install via Coursier
cs install s2d --contrib
This will make the s2d
command available globally on your system.
Alternative: Build from Source (Not Recommended)
If you need to build from source for development purposes:
git clone https://github.com/FinochioM/S2D_CLI.git
cd S2D_CLI
sbt publishLocal
🔗 Verification
Verify your installation by running the help command:
s2d --help
You should see output similar to:
S2D - Scala 2D Native Library CLI Tool
Usage:
s2d --generate Generate a new S2D project template
s2d --help Show this help message
🔗 Basic Usage
S2D CLI provides two main commands:
Generate a new project
s2d --generate
Show help
s2d --help
Cancel operation
During project generation, you can type cancel
at any prompt to exit.
🔗 Your First Project
Let's create your first S2D project:
- Run the generator:
s2d --generate
- Follow the prompts:
- Enter project name (e.g., "my-first-game")
- Choose build system (scala-cli recommended for beginners)
- Enter project path (or press Enter for current directory)
- Navigate to your project:
cd my-first-game
- Run the project:
# For scala-cli projects: scala-cli run . # For sbt projects: sbt run
Your S2D window should open displaying a blue background. You're now ready to start building your game!
For more details on project structure and customization, see the Project Generation guide.