Пример #1
0
 // set to full screen
 public void init() {
   s = new ScreenManager();
   DisplayMode dm = s.findFirstCompatibleMode(modes);
   s.setFullScreen(dm);
   Window w = s.getFullScreenWindow();
   w.setFont(new Font("Arial", Font.PLAIN, 20));
   w.setBackground(Color.GREEN);
   w.setForeground(Color.WHITE);
   running = true;
 }
Пример #2
0
 public void run() {
   try {
     init();
     gameLoop();
   } finally {
     s.restoreScreen();
   }
 }
Пример #3
0
 // main gameloop
 @SuppressWarnings("unused")
 public void gameLoop() {
   Window w = s.getFullScreenWindow();
   long startTime = System.currentTimeMillis();
   long cumTime = startTime;
   while (running) {
     long timePassed = System.currentTimeMillis() - cumTime;
     cumTime += timePassed;
     update(timePassed);
     Graphics2D g = s.getGraphics();
     draw(g);
     g.dispose();
     s.update();
     try {
       Thread.sleep(20);
     } catch (Exception ex) {
     }
   }
 }
Пример #4
0
  public void run2() {
    try {
      init();
      gameLoop();

    } finally {
      s.restoreScreen();
      Look.main(null);
    }
  }
Пример #5
0
  // call init and gameloop
  public void run() {
    try {
      init();
      gameLoop();

    } finally {
      s.restoreScreen();
      PlayMenu.main(null);
    }
  }
Пример #6
0
  // main grameloop
  public void gameLoop() {
    long startingTime = System.currentTimeMillis();
    long cumTime = startingTime;

    while (running) {
      long timePassed = System.currentTimeMillis() - cumTime;
      cumTime += timePassed;
      //			a.update(timePassed);
      update(timePassed);
      // draw graphics
      Graphics2D g = s.getGraphics();
      draw(g);
      g.dispose();
      s.update();

      try {
        Thread.sleep(20);
      } catch (Exception ex) {
      }
    }
  }
Пример #7
0
 public void invisibleCursor() {
   Image curs;
   curs = new ImageIcon("Textures\\Cross.png").getImage();
   Window w = s.getFullScreenWindow();
   w.setCursor(w.getToolkit().createCustomCursor(curs, new Point(0, 0), "null"));
 }