Source: app01/model/update.js

/**
 * @author    Wolfgang Kowarschick <kowa@hs-augsburg.de>
 * @copyright 2017 - 2018
 * @license   CC-BY-NC-SA-4.0
 */

/**
 * @module app01/model/update
 */

import collisionCircleStage from './collisionCircleStage';

/** @private */
let v_stage, v_circle;

/**
 * @function initUpdater
 * @static
 *
 * @param {Object}             p_config
 * @param {ModelStage|Object}  p_config.stage
 * @param {ModelCircle|Object} p_config.circle
 */
function initUpdater({stage: p_stage, circle: p_circle})
{ v_stage  = p_stage;
  v_circle = p_circle;
}

/**
 * @function update
 * @static
 * @description
 *   Update function to be called at least 60 times per second.
 *   Typically used as a callback function.
 *
 * @param {number} p_delta_s - time in seconds since last call (max 1/60)
 */
function update(p_delta_s)
{ v_circle.update(p_delta_s);
  collisionCircleStage(v_circle, v_stage);
}

export { initUpdater, update };