本帖最后由 liupk 于 2021-3-6 14:38 编辑
3.在setup()中初始化配置最外围的红色框框,和显示区的绿色框框,和输入区的蓝色框框,点击运行按钮效果如下图
//外框宽和高
int outerFrameWidth,outerFrameHeight,outerFrameX,outerFrameY;
//配置框宽和高
int displayFrameWidth,displayFrameHeight,displayFrameX,displayFrameY;
//发送框宽和高
int sendFrameWidth,sendFrameHeight,sendFrameX,sendFrameY;
void setup()
{
size(1000, 800);
background(0);
//外框四条线
outerFrameWidth = width-20;
outerFrameHeight = height-20;
outerFrameX = 10;
outerFrameY = 10;
stroke(100,0,0);
noFill();
rect(outerFrameX,outerFrameY,outerFrameWidth,outerFrameHeight);
//配置框四条线
displayFrameWidth = outerFrameWidth-20;
displayFrameHeight = outerFrameHeight*2/3;
displayFrameX = outerFrameX+10;
displayFrameY = outerFrameY+10;
stroke(0,100,0);
noFill();
rect(displayFrameX,displayFrameY,displayFrameWidth,displayFrameHeight);
//发送框四条线
sendFrameWidth = outerFrameWidth-400;
sendFrameHeight = outerFrameHeight/3-40;
sendFrameX = outerFrameX+185;
sendFrameY = displayFrameHeight+30;
stroke(0,0,100);
noFill();
rect(sendFrameX,sendFrameY,sendFrameWidth,sendFrameHeight);
}
void draw()
{
}
|