本文整理汇总了Java中org.lwjgl.Sys.getTimerResolution方法的典型用法代码示例。如果您正苦于以下问题:Java Sys.getTimerResolution方法的具体用法?Java Sys.getTimerResolution怎么用?Java Sys.getTimerResolution使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.Sys
的用法示例。
在下文中一共展示了Sys.getTimerResolution方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testTimer
import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
* Tests the timer
*/
private void testTimer() {
long resolution = Sys.getTimerResolution();
long time = Sys.getTime();
System.out.println("==== Test Timer ====");
System.out.println("Resolution of timer (ticks per second): " + resolution);
System.out.println("Current time: " + time);
System.out.println("Sleeping for 2 seconds, using Thread.sleep()");
pause(2000);
long time2 = Sys.getTime();
System.out.println("Current time: " + time2);
System.out.println("Actually slept for: " + ((time2 - time) / (float) resolution) + " seconds");
System.out.println("---- Test Timer ----\n");
}
示例2: main
import org.lwjgl.Sys; //导入方法依赖的package包/类
public static void main( String[] args ) {
try {
StartupUtils.setupLibraries();
}
catch ( IOException e ) {
e.printStackTrace();
throw new RuntimeException( e );
}
timerTicksPerSecond = Sys.getTimerResolution();
new PickingTest().execute();
}
示例3: tick
import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
* Get the next time update from the system's hires timer. This method should
* be called once per main loop iteration; all timers are updated simultaneously
* from it.
*/
public static void tick() {
currentTime = Sys.getTime();
// Periodically refresh the timer resolution:
queryCount ++;
if (queryCount > QUERY_INTERVAL) {
queryCount = 0;
resolution = Sys.getTimerResolution();
}
}
示例4: busyWait
import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
* Busy waits for a specified number of seconds
*
* @param priority Priority to busy wait in
* @param seconds Number of seconds to busy wait
* @param message Message to print to user
*/
private void busyWait(int priority, int seconds, String message) {
long future = Sys.getTime() + (Sys.getTimerResolution() * seconds);
System.out.print(message);
// waste some cycles
while (Sys.getTime() < future) {
}
System.out.println("done");
}
示例5: wiggleMouse
import org.lwjgl.Sys; //导入方法依赖的package包/类
private void wiggleMouse() {
System.out.print("Please move the mouse around");
long statustime = Sys.getTime();
long endtime = Sys.getTime() + Sys.getTimerResolution() * 5;
while (Sys.getTime() < endtime) {
Display.update();
// empty mouse buffer
while(Mouse.next());
position.x += Mouse.getDX();
position.y += Mouse.getDY();
if(position.x<0) {
position.x = 0;
} else if (position.x>640-60) {
position.x = 640-60;
}
if(position.y < 0) {
position.y = 0;
} else if (position.y>480-30) {
position.y = 480-30;
}
render();
if (Sys.getTime() - statustime > Sys.getTimerResolution()) {
System.out.print(".");
statustime = Sys.getTime();
}
}
System.out.println("thank you");
}
示例6: run
import org.lwjgl.Sys; //导入方法依赖的package包/类
private void run() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
long time = Sys.getTime();
final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
renderer.render(false, true, 0);
while ( run ) {
Display.processMessages();
handleInput();
glClear(GL_COLOR_BUFFER_BIT);
final long currTime = Sys.getTime();
final int delta = (int)(currTime - time);
if ( smooth || delta >= ticksPerUpdate ) {
renderer.render(render, animate, delta);
time = currTime;
} else
renderer.render(render, false, 0);
Display.update(false);
//Display.sync(60);
if ( startTime > System.currentTimeMillis() ) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
System.out.println("\tAnimation: " + (animateTime / fps / 1000) + "us");
animateTime = 0;
fps = 0;
}
}
}
示例7: run
import org.lwjgl.Sys; //导入方法依赖的package包/类
private void run() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
long time = Sys.getTime();
final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
renderer.render(false, true, 0);
while ( run ) {
Display.processMessages();
handleInput();
glClear(GL_COLOR_BUFFER_BIT);
final long currTime = Sys.getTime();
final int delta = (int)(currTime - time);
if ( smooth || delta >= ticksPerUpdate ) {
renderer.render(render, animate, delta);
time = currTime;
} else
renderer.render(render, false, 0);
Display.update(false);
//Display.sync(60);
if ( startTime > System.currentTimeMillis() ) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
System.out.println("Animation: " + animateTime / fps);
animateTime = 0;
fps = 0;
}
}
}
示例8: run
import org.lwjgl.Sys; //导入方法依赖的package包/类
private void run() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
long time = Sys.getTime();
final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
renderer.render(false, true, 0);
while ( run ) {
Display.processMessages();
handleInput();
glClear(GL_COLOR_BUFFER_BIT);
final long currTime = Sys.getTime();
final int delta = (int)(currTime - time);
if ( smooth || delta >= ticksPerUpdate ) {
renderer.render(render, animate, delta);
time = currTime;
} else
renderer.render(render, false, 0);
Display.update(false);
if ( startTime > System.currentTimeMillis() ) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
fps = 0;
}
}
}
示例9: run
import org.lwjgl.Sys; //导入方法依赖的package包/类
private void run() {
long startTime = System.currentTimeMillis() + 5000;
long fps = 0;
long time = Sys.getTime();
final int ticksPerUpdate = (int)(Sys.getTimerResolution() / ANIMATION_TICKS);
renderer.render(false, true, 0);
while ( run ) {
Display.processMessages();
handleInput();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
final long currTime = Sys.getTime();
final int delta = (int)(currTime - time);
if ( smooth || delta >= ticksPerUpdate ) {
renderer.render(render, animate, delta);
time = currTime;
} else
renderer.render(render, false, 0);
Display.update(false);
//Display.sync(60);
if ( startTime > System.currentTimeMillis() ) {
fps++;
} else {
long timeUsed = 5000 + (startTime - System.currentTimeMillis());
startTime = System.currentTimeMillis() + 5000;
System.out.println("FPS: " + (Math.round(fps / (timeUsed / 1000.0) * 10) / 10.0) + ", Balls: " + ballCount);
fps = 0;
}
}
}
示例10: getCurrentTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
private static long getCurrentTime() {
return Sys.getTime() * 1000 / Sys.getTimerResolution();
}
示例11: getSystemTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
* Gets the system time in milliseconds.
*/
public static long getSystemTime()
{
return Sys.getTime() * 1000L / Sys.getTimerResolution();
}
示例12: getCurrentTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
private long getCurrentTime(){
return Sys.getTime()*1000/Sys.getTimerResolution();
}
示例13: getSystemTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
* Gets the system time in milliseconds.
*/
public static long getSystemTime() {
return Sys.getTime() * 1000L / Sys.getTimerResolution();
}
示例14: getTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
private long getTime() {
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
示例15: getTime
import org.lwjgl.Sys; //导入方法依赖的package包/类
private static long getTime() {
return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}