当前位置: 首页>>代码示例>>Java>>正文


Java Sys.getTimerResolution方法代码示例

本文整理汇总了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"); 
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:SysTest.java

示例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();
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:14,代码来源:PickingTest.java

示例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();
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:Timer.java

示例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");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:19,代码来源:SysTest.java

示例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");
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:37,代码来源:MouseCreationTest.java

示例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;
		}
	}
}
 
开发者ID:Arcbe,项目名称:GPVM,代码行数:39,代码来源:SpriteShootout.java

示例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;
		}
	}
}
 
开发者ID:CodeConglomerate,项目名称:TeacherSmash,代码行数:39,代码来源:SpriteShootoutMapped.java

示例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;
		}
	}
}
 
开发者ID:CodeConglomerate,项目名称:TeacherSmash,代码行数:36,代码来源:SpriteShootoutCL.java

示例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;
		}
	}
}
 
开发者ID:Superloup10,项目名称:Wolf_game,代码行数:37,代码来源:SpriteShootout2P.java

示例10: getCurrentTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
private static long getCurrentTime() {
	return Sys.getTime() * 1000 / Sys.getTimerResolution();
}
 
开发者ID:marcioz98,项目名称:MRCEngine,代码行数:4,代码来源:DisplayManager.java

示例11: getSystemTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Gets the system time in milliseconds.
 */
public static long getSystemTime()
{
    return Sys.getTime() * 1000L / Sys.getTimerResolution();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:8,代码来源:Minecraft.java

示例12: getCurrentTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
private long getCurrentTime(){
	return Sys.getTime()*1000/Sys.getTimerResolution();
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:4,代码来源:DisplayManager.java

示例13: getSystemTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
/**
 * Gets the system time in milliseconds.
 */
public static long getSystemTime() {
	return Sys.getTime() * 1000L / Sys.getTimerResolution();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:Minecraft.java

示例14: getTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
private long getTime() {
	return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:4,代码来源:UsingEntities.java

示例15: getTime

import org.lwjgl.Sys; //导入方法依赖的package包/类
private static long getTime() {
    return (Sys.getTime() * 1000) / Sys.getTimerResolution();
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:4,代码来源:AdvancedRendering.java


注:本文中的org.lwjgl.Sys.getTimerResolution方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。