MCPcopy Create free account
hub / github.com/aegeorge42/aegeorge42.github.io / constructor

Method constructor

View/Button.js:3–38  ·  view source on GitHub ↗
(name,texture,x,y,vis,tint)

Source from the content-addressed store, hash-verified

1export class Button extends PIXI.Sprite{
2
3 constructor(name,texture,x,y,vis,tint){
4 super(texture)
5 this.name=name;
6 this.x=x;
7 this.y=y;
8 this.tint=tintNone;
9 this.anchor.set(0.5);
10 this.interactive=true;
11 this.buttonMode=true;
12 this.visible=vis;
13 if(tint){
14 this.tint=tint;
15 } else this.tint=0xFFFFFF;
16 //set tints for when button is hovered over
17 //might make this variable in the future for
18 //different buttons?
19 this.on('mouseover', function(e){
20 this.tint=tintOver;
21 // console.log(this.parent.app.renderer.plugins.interaction.mouse.global);
22
23 })
24
25 this.on('mouseout', function(e){
26 if(tint){
27 this.tint=tint;}
28 else this.tint=0xFFFFFF;
29 })
30
31 this.on('mousedown', function(e){
32 this.tint=tintDown;
33 })
34
35 this.on('mouseup', function(e){
36 this.tint=tintOver;
37 })
38 }
39
40 setTint(tint,event){
41 if(event){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected