<commit_before>/**
 * @module Environment
 * @submodule Environment
 * @for p5
 * @requires core
 * @requires constants
 */

'use strict';

var p5 = require('./core');
var C = require('./constants');

var standardCursors = [C.ARROW, C.CROSS, C.HAND, C.MOVE, C.TEXT, C.WAIT];

p5.prototype._frameRate = 0;
p5.prototype._lastFrameTime = window.performance.now();
p5.prototype._targetFrameRate = 60;

var _windowPrint = window.print;

/**
 * The <a href="#/p5/print">print()</a> function writes to the console area of your browser.
 * This function is often helpful for looking at the data a program is
 * producing. This function creates a new line of text for each call to
 * the function. Individual elements can be
 * separated with quotes ("") and joined with the addition operator (+).
 *
 * @method print
 * @param {Any} contents any combination of Number, String, Object, Boolean,
 *                       Array to print
 * @example
 * <div><code class='norender'>
 * var x = 10;
 * print('The value of x is ' + x);
 * // prints "The value of x is 10"
 * </code></div>
 * @alt
 * default grey canvas
 */
p5.prototype.print = function() {
  if (!arguments.length) {
    _windowPrint();
  } else {
    console.log.apply(console, arguments);
  }
};

/**
 * The system variable <a href="#/p5/frameCount">frameCount</a> contains the number of frames that have
 * been displayed since the program started. Inside <a href="#/p5/setup">setup()</a> the value is 0,
 * after the first iteration of draw it is 1, etc.
 *
 * @property {Integer} frameCount
 * @readOnly
 * @example
 *   <div><code>
 * function setup() {
 *   frameRate(30);
 *   textSize(20);
 *   textSize(30);
 *   textAlign(CENTER);
 * }
 *
 * function draw() {
 *   background(200);
 *   text(frameCount, width / 2, height / 2);
 * }
</code></div>
 *
 * @alt
 * numbers rapidly counting upward with frame count set to 30.
 *
 */
p5.prototype.frameCount = 0;

/**
 * Confirms if the window a p5.js program is in is "focused," meaning that
 * the sketch will accept mouse or keyboard input. This variable is
 * "true" if the window is focused and "false" if not.
 *
 * @property {Boolean} focused
 * @readOnly
 * @example
 * <div><code>
 * // To demonstrate, put two windows side by side.
 * // Click on the window that the p5 sketch isn't in!
 * function draw() {
 *   background(200);
 *   noStroke();
 *   fill(0, 200, 0);
 *   ellipse(25, 25, 50, 50);
 *
 *   if (!focused) {
    // or "if (focused === false)"
 *     stroke(200, 0, 0);
 *     line(0, 0, 100, 100);
 *     line(100, 0, 0, 100);
 *   }
 * }
 * </code></div>
 *
 * @alt
 * green 50x50 ellipse at top left. Red X covers canvas when page focus changes
 *
 */
p5.prototype.focused = document.hasFocus();

/**
 * Sets the cursor to a predefined symbol or an image, or makes it visible
 * if already hidden. If you are trying to set an image as the cursor, the
 * recommended size is 16x16 or 32x32 pixels. It is not possible to load an
 * image as the cursor if you are exporting your program for the Web, and not
 * all MODES work with all browsers. The values for parameters x and y must
 * be less than the dimensions of the image.
 *
 * @method cursor
 * @param {String|Constant} type either ARROW, CROSS, HAND, MOVE, TEXT, or
 *                               WAIT, or path for image
 * @param {Number}          [x]  the horizontal active spot of the cursor
 * @param {Number}          [y]  the vertical active spot of the cursor
 * @example
 * <div><code>
 * // Move the mouse left and right across the image<commit_msg>updating cursor doc closes #2900<commit_after>/**
 * @module Environment
 * @submodule Environment
 * @for p5
 * @requires core
 * @requires constants
 */

'use strict';

var p5 = require('./core');
var C = require('./constants');

var standardCursors = [C.ARROW, C.CROSS, C.HAND, C.MOVE, C.TEXT, C.WAIT];

p5.prototype._frameRate = 0;
p5.prototype._lastFrameTime = window.performance.now();
p5.prototype._targetFrameRate = 60;

var _windowPrint = window.print;

/**
 * The <a href="#/p5/print">print()</a> function writes to the console area of your browser.
 * This function is often helpful for looking at the data a program is
 * producing. This function creates a new line of text for each call to
 * the function. Individual elements can be
 * separated with quotes ("") and joined with the addition operator (+).
 *
 * @method print
 * @param {Any} contents any combination of Number, String, Object, Boolean,
 *                       Array to print
 * @example
 * <div><code class='norender'>
 * var x = 10;
 * print('The value of x is ' + x);
 * // prints "The value of x is 10"
 * </code></div>
 * @alt
 * default grey canvas
 */
p5.prototype.print = function() {
  if (!arguments.length) {
    _windowPrint();
  } else {
    console.log.apply(console, arguments);
  }
};

/**
 * The system variable <a href="#/p5/frameCount">frameCount</a> contains the number of frames that have
 * been displayed since the program started. Inside <a href="#/p5/setup">setup()</a> the value is 0,
 * after the first iteration of draw it is 1, etc.
 *
 * @property {Integer} frameCount
 * @readOnly
 * @example
 *   <div><code>
 * function setup() {
 *   frameRate(30);
 *   textSize(20);
 *   textSize(30);
 *   textAlign(CENTER);
 * }
 *
 * function draw() {
 *   background(200);
 *   text(frameCount, width / 2, height / 2);
 * }
</code></div>
 *
 * @alt
 * numbers rapidly counting upward with frame count set to 30.
 *
 */
p5.prototype.frameCount = 0;

/**
 * Confirms if the window a p5.js program is in is "focused," meaning that
 * the sketch will accept mouse or keyboard input. This variable is
 * "true" if the window is focused and "false" if not.
 *
 * @property {Boolean} focused
 * @readOnly
 * @example
 * <div><code>
 * // To demonstrate, put two windows side by side.
 * // Click on the window that the p5 sketch isn't in!
 * function draw() {
 *   background(200);
 *   noStroke();
 *   fill(0, 200, 0);
 *   ellipse(25, 25, 50, 50);
 *
 *   if (!focused) {
    // or "if (focused === false)"
 *     stroke(200, 0, 0);
 *     line(0, 0, 100, 100);
 *     line(100, 0, 0, 100);
 *   }
 * }
 * </code></div>
 *
 * @alt
 * green 50x50 ellipse at top left. Red X covers canvas when page focus changes
 *
 */
p5.prototype.focused = document.hasFocus();

/**
 * Sets the cursor to a predefined symbol or an image, or makes it visible
 * if already hidden. If you are trying to set an image as the cursor, the
 * recommended size is 16x16 or 32x32 pixels. The values for parameters x and y
 * must be less than the dimensions of the image.
 *
 * @method cursor
 * @param {String|Constant} type either ARROW, CROSS, HAND, MOVE, TEXT, or
 *                               WAIT, or path for image
 * @param {Number}          [x]  the horizontal active spot of the cursor
 * @param {Number}          [y]  the vertical active spot of the cursor
 * @example
 * <div><code>
 * // Move the mouse left and right across the image
{'fraction_non_alphanumeric': 0.13231077981651376, 'fraction_numerical': 0.024942660550458715, 'mean_word_length': 3.0422943221320975, 'pattern_counts': {'":': 0, '<': 43, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4704150', 'n_tokens_mistral': 2289, 'n_tokens_neox': 2133, 'n_words': 849}