-
Notifications
You must be signed in to change notification settings - Fork 1
/
GlobalMenu.java
57 lines (49 loc) · 1.27 KB
/
GlobalMenu.java
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
47
48
49
50
51
52
53
54
55
56
57
import processing.core.PApplet;
import processing.core.PImage;
//TODO: this class should be a Singleton
class GlobalMenu extends ThoughtMenu
{
protected ColorConfiguration config;
protected PImage logoImage;
GlobalMenu(PApplet context, Camera cam, ObjectProvider objects)
{
super(context, cam, objects);
this.setId(0);
this.config = ((NetworkOfThoughts)context).config;
this.logoImage = context.loadImage(config.menuLogo);
this.position.setPosition(0,0,0);
}
public void deactivate()
{
this.active = false;
}
public void step()
{
if(this.isActive())
{
//Check for mouse hover
this.hit();
//Setting positions
for (int i=0; i<menuItems.size(); i++)
{
MenuItem currentItem = (MenuItem) menuItems.get(i);
currentItem.position.setPosition(context.width/2 - 152 + (i*75), 130 ,0);
}
}
}
public void render()
{
if(this.isActive())
{
context.camera();
context.image(this.logoImage, context.width/2 - 50, 40, 100, 50);
for(int i=0; i<menuItems.size(); i++)
{
MenuItem currentItem = (MenuItem) menuItems.get(i);
//render node
currentItem.render();
//currentItem.renderHitArea();
}
}
}
}