ZhouWeikuan / cocos2d

cocos2d for android, based on cocos2d-android-0.82, and now ported from cocos2d-iphone 0.99.4. The googlecode address is here: http://code.google.com/p/cocos2d-android-1/ . There are several demos to watch.
610 stars 291 forks source link

Defect in CCTimer callback update #6

Closed genevictor closed 13 years ago

genevictor commented 13 years ago

Sorry if this is not the best way/place to report. I do not know how to branch/commit.

In CCTimer.java:

public void update(float dt) {
    if (elapsed == -1) {
        elapsed = 0;
    } else {
        elapsed += dt;
    }
    if (elapsed >= interval) {
        if(callback != null) {
            //callback.update(dt); // original
            callback.update(elapsed); // fixed
        } else {
            try {
                invocation.invoke(target, elapsed);
            } catch (Exception e) {
                e.printStackTrace();
            }               
        }
        elapsed = 0;
    }
}