Esempio n. 1
0
  /* (non-Javadoc)
   * @see chu.engine.Stage#render()
   */
  public void render() {
    // Draw and label boxes
    Renderer.drawString("default_med", "Name:", 150, 140, 0.0f);
    Renderer.drawString("default_med", "Server IP:", 133, 170, 0.0f);

    super.render();
  }
Esempio n. 2
0
 /* (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();
 }
Esempio n. 3
0
 /**
  * Connect.
  *
  * @param nickname player nickname
  * @param ip the host ip
  */
 public static void connect(String nickname, String ip) {
   getLocalPlayer().setName(nickname);
   client = new Client(ip, 21255);
   if (client.isOpen()) {
     lobby = new ClientLobbyStage(client.getSession());
     setCurrentStage(lobby);
     client.start();
   } else {
     currentStage.addEntity(
         new Notification(
             180,
             120,
             "default_med",
             "ERROR: Could not connect to the server!",
             5f,
             new Color(255, 100, 100),
             0f));
   }
 }