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


Java Sys类代码示例

本文整理汇总了Java中org.lwjgl.Sys的典型用法代码示例。如果您正苦于以下问题:Java Sys类的具体用法?Java Sys怎么用?Java Sys使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sys类属于org.lwjgl包,在下文中一共展示了Sys类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import org.lwjgl.Sys; //导入依赖的package包/类
protected void actionPerformed(GuiButton guibutton)
{
    if(!guibutton.enabled)
    {
        return;
    }
    if(guibutton.id == 5)
    {
        Sys.openURL((new StringBuilder()).append("file://").append(fileLocation).toString());
    } else
    if(guibutton.id == 6)
    {
        mc.displayGuiScreen(guiScreen);
    } else
    {
        guiTexturePackSlot.actionPerformed(guibutton);
    }
}
 
开发者ID:jd-lang,项目名称:betaexpansion,代码行数:19,代码来源:GuiTexturePacks.java

示例2: Cursor

import org.lwjgl.Sys; //导入依赖的package包/类
/**
 * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create
 * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported.
 * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values.
 * The constructor will copy the images and delays, so there's no need to keep them around.
 *
 * @param width cursor image width
 * @param height cursor image height
 * @param xHotspot the x coordinate of the cursor hotspot
 * @param yHotspot the y coordinate of the cursor hotspot
 * @param numImages number of cursor images specified. Must be 1 if animations are not supported.
 * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL.
 * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null
 * @throws LWJGLException if the cursor could not be created for any reason
 */
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
	synchronized (OpenGLPackageAccess.global_lock) {
		if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
			throw new LWJGLException("Native cursors not supported");
		images = NondirectBufferWrapper.wrapBuffer(images, width*height*numImages);
		if (delays != null)
			delays = NondirectBufferWrapper.wrapBuffer(delays, numImages);
		if (!Mouse.isCreated())
			throw new IllegalStateException("Mouse must be created before creating cursor objects");
		if (width*height*numImages > images.remaining())
			throw new IllegalArgumentException("width*height*numImages > images.remaining()");
		if (xHotspot >= width || xHotspot < 0)
			throw new IllegalArgumentException("xHotspot > width || xHotspot < 0");
		if (yHotspot >= height || yHotspot < 0)
			throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");

		Sys.initialize();

		// Hmm
		yHotspot = height - 1 - yHotspot;

		// create cursor (or cursors if multiple images supplied)
		cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:41,代码来源:Cursor.java

示例3: 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

示例4: mainLoop

import org.lwjgl.Sys; //导入依赖的package包/类
/**
 * All calculations are done in here
 */
private static void mainLoop() {
	angle += 1f;
	if ( angle > 360.0f )
		angle = 0.0f;

	if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 )
		System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
	for ( int i = 0; i < Mouse.getButtonCount(); i++ )
		if ( Mouse.isButtonDown(i) )
			System.out.println("Button " + i + " down");
	if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) )
		finished = true;
	for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) {
		Keyboard.next();
		if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() )
			finished = true;
		if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() )
			System.out.println("Current time: " + Sys.getTime());
	}
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:24,代码来源:VBOTest.java

示例5: init

import org.lwjgl.Sys; //导入依赖的package包/类
/**
 * Initialize
 */
private static void init() throws Exception {
	System.out.println("Timer resolution: " + Sys.getTimerResolution());
	// Go into orthographic projection mode.
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	gluOrtho2D(0, Display.getDisplayMode().getWidth(), 0, Display.getDisplayMode().getHeight());
	glMatrixMode(GL_MODELVIEW);
	glLoadIdentity();
	glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());
	if ( !GLContext.getCapabilities().GL_ARB_vertex_buffer_object ) {
		System.out.println("ARB VBO not supported!");
		System.exit(1);
	}
	buffer_id = glGenBuffersARB();
	glBindBufferARB(GL_ARRAY_BUFFER_ARB, buffer_id);
	vertices = ByteBuffer.allocateDirect(2 * 4 * 4).order(ByteOrder.nativeOrder()).asFloatBuffer();
	vertices.put(-50).put(-50).put(50).put(-50).put(50).put(50).put(-50).put(50);
	glBufferDataARB(GL_ARRAY_BUFFER_ARB, 2 * 4 * 4, GL_STREAM_DRAW_ARB);
	glEnableClientState(GL_VERTEX_ARRAY);
	glVertexPointer(2, GL_FLOAT, 0, 0);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:VBOTest.java

