Skip to content

Commit 533e41e

Browse files
committed
add two more processing projects
1 parent 75260f4 commit 533e41e

File tree

6 files changed

+285
-0
lines changed

6 files changed

+285
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: processing
3+
title: "Bármi Más"
4+
processing-source: /files/BarmiMas/BarmiMas.pde
5+
header-img: "img/projektek/cseresznyepej/barmi_mas.png"
6+
categories: projektek
7+
tags: ["processing", "cseresznyepej"]
8+
---
9+
<h2>Bármi Más :)</h2>
10+
<h3 class="authors">Ottó Panna</h3>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
layout: processing
3+
title: "Analóg Óra"
4+
processing-source: /files/analog_ora/analog_ora.pde
5+
header-img: "img/projektek/cseresznyepej/analog_ora.png"
6+
categories: projektek
7+
tags: ["processing", "cseresznyepej"]
8+
---
9+
<h2>Analóg óra</h2>
10+
<h3 class="authors">Szarka Zsombor</h3>

files/BarmiMas/BarmiMas.pde

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
2+
class Ellipse{
3+
int x;
4+
int y;
5+
Ellipse (int x1, int y1){
6+
x = x1;
7+
y = y1;
8+
}
9+
int top(){
10+
return y - 50;
11+
}
12+
int bot(){
13+
return y + 50;
14+
}
15+
int left(){
16+
return x - 50;
17+
}
18+
int right(){
19+
return x + 50;
20+
}
21+
int X(){
22+
return x;
23+
}
24+
int Y(){
25+
return y;
26+
}
27+
}
28+
29+
ArrayList<Ellipse> players = new ArrayList<Ellipse>();
30+
31+
void setup(){
32+
size(800,800);
33+
players.add(new Ellipse(750,50));
34+
players.add(new Ellipse(650,50));
35+
players.add(new Ellipse(750,150));
36+
37+
}
38+
39+
void draw(){
40+
background(255);
41+
for (int y = height; y > -100; y = y - 100){
42+
for (int x = width; x > -100; x = x - 100){
43+
noStroke();
44+
fill(225);
45+
rect(x,y,100,100);
46+
x = x - 100;
47+
fill(0);
48+
rect(x,y,100,100);
49+
}
50+
y = y - 100;
51+
for (int x = width; x > -100; x = x - 100){
52+
fill(0);
53+
rect(x,y,100,100);
54+
x = x - 100;
55+
fill(255);
56+
rect(x,y,100,100);
57+
}
58+
}
59+
stroke(0,255,0);
60+
strokeWeight(10);
61+
line(800,0,800,200);
62+
line(800,0,600,0);
63+
line(800,200,700,200);
64+
line(600,0,600,100);
65+
line(700,200,700,100);
66+
line(600,100,700,100);
67+
for (int i = players.size()-1; i > -1; i = i - 1){
68+
fill(255,0,0);
69+
stroke(255,0,0);
70+
ellipse(players.get(i).x,players.get(i).y,50,50);
71+
}
72+
}
73+
74+
void mousePressed(){
75+
int xMouse = mouseX;
76+
int yMouse = mouseY;
77+
int listnum = 0;
78+
for (int i = players.size()-1; i > -1; i = i - 1){
79+
if ((players.get(i).right() > xMouse) && (xMouse > players.get(i).left()) && (players.get(i).bot() > yMouse) && (yMouse > players.get(i).top())){
80+
for (int k = players.size()-1; k > -1; k = k - 1){
81+
if(((players.get(k).x) == (players.get(i).x-100) && (players.get(k).y) == (players.get(i).y)) || ((players.get(k).y) == (players.get(i).y+100) && (players.get(k).x) == (players.get(i).x))){
82+
listnum = listnum + 1;
83+
}
84+
}
85+
if(listnum == 0){
86+
players.add(new Ellipse(players.get(i).x-100,players.get(i).y));
87+
players.add(new Ellipse(players.get(i).x,players.get(i).y+100));
88+
players.remove(i);
89+
return;
90+
}
91+
}
92+
}
93+
}

