A Qt-based Live2d widget
QtLive2d is a Qt-based Live2d widget, it is modified from the official Live2d Sample. Unlike the official examples, QtLive2d uses QOpenGLWidget and QOpenGLFunctions provided by Qt instead of glfw and glew. This makes it easy to combine with any Qt Gui software.
Thanks @6ziv for your blogs and projects. They have helped me a lot on this project
- Easy to use
- Using OpenGL instead of WebGL
- Less resource consumption
- Support Live2d mouse events
- Support transparent background
- CrossPlatform (Qt is CrossPlatform, haven't test on other platform yet)
We provide a sample application called Sample to show you how to use it.
- Live2DCubismCore.lib
- Framework.lib
- OpenGL32
- User32
- Glu32
- Please use MSVC 2017 or 2019! and std C++ 17
- To use QtLive2d in your program, you need to add Floder QtLive2d, Framework, thirdParty and Core into you project.
- Add includepath and dependpath in
pro
fileINCLUDEPATH += $$PWD/Core/include INCLUDEPATH += $$PWD/Framework/src INCLUDEPATH += $$PWD/thirdParty/stb DEPENDPATH += $$PWD/../dll
- Define flags in
pro
fileDEFINES += WIN32 DEFINES += _WINDOWS DEFINES += CSM_TARGET_WIN_GL
- Compiling Framework and add Framework.lib into
pro
file. - Add other libs into
pro
file.CONFIG += debug_and_release CONFIG(debug, debug|release){ message(Debug build) LIBS += -L$$PWD/lib/ -lLive2DCubismCore_MDd LIBS += -L$$PWD/lib/ -lFrameworkd } CONFIG(release, debug|release){ message(Release build) LIBS += -L$$PWD/lib/ -lLive2DCubismCore_MD LIBS += -L$$PWD/lib/ -lFramework } LIBS += -lOpenGL32 LIBS += -lUser32 LIBS += -lGlu32
- QLive2dWidget is a subclass of QOpenGLWidget, which can be used directly or be promoted in the Qt Designer.
- To use QOpenGLWidget in Qt, you need add extra moudules.
QT += core gui opengl openglwidgets greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
- Define you model path in
LAppDefine.cpp
. - Enjoy it!
- Cross Platform
Copyright (C) 2022 duanxianpi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.