Java Code Examples for master.flame.danmaku.danmaku.model.IDanmakus#addItem()

The following examples show how to use master.flame.danmaku.danmaku.model.IDanmakus#addItem() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DanmakuTouchHelper.java    From letv with Apache License 2.0 6 votes vote down vote up
public IDanmakus touchHitDanmaku(float x, float y) {
    IDanmakus hitDanmakus = new Danmakus();
    this.mDanmakuBounds.setEmpty();
    IDanmakus danmakus = this.danmakuView.getCurrentVisibleDanmakus();
    if (danmakus != null && !danmakus.isEmpty()) {
        IDanmakuIterator iterator = danmakus.iterator();
        while (iterator.hasNext()) {
            BaseDanmaku danmaku = iterator.next();
            if (danmaku != null) {
                this.mDanmakuBounds.set(danmaku.getLeft(), danmaku.getTop() - 30.0f, danmaku.getRight(), danmaku.getBottom() + 30.0f);
                if (this.mDanmakuBounds.contains(x, y)) {
                    danmaku.clickX = x;
                    danmaku.clickY = y;
                    danmaku.setRectF(this.mDanmakuBounds);
                    hitDanmakus.addItem(danmaku);
                    break;
                }
            }
        }
    }
    return hitDanmakus;
}
 
Example 2
Source File: DrawTask.java    From letv with Apache License 2.0 5 votes vote down vote up
public IDanmakus getVisibleDanmakusOnTime(long time) {
    IDanmakus subDanmakus = this.danmakuList.subnew((time - this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION) - 100, time + this.mContext.mDanmakuFactory.MAX_DANMAKU_DURATION);
    IDanmakus visibleDanmakus = new Danmakus();
    if (!(subDanmakus == null || subDanmakus.isEmpty())) {
        IDanmakuIterator iterator = subDanmakus.iterator();
        while (iterator.hasNext()) {
            BaseDanmaku danmaku = iterator.next();
            if (danmaku.isShown() && !danmaku.isOutside()) {
                visibleDanmakus.addItem(danmaku);
            }
        }
    }
    return visibleDanmakus;
}