function Mouse(domElement, dontInitialize)
{
	// Raw data
	this._keys = new Array(5);
	this._position = new Vector2(0, 0);
	this._positionUpdated = false;
	this._delta = new Vector2(0, 0);
	this._wheel = 0;
	this._wheelUpdated = false;
	this._doubleClicked = new Array(5);

	/**
	 * Array with mouse buttons status.
	 *
	 * @type {array}
	 * @property keys
	 */
	this.keys = new Array(5);

	/**
	 * Mouse position inside of the window (coordinates in window space).
	 *
	 * @type {Vector2}
	 * @property position
	 */
	this.position = new Vector2(0, 0);

	/**
	 * Mouse movement (coordinates in window space).
	 *
	 * @type {Vector2}
	 * @property delta
	 */
	this.delta = new Vector2(0, 0);

	/**
	 * Mouse scroll wheel movement.
	 *
	 * @type {number}
	 * @property wheel
	 */
	this.wheel = 0;
	
	/**
	 * Indicates a button of the mouse was double clicked.
	 *
	 * @type {Array}
	 * @property doubleClicked
	 */
	this.doubleClicked = new Array(5);

	/**
	 * DOM element where to attach the mouse events.
	 *
	 * @property domElement
	 * @type {Element}
	 */
	this.domElement = domElement !== undefined ? domElement : window;

	/**
	 * Canvas attached to this mouse instance used to calculate position and delta in element space coordinates.
	 *
	 * @type {Element}
	 * @property canvas
	 */
	this.canvas = null;
	
	/**
	 * Event manager responsible for updating the raw data variables.
	 *
	 * Diferent events are used depending on the host platform.
	 *
	 * When the update method is called the raw data is reset.
	 *
	 * @property events
	 * @type {EventManager} 
	 */
	this.events = new EventManager();

	// Initialize key instances
	for (var i = 0; i < 5; i++)
	{
		this._doubleClicked[i] = false;
		this.doubleClicked[i] = false;
		this._keys[i] = new Key();
		this.keys[i] = new Key();
	}

	// Self pointer
	var self = this;

	// Scroll wheel
	if (window.onmousewheel !== undefined)
	{
		// Chrome, edge
		this.events.add(this.domElement, "mousewheel", function(event)
		{
			self._wheel = event.deltaY;
			self._wheelUpdated = true;
		});
	}
	else if (window.addEventListener !== undefined)
	{
		// Firefox
		this.events.add(this.domElement, "DOMMouseScroll", function(event)
		{
			self._wheel = event.detail * 30;
			self._wheelUpdated = true;
		});
	}
	else
	{
		this.events.add(this.domElement, "wheel", function(event)
		{
			self._wheel = event.deltaY;
			self._wheelUpdated = true;
		});
	}

	// Touchscreen input events
	if ('ontouchstart' in window || navigator.msMaxTouchPoints > 0)
	{
		// Auxiliar variables to calculate touch delta
		var lastTouch = new Vector2(0, 0);

		// Touch start event
		this.events.add(this.domElement, "touchstart", function(event)
		{
			var touch = event.touches[0];

			self.updatePosition(touch.screenX, touch.screenY, 0, 0);
			self.updateKey(Mouse.LEFT, Key.DOWN);

			lastTouch.set(touch.screenX, touch.screenY);
		});

		// Touch end event
		this.events.add(this.domElement, "touchend", function(event)
		{
			self.updateKey(Mouse.LEFT, Key.UP);
		});

		// Touch cancel event
		this.events.add(this.domElement, "touchcancel", function(event)
		{
			self.updateKey(Mouse.LEFT, Key.UP);
		});

		// Touch move event
		this.events.add(document.body, "touchmove", function(event)
		{
			var touch = event.touches[0];
			self.updatePosition(touch.screenX, touch.screenY, touch.screenX - lastTouch.x, touch.screenY - lastTouch.y);
			lastTouch.set(touch.screenX, touch.screenY);
		});
	}

	// Move
	this.events.add(this.domElement, "mousemove", function(event)
	{
		// console.log("nunuStudio: Mouse move event", event.offsetX, event.offsetY);

		self.updatePosition(event.clientX, event.clientY, event.movementX, event.movementY);
	});

	// Button pressed
	this.events.add(this.domElement, "mousedown", function(event)
	{
		self.updateKey(event.which - 1, Key.DOWN);
	});

	// Button released
	this.events.add(this.domElement, "mouseup", function(event)
	{
		self.updateKey(event.which - 1, Key.UP);
	});

	// Drag start
	this.events.add(this.domElement, "dragstart", function(event)
	{
		self.updateKey(event.which - 1, Key.UP);
	});

	// Mouse double click
	this.events.add(this.domElement, "dblclick", function(event)
	{	
		self._doubleClicked[event.which - 1] = true;
	});

	if (dontInitialize !== true)
	{
		this.create();
	}
}
Mouse instance for sync input the mouse should be updated everytime before.

Automatically calculates the diff of position between frames.

The mouse object provided by scripts is automatically updated by the runtime handler.

@class Mouse
@module Input
@param {Component} domElement DOM element to craete the mouse events.
@param {boolean} dontInitialize If true the mouse events are not created.