示例6: reset

import org.lwjgl.Sys; //导入依赖的package包/类
public void reset() {
    lastFrameDiff = 0;
    lastFPS = 0;
    lastTPF = 0;

    // init to -1 to indicate this is a new timer.
    oldTime = -1;
    //reset time
    startTime = Sys.getTime();

    tpf = new long[TIMER_SMOOTHNESS];
    smoothIndex = TIMER_SMOOTHNESS - 1;
    invTimerRezSmooth = ( 1f / (LWJGL_TIMER_RES * TIMER_SMOOTHNESS));

    // set tpf... -1 values will not be used for calculating the average in update()
    for ( int i = tpf.length; --i >= 0; ) {
        tpf[i] = -1;
    }
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:20,代码来源:LwjglTimer.java

示例7: disconnectGame

import org.lwjgl.Sys; //导入依赖的package包/类
/**
 * Disconnect from game. 
 * Allows for resetting server and client if triggered, but is not used in all situations.
 *
 * @param message the message
 */
public static void disconnectGame(String message){
	/*
	//wouldn't be hard to use something like this to reset to lobby rather than quit the game:
	//at the moment this disconnect is only in a few places between stages, i.e. while waiting
	//so it's not too bad to quit the game.
	Player leaver = null;
	for(Player p : session.getPlayers()) {
		if(p.getID() == message.origin) {
			leaver = p;
		}
	}
	session.removePlayer(leaver);
	System.out.println(leaver.getName()+" LEFT THE GAME");
	 * */
	if(FEServer.getServer() != null) {
		//boot the server back to lobby
		FEServer.resetToLobbyAndKickPlayers();
	}else{
		//exit the client
		if(message!=null && !message.equals("")){
			Sys.alert("FE:MP", message);
		}
		System.exit(0);
	}
}
 
开发者ID:eliatlarge,项目名称:FEMultiPlayer-V2,代码行数:32,代码来源:FEMultiplayer.java

示例8: run

import org.lwjgl.Sys; //导入依赖的package包/类
public void run() {
    System.out.println("Starting a GameWindow with LWJGL "+ Sys.getVersion());

    try {
        /* Prepare the window */
        prepareWindow();

        /* Render the window in a loop */
        renderWindow();

        /* Release the window */
        glfwDestroyWindow(window);

        /* Release input handler */
        inputHandler.release();
    }
    finally {
        /* Terminate GLFW */
        glfwTerminate();
    }

    System.out.println("Terminating a GameWindow");
}
 
开发者ID:PetarC,项目名称:OpenAgar,代码行数:24,代码来源:GameWindow.java

示例9: run

import org.lwjgl.Sys; //导入依赖的package包/类
public void run() {
  System.out.println("Hello LWJGL " + Sys.getVersion() + "!");

  try (DatagramSocket socket = new DatagramSocket()) {
    init();
    loop(socket);

    glfwDestroyWindow(window);
    keyCallback.release();
  } catch (Exception e) {
    e.printStackTrace();
  } finally {
    glfwTerminate();
    errorCallback.release();
  }
}
 
开发者ID:sormuras,项目名称:cars,代码行数:17,代码来源:Remote.java

示例10: run

import org.lwjgl.Sys; //导入依赖的package包/类
public void run() {
    System.out.println("Hello LWJGL " + Sys.getVersion() + "!");
    
    objects = new LinkedList<GObject>();
    objects.add(new GObject(200,200));
    objects.add(new GObject(600,200));
    objects.add(new GObject(200,400));
    objects.add(new GObject(600,400));
 
    try {
        init();
        loop();
 
        // Release window and window callbacks
        glfwDestroyWindow(window);
        keyCallback.release();
    } finally {
        // Terminate GLFW and release the GLFWerrorfun
        glfwTerminate();
        errorCallback.release();
    }
}
 
开发者ID:Klazen108,项目名称:IWannaBeTheJavaEngine,代码行数:23,代码来源:Main.java

示例11: actionPerformed

import org.lwjgl.Sys; //导入依赖的package包/类
@Override
 protected void actionPerformed(GuiButton btn)
 {
 	if(invoker.getId(btn) == 69){
 		this.mc.displayGuiScreen(GuiResilienceMain.screen);
 		hasClickedRes = true;
 	}else if(invoker.getId(btn) == 70){
 		Sys.openURL("http://resilience.krispdev.com/suggest");
 	}else if(invoker.getId(btn) == 199){
btn.displayString = "Change to "+version;
 		if(version.equals("1.7.9")){
 			version = "1.7.6";
 			Resilience.getInstance().getValues().version = 4;
 		}else if(version.equals("1.7.6")){
 			version = "1.7.9";
 			Resilience.getInstance().getValues().version = 5;
 		}
 	}//else if(invoker.getId(btn) == 124124){
 		//this.func_140005_i();
 	//}
 	super.actionPerformed(btn);
 }
 
开发者ID:MinecraftModdedClients,项目名称:Resilience-Client-Source,代码行数:23,代码来源:HookGuiMainMenu.java

示例12: mainLoop

import org.lwjgl.Sys; //导入依赖的package包/类
/** All calculations are done in here */
private static void mainLoop() {
	angle += 1f;
	if ( angle > 360.0f )
		angle = 0.0f;

	if ( Mouse.getDX() != 0 || Mouse.getDY() != 0 || Mouse.getDWheel() != 0 )
		System.out.println("Mouse moved " + Mouse.getDX() + " " + Mouse.getDY() + " " + Mouse.getDWheel());
	for ( int i = 0; i < Mouse.getButtonCount(); i++ )
		if ( Mouse.isButtonDown(i) )
			System.out.println("Button " + i + " down");
	if ( Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) )
		finished = true;
	for ( int i = 0; i < Keyboard.getNumKeyboardEvents(); i++ ) {
		Keyboard.next();
		if ( Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState() )
			finished = true;
		if ( Keyboard.getEventKey() == Keyboard.KEY_T && Keyboard.getEventKeyState() )
			System.out.println("Current time: " + Sys.getTime());
	}
}
 
