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


Java Display.destroy方法代码示例

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


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

示例1: startLWJGL

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Start a thread to run LWJGL in
 */
public void startLWJGL() {
   if (gameThread != null) {
      return;
   }
   
   gameThread = new Thread() {
      public void run() {
         try {
            canvas.start();
         }
         catch (Exception e) {
            e.printStackTrace();
            if (Display.isCreated()) {
               Display.destroy();
            }
            displayParent.setVisible(false);//removeAll();
            add(new ConsolePanel(e));
            validate();
         }
      }
   };
   
   gameThread.start();
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:28,代码来源:AppletGameContainer.java

示例2: checkInput

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private void checkInput() {
	switch(state) {
	case INTRO:
		if (Keyboard.isKeyDown(Keyboard.KEY_S))
			state = State.MAIN_MENU;
		if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
			Display.destroy();
			System.exit(0);
		}
		break;
	case GAME:
		if (Keyboard.isKeyDown(Keyboard.KEY_BACK)) {
			state = State.MAIN_MENU;
		}
		break;
	case MAIN_MENU:
		if (Keyboard.isKeyDown(Keyboard.KEY_RETURN)) {
			state = State.GAME;
		}
		if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) {
			state = State.INTRO;
		}
		break;
	
	}
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:27,代码来源:StateDemo.java

示例3: createDisplay

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Create the LWJGL display
 * 
 * @throws Exception Failure to create display
 */
private void createDisplay() throws Exception {
   try {
      // create display with alpha
      Display.create(new PixelFormat(8,8,GameContainer.stencil ? 8 : 0));
      alphaSupport = true;
   } catch (Exception e) {
      // if we couldn't get alpha, let us know
      alphaSupport = false;
       Display.destroy();
       // create display without alpha
      Display.create();
   }
}
 
开发者ID:j-dong,项目名称:trashjam2017,代码行数:19,代码来源:AppletGameContainer.java

示例4: StateDemo

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private StateDemo() {
    
	try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("Game States");
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
    
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 640, 480, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);

    while (!Display.isCloseRequested()) {
        // Render Code here
        glClear(GL_COLOR_BUFFER_BIT);
        
        render();
        checkInput();
        
        Display.update();
        Display.sync(60);
    }
    
    Display.destroy();
    System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:30,代码来源:StateDemo.java

示例5: shutdownMinecraftApplet

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the
 * application (or web page) is exited.
 */
