forked from andrewalbers/CardCreator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuser_interface.pde
More file actions
108 lines (93 loc) · 1.93 KB
/
user_interface.pde
File metadata and controls
108 lines (93 loc) · 1.93 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
import de.bezier.guido.*;
PGraphics bufferPG;
Listbox listbox;
ContentHandler content;
TemplateHandler template;
TemplateCanvas canvas;
Toolbar tools;
Interface mainInterface;
void setup ()
{
size(1000, 700);
bufferPG = createGraphics(width, height);
frameRate(30);
frame.setResizable(true);
// make the manager
Interactive.make( this );
// create a list box
template = new TemplateHandler();
listbox = new Listbox("element menu", width - 150 , 35 , 150 , 400 , 50 , template.elements );
content = new ContentHandler( );
canvas = new TemplateCanvas("canvas", template.elements, content.table, 200, 30, 675, 1050);
tools = new Toolbar("toolbar", width - 150 , 0 , 150 , 35 );
ArrayList<Panel> parentPanels = new ArrayList<Panel>();
parentPanels.add(canvas);
parentPanels.add(listbox);
parentPanels.add(tools);
mainInterface = new Interface("main interface", parentPanels);
}
void draw ()
{
bufferPG = createGraphics(width, height);
bufferPG.clear();
bufferPG.beginDraw();
mainInterface.refresh();
bufferPG.endDraw();
image(bufferPG,0,0);
}
void mouseMoved()
{
if (listbox.handleMoved(mouseX,mouseY)){
}
}
void mouseDragged()
{
if (canvas.handleDragged(mouseX,mouseY,listbox.selectedItem)){
}
}
void mouseReleased()
{
mainInterface.click(mouseX,mouseY);
}
void keyPressed ()
{
if( key == 'a' )
{
addElement();
}
else if( keyCode == 8 )
{
println("delete clicked");
removeElement();
}
else if ( key == 's' )
{
saveTemplate();
}
else if ( key == 'h' )
{
toggleDrawHighlights();
}
else if ( key == 'c' )
{
toggleDrawContent();
}
else if ( key == CODED )
{
if ( keyCode == UP || keyCode == DOWN || keyCode == LEFT || keyCode == RIGHT)
{
handleArrowPress();
}
}
}
void keyReleased ()
{
if(key == '=')
{
zoom(1.25);
}
else if(key == '-')
{
zoom(0.8);
}
}