开发者ID:Superloup10,项目名称:Wolf_game,代码行数:22,代码来源:MappedIndexedVBOTest.java

示例13: Cursor

import org.lwjgl.Sys; //导入依赖的package包/类
/**
 * Constructs a new Cursor, with the given parameters. Mouse must have been created before you can create
 * Cursor objects. Cursor images are in ARGB format, but only one bit transparancy is guaranteed to be supported.
 * So to maximize portability, lwjgl applications should only create cursor images with 0x00 or 0xff as alpha values.
 * The constructor will copy the images and delays, so there's no need to keep them around.
 *
 * @param width cursor image width
 * @param height cursor image height
 * @param xHotspot the x coordinate of the cursor hotspot
 * @param yHotspot the y coordinate of the cursor hotspot
 * @param numImages number of cursor images specified. Must be 1 if animations are not supported.
 * @param images A buffer containing the images. The origin is at the lower left corner, like OpenGL.
 * @param delays An int buffer of animation frame delays, if numImages is greater than 1, else null
 * @throws LWJGLException if the cursor could not be created for any reason
 */
public Cursor(int width, int height, int xHotspot, int yHotspot, int numImages, IntBuffer images, IntBuffer delays) throws LWJGLException {
	synchronized (OpenGLPackageAccess.global_lock) {
		if ((getCapabilities() & CURSOR_ONE_BIT_TRANSPARENCY) == 0)
			throw new LWJGLException("Native cursors not supported");
		BufferChecks.checkBufferSize(images, width*height*numImages);
		if (delays != null)
			BufferChecks.checkBufferSize(delays, numImages);
		if (!Mouse.isCreated())
			throw new IllegalStateException("Mouse must be created before creating cursor objects");
		if (width*height*numImages > images.remaining())
			throw new IllegalArgumentException("width*height*numImages > images.remaining()");
		if (xHotspot >= width || xHotspot < 0)
			throw new IllegalArgumentException("xHotspot > width || xHotspot < 0");
		if (yHotspot >= height || yHotspot < 0)
			throw new IllegalArgumentException("yHotspot > height || yHotspot < 0");

		Sys.initialize();

		// Hmm
		yHotspot = height - 1 - yHotspot;

		// create cursor (or cursors if multiple images supplied)
		cursors = createCursors(width, height, xHotspot, yHotspot, numImages, images, delays);
	}
}
 
