Introduction
Q. What is Live2D?
A. See Official Site.
Main Topic
If you want to use Live2D, you’ll need the Cubism Framework and Cubism Core. The former has official open-source releases for various environments and programming languages, but the latter is closed and has no alternatives. (For detailed configuration, please refer to the Cubism Core API Reference.)
Now, looking at the Cubism Framework, you can find available versions for Unity, Native, Web and Java.
But I’m really into Golang and Ebitengine!
Deliverables
In the end, I wrote my own code that replicates the Cubism Framework’s functionality and turned it into a library: github.com/aethiopicuschan/cubism-go.
The library also includes a reference renderer for Ebitengine, so if you’re using Ebitengine for development, you can easily incorporate it into your project.
About Cubism Core
Cubism Core is provided as a dynamic library (such as a .dylib
).
Let's consider how to use it from Golang. We could use cgo
, of course, but this time I employed a library called purego.
You'll need to grapple with a storm of unsafe
and uintptr
, but it's still much better than using cgo
.
In this case, there's an implementation related to the following. Feel free to take a look and experience the storm for yourself!
I did say you'd have to battle a storm, but purego is a fantastic library, so I encourage everyone to try it out.
That's all. Thank you for reading.
Top comments (0)