public void shutdownMinecraftApplet()
{
    try
    {
        LOGGER.info("Stopping!");

        try
        {
            this.loadWorld((WorldClient)null);
        }
        catch (Throwable var5)
        {
            ;
        }

        this.mcSoundHandler.unloadSounds();
    }
    finally
    {
        Display.destroy();

        if (!this.hasCrashed)
        {
            System.exit(0);
        }
    }

    System.gc();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:34,代码来源:Minecraft.java

示例6: runloop

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * The running game loop
 * 
 * @throws Exception Indicates a failure within the game's loop rather than the framework
 */
public void runloop() throws Exception {
   while (running) {
      int delta = getDelta();

      updateAndRender(delta);

      updateFPS();
      Display.update();
   }

   Display.destroy();
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:18,代码来源:AppletGameContainer.java

示例7: TimersAndBasicAnimation

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private TimersAndBasicAnimation() {
    
	try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("Timer");
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }
    
	int x = 100;
	int y = 100;
	int dx = 3;
	int dy = 3;
	
    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(0, 640, 480, 0, 1, -1);
    glMatrixMode(GL_MODELVIEW);
    
    lastFrame = getTime();

    while (!Display.isCloseRequested()) {
        // Render Code here
        glClear(GL_COLOR_BUFFER_BIT);
        
        int delta = getDelta();
        
        x += delta * dx * 0.1;
        y += delta * dy * 0.1;
        
        glRecti(x, y, x + 30, y + 30);
        
        Display.update();
        Display.sync(60);
    }
    Display.destroy();
    System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:40,代码来源:TimersAndBasicAnimation.java

示例8: gameOver

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * This method ends the game
 */
private void gameOver() {
    if(pacman.getLives() == 0){
        delay(true, 3000);
        Display.destroy();
    }
}
 
开发者ID:IngSW-unipv,项目名称:Progetto-C,代码行数:10,代码来源:MazeModality.java

示例9: shutdownMinecraftApplet

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
/**
 * Shuts down the minecraft applet by stopping the resource downloads, and clearing up GL stuff; called when the
 * application (or web page) is exited.
 */
public void shutdownMinecraftApplet()
{
    try
    {
        this.stream.shutdownStream();
        logger.info("Stopping!");

        try
        {
            this.loadWorld((WorldClient)null);
        }
        catch (Throwable var5)
        {
            ;
        }

        this.mcSoundHandler.unloadSounds();
    }
    finally
    {
        Display.destroy();

        if (!this.hasCrashed)
        {
            System.exit(0);
        }
    }

    System.gc();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:35,代码来源:Minecraft.java

示例10: main

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
		Display.setTitle("Input");
		Display.create();
	} catch (LWJGLException e) {
		e.printStackTrace();
		Display.destroy();
		// exit code 1 : failure
		System.exit(1);
	}
	
	shapes.add(new Box(15, 15));
	shapes.add(new Box(150, 150));
	shapes.add(new Box(5, 15));
	shapes.add(new Box(10, 150));
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
	glMatrixMode(GL_MODELVIEW);
	
	while (!Display.isCloseRequested()) {
		// Render Data
		glClear(GL_COLOR_BUFFER_BIT);
		
		if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
			Display.destroy();
			System.exit(0);
		}
		
		
		for (final Box box : shapes) {
			if (Mouse.isButtonDown(0) && box.inBounds(Mouse.getX(), 480 - Mouse.getY()) && !somethingIsSelected) {
				somethingIsSelected = true;
				box.selected = true;
			}
			
			if (Mouse.isButtonDown(2) && box.inBounds(Mouse.getX(), 480 - Mouse.getY()) && !somethingIsSelected) {
				if ((System.currentTimeMillis() - lastColourChange) >= 200) {
					box.randomizeColors();
					lastColourChange = System.currentTimeMillis();
				}
			}
			
			if (Mouse.isButtonDown(1)) {
				box.selected = false;
				somethingIsSelected = false;
			}
			
			if (box.selected) {
				box.update(Mouse.getDX(), -Mouse.getDY());
			}
			
			box.draw();
		}
		
		Display.update();
		Display.sync(60);
	}
	
	Display.destroy();
	System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:65,代码来源:LWJGLInput.java

示例11: closeDisplay

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public void closeDisplay(){
	Display.destroy();
}
 
开发者ID:TheThinMatrix,项目名称:OcclusionQueries,代码行数:4,代码来源:DisplayManager.java

示例12: checkDisplaySettings

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static void checkDisplaySettings()
{
    int i = getAntialiasingLevel();

    if (i > 0)
    {
        DisplayMode displaymode = Display.getDisplayMode();
        dbg("FSAA Samples: " + i);

        try
        {
            Display.destroy();
            Display.setDisplayMode(displaymode);
            Display.create((new PixelFormat()).withDepthBits(24).withSamples(i));
            Display.setResizable(false);
            Display.setResizable(true);
        }
        catch (LWJGLException lwjglexception2)
        {
            warn("Error setting FSAA: " + i + "x");
            lwjglexception2.printStackTrace();

            try
            {
                Display.setDisplayMode(displaymode);
                Display.create((new PixelFormat()).withDepthBits(24));
                Display.setResizable(false);
                Display.setResizable(true);
            }
            catch (LWJGLException lwjglexception1)
            {
                lwjglexception1.printStackTrace();

                try
                {
                    Display.setDisplayMode(displaymode);
                    Display.create();
                    Display.setResizable(false);
                    Display.setResizable(true);
                }
                catch (LWJGLException lwjglexception)
                {
                    lwjglexception.printStackTrace();
                }
            }
        }

        if (!Minecraft.IS_RUNNING_ON_MAC && getDefaultResourcePack() != null)
        {
            InputStream inputstream = null;
            InputStream inputstream1 = null;

            try
            {
                inputstream = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_16x16.png"));
                inputstream1 = getDefaultResourcePack().getInputStreamAssets(new ResourceLocation("icons/icon_32x32.png"));

                if (inputstream != null && inputstream1 != null)
                {
                    Display.setIcon(new ByteBuffer[] {readIconImage(inputstream), readIconImage(inputstream1)});
                }
            }
            catch (IOException ioexception)
            {
                warn("Error setting window icon: " + ioexception.getClass().getName() + ": " + ioexception.getMessage());
            }
            finally
            {
                IOUtils.closeQuietly(inputstream);
                IOUtils.closeQuietly(inputstream1);
            }
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:75,代码来源:Config.java

示例13: destroy

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public void destroy() {
	Display.destroy();
}
 
开发者ID:TheThinMatrix,项目名称:LowPolyWater,代码行数:4,代码来源:Window.java

示例14: main

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
public static void main(String[] args) {
	try {
		Display.setDisplayMode(new DisplayMode(640, 480));
		Display.setTitle("I don't get it");
		Display.create();
	} catch (LWJGLException e) {
		e.printStackTrace();
		Display.destroy();
		// exit code 1 : failure
		System.exit(1);
	}
	
	glMatrixMode(GL_PROJECTION);
	glLoadIdentity();
	glOrtho(0, 640, 480, 0, 1, -1);
	glMatrixMode(GL_MODELVIEW);
	
	while (!Display.isCloseRequested()) {
		// Clears a 2D Canvas.
		glClear(GL_COLOR_BUFFER_BIT);
		/* ">>" denotes a possibly modified piece of OpenGL documentation (http://www.opengl.org/sdk/docs/man/)
           >> glBegin and glEnd delimit the vertices that define a primitive or a group of like primitives.
           >> glBegin accepts a single argument that specifies how the vertices are interpreted.
           All upcoming vertex calls will be taken as points of a quadrilateral until glEnd is called. Since
           this primitive requires four vertices, we will have to call glVertex four times. */
		
		// glBegin() takes an integer as a parameter.
		// all of the set commands are constants
		// GL_POINTS, GL_LINES, GL_TRIANGLES, GL_QUADS, GL_TRIANGLE_STRIP, GL_TRIANGLE_FAN, and GL_POLYGONS
		// Don't use GL_QUADS or GL_POLYGONS, as they have been deprecated.
		glBegin(GL_QUADS);
		// >> glVertex commands are used within glBegin/glEnd pairs to specify point, line, and polygon vertices.
           // >> glColor sets the current color. (All subsequent calls to glVertex will be assigned this color)
           // >> The number after 'glVertex'/'glColor' indicates the amount of components. (xyzw/rgba)
           // >> The character after the number indicates the type of arguments.
           // >>      (for 'glVertex' = d: Double, f: Float, i: Integer)
           // >>      (for 'glColor'  = d: Double, f: Float, b: Signed Byte, ub: Unsigned Byte)

		// glVertex() takes its parameters as its location.
		// glColor() takes its parameters and makes it a color.
		
		glColor3f(1.0f, 0.0f, 0.0f);                    // Pure Green
           glVertex2i(0, 0);                               // Upper-left
           
           glColor3b((byte)0, (byte)127, (byte)0);         // Pure Red
           glVertex2d(640, 0);                             // Upper-right
           
           glColor3ub((byte)255, (byte)0, (byte)255);      // Purple
           glVertex2f(640.0f, 480.0f);                     // Bottom-right
           
           glColor3d(0, 0, 1);                             // Pure Blue
           glVertex2i(0, 480);                             // Bottom-left
           
		glEnd();
		
		// refresh display and poll input
		Display.update();
		// Maintain a 60fps frame rate
		Display.sync(60);
	}
	Display.destroy();
	// exit code 0 : success!
	System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:65,代码来源:Ep3OpenGLRenderer.java

示例15: VertexBufferObject

import org.lwjgl.opengl.Display; //导入方法依赖的package包/类
private VertexBufferObject() {
    try {
        Display.setDisplayMode(new DisplayMode(640, 480));
        Display.setTitle("VBO Rendering");
        Display.create();
    } catch (LWJGLException e) {
        e.printStackTrace();
    }

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    glOrtho(1, 1, 1, 1, 1, -1);
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();

    final int amountOfVertices = 3;
    final int vertexSize = 2;
    final int colorSize = 3;

    FloatBuffer vertexData = BufferUtils.createFloatBuffer(amountOfVertices * vertexSize);
    vertexData.put(new float[]{-0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 0.5f});
    vertexData.flip();

    FloatBuffer colorData = BufferUtils.createFloatBuffer(amountOfVertices * colorSize);
    colorData.put(new float[]{-0.5f, -0.5f, 0.5f, -0.5f, 0.5f, 0.5f, 0.5f});
    colorData.flip();

    int vboVertexHandle = glGenBuffers();
    glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
    glBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    int vboColorHandle = glGenBuffers();
    glBindBuffer(GL_ARRAY_BUFFER, vboColorHandle);
    glBufferData(GL_ARRAY_BUFFER, colorData, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    while (!Display.isCloseRequested()) {
        glClear(GL_COLOR_BUFFER_BIT);

        glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
        glVertexPointer(vertexSize, GL_FLOAT, 0, 0L);

        glBindBuffer(GL_ARRAY_BUFFER, vboColorHandle);
        glVertexPointer(colorSize, GL_FLOAT, 0, 0L);

        glEnableClientState(GL_VERTEX_ARRAY);
        glEnableClientState(GL_COLOR_ARRAY);
        glDrawArrays(GL_TRIANGLES, 0, 1);
        glDisableClientState(GL_VERTEX_ARRAY);
        glDisableClientState(GL_COLOR_ARRAY);

        Display.update();
        Display.sync(60);

    }
    glDeleteBuffers(vboVertexHandle);
    glDeleteBuffers(vboColorHandle);

    Display.destroy();
    System.exit(0);
}
 
开发者ID:nitrodragon,项目名称:lwjgl_collection,代码行数:63,代码来源:VertexBufferObject.java


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