本文整理汇总了Java中processing.core.PApplet.round方法的典型用法代码示例。如果您正苦于以下问题:Java PApplet.round方法的具体用法?Java PApplet.round怎么用?Java PApplet.round使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.PApplet
的用法示例。
在下文中一共展示了PApplet.round方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updatePos
import processing.core.PApplet; //导入方法依赖的package包/类
public static final void updatePos() {
if(following && (followedGameObject != null)) {
posToGo.set(followedGameObject.loc);
posToGo.x = PApplet.round(posToGo.x);
posToGo.y = PApplet.round(posToGo.y);
}
getGame().translate(-(camLoc.x-WINDOW_WIDTH/2),-(camLoc.y-WINDOW_HEIGHT/2));
switch(fancy) {
case 3:
//Note: This is the default which is move only when outside the window and try to keep the y position in the middle
fancyOption3();
break;
case 2:
//Note: This option always follows the entity even if it is or not outside the bounds but it also tries to keep the y position in the middle
fancyOption2();
break;
case 1:
//Note: This option follows the entity no matter what
fancyOption1();
break;
case 0:
//Note: This option follows the entity when outside bounds but dosen't try to keep the y position in the middle
fancyOption0();
break;
default:
fancyOption3();
break;
}
if(goToTarget){
//Adding a nice little speedup/speeddown effect
if(posToGo.x - camLoc.x*-1 < -120) {
camSpeed -= speedDown;
}else{
camSpeed += speedUp;
}
}else{
//Resetting cam speed once we reached the point
if((int)camSpeed != (int) cSB) {
if(camSpeed > cSB)
camSpeed -=0.5f;
else
camSpeed +=0.5f;
}else{
camSpeed = cSB;
}
}
}
示例2: render
import processing.core.PApplet; //导入方法依赖的package包/类
@Override
public void render(){
getGame().background(255);
if(t == PApplet.map(WINDOW_HEIGHT, 400, 900, 28, 46)*PApplet.round(getGame().frameRate) )exit();
t++;
}