-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGlobalMenuItem.java
More file actions
46 lines (40 loc) · 1.33 KB
/
GlobalMenuItem.java
File metadata and controls
46 lines (40 loc) · 1.33 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import picking.Buffer;
import processing.core.PApplet;
import processing.core.PImage;
class GlobalMenuItem extends MenuItem
{
protected PImage icon;
protected PImage iconActive;
GlobalMenuItem(PApplet context, ThoughtMenu parent, String title, Camera cam, PImage icon, PImage iconActive)
{
super(context, parent, title, cam);
this.icon = icon;
this.iconActive = iconActive;
}
public void render()
{
if(this.active)
{
if(this.hitState)
{
context.image(this.iconActive, this.position.getPosition().x-15, this.position.getPosition().y-15, 30, 30);
}
else
{
context.image(this.icon, this.position.getPosition().x-15, this.position.getPosition().y-15, 30, 30);
}
this.context.textSize(13);
context.fill(context.red(config.text),context.green(config.text),context.blue(config.text),this.getAlpha());
this.context.text(title, this.position.getPosition().x - (context.textWidth(title)/2), this.position.getPosition().y + 30);
}
}
public void renderHitArea()
{
context.ellipse(this.position.getPosition().x, this.position.getPosition().y, 30, 30);
}
public void renderHitArea(Buffer buffer)
{
buffer.camera();
buffer.ellipse(this.position.getPosition().x, this.position.getPosition().y, 30, 30);
}
}