GithubHelp home page GithubHelp logo

dragonbones / dragonbonescpp Goto Github PK

View Code? Open in Web Editor NEW
395.0 91.0 228.0 16.34 MB

DragonBones C++ Runtime

License: MIT License

C++ 95.83% C 2.10% Makefile 2.07%
dragonbones c-plus-plus cocos2d cpp sfml demos

dragonbonescpp's People

Contributors

aceiii avatar againpsychox avatar akdcl avatar brbranch avatar doubleclip avatar flamefox avatar hary309 avatar hejiangzhou avatar hetter avatar joelyoung avatar leafvmaple avatar litefeel avatar mybios avatar namkazt avatar puckery avatar sandao avatar superlancelot avatar zrong avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dragonbonescpp's Issues

怎么添加帧事件

不是帧事件回调,是没知道添加龙骨动画帧事件的地方
实在flash里边,还是在哪里加入呢?

local variable reference

static const auto DEFAULT_NAME = ""; creates a char* not a std::string. As result the address of a stack variable is returned. Simple fix, force the static instance to be a std::string - see diff below.

--- a/DragonBones/src/dragonBones/animation/Animation.cpp
+++ b/DragonBones/src/dragonBones/animation/Animation.cpp
@@ -447,7 +447,7 @@ bool Animation::getIsCompleted() const

 const std::string& Animation::getLastAnimationName() const
 {
-    static const auto DEFAULT_NAME = "";
+    static const std::string DEFAULT_NAME = "";
     return _lastAnimationState ? _lastAnimationState->getName() : DEFAULT_NAME;
 }

lua 回调参数修改

DBCPP 现在lua事件回调直接将参数列表作为回调函数的参数列表,这样的缺点是想要增加参数就需要再向参数列表末尾添加,会打乱参数的优先级,比如后面要添加Armature的参数就要放到最后,但是这是一个重要参数。

-- @param db.DBCCArmatureNode armatureNode
-- @param int movementType
-- @param string movementId
-- @param bool isLastMovementId
local function onMovementEvent( armatureNode, movementType, movementID, isLastMovementId)

end
-- @param db.DBCCArmatureNode armatureNode
-- @param int movementType
-- @param string movementId
-- @param string frameLabel
local function onFrameEvent( armatureNode, movementType, movementID, frameLabel )

end
armatureNode:registerMovementEventHandler(onMovementEvent)
armatureNode:registerFrameEventHandler(onFrameEvent)

修改参数形式,将所有参数封装到一个table中,那么后续添加参数会很方便,也不影响现有的代码。

-- @param table event
--  db.DBCCArmature armature
--  db.DBCCArmatureNode armatureNode
--  int type
--  string boneName
--  string movementId
--  string frameLabel
--  bool isLastMovementId
local function onEvent( event )

end
armatureNode:registerMovementEventHandler(onEvent)
armatureNode:registerFrameEventHandler(onEvent)

大家看这个table 中属性名是否需要修改,如果不修改过段时间我会提交上去。

添加travis-ci测试

添加自动测试,以保证pr的代码不会有问题,至少是编译时错误。

cocos2d-x 2.2.3 CCTextureAtlas::drawNumberOfQuads(unsigned int n, unsigned int start) crash

When I run demo project with cocos2d-x 2.2.3, I got crash at CCTextureAtlas.cpp line 619:

        glBufferData(GL_ARRAY_BUFFER, sizeof(m_pQuads[0]) * (n-start), NULL, GL_DYNAMIC_DRAW);
        void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
        memcpy(buf, m_pQuads, sizeof(m_pQuads[0])* (n-start));
        glUnmapBuffer(GL_ARRAY_BUFFER);

It's called by m_pTextureAtlas->drawNumberOfQuads(1, m_nQuadIndex);

Is this the bug of DragonBoneCpp or cocos2d-x?

支持 ColorTransform

看了下代码,似乎还不支持变色的所有参数 alphaOffset redMultiplier 等等,只是从xml中读出来了。需要添加shader处理吗?

Could you please add a Cocos2dx V3.0 Android build project?

Hi!, I'm trying to compile the Cocos2dx 3.0 demo that comes with this library to make it work in Android (DragonBonesCPP-dev\demos\cocos2d-x-3.x\DragonBonesCppDemos)
But I'm getting trouble making it work. Specially because there are not android-mk files in the renderer/cocos2dx3.0 folder. I tried to make it myself but I can't get the include files right.

Is there any working test sample for using Cocos2dx 3.0 with DragonBones?

Im using Eclipse and windows 7.

Thanks in Advance, Really great library!!

关于动画解析速度

在optimization临时分支中,初步做了修改:

  1. 在xxxData.h等结构文件中的 getXXX()方法增加判空,减少空值的循环遍历,如BaseDataParser::setFrameTransform中getBoneData的操作,由于没有判空条件,一旦动画层数过多时这里的消耗还是比较可观的;
  2. 考虑去掉hideTimelineList结构,在解析过程中不做addHideTimeline的调用,在AnimationState::hideBones()方法中通过getBones和getTimeline来结合进行hideSlots,减少遍历次数;
  3. 考虑将部分查找频繁过遍历的结构改成map的形式?

一个动画作为另一个的子节点,并且setChildArmature后释放报错

调用代码
local bone=self.body:getCCSlot("Layer_11")
self.gy=db.buildArmatureNode("zf")
self:add(self.gy)
bone:setChildArmature(self.gy:getArmature())
self.gy:pos(100,100)
self.gy:getAnimation():gotoAndPlay("stand", -1, -1, 0)

出错位置
DBCCArmatureNode::~DBCCArmatureNode()
{

if (DRAGON_BONES_ENABLE_LUA == 1)

unregisterFrameEventHandler();
unregisterMovementEventHandler();

endif // DRAGON_BONES_ENABLE_LUA

if (_clock)
{
    _clock->remove(this);
    _clock = nullptr;
}

if (_armature)
{
    delete _armature;//《-----------------------崩溃后调试armature已经被释放掉了
    _armature = nullptr;
}

}

是我的用法有问题么?

Latest version crashes when firing up

Previous version breaks on Visual Studio while firing up in debug mode.

The warning is: HEAP: Free Heap block XXXX modified at XXXX after it was freed

But latest version crashes anyway.

The error is: In CCRef the reference count is none zero while freeing the pointer. And in AmatureDisplayContainer.cpp line 42, before the EventDispatcher pointer is released, the address is already 0xfeeefeee.

Please solve the bug! It's fatal!

请问如何提高龙骨动画的性能?

好像龙骨动画的性能并不高,我们测试官方的小绿龙,在iPad3上同时跑100个,帧数掉到了25帧左右,这是完全无法接受的。

不知道是动画本身复杂度的问题,还是播放框架的问题?动画制作的过程中,有没有什么需要注意的地方,可以提高性能的?代码上有没有什么缓存或者其他方式可以提高性能?

DragonBonesHeaders.h includes missing file?

Hi.

I am using cocos2d-x 3.2 and DragonBonesCPP dev branch.
The DragonBonesHeaders.h includes CCDragonBones.h This file only exist in renderer\cocos2d-x-2.x and not in renderer\cocos2d-x-3.x.

Error when run any animation

Error : Expression: vector subscript out of range
On : BaseTimelineState.h line 277
const auto currentFrame = _timeline->frames[currentFrameIndex];

_timeline->bone is NULL ? and _timeline->frames have zero frame inside ?
at passed time == 0.0f it still working but when passed time insert from 0.0f to 0.xxxf ( on the first time ) it cause that error.

my implement :
dragonBones::CCFactory _factory;
_factory.loadDragonBonesData(_refInfo->armaturePath);
_factory.loadTextureAtlasData(_refInfo->armatureTexture);
_armature = _factory.buildArmatureDisplay(_refInfo->armatureName, _refInfo->armatureDataName);
_armature->getAnimation().fadeIn(_refInfo->armatureAnimationIdie);
i ran on cocos2d-x 3.8
happen with any dragonbones file at Demo folder.

浮點數問題

TimelineState::update裡面
if(progress == 1)
{
progress = 0.99999999f;
}

0.99999999f 趨近於 1
0.99999997f 趨近於 0.99999994f

DBCCArmatureNode::getBoundingBox 不正确

cocos2dx 中 getBoundingBox 返回flash中 getBounds(parent) 的值

现在DBCCArmatureNode::getBoundingBox 返回flash中 getBounds(null) 的值

使用 getInnerBoundingBox 来返回 flash中 getBounds(null)
getBoundingBox还是按照cocos2dx中的规则来返回flash中 getBounds(parent)

