最近我一直在使用大数字循环打印出来Hello World:
int counter = 0;
while(true) {
//loop for ~5 seconds
for(int i = 0; i < 2147483647 ; i++) {
//another loop because it's 2012 and PCs have gotten considerably faster :)
for(int j = 0; j < 2147483647 ; j++){ ... }
}
System.out.println(counter + ". Hello World!");
counter++;
}
Run Code Online (Sandbox Code Playgroud)
我知道这是一个非常愚蠢的方法,但我还没有在Java中使用任何计时器库.怎么会修改上面打印每说3秒?
我目前正在使用LibGDX和Java.我想知道,为什么LibGDX只为你提供游戏逻辑和渲染的渲染Mehtod.为什么LibGDX这样做,为什么LibGDX不继承像更新这样的另一个方法?我应该在渲染方法中处理游戏逻辑和渲染(当然我在渲染和更新方法中将其拆分)