Skip to content

Latest commit

 

History

History
29 lines (21 loc) · 1.21 KB

README.md

File metadata and controls

29 lines (21 loc) · 1.21 KB

cocos2d-x-live2d

This project provides Live2D support for cocos2d-x v4 and this project.

You need to download Cubism SDK for Native from here and copy files in Core folder in the SDK to Core folder in this project. For license of usage, please check here.

This project is base on Cubism Native Samples and published under Live2D Open Software License.

Note

Branch v3 can work with cocos2d-x v3, but will not be maintained any more.

Example in Lua

local model = l2d.Model:create('Haru', 'Haru.model3.json')
scene:addChild(model)
model:setPosition(cc.p(500, 500))
model:setTouchEnabled(true)
model:setAutoDragging(true)
model:addClickEventListener(function()
    local pos = model:getTouchEndPosition()
    if model:areaHitTest('Head', pos.x, pos.y) then
        print('hit at head')
    end
end)

Remember to call l2d::Framework::end() in C++ to end the framework.