<commit_before>/***************************************************************
 * Copyright (c) 2014 - 2015 , gurkenlabs, All rights reserved *
 ***************************************************************/
package de.gurkenlabs.litiengine.graphics.particles.emitters;

import java.awt.Color;
import java.util.Random;

import de.gurkenlabs.litiengine.annotation.EmitterInfo;
import de.gurkenlabs.litiengine.annotation.EntityInfo;
import de.gurkenlabs.litiengine.graphics.particles.Emitter;
import de.gurkenlabs.litiengine.graphics.particles.Particle;
import de.gurkenlabs.litiengine.graphics.particles.ShimmerParticle;

// TODO: Auto-generated Javadoc
/**
 * The Class ShimmerEmitter.
 */
@EntityInfo(width = 64, height = 64)
@EmitterInfo(maxParticles = 10, spawnAmount = 10, spawnRate = 10, activateOnInit = false)
public class ShimmerEmitter extends Emitter {

  /**
   * Instantiates a new shimmer emitter.
   *
   * @param originX
   *          the origin x
   * @param originY
   *          the origin y
   */
  public ShimmerEmitter(final int originX, final int originY) {
    super(originX, originY);
  }

  /*
   * (non-Javadoc)
   *
   * @see de.gurkenlabs.liti.graphics.particles.Emitter#createNewParticle()
   */
  @Override
  public Particle createNewParticle() {
    final Random rand = new Random();

    final float xCoord = rand.nextInt((int) this.getWidth());
    final float yCoord = rand.nextInt((int) this.getHeight());
    final float randX = rand.nextFloat();
    final float dx = Math.random() >= 0.5 ? -randX : randX;
    final float dy = Math.random() >= 0.5 ? -randX : randX;
    final float gravityX = 0.0f;
    final float gravityY = 0.0f;
    final byte size = (byte) (rand.nextInt(3) + 2);
    final short life = (short) 0;

    Color color = new Color(255, 255, 255, (int) Math.round(Math.random() * 155) + 100);
    if (rand.nextFloat() > 0.5) {
      color = new Color(170, 255, 255, (int) Math.round(Math.random() * 155) + 100);
    }
    final Particle p = new ShimmerParticle(this.getBoundingBox(), xCoord, yCoord, dx, dy, gravityX, gravityY, size, size, life, color);
    return p;
  }
}<commit_msg>Optimized lightsource by using a particle effect for it.<commit_after>/***************************************************************
 * Copyright (c) 2014 - 2015 , gurkenlabs, All rights reserved *
 ***************************************************************/
package de.gurkenlabs.litiengine.graphics.particles.emitters;

import java.awt.Color;
import java.util.Random;

import de.gurkenlabs.litiengine.annotation.EmitterInfo;
import de.gurkenlabs.litiengine.annotation.EntityInfo;
import de.gurkenlabs.litiengine.graphics.particles.Emitter;
import de.gurkenlabs.litiengine.graphics.particles.Particle;
import de.gurkenlabs.litiengine.graphics.particles.ShimmerParticle;

// TODO: Auto-generated Javadoc
/**
 * The Class ShimmerEmitter.
 */
@EntityInfo(width = 64, height = 64)
@EmitterInfo(maxParticles = 10, spawnAmount = 10, spawnRate = 10, activateOnInit = false)
public class ShimmerEmitter extends Emitter {

  /**
   * Instantiates a new shimmer emitter.
   *
   * @param originX
   *          the origin x
   * @param originY
   *          the origin y
   */
  public ShimmerEmitter(final int originX, final int originY) {
    super(originX, originY);
  }

  /*
   * (non-Javadoc)
   *
   * @see de.gurkenlabs.liti.graphics.particles.Emitter#createNewParticle()
   */
  @Override
  public Particle createNewParticle() {
    final Random rand = new Random();

    final float xCoord = rand.nextInt((int) this.getWidth());
    final float yCoord = rand.nextInt((int) this.getHeight());
    final float randX = rand.nextFloat();
    final float dx = Math.random() >= 0.5 ? -randX : randX;
    final float dy = Math.random() >= 0.5 ? -randX : randX;
    final float gravityX = 0.0f;
    final float gravityY = 0.0f;
    final byte size = (byte) (rand.nextInt(3) + 2);

    Color color = new Color(255, 255, 255, (int) Math.round(Math.random() * 155) + 100);
    if (rand.nextFloat() > 0.5) {
      color = new Color(170, 255, 255, (int) Math.round(Math.random() * 155) + 100);
    }
    final Particle p = new ShimmerParticle(this.getBoundingBox(), xCoord, yCoord, dx, dy, gravityX, gravityY, size, size, 0, color);
    return p;
  }
}
{'fraction_non_alphanumeric': 0.17942137190853943, 'fraction_numerical': 0.028464769015398975, 'mean_word_length': 3.7739420935412027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5014763', 'n_tokens_mistral': 1505, 'n_tokens_neox': 1389, 'n_words': 343}