Vanilla ProcessingshapeMode()
用于修改“绘制形状的位置”。如果可能的话,如何使用ControlP5获得相同的功能来绘制 UI“控制器” ?
具体来说,我尝试了以下代码:
shapeMode(CENTER);
cp5.addButton("On/Off")
.setPosition(width/2, height/2)
.setSize(300, 300)
.setColorBackground(color(0, 113, 0));
并得到了这个结果:
但我想看到的是:
显然,类似的东西.setPosition(width/2 - buttonWidth/2, height/2 - buttonWidth/2)
会起作用,但我想保持代码最少。