spine-glfw
The spine-glfw runtime provides functionality to load, manipulate and render Spine skeletal animation data using GLFW and OpenGL. spine-glfw is based on spine-c and spine-cpp. Note that spine-c depends on spine-cpp, so both are required regardless of which API you choose to use.
See the Spine Runtimes documentation for in-depth information
Licensing
You are welcome to evaluate the Spine Runtimes and the examples we provide in this repository free of charge.
You can integrate the Spine Runtimes into your software free of charge, but users of your software must have their own Spine license. Please make your users aware of this requirement! This option is often chosen by those making development tools, such as an SDK, game toolkit, or software library.
In order to distribute your software containing the Spine Runtimes to others that don't have a Spine license, you need a Spine license at the time of integration. Then you can distribute your software containing the Spine Runtimes however you like, provided others don't modify it or use it to create new software. If others want to do that, they'll need their own Spine license.
For the official legal terms governing the Spine Runtimes, please read the Spine Runtimes License Agreement and Section 2 of the Spine Editor License Agreement.
Spine version
spine-glfw works with data exported from Spine 4.3.xx.
spine-glfw supports all Spine features.
Usage
Integration with CMake (Recommended)
The easiest way to integrate spine-glfw into your project is via CMake FetchContent:
include(FetchContent)
FetchContent_Declare(
spine-glfw
GIT_REPOSITORY https://github.com/esotericsoftware/spine-runtimes.git
GIT_TAG 4.3
SOURCE_SUBDIR spine-glfw
)
FetchContent_MakeAvailable(spine-glfw)
# Link against spine-glfw (includes both C and C++ APIs)
target_link_libraries(your_target spine-glfw)
This will automatically fetch and build spine-glfw along with its dependencies (spine-c, spine-cpp, GLFW, and glbinding).
Manual Integration
If you prefer manual integration:
- Download the Spine Runtimes source using git (
git clone https://github.com/esotericsoftware/spine-runtimes) or download it as a zip. - Add the required source files to your project:
- Add sources from
spine-cpp/src,spine-c/src, andspine-glfw/src
- Add sources from
- Add the include directories:
spine-cpp/include,spine-c/include, andspine-glfw/src - Link against GLFW and OpenGL libraries
See the Spine Runtimes documentation for detailed API usage.
Examples
The repository includes example code for both C and C++ APIs:
- C example: example/main-c.cpp
- C++ example: example/main.cpp
Building the Examples
The project includes a build.sh script for easy building:
cd spine-glfw
./build.sh # Build debug version
./build.sh release # Build release version
./build.sh clean # Clean and rebuild
Windows
- Install Visual Studio Community with C++ support and Windows SDK.
- Install CMake via the Windows installer package.
- Clone the repository:
git clone https://github.com/esotericsoftware/spine-runtimes - Run CMake GUI from the start menu
- Set source directory to
spine-runtimes/spine-glfw - Set build directory to
spine-runtimes/spine-glfw/build - Click
Configure, thenGenerate - Open the generated solution in Visual Studio
- Set
spine-glfw-exampleorspine-glfw-example-cas the startup project - Run the project
Linux
- Install dependencies:
sudo apt-get install cmake ninja-build libgl1-mesa-dev libx11-dev libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev # Ubuntu/Debian # or equivalent for your distribution - Clone the repository:
git clone https://github.com/esotericsoftware/spine-runtimes - Build and run:
cd spine-runtimes/spine-glfw ./build.sh ./build/debug/spine-glfw-example-c # Run C example ./build/debug/spine-glfw-example # Run C++ example
macOS
- Install Xcode
- Install Homebrew
- Install dependencies:
brew install cmake ninja - Clone the repository:
git clone https://github.com/esotericsoftware/spine-runtimes - Build and run:
cd spine-runtimes/spine-glfw ./build.sh ./build/debug/spine-glfw-example-c # Run C example ./build/debug/spine-glfw-example # Run C++ example