【发布时间】:2019-03-13 12:46:00
【问题描述】:
void setup(){}
老实说,我不知道这个顶部是做什么的,最初我的类“东西”甚至没有出现,因为它一直说它不存在,所以有人做了那个 void setup 的东西并且它有效?我是新手,所以如果我触发了某人,我深表歉意。
class TarotGame1
{
Stuff game = new Stuff();
}
我照常上课
class Stuff
{
Stuff 类的构造函数
Stuff()
{
tarotCircle();
tarotCircle();
tarotSquare();
tarotDiamond();
tarotPacMan();
rngSelect1();
rngSelect2();
rngSelect3();
rngSelect4();
}
//Tarot for Circle
void tarotCircle()
{
size(800,600);
rectMode(CENTER);
fill(#2c3e50);
rect(width / 2, height / 2, 300, 400, 60);
noFill();
fill(#16a085);
rect(width / 2, height / 2, 250, 350, 60);
noFill();
fill(#c0392b);
ellipse(width /2, 250, 100, 100);
noFill();
textSize(32);
fill(#c0392b);
text("Circle", 360, 350);
noFill();
}
//Tarot for Square
void tarotSquare()
{
rectMode(CENTER);
fill(#2c3e50);
rect(width / 2, height / 2, 300, 400, 60);
noFill();
fill(#16a085);
rect(width / 2, height / 2, 250, 350, 60);
noFill();
fill(#c0392b);
rect(width / 2, 225, 100, 100);
noFill();
textSize(32);
fill(#c0392b);
text("Rectangle", 330, 350);
noFill();
}
//Tarot for Diamond
void tarotDiamond()
{
rectMode(CENTER);
fill(#8e44ad);
rect(width / 2, height / 2, 300, 400, 60);
noFill();
fill(#16a085);
rect(width / 2, height / 2, 250, 350, 60);
noFill();
fill(#27ae60);
beginShape(TRIANGLE_FAN);
vertex(57.5 + 340, 50+ 200);
vertex(57.5+340, 15+ 200);
vertex(92+ 340, 50+ 200);
vertex(57.5+ 340, 85+ 200);
vertex(22+ 340, 50+ 200);
vertex(57.5+ 340, 15+ 200);
endShape();
noFill();
textSize(32);
fill(#c0392b);
text("Diamond", 330, 350);
noFill();
}
//Tarot for Pac-Man
void tarotPacMan()
{
rectMode(CENTER);
fill(#2c3e50);
rect(width / 2, height / 2, 300, 400, 60);
noFill();
fill(#16a085);
rect(width / 2, height / 2, 250, 350, 60);
noFill();
fill(#f1c40f);
arc(width / 2, 250, 80, 80, 0, PI+2.5, PIE);
noFill();
textSize(32);
fill(#c0392b);
text("Pac-Man", 330, 350);
noFill();
}
//Randomized Selection #1 (Barely Randomized Values)
void rngSelect1()
{
rectMode(CENTER);
fill(#c0392b);
size(800,600);
fill(#f1c40f);
arc(500, 200, 80, 80, 0, PI+2.5, PIE);
noFill();
fill(#27ae60);
beginShape(TRIANGLE_FAN);
vertex(57.5 + 340+ 150, 50+ 200);
vertex(57.5+340, 15+ 200);
vertex(92+ 340+ 150, 50+ 200);
vertex(57.5+ 340, 85+ 200);
vertex(22+ 340, 50+ 200);
vertex(57.5+ 340+ 150, 15+ 200);
endShape();
noFill();
fill(#8e44ad );
rect(width / 2, 225, 100, 100);
noFill();
fill(#c0392b);
ellipse(width /2, 150, 100, 100);
noFill();
textSize(32);
fill(#c0392b);
text("Randomized Selection", 330, 500);
noFill();
}
//Randomized Selection #2 (Somewhat Randomized Values)
void rngSelect2()
{
rectMode(CENTER);
fill(#c0392b);
size(800,600);
fill(#f1c40f);
arc(500, 124, 80, 80, 0, PI+2.5, PIE);
noFill();
fill(#27ae60);
beginShape(TRIANGLE_FAN);
vertex(57.5 + 340+ 75, 50+ 200);
vertex(57.5+340, 35+ 200);
vertex(92+ 340+ 57, 50+ 203);
vertex(57.5+ 56, 85+ 53);
vertex(22+ 57, 50+ 24);
vertex(57.5+ 75+ 150, 15+ 200);
endShape();
noFill();
fill(#8e44ad );
rect(width / 2, 225, 100, 100);
noFill();
fill(#c0392b);
ellipse(width /2, 143, 100, 100);
noFill();
textSize(32);
fill(#c0392b);
text("Randomized Selection", 330, 500);
noFill();
}
//Randomized Selection #3 (More Randomized Values)
void rngSelect3()
{
rectMode(CENTER);
fill(#c0392b);
size(800,600);
fill(#f1c40f);
arc(500, 300, 80, 80, 0, PI+2.5, PIE);
noFill();
fill(#27ae60);
beginShape(TRIANGLE_FAN);
vertex(57.5 + 340+ 75, 50+ 23);
vertex(57.5+340, 35+ 127);
vertex(92+ 340+ 57, 50+ 721);
vertex(57.5+ 56, 85+ 126);
vertex(22+ 57, 50+ 234);
vertex(57.5+ 75+ 150, 15+ 34);
endShape();
noFill();
fill(#8e44ad );
rect(111, 341, 100, 100);
noFill();
fill(#c0392b);
ellipse(231, 180, 100, 100);
noFill();
textSize(32);
fill(#c0392b);
text("Randomized Selection", 330, 500);
noFill();
}
//Randomized Selection #4 (Super Randomized Values)
void rngSelect4()
{
rectMode(CENTER);
fill(#c0392b);
size(800,600);
fill(#f1c40f);
arc(500, 300, 132, 221, 0, PI+2.5, PIE);
noFill();
fill(#27ae60);
beginShape(TRIANGLE_FAN);
vertex(57.5 + 12+ 75, 50+ 23);
vertex(57.5+340, 351+ 127);
vertex(92+ 340+ 577, 50+ 12);
vertex(57.5+ 56, 85+ 136);
vertex(22+ 57, 50+ 234);
vertex(57.5+ 75+ 150, 15+ 13);
endShape();
noFill();
fill(#8e44ad );
rect(123, 461, 111, 425);
noFill();
fill(#c0392b);
ellipse(231, 180, 123, 560);
noFill();
textSize(32);
fill(#c0392b);
text("Randomized Selection", 310, 550);
noFill();
}
}
有什么想法吗?如果你把它放在处理中,我只会得到一个空白屏幕。
【问题讨论】:
-
有一些“标准”方法(@987654325@、
setup()等)在应用程序的生命周期中的特定时间被调用 - 我鼓励您查看它们的内容是以及它们何时运行。 -
在类似的注释中,我看不到您在哪里进行方法调用以使您的程序真正做任何事情。你的
setup()方法没有做任何事情,我看不到你在哪里调用draw()或类似的东西。正如我上面所说,您真的,真的需要了解这些方法的作用才能成功编写处理程序。 -
啊,好吧!谢谢你的快速回复我的朋友:D
-
@shmosel 我看不出将这个标记为 Java 有什么害处——毕竟,它或多或少是 Java 编程语言的一个子集。
标签: processing