quick3.3rc1下android编译通不过的问题

问题:

http://www.cocoachina.com/bbs/read.php?tid-273345.html

把render/cocos2d-x-3.2/android_demo下的Android.mk文件替换成下面的内容就好了

LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE := dragonbones_static

LOCAL_MODULE_FILENAME := libdragonbones

LOCAL_SRC_FILES := ../../../animation/Animation.cpp
../../../animation/AnimationState.cpp
../../../animation/TimelineState.cpp
../../../animation/WorldClock.cpp
../../../core/Armature.cpp
../../../core/Bone.cpp
../../../core/Object.cpp
../../../core/Slot.cpp
../../../events/EventData.cpp
../../../factories/BaseFactory.cpp
../../../parsers/BaseDataparser.cpp
../../../parsers/ConstValues.cpp
../../../parsers/XMLDataParser.cpp
../../../parsers/dbtinyxml2.cpp
../DBCCArmature.cpp
../DBCCArmatureNode.cpp
../DBCCFactory.cpp
../DBCCSlot.cpp

LOCAL_C_INCLUDES :=
$(LOCAL_PATH)/..
$(LOCAL_PATH)/../../..
$(LOCAL_PATH)/../../../../../../cocos/2d
$(LOCAL_PATH)/../../../../../../external/lua/tolua
$(LOCAL_PATH)/../../../../../../external/lua/luajit/include
$(LOCAL_PATH)/../../../../../../cocos/scripting/lua-bindings/manual

LOCAL_EXPORT_C_INCLUDES :=
$(LOCAL_PATH)/..
$(LOCAL_PATH)/../../..

LOCAL_CFLAGS += -fexceptions

LOCAL_STATIC_LIBRARIES := cocos2dx_internal_static

include $(BUILD_STATIC_LIBRARY)

lua_dragonbones_auto.cpp报错

使用最新的3.9framework生成的lua_dragonbones_auto.cpp中的getDragonBonesDataMap()方法报错。看本官方DragonbonesCPPForLua中没这个方法,该怎么处理?dragonbones.ini中删了这方法?

Suggestion to change the name of /library to /dragon-bones

I suggest to change name of the directory /library to /dragon-bones.

  1. The most straightforward motivation is for Android's Makefile, which needs to import the library by the name of directory which contains the library's Android.mk. So, currently the line in Android.mk to import the DragonBones library will look like this:

    $(call import-module, library)

    which is very confusing. Moreover, if more than one project follow such naming convention, there will be name conflicts when an application needs to import libraries from all of them. Although we can "solve" the problem by adding the parent directory of DragonBonesCPP to NDK_MODULE_PATH and use DragonBonesCPP/library for import-module, but that will restrict the user renaming the top level directory DragonBonesCPP, which makes no sense.

  2. Such renaming is also consistent with other projects. For example, in cocos2d-x the main source code directory is /cocos2dx. To import cocos2dx library in Android.mk, the line will look like this:

    $(call import-module, cocos2dx)

Thanks!

How to detect collision by Box2D physics?

Hi there!
Excuse me! Can you show me how to detect collision by Box2D physics or how to use function boundingbox() to detect collision.
i saw that coordinate of the Armature and the ArmatureNode are not same. So, we need to convert it to same coordinate, is it right?
Why don't we intergration the Box2D lib into Armature to use it?
Sorry. I'm not good at English
dear.

手机帧数低

我加了12个角色(总共5个不同的角色),魅族mx3上的帧数只有10帧左右,touch4是40帧左右,用的版本是quick2.2.5

ColorTransfrom 的一些問題

我想請教一下 我們在使用flash編輯動畫時 發生了同一個動作 在第二次播放後 元件沒有改回原本顏色狀態

我的推測是 當我在 TimelineState::updateToNextFrame 這個函式下

由於第二次播放元件時 該bone的_isColorChanged == false 所以沒有還原上次造成的效果

我們設計的案例是這樣的 有一個timeline 內有3條補間動畫影格 其中第1條是一個image 第二第三條是另一個image

不過在第三條 我們改變了color transform

我有想出一個方法解決 就是無視上述 _isColorChanged 的判斷 只要一切換就將bone的顏色還原

但不知道這樣做會不會影響舊有系統?

感謝

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.