-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCursor.js
More file actions
25 lines (24 loc) · 790 Bytes
/
Cursor.js
File metadata and controls
25 lines (24 loc) · 790 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
define([
'js/Game',
'js/Input'
], function(
Game,
Input
){
function Cursor(settings){
this.domElement = document.getElementById("cursor");
this.domElement.px = settings.x;
this.domElement.py = settings.y;
this.domElement.src = settings.url;
this.domElement.style.top = (Input.mousePosition.y-this.domElement.py)+"px";
this.domElement.style.left = (Input.mousePosition.x-this.domElement.px)+"px";
function update(){
this.style.top = (Input.mousePosition.y-this.py)+"px";
this.style.left = (Input.mousePosition.x-this.px)+"px";
}
this.domElement.style.top = (Input.mousePosition.y-this.domElement.py)+"px";
this.domElement.style.left = (Input.mousePosition.x-this.domElement.px)+"px";
Game.register("Update", this.domElement, update);
}
return Cursor;
});