第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

為什么這不能創(chuàng)建緩沖策略?

為什么這不能創(chuàng)建緩沖策略?

jeck貓 2023-11-10 15:24:19
我收到一個(gè)Exception in thread "Thread-3" java.lang.InternalError: Could not create a buffer strategy錯(cuò)誤,該錯(cuò)誤可以追溯到 Java 的基本代碼,它可以追溯到下面第 58 ( render();) 和 77 ( this.createBufferStrategy(5);) 行的 Game 類。任何幫助都會(huì)很棒,如果您需要查看其他類,我還將我的所有代碼上傳到 github (mitisme/mit)。import java.awt.Canvas;import java.awt.Color;import java.awt.*;import java.awt.image.BufferStrategy;public class Game extends Canvas implements Runnable {   private static final long serialVersionUID = 1L;   private boolean isRunning = false;   private Thread thread;   private Handler handler;   //Creates background window size and holds objects by handler   public Game() {      Screen myScreen = new Screen(1280, 720, "Deed", this);      start();      handler = new Handler();      addKeyListener(new KeyInput(handler));      handler.addObject(new Player(425, 745, ID.Player, handler));   }//starts a new thread   private void start() {      isRunning = true;      thread = new Thread(this);      thread.start();   }   // Stops current thread, and catches exceptions   private void stop() {      isRunning = false;      try {         thread.join();      } catch (InterruptedException e) {         e.printStackTrace();      }   }   //Infinite game loop   public void run() {      this.requestFocus();      long lastTime = System.nanoTime();      double amountOfTicks = 60.0;      double ns = 1000000000 / amountOfTicks;      double delta = 0;      long timer = System.currentTimeMillis();      int frames = 0;      while(isRunning) {         long now = System.nanoTime();         delta += (now - lastTime) / ns;         lastTime = now;         while(delta >= 1) {            tick();            delta--;         }         render();         frames++;         if(System.currentTimeMillis() - timer > 1000) {            timer += 1000;            frames = 0;         }      }      stop();   }
查看完整描述

1 回答

?
LEATH

TA貢獻(xiàn)1936條經(jīng)驗(yàn) 獲得超7個(gè)贊

我發(fā)現(xiàn),這條線this.createBufferStrategy(5);只能從2-4創(chuàng)建緩沖策略,否則會(huì)出錯(cuò)。



查看完整回答
反對(duì) 回復(fù) 2023-11-10
  • 1 回答
  • 0 關(guān)注
  • 110 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)