<commit_before>package org.zamedev.particles.renderers;

import lime.graphics.opengl.GL;
import openfl.display.BlendMode;
import openfl.display.TileContainer;
import openfl.display.Tile;
import openfl.display.Tileset;
import openfl.events.Event;
import openfl.geom.ColorTransform;
import org.zamedev.particles.ParticleSystem;
import org.zamedev.particles.util.MathHelper;

class TileContainerParticleRendererData {
    public var ps : ParticleSystem;
    public var tileContainer : TileContainer;
    public var tileList : Array<Tile>;
    public var updated : Bool = false;

    public function new(ps : ParticleSystem, tileContainer : TileContainer, tileList : Array<Tile>) {
        this.ps = ps;
        this.tileContainer = tileContainer;
        this.tileList = tileList;
    }
}

// Use -Dzameparticles_use_tile_visibility to enable tile pool.
// This can be faster or slower, depending on the project (especially on neko).

class TileContainerParticleRenderer extends TileContainer implements ParticleSystemRenderer {
    private var manualUpdate : Bool;
    private var dataList : Array<TileContainerParticleRendererData> = [];

    public function new(manualUpdate : Bool = false) {
        super();
        this.manualUpdate = manualUpdate;
    }

    public function addParticleSystem(ps : ParticleSystem) : ParticleSystemRenderer {
        if (dataList.length == 0 && !manualUpdate) {
            openfl.Lib.current.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        ps.__initialize();
        var tileList = new Array<Tile>();<commit_msg>Documentation about "removeEvent()" added.<commit_after>package org.zamedev.particles.renderers;

import lime.graphics.opengl.GL;
import openfl.display.BlendMode;
import openfl.display.TileContainer;
import openfl.display.Tile;
import openfl.display.Tileset;
import openfl.events.Event;
import openfl.geom.ColorTransform;
import org.zamedev.particles.ParticleSystem;
import org.zamedev.particles.util.MathHelper;

class TileContainerParticleRendererData {
    public var ps : ParticleSystem;
    public var tileContainer : TileContainer;
    public var tileList : Array<Tile>;
    public var updated : Bool = false;

    public function new(ps : ParticleSystem, tileContainer : TileContainer, tileList : Array<Tile>) {
        this.ps = ps;
        this.tileContainer = tileContainer;
        this.tileList = tileList;
    }
}

// Use -Dzameparticles_use_tile_visibility to enable tile pool.
// This can be faster or slower, depending on the project (especially on neko).

/**
    `removeEvent()` must be called when this renderer is removed from the container.
**/
class TileContainerParticleRenderer extends TileContainer implements ParticleSystemRenderer {
    private var manualUpdate : Bool;
    private var dataList : Array<TileContainerParticleRendererData> = [];

    public function new(manualUpdate : Bool = false) {
        super();
        this.manualUpdate = manualUpdate;
    }

    public function addParticleSystem(ps : ParticleSystem) : ParticleSystemRenderer {
        if (dataList.length == 0 && !manualUpdate) {
            openfl.Lib.current.stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
        }

        ps.__initialize();
        var tileList = new Array<Tile>();
{'fraction_non_alphanumeric': 0.08852258852258853, 'fraction_numerical': 0.0006105006105006105, 'mean_word_length': 3.8764880952380953, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4332511', 'n_tokens_mistral': 931, 'n_tokens_neox': 903, 'n_words': 234}