/* (non-Javadoc) * @see chu.engine.Game#loop() */ @Override public void loop() { while (!Display.isCloseRequested()) { final long time = System.nanoTime(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); glClearDepth(1.0f); getInput(); final ArrayList<Message> messages = new ArrayList<>(); if (client != null) { synchronized (client.messagesLock) { messages.addAll(client.messages); for (Message m : messages) client.messages.remove(m); } } SoundStore.get().poll(0); glPushMatrix(); // Global resolution scale // Renderer.scale(scaleX, scaleY); currentStage.beginStep(messages); currentStage.onStep(); currentStage.processAddStack(); currentStage.processRemoveStack(); currentStage.render(); // FEResources.getBitmapFont("stat_numbers").render( // (int)(1.0f/getDeltaSeconds())+"", 440f, 0f, 0f); currentStage.endStep(); glPopMatrix(); Display.update(); timeDelta = System.nanoTime() - time; } AL.destroy(); Display.destroy(); if (client != null && client.isOpen()) client.quit(); }
public void start() { try { Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } initGL(); // init OpenGL try { font = new Font("assets/text.png", "assets/text.txt", 6, 13); font.buildFont(2); // build the textures for text s = new Sprite("assets/pokemon_sprites/front/643.png"); } catch (IOException e) { e.printStackTrace(); System.exit(0); } getDelta(); // call once before loop to initialise lastFrame lastFPS = getTime(); // call before loop to initialise fps timer while (!Display.isCloseRequested() && !finished) { int delta = getDelta(); update(delta); renderGL(); Display.update(); Display.sync(60); // cap fps to 60fps } Display.destroy(); }
/** * Start the application. The window is opened and the main loop is entered. This call does not * return until the window is closed or an exception was caught. */ public void start() { try { Display.setDisplayMode(new DisplayMode(width, height)); Display.setTitle(title); if (multisampling) Display.create(new PixelFormat().withSamples(8)); else Display.create(); // Sync buffer swap with vertical sync. Results in 60 fps on my Mac // Book. Display.setSwapInterval(1); Display.setVSyncEnabled(true); input = new Input(); application.init(); while (!Display.isCloseRequested()) { input.update(); input.setWindowSize(width, height); application.simulate(time.elapsed(), input); application.display(width, height, input); Display.update(); } } catch (LWJGLException e) { e.printStackTrace(); } finally { Display.destroy(); } }
private void mainLoop() { long startTime = 0L; long endTime = 0L; long deltaTime = 0L; while (!Display.isCloseRequested()) { startTime = System.currentTimeMillis(); // Run the physics simulation if (useOpenCL) { clPhysics.doPhysics(particleCount, deltaTime); // Render Renderer.render(clPhysics.getCurrentPosBuffer(), particleCount); } else { normalPhysics.doPhysics(particles, boxWidth, boxHeight, deltaTime); // Render Renderer.render(particles); } // Update the display Display.update(); endTime = System.currentTimeMillis(); deltaTime = endTime - startTime; System.out.println(deltaTime); } }
/** Run the main game loop. */ public void run() { while (gameRunning) { // reset drawCount mapCount = 0; drawCount = 0; // clear screen gameWindow.clearScreen(); // get delta timer.update(); long delta = timer.getDelta(); // update state stateManager.input(delta); stateManager.update(delta); stateManager.draw(); // draw DebugHUD debugHUD.draw(); // if escape has been pressed, stop the game if ((Display.isCloseRequested() || Keyboard.isKeyDown(Keyboard.KEY_ESCAPE) && Keyboard.isKeyDown(Keyboard.KEY_LSHIFT))) { gameRunning = false; } // update window contents gameWindow.update(); } }
/** Runs the game (the "main loop") */ private static void run() { while (!finished) { // Always call Window.update(), all the time Display.update(); if (Display.isCloseRequested()) { // Check for O/S close requests finished = true; } else if (Display.isActive()) { // The window is in the foreground, so we should play the game logic(); render(); Display.sync(FRAMERATE); } else { // The window is not in the foreground, so we can allow other stuff to run and // infrequently update try { Thread.sleep(100); } catch (InterruptedException e) { } logic(); if (Display.isVisible() || Display.isDirty()) { // Only bother rendering if the window is visible or dirty render(); } } } }
@Override public void run() { long lastTime = System.nanoTime(); start(); long now = System.nanoTime(); long timer = System.currentTimeMillis(); double delta = 0; int frames = 0; int updates = 0; System.out.println("Initialized in " + ((now - lastTime) / 1000000000.0) + " seconds"); while (!Display.isCloseRequested()) { now = System.nanoTime(); delta += (now - lastTime) / NANOSECS; lastTime = now; while (delta >= 1) { update(updates); updates++; delta--; } render(); frames++; if (System.currentTimeMillis() - timer > 1000) { timer += 1000; Display.setTitle("SplitMan | FPS: " + frames + " | UPS: " + updates); frames = 0; updates = 0; } Display.update(); Display.sync(120); } stop(); }
/** * The menu sequence that allows the user to select options. * * <p> * * <ul> * <li>QuickStart (random character created for the player) * <li>Create new character * <li>Load a character * <li> * <li>Settings, including keybindings * <li>Quit * </ul> */ private void menuSelectionSequence() { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); Input.poll(); mouseEvents = Input.getMouseEvents(); for (GLUIComponent b : menuSelectionButtons) { b.processMouseEvents(mouseEvents); b.update(0); b.renderGL(); } try { menuTheme .getFont() .glDrawText( "\\c#FFFFFFUniQuest", (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("UniQuest")) / 2 + 2, 50); } catch (InvalidEscapeSequenceException e) { e.printStackTrace(); } Display.update(); if (Display.isCloseRequested()) { Game.GAME_STATE = Game.GAME_STATE_QUIT; menu = false; } }
public void start() { // ウィンドウの生成 try { Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); // Display.setTitle("SimField"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } initGL(); // メインループ while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); /** * for(Life l : lifeSet.getArray()){ l.renderLife(); } for(Life lr: lifeRedSet.getArray()){ * lr.renderLife(); } for(Life lb: lifeBlueSet.getArray()){ lb.renderLife(); } */ for (Life l : life) { l.renderLife(); } for (Life lr : lifeRed) { lr.renderLife(); } for (Life lb : lifeBlue) { lb.renderLife(); } status.updateFPS(); Display.update(); // オンスクリーンに反映 Display.sync(60); // FPSを60に固定 } }
public void start() { // set up the console handler console.setHandler(new ConsoleHandler()); // load the map map = MapLoader.loadMap("map_basic.txt"); // grab some entities StaticEntity chip = new StaticEntity(); chip.setPosition(new Coord(9, 5)); chip.addTexture(GameContext.getTextureLoader().getTexture("gtest/resources/chipA.png")); chip.addTexture(GameContext.getTextureLoader().getTexture("gtest/resources/chipB.png")); entities.add(chip); // create the player player = new Player(new Coord(0, 12)); player.setMapContext(map); entities.add(player); // set up camera GameContext.getCamera().setFollowing(player); // set up openGL GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glDisable(GL11.GL_DEPTH_TEST); GL11.glDisable(GL11.GL_LIGHTING); GL11.glEnable(GL11.GL_BLEND); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); // game loop while (!Display.isCloseRequested()) { Date d = new Date(); long startTime = d.getTime(); draw(); update(); handleInput(); d = new Date(); long endTime = d.getTime(); try { Thread.sleep(50 - (endTime - startTime)); } catch (Exception e) { } if ((endTime - startTime) != 0) { GameContext.addToLog("fps", "" + 1000 / (endTime - startTime)); } } Display.destroy(); }
public void run() { if (listener == null) throw new IllegalStateException( "SystemListener is not set on context!" + "Must set with JmeContext.setSystemListner()."); logger.log(Level.INFO, "Using LWJGL {0}", Sys.getVersion()); if (!initInThread()) { logger.log(Level.SEVERE, "Display initialization failed. Cannot continue."); return; } while (true) { if (renderable.get()) { if (Display.isCloseRequested()) listener.requestClose(false); if (wasActive != Display.isActive()) { if (!wasActive) { listener.gainFocus(); timer.reset(); wasActive = true; } else { listener.loseFocus(); wasActive = false; } } } runLoop(); if (needClose.get()) break; } deinitInThread(); }
private void run() { int frames = 0; double nsPerFrame = 1000000000.0 / 60.0; double unProcessed = 0; long lastFrameTime = System.nanoTime(); long currentFrameTime = System.currentTimeMillis(); while (running) { long now = System.nanoTime(); unProcessed += (now - lastFrameTime) / nsPerFrame; lastFrameTime = now; if (Display.isCloseRequested()) running = false; while (unProcessed > 1) { unProcessed -= 1; tick(); display.render(); } frames++; if (System.currentTimeMillis() - currentFrameTime > 1000) { currentFrameTime += 1000; // Print.line(frames + " fps"); Display.setTitle(frames + " fps"); frames = 0; } Display.sync(60); Display.update(); } Display.destroy(); }
public static void main(String[] args) throws InterruptedException { try { Display.setTitle("Simple Square"); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); } // draw the square glBegin(GL_LINE_LOOP); glVertex3f(-0.5f, -0.5f, 0f); glVertex3f(-0.5f, 0.5f, 0f); glVertex3f(0.5f, 0.5f, 0f); glVertex3f(0.5f, -0.5f, 0f); glEnd(); // flush any commands that are still hanging about. glFlush(); // update window. Display.update(); while (!Display.isCloseRequested()) { Thread.sleep(100); } Display.destroy(); }
public void start() { try { Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } initGL(); // init OpenGL getDelta(); // call once before loop to initialise lastFrame lastFPS = getTime(); // call before loop to initialise fps timer while (!Display.isCloseRequested()) { int delta = getDelta(); update(delta); renderGL(); Display.update(); Display.sync(60); // cap fps to 60fps } Display.destroy(); }
/** Enters the Main-Loop */ private void beginLoop() { this.isRunning = true; this.timing.init(); while (this.isRunning) { int delta = this.timing.getDelta(); this.handleDisplayResize(); if (Display.isCloseRequested()) this.isRunning = false; // Mouse updates this.profiler.start("Mouse updates"); this.mouseX = Mouse.getX(); this.mouseY = this.height - Mouse.getY(); if (!this.isGamePaused) { this.input.mousePos(this.mouseX, this.mouseY); if (Mouse.isButtonDown(0) && !this.lastButtonState) this.input.mouseClick(this.mouseX, this.mouseY); this.lastButtonState = Mouse.isButtonDown(0); } // Scrolling if (!this.isGamePaused) { int scroll = Mouse.getDWheel(); if (scroll > 0) this.camera.zoom(-1); else if (scroll < 0) this.camera.zoom(1); } // Keyboard updates this.profiler.endStart("Keyboard updates"); this.keyboardListener.update(); // Audio this.profiler.endStart("Audio updates"); this.soundEngine.update(delta); // Rendering this.profiler.endStart("Render game"); this.camera.update(delta); this.renderer.render(this.camera, this.logic.getGameState(), delta); this.profiler.endStart("Render GUI"); this.guiRenderer.render(this.width, this.height, this.mouseX, this.mouseY); this.profiler.end(); Display.update(); Display.sync(60); int error = glGetError(); if (error != GL_NO_ERROR) System.out.println("GLError " + error + ": " + GLU.gluErrorString(error)); this.timing.updateFPS(); } this.soundEngine.dispose(); Settings.saveSettings(this.settings); if (Display.isCreated()) Display.destroy(); }
private void loop() { while (!Display.isCloseRequested()) { run(); updateFPS(); Display.update(); Display.sync(60); } }
public void run() { while (!Display.isCloseRequested()) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); gui.update(); Display.update(); TestUtils.reduceInputLag(); } }
private static void enterGameLoop() { while (!Display.isCloseRequested()) { render(); logic(); input(); update(); } }
public Game(boolean host) { try { if (host) { System.out.println("Hosting..."); server = new ServerSocket(port, 4, InetAddress.getByName(serverIP)); System.out.println("Ready!\nAwaiting client..."); client = server.accept(); System.out.println("Client connected!\nBuffering..."); out = new ObjectOutputStream(client.getOutputStream()); in = new ObjectInputStream(client.getInputStream()); System.out.println("Buffered!\nPinging for 256 bytes..."); long start = System.currentTimeMillis(); byte[] ping = new byte[256]; in.read(ping); System.out.println("Latency: " + (System.currentTimeMillis() - start)); out.writeLong(start); out.flush(); System.out.println("Starting threads..."); new ThreadSend(world, out); new ThreadReceive(world, in); System.out.println("Started!\nCreating game world..."); } else { System.out.println("Connecting..."); socket = new Socket(connectIP, port); System.out.println("Connected!\nBuffering..."); in = new ObjectInputStream(socket.getInputStream()); out = new ObjectOutputStream(socket.getOutputStream()); byte[] ping = new byte[256]; new Random().nextBytes(ping); System.out.println("Buffered\nPinging for 256 bytes..."); out.write(ping); out.flush(); long latency = in.readLong(); System.out.println("Latency: " + (System.currentTimeMillis() - latency)); System.out.println("Starting threads..."); new ThreadReceive(world, in); new ThreadSend(world, out); System.out.println("Started!\nCreating game world..."); } } catch (Exception e) { e.printStackTrace(); } try { Display.setDisplayMode(new DisplayMode(width, height)); Display.create(); } catch (Exception e) { e.printStackTrace(); } world.init(); while (!Display.isCloseRequested()) { if (ended) break; world.update(); } Display.destroy(); }
/** * Connect to the server and execute the initial data exchange. Returns when the connection is * successfully established * * @return false if the connection failed and the game should quit (or go back to the menu) */ public boolean loop() { networkedGame = new NetworkedGame(loop, httpUrl, nickname); loadingCamera = new Camera(resourceDB); loadingStarfield = new StarField(SwissArmyKnife.random.nextInt(), resourceDB); loadingCamera.setScreenPosition(0, 0); loadingCamera.setPosition(0, loadingCameraY); connection = new SingleGameConnection(wsUri, loop); connection.addListener(networkedGame); connection.connect(); loop.addTickEvent(this); try { while (!loop.isInterruped() && networkedGame.isConnecting()) { Display.update(); if (Display.isCloseRequested()) { log.log(Level.WARNING, "Close requested in connect loop"); return false; } loadingCamera.setDimension(Display.getWidth(), Display.getHeight()); Graph.graphicsLoop(); Client.initGL(); loop.loop(); loadingStarfield.render(loadingCamera); String line = "Connecting..."; int line_width = Graph.g.getFont().getWidth(line); Graph.g.setColor(Color.white); Graph.g.drawString( line, loadingCamera.dimensionHalf.x - line_width / 2, loadingCamera.dimension.y * 0.75f); loadingCamera.setPosition(0, loadingCameraY); Display.sync(60); } if (loop.isInterruped()) { log.log(Level.WARNING, "Connect loop interrupted"); return false; } return !networkedGame.isConnecting() && !networkedGame.isDisconnected(); } finally { loop.removeTickEvent(this); } }
private void keyConfigSequence() { while (loop) { GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT); try { menuTheme .getFont() .glDrawText( "\\c#FFFFFFKey Bindings", (Main.SCREEN_WIDTH - menuTheme.getFont().getStringWidth("Key Bindings")) / 2 + 2, 50); } catch (InvalidEscapeSequenceException e) { e.printStackTrace(); } Input.poll(); mouseEvents = Input.getMouseEvents(); keyEvents = Input.getKeyEvents(); try { drawKeyConfigText(margin, 75, 30); } catch (InvalidEscapeSequenceException e) { } for (GLUIComponent t : keyConfigTextField) { t.processKeyEvents(keyEvents); t.processMouseEvents(mouseEvents); t.update(0); t.renderGL(); } Display.update(); if (Display.isCloseRequested()) { Game.GAME_STATE = Game.GAME_STATE_QUIT; menu = false; loop = false; } else if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { loop = false; } } for (GLUIComponent t : keyConfigTextField) { if (t instanceof GLTextField) { ((GLTextField) t).setText(((GLTextField) t).getText().toUpperCase()); KeyBindings.valueOf(t.getContext().toString()) .setUserKey(Keyboard.getKeyIndex(((GLTextField) t).getText())); } } }
private void loop() { long lastFrameTime = 0; while (!Display.isCloseRequested()) { long now = System.nanoTime(); long renderFps = 30; long nanoPerFrame = 1000000000 / renderFps; // update the animation if (now - lastFrameTime >= nanoPerFrame) { lastFrameTime = now; angle += 2.0f; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glPushMatrix(); glRotatef(view_rotx, 1.0f, 0.0f, 0.0f); glRotatef(view_roty, 0.0f, 1.0f, 0.0f); glRotatef(view_rotz, 0.0f, 0.0f, 1.0f); glPushMatrix(); glTranslatef(-3.0f, -2.0f, 0.0f); glRotatef(angle, 0.0f, 0.0f, 1.0f); glCallList(gear1); glPopMatrix(); glPushMatrix(); glTranslatef(3.1f, -2.0f, 0.0f); glRotatef(-2.0f * angle - 9.0f, 0.0f, 0.0f, 1.0f); glCallList(gear2); glPopMatrix(); glPushMatrix(); glTranslatef(-3.1f, 4.2f, 0.0f); glRotatef(-2.0f * angle - 25.0f, 0.0f, 0.0f, 1.0f); glCallList(gear3); glPopMatrix(); glPopMatrix(); Display.update(); } handleInput(); if (broadcastController != null) { submitFrame(); broadcastController.update(); } if (chatController != null) { chatController.update(); } } }
/** * ************************************************************************************************************************************************************************************************* * Checks if key is pressed or mouse is moved etc. * ************************************************************************************************************************************************************************************************ */ private void checkInput() { if (Keyboard.next() && Keyboard.getEventKeyState()) { if (Keyboard.getEventKey() == Keyboard.KEY_ESCAPE) closeRequested = true; } if (Display.isCloseRequested()) { closeRequested = true; } }
public void execute() { long lastTime = System.nanoTime(); while (!Display.isCloseRequested()) { long deltaTime = System.nanoTime() - lastTime; lastTime += deltaTime; display(deltaTime); } Display.destroy(); }
public void start() { try { Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT)); Display.create(); Display.setFullscreen(true); } catch (LWJGLException e) { e.printStackTrace(); System.exit(0); } GL11.glEnable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_BLEND); GL11.glEnable(GL11.GL_ALPHA); GL11.glEnable(GL11.GL_ALPHA_TEST); GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); GL11.glClearAccum(0f, 0f, 0f, 1f); GL11.glClear(GL11.GL_ACCUM_BUFFER_BIT); while (!Display.isCloseRequested() && !finished) { if (System.currentTimeMillis() - time > 1000) { System.out.println(framecount + " FPS"); time = System.currentTimeMillis(); framecount = 0; } GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); GL11.glColor3f(1, 1, 1); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10); Manager.DrawBackground(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10); GL11.glTranslatef(-Camera.x, -Camera.y, 0); Display.sync(60); Manager.Draw(); Manager.Update(); GL11.glMatrixMode(GL11.GL_MODELVIEW); GL11.glLoadIdentity(); GL11.glOrtho(0, WIDTH, HEIGHT, 0, -10, 10); Manager.DrawForeground(); Display.update(); framecount++; } }
public static void loop() { while (CSGame.state == States.ThreeDeeTest) { // Clear the screen of its filthy contents glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Push the screen inwards at the amount of speed glTranslatef(0, 0, speed); // Begin drawing points glBegin(GL_POINTS); // Iterate of every point for (Point p : points) { // Draw the point at its coordinates glColor3f(0.0f, 1f, 0f); glVertex3f(p.x, p.y, p.z); } // Stop drawing points glEnd(); // If we're pressing the "up" key increase our speed if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { speed += 0.01f; } // If we're pressing the "down" key decrease our speed if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { speed -= 0.01f; } // Iterate over keyboard input events while (Keyboard.next()) { // If we're pressing the "space-bar" key reset our speed to zero if (Keyboard.isKeyDown(Keyboard.KEY_SPACE)) { speed = 0f; } // If we're pressing the "c" key reset our speed to zero and reset our position if (Keyboard.isKeyDown(Keyboard.KEY_C)) { speed = 0; glLoadIdentity(); } } if (Display.isCloseRequested()) { CSGame.state = States.Closing; break; } Debug.debugLoop(); // Update the display Display.update(); // Wait until the frame-rate is 60fps Display.sync(60); } }
public void runtime() throws IOException { Logic logic = new Logic(); while (!finished) { Display.update(); if (Display.isCloseRequested()) finished = true; else if (Display.isActive()) logic.logic(blocks, player); if (Display.isVisible() || Display.isDirty()) globaldraw(); } }
/** Runs the game (the "main loop") */ private static void run() { while (!finished) { Display.update(); if (Display.isCloseRequested()) { finished = true; } else { logic(); render(); Display.sync(FRAMERATE); } } }
private void doRenderLoop() { try { while (!isDisplayable()) { Thread.sleep(50); } Display.setParent(this); Display.setVSyncEnabled(true); Display.create(); mMouseState = new boolean[Mouse.getButtonCount()]; for (int i = 0; i < mMouseState.length; i++) { mMouseState[i] = Mouse.isButtonDown(i); } // GL11.glsetSwapInterval(1); GL11.glClearColor(1.0f, 1.0f, 1.0f, 1.0f); // gl11.glColor3f(1.0f, 0.0f, 0.0f); GL11.glHint(GL11.GL_PERSPECTIVE_CORRECTION_HINT, GL11.GL_NICEST); GL11.glClearDepth(1.0); GL11.glLineWidth(2); GL11.glEnable(GL11.GL_DEPTH_TEST); if (mScene.getAmbientLight() != null) { GL11.glEnable(GL11.GL_LIGHTING); GL11.glLightModel( GL11.GL_LIGHT_MODEL_AMBIENT, Color4fLogic.toFloatBuffer(mScene.getAmbientLight())); } if (mScene.getColorMaterialFace() != JGLColorMaterialFace.UNSET) { initMaterial(); } if (mScene.getFogMode() != JGLFogMode.UNSET) { initFog(); } Dimension newDim; while (!Display.isCloseRequested() && !mCloseRequested) { newDim = mNewCanvasSize.getAndSet(null); if (newDim != null) { GL11.glViewport(0, 0, newDim.width, newDim.height); syncViewportSize(); } doRender(); doMouse(); doKeys(); doEye(); Display.update(); } Display.destroy(); } catch (InterruptedException | LWJGLException e) { e.printStackTrace(); } }
public Main() { try { Display.setDisplayMode(new DisplayMode(800, 600)); Display.create(); while (!Display.isCloseRequested()) { Display.update(); } Display.destroy(); } catch (LWJGLException e) { e.printStackTrace(); } }