Skip to content

wxydejoy/QtLive2d

 
 

Repository files navigation

A Qt-based Live2d widget

GitHub GitHub Repo stars GitHub release (latest by date including pre-releases) GitHub user

Introduction

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

Feature

  • 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)

Sample

We provide a sample application called Sample to show you how to use it. HUSmi4.md.png

Build

Dependency

  • Live2DCubismCore.lib
  • Framework.lib
  • OpenGL32
  • User32
  • Glu32

Usage

  1. Please use MSVC 2017 or 2019! and std C++ 17
  2. To use QtLive2d in your program, you need to add Floder QtLive2d, Framework, thirdParty and Core into you project.
  3. Add includepath and dependpath in pro file
    INCLUDEPATH += $$PWD/Core/include
    INCLUDEPATH += $$PWD/Framework/src
    INCLUDEPATH += $$PWD/thirdParty/stb
    DEPENDPATH += $$PWD/../dll
  4. Define flags in pro file
    DEFINES += WIN32
    DEFINES += _WINDOWS
    DEFINES += CSM_TARGET_WIN_GL
  5. Compiling Framework and add Framework.lib into pro file.
  6. 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
  7. QLive2dWidget is a subclass of QOpenGLWidget, which can be used directly or be promoted in the Qt Designer.
  8. To use QOpenGLWidget in Qt, you need add extra moudules.
    QT       += core gui opengl openglwidgets
    greaterThan(QT_MAJOR_VERSION, 5): QT += widgets
  9. Define you model path in LAppDefine.cpp.
  10. Enjoy it!

What's Next?

  • Cross Platform

License

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.

About

Qt-based Live2d widget

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 92.2%
  • Makefile 4.5%
  • C 1.6%
  • Other 1.7%