files/analog_ora/analog_ora.pde

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
int ArectX = 42;
2+
int BrectX = 30; //2 - vel oszthato kell legyen!!!
3+
int ABrectY = 42; //3 - mal oszthato kell legyen!!!
4+
int Aspace = 10;
5+
int Bspace = 10;
6+
int ABshape = 7;
7+
8+
int BYspace = 4;
9+
10+
int AXCoords[][] = {{0,0},{0,0},{0,0},{0,0},{0,0}};
11+
int ABYCoords[] = {0,0};
12+
int BXCoords[] = {0,0};
13+
14+
int trashX = 35;
15+
int trashY = 35;
16+
17+
18+
int selectedItem = 0;
19+
int red = 255;
20+
int green = 255;
21+
int blue = 255;
22+
int S = 0;
23+
int G = 0;
24+
25+
26+
void setup()
27+
{
28+
size(700,500);
29+
background(255);
30+
31+
//calculating rects Coords
32+
33+
//Y
34+
ABYCoords[0] = trashY;
35+
ABYCoords[1] = trashY + ABrectY;
36+
37+
int first = 0;
38+
int second = 0;
39+
40+
//AX
41+
for(int j = 0; j < 10; j++){
42+
AXCoords[first][second] = trashX;
43+
if(j%2 == 0){
44+
trashX = trashX + ArectX;
45+
}else{
46+
trashX = trashX + Aspace;
47+
}
48+
49+
if(j%2 == 1){
50+
second = 0;
51+
first++;
52+
} else{
53+
second = 1;
54+
}
55+
}
56+
57+
//BX
58+
trashX = trashX + Bspace;
59+
for(int j = 0; j < 2; j++){BXCoords[j] = trashX; trashX = trashX + 4*Bspace + 3*BrectX;}
60+
61+
}
62+
63+
64+
boolean mouseMenu(int minX, int maxX, int minY, int maxY)
65+
{
66+
boolean Mc = mousePressed == true;
67+
boolean MouseMenuResult = mouseX > minX && mouseX < maxX && mouseY > minY && mouseY < maxY && Mc;
68+
return MouseMenuResult;
69+
}
70+
71+
72+
void backgroundMenuRGB(int xCoord,int yCoord){
73+
strokeWeight(1);
74+
int W = 0;
75+
int Vertical = ABrectY/3;
76+
int SmallBXCoords[][][] = {{{0,0},{0,0},{0,0}},{{0,0},{0,0},{0,0}},{{0,0},{0,0},{0,0}}};
77+
int SmallBYCoords[][][] = {{{0,0},{0,0},{0,0}},{{0,0},{0,0},{0,0}},{{0,0},{0,0},{0,0}}};
78+
for(int j = 0; j < 3; j++){
79+
W = W + Bspace;
80+
81+
SmallBXCoords[j][0][0] = W + xCoord + 1;
82+
SmallBXCoords[j][0][1] = W + BrectX + xCoord - 1;
83+
SmallBXCoords[j][1][0] = W + xCoord;
84+
SmallBXCoords[j][1][1] = W + xCoord + BrectX;
85+
SmallBXCoords[j][2][0] = W + xCoord + 1;
86+
SmallBXCoords[j][2][1] = W + (BrectX/2) + xCoord;
87+
88+
SmallBYCoords[j][0][0] = ABYCoords[0] + Vertical - BYspace;
89+
SmallBYCoords[j][0][1] = ABYCoords[0] + BYspace;
90+
SmallBYCoords[j][1][0] = ABYCoords[0] + Vertical;
91+
SmallBYCoords[j][1][1] = ABYCoords[0] + 2*Vertical;
92+
SmallBYCoords[j][2][0] = ABYCoords[0] + 2*Vertical + BYspace;
93+
SmallBYCoords[j][2][1] = ABYCoords[0] + 3*Vertical - BYspace;
94+
95+
triangle(SmallBXCoords[j][0][0], SmallBYCoords[j][0][0], SmallBXCoords[j][0][1], SmallBYCoords[j][0][0], SmallBXCoords[j][2][1], SmallBYCoords[j][0][1]);
96+
rect(SmallBXCoords[j][1][0],SmallBYCoords[j][1][0],BrectX,Vertical);
97+
triangle(SmallBXCoords[j][2][0], SmallBYCoords[j][2][0], SmallBXCoords[j][0][1], SmallBYCoords[j][2][0], SmallBXCoords[j][2][1], SmallBYCoords[j][2][1]);
98+
W = W + BrectX;
99+
}
100+
//ellenorzes
101+
102+
}
103+
104+
void backgroundMenu()
105+
{
106+
//clear();
107+
color[] colors = {#00ffdc,#009984,#00d4b7,#32ff8a,#94ffff};
108+
109+
if(selectedItem == 5){
110+
background(red,green,blue);
111+
} else{
112+
background(colors[selectedItem]);
113+
}
114+
115+
for(int i = 0; i < 6; i++){
116+
strokeWeight(1);
117+
if(i == selectedItem){
118+
strokeWeight(2);
119+
stroke(#000000);
120+
}
121+
122+
switch(i){
123+
case 0:fill(colors[0]);break;
124+
case 1:fill(colors[1]);break;
125+
case 2:fill(colors[2]);break;
126+
case 3:fill(colors[3]);break;
127+
case 4:fill(colors[4]);break;
128+
case 5:noFill();
129+
}
130+
131+
if(i == 5){
132+
rect(BXCoords[0],ABYCoords[0],4*Bspace + 3*BrectX,ABrectY,ABshape);
133+
backgroundMenuRGB(BXCoords[0],ABYCoords[0]);
134+
} else{
135+
rect(AXCoords[i][0],ABYCoords[0],ArectX,ABrectY,ABshape);
136+
}
137+
}
138+
if(mouseMenu(AXCoords[0][0],AXCoords[0][1],ABYCoords[0],ABYCoords[1])){
139+
selectedItem = 0;
140+
} else if(mouseMenu(AXCoords[1][0],AXCoords[1][1],ABYCoords[0],ABYCoords[1])){
141+
selectedItem = 1;
142+
} else if(mouseMenu(AXCoords[2][0],AXCoords[2][1],ABYCoords[0],ABYCoords[1])){
143+
selectedItem = 2;
144+
} else if(mouseMenu(AXCoords[3][0],AXCoords[3][1],ABYCoords[0],ABYCoords[1])){
145+
selectedItem = 3;
146+
} else if(mouseMenu(AXCoords[4][0],AXCoords[4][1],ABYCoords[0],ABYCoords[1])){
147+
selectedItem = 4;
148+
} else if(mouseMenu(BXCoords[0],BXCoords[1],ABYCoords[0],ABYCoords[1])){
149+
selectedItem = 5;
150+
}
151+
}
152+
153+
void clock(int X, int Y,int radius){
154+
stroke(255);
155+
strokeWeight(3);
156+
ellipse(X,Y,radius,radius);
157+
158+
translate(X,Y);
159+
rotate(second()*6/57.3);
160+
line(0,0,0,0-(radius/2-5));
161+
rotate(second()*6/57.3*(-1));
162+
rotate(minute()*6/57.3);
163+
line(0,0,0,0-(radius/2-20));
164+
rotate(minute()*6/57.3*(-1));
165+
rotate(hour()*30/57.3);
166+
line(0,0,0,0-(radius/2-50));
167+
}
168+
169+
void draw(){
170+
backgroundMenu();
171+
clock(200,270,200);
172+
}
90.4 KB
Loading
106 KB
Loading

0 commit comments

Comments
 (0)