-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVisitenkartenKonfigurator.pde
394 lines (344 loc) · 12 KB
/
VisitenkartenKonfigurator.pde
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
ArrayList<dragText> dragTextList = new ArrayList<dragText>();
ArrayList<dragText> dragTextListEtui = new ArrayList<dragText>();
ArrayList<dragImage> dragImageList = new ArrayList<dragImage>();
textField textFieldTest;
toggleButton toggleMask;
toggleButton toggleLabel;
card myCard;
card transCard;
card transCard2;
card transCard3;
card transCard4;
button changePage;
button addDragText;
button addDragImage;
tabButton tabButtonTest;
tabButton etuiColorTab;
slider sliderTest;
slider sliderTestBG;
slider cardWidth;
slider cardHeight;
slider etuiColor;
PFont myFontUI;
PImage bottom;
PImage metallBG;
PImage pappeBG;
PImage woodBG;
PImage topHand;
PImage circle;
//2 Scene
PImage etui;
PImage etuiTop;
PImage etuiWhole;
PImage etuiTopClap;
PImage curCard;
PImage gravur;
int scene;
void setup()
{
size(1024,768, P3D);
scene = 0;
String[] tabLabels = {"metall", "carton", "glass", "paper"};
String[] colorLabels = {"Silver", "RGB"};
tabButtonTest = new tabButton(350, 560, 4, 500, 30, tabLabels);
tabButtonTest.activeTab = 3;
etuiColorTab = new tabButton(608, 100, 2, 250, 30, colorLabels);
etuiColorTab.activeTab = 0;
toggleMask = new toggleButton(490, 710);
toggleLabel = new toggleButton(170, 630);
transCard = new card(780, 90, 230, 300, 10);
transCard2 = new card(328, 530, 550, 225, 10);
transCard3 = new card(585, 35, 405, 158, 10);
transCard4 = new card(20, 600, 700, 150, 10);
cardWidth = new slider(795, 150, 200, 12, false);
cardWidth.myValue = 0.5;
cardHeight = new slider(795, 250, 200, 12, false);
cardHeight.myValue = 0.25;
sliderTestBG = new slider(795, 250, 200, 12, true);
sliderTestBG.myValue = 0.5;
sliderTest = new slider(795, 350, 200, 12, true);
sliderTest.myValue = 0.5;
etuiColor = new slider(608, 150, 200, 12, true);
etuiColor.myValue = 0;
textFieldTest = new textField(350, 630, 200, 40, "test");
addDragText = new button(600,630,120,40, "Add Text");
addDragImage = new button(600, 702, 120, 40, "Add Image");
changePage = new button(945,702,50,40, ">");
myFontUI = createFont("lmmono10-regular.otf", 32);
metallBG = loadImage("metallBG.jpg");
pappeBG = loadImage("pappeBG.jpg");
woodBG = loadImage("glass.png");
bottom = loadImage("bottom.jpg");
topHand = loadImage("TopHand.png");
circle = loadImage("circle.png");
//2 Scene
etui = loadImage("etui.jpg");
etuiTop = loadImage("etuiTop.png");
etuiWhole = loadImage("etuiWhole.png");
etuiTopClap = loadImage("etuiTopClap.png");
smooth(8);
textSize(30);
}
void draw()
{
colorMode(RGB, 255, 255, 255);
changePage.changeLabel(scene == 0 ? ">" : "<");
//------------------------ SCENE 0 ------------------------
if (scene == 0)
{
background(240);
createTransCardForEtui();
addDragText.xPos = 600;
addDragText.yPos = 630;
textFieldTest.xPos = 353;
textFieldTest.yPos = 630;
colorMode(HSB, 360, 100, 100);
imageMode(CORNER);
noTint();
image(bottom, -210, -115, 1022*1.3, 680*1.3);
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).BGmask = get(dragImageList.get(i).xPos, dragImageList.get(i).yPos, 100, 100);
}
pushStyle();
fill(sliderTestBG.myValue * 360, 50, 90);
if (tabButtonTest.activeTab == 0) {
image(metallBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else if (tabButtonTest.activeTab == 1) {
image(pappeBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else if (tabButtonTest.activeTab == 2) {
image(woodBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else {
tint(sliderTestBG.myValue * 360, 50, 90);
rectMode(CORNER);
myCard = new card(320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)),0);
myCard.draw();
}
imageMode(CENTER);
tint(sliderTest.myValue * 360, 50, 90);
tint(sliderTest.myValue * 360, 50, 90);
for(int i = 0; i < dragImageList.size(); i++) {
if(dragImageList.get(i).mask == false) dragImageList.get(i).draw();
}
for(int i = 0; i < dragTextList.size(); i++) {
dragTextList.get(i).draw();
}
for(int i = 0; i < dragImageList.size(); i++) {
if(dragImageList.get(i).mask) dragImageList.get(i).draw();
}
textAlign(CENTER);
fill(0, 0, 100, 150);
transCard.draw();
transCard2.draw();
fill(0);
textSize(32);
text("Size", 830, 130);
pushStyle();
fill(0);
textSize(22);
text((220 + (int)(2.5 *( cardWidth.myValue * 90))) + "x" + (140 + (int)(1.2 * (cardWidth.myValue * 90))), 954, 130);
popStyle();
text("Background", 880, 230);
text("Design", 846, 330);
text("Emboss", 402 ,730);
popStyle();
image(topHand, -210, -115, 1022*1.3, 680*1.3);
tabButtonTest.draw();
sliderTest.draw();
sliderTestBG.draw();
cardWidth.draw();
//cardHeight.draw();
textFieldTest.draw();
addDragText.draw();
addDragImage.draw();
toggleMask.draw();
if (addDragText.pressed == 1)
{
dragText t = new dragText(400, 250, textFieldTest.myText);
dragTextList.add(t);
addDragText.pressed = 0;
}
if (addDragImage.pressed == 1)
{
dragImage i = new dragImage(530, 310, 100, 100, "circle.png", toggleMask.myStateActive);
dragImageList.add(i);
addDragImage.pressed = 0;
}
}
//------------------------ SCENE 1 ------------------------
else
{
background(255);
noTint();
image(etui, 50, 20, 920, 600);
etuiColorTab.draw();
if (etuiColorTab.activeTab == 1) etuiColor.draw();
noStroke();
beginShape();
texture(curCard);
vertex(200, 478, 0, 0);
vertex(325, 575, 0, 140 + (int)(1.2 * (cardWidth.myValue * 90)));
vertex(573, 458, 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
vertex(446, 365, 220 + (int)(2.5 *( cardWidth.myValue * 90)), 0);
endShape();
colorMode(HSB, 360, 100, 100);
if (etuiColorTab.activeTab == 1) tint(etuiColor.myValue * 360, 50, 90);
image(etuiWhole, 50, 20, 920, 600);
noTint();
noStroke();
beginShape();
texture(curCard);
vertex(204, 302, 0, 0);
vertex(300, 376, 0, 140 + (int)(1.2 * (cardWidth.myValue * 90)));
vertex(550, 275, 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
vertex(447, 200, 220 + (int)(2.5 *( cardWidth.myValue * 90)), 0);
endShape();
colorMode(HSB, 360, 100, 100);
if (etuiColorTab.activeTab == 1) tint(etuiColor.myValue * 360, 50, 90);
image(etuiTop, 50, 20, 920, 600);
image(etuiTopClap, 50, 20, 920, 600);
fill(0, 0, 0, 20);
transCard3.draw();
transCard4.draw();
toggleLabel.draw();
colorMode(RGB, 255, 255, 255);
fill(0);
text("Color", 608, 75);
text("Label", 50, 650);
if (toggleLabel.myStateActive)
{
addDragText.xPos = 280;
addDragText.yPos = 680;
textFieldTest.xPos = 50;
textFieldTest.yPos = 680;
addDragText.draw();
textFieldTest.draw();
colorMode(RGB, 255, 255, 255);
fill(255);
noStroke();
rect(490,620,210,110,0);
for(int i = 0; i < dragTextListEtui.size(); i++) {
dragTextListEtui.get(i).draw();
}
gravur = get(490, 620, 210, 110);
noTint();
noStroke();
beginShape();
texture(gravur);
vertex(566, 397, 0, 0);
vertex(633, 442, 0, 110);
vertex(773, 373, 210, 110);
vertex(702, 332, 210, 0);
endShape();
}
if (addDragText.pressed == 1)
{
dragText t = new dragText(750, 650, textFieldTest.myText);
dragTextListEtui.add(t);
addDragText.pressed = 0;
print("test");
}
}
changePage.draw();
if (changePage.pressed == 1)
{
if (scene == 0)
scene = 1;
else
scene = 0;
changePage.pressed = 0;
}
}
boolean insideRect(int xPos, int yPos, int targetXPos, int targetYPos, int targetWidth, int targetHeight) {
if (xPos > targetXPos && xPos < targetXPos + targetWidth && yPos > targetYPos && yPos < targetYPos + targetHeight) {
return true;
}
return false;
}
void mousePressed() {
toggleLabel.mousePressed();
toggleMask.mousePressed();
etuiColor.mousePressed();
sliderTest.mousePressed();
sliderTestBG.mousePressed();
cardWidth.mousePressed();
cardHeight.mousePressed();
textFieldTest.mousePressed();
changePage.mousePressed();
addDragText.mousePressed();
addDragImage.mousePressed();
for(int i = 0; i < dragTextList.size(); i++) {
dragTextList.get(i).mousePressed();
}
for(int i = 0; i < dragTextListEtui.size(); i++) {
dragTextListEtui.get(i).mousePressed();
}
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).mousePressed();
}
tabButtonTest.mousePressed();
etuiColorTab.mousePressed();
}
void keyPressed() {
textFieldTest.keyPressed();
}
void mouseDragged() {
etuiColor.mouseDragged();
sliderTest.mouseDragged();
sliderTestBG.mouseDragged();
cardWidth.mouseDragged();
cardHeight.mouseDragged();
for(int i = 0; i < dragTextList.size(); i++) {
dragTextList.get(i).mouseDragged();
}
for(int i = 0; i < dragTextListEtui.size(); i++) {
dragTextListEtui.get(i).mouseDragged();
}
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).mouseDragged();
}
}
void mouseReleased() {
etuiColor.mouseReleased();
sliderTest.mouseReleased();
sliderTestBG.mouseReleased();
cardWidth.mouseReleased();
cardHeight.mouseReleased();
for(int i = 0; i < dragTextList.size(); i++) {
dragTextList.get(i).mouseReleased();
}
for(int i = 0; i < dragTextListEtui.size(); i++) {
dragTextListEtui.get(i).mouseReleased();
}
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).mouseReleased();
}
}
void createTransCardForEtui()
{
colorMode(HSB, 360, 100, 100);
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).BGmask = get(dragImageList.get(i).xPos, dragImageList.get(i).yPos, 100, 100);
}
fill(sliderTestBG.myValue * 360, 50, 90);
if (tabButtonTest.activeTab == 0) {
image(metallBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else if (tabButtonTest.activeTab == 1) {
image(pappeBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else if (tabButtonTest.activeTab == 2) {
image(woodBG, 320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
} else {
tint(sliderTestBG.myValue * 360, 50, 90);
rectMode(CORNER);
myCard = new card(320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)),0);
myCard.draw();
}
tint(sliderTest.myValue * 360, 50, 90);
for(int i = 0; i < dragTextList.size(); i++) {
dragTextList.get(i).draw();
}
for(int i = 0; i < dragImageList.size(); i++) {
dragImageList.get(i).draw();
}
noTint();
curCard = get(320 - (int)(cardWidth.myValue * 360)/7, 180 - (int)(cardWidth.myValue * 360)/7 , 220 + (int)(2.5 *( cardWidth.myValue * 90)), 140 + (int)(1.2 * (cardWidth.myValue * 90)));
}