开发者ID:CodeConglomerate,项目名称:TeacherSmash,代码行数:41,代码来源:Cursor.java

示例14: checkOpenGlCaps

import org.lwjgl.Sys; //导入依赖的package包/类
private static void checkOpenGlCaps()
{
    log("");
    log(getVersion());
    log("Build: " + getBuild());
    log("OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"));
    log("Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor"));
    log("VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"));
    log("LWJGL: " + Sys.getVersion());
    openGlVersion = GL11.glGetString(GL11.GL_VERSION);
    openGlRenderer = GL11.glGetString(GL11.GL_RENDERER);
    openGlVendor = GL11.glGetString(GL11.GL_VENDOR);
    log("OpenGL: " + openGlRenderer + ", version " + openGlVersion + ", " + openGlVendor);
    log("OpenGL Version: " + getOpenGlVersionString());

    if (!GLContext.getCapabilities().OpenGL12)
    {
        log("OpenGL Mipmap levels: Not available (GL12.GL_TEXTURE_MAX_LEVEL)");
    }

    fancyFogAvailable = GLContext.getCapabilities().GL_NV_fog_distance;

    if (!fancyFogAvailable)
    {
        log("OpenGL Fancy fog: Not available (GL_NV_fog_distance)");
    }

    occlusionAvailable = GLContext.getCapabilities().GL_ARB_occlusion_query;

    if (!occlusionAvailable)
    {
        log("OpenGL Occlussion culling: Not available (GL_ARB_occlusion_query)");
    }

    int i = Minecraft.getGLMaximumTextureSize();
    dbg("Maximum texture size: " + i + "x" + i);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:Config.java

示例15: checkOpenGlCaps

import org.lwjgl.Sys; //导入依赖的package包/类
private static void checkOpenGlCaps()
{
    log("");
    log(getVersion());
    log("" + new Date());
    log("OS: " + System.getProperty("os.name") + " (" + System.getProperty("os.arch") + ") version " + System.getProperty("os.version"));
    log("Java: " + System.getProperty("java.version") + ", " + System.getProperty("java.vendor"));
    log("VM: " + System.getProperty("java.vm.name") + " (" + System.getProperty("java.vm.info") + "), " + System.getProperty("java.vm.vendor"));
    log("LWJGL: " + Sys.getVersion());
    openGlVersion = GL11.glGetString(GL11.GL_VERSION);
    openGlRenderer = GL11.glGetString(GL11.GL_RENDERER);
    openGlVendor = GL11.glGetString(GL11.GL_VENDOR);
    log("OpenGL: " + openGlRenderer + ", version " + openGlVersion + ", " + openGlVendor);
    log("OpenGL Version: " + getOpenGlVersionString());

    if (!GLContext.getCapabilities().OpenGL12)
    {
        log("OpenGL Mipmap levels: Not available (GL12.GL_TEXTURE_MAX_LEVEL)");
    }

    fancyFogAvailable = GLContext.getCapabilities().GL_NV_fog_distance;

    if (!fancyFogAvailable)
    {
        log("OpenGL Fancy fog: Not available (GL_NV_fog_distance)");
    }

    occlusionAvailable = GLContext.getCapabilities().GL_ARB_occlusion_query;

    if (!occlusionAvailable)
    {
        log("OpenGL Occlussion culling: Not available (GL_ARB_occlusion_query)");
    }

    int i = Minecraft.getGLMaximumTextureSize();
    dbg("Maximum texture size: " + i + "x" + i);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:38,代码来源:Config.java


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