Пример #1
0
  @Override
  protected void _render(GameTime gametime, Graphics2D graphics) throws GameException {
    if (viewport.getView() == null || viewport.getReal() == null) {
      gamestatus.render(graphics);
      return;
    }

    systemrender.renderSystems(graphics, systems);

    gamestatus.render(graphics);
  }
Пример #2
0
  @Override
  public boolean update(GameTime gametime, KeyBoardState keyboard, MouseState mouse)
      throws GameException {
    if (exception != null) {
      GameException throwing = exception;
      exception = null;
      throw throwing;
    }

    gamestatus.update(gametime, client);
    updatemouse = mouse;

    if (!input.update(keyboard, mouse, viewport)) {
      return false;
    }

    systemupdater.updateSystems(client, systems);

    if (focus != null) {
      focus.update(viewport, systems);

      if (viewport.getView() != null) {
        double viewwidth = Math.max(viewport.getView().getWidth(), viewport.getView().getHeight());
        if (viewwidth > WindowFocusType.SYSTEM.maxout) {
          if (!(focus instanceof FocusState_MultiSystem)) {
            // change to multi system focus
            focus = new FocusState_MultiSystem(client, focusname, focus.getFocusId());
          }
        } else if (viewwidth < WindowFocusType.MULTI_SYSTEM.maxin) {
          if (!(focus instanceof FocusState_System)) {
            // change to single system focus
            focus = new FocusState_System(client, focusname, focus.getFocusId());
          }
        }
      }
    }

    return true;
  }
Пример #3
0
 public void setClientConnection(ClientConnection client) {
   this.client = client;
   gamestatus = new BasicStatus(client, Color.RED);
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           setMessage(
               String.format(
                   "mouse [x:%s, y:%s, window:%s]",
                   updatemouse.getX(), updatemouse.getY(), updatemouse.isOverWindow()));
           super.render(graphics);
         }
       });
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           if (viewport.getView() != null) {
             setMessage(String.format("viewport: x -> %s", viewport.getView().getX()));
             super.render(graphics);
           }
         }
       });
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           if (viewport.getView() != null) {
             setMessage(String.format("viewport: y -> %s", viewport.getView().getY()));
             super.render(graphics);
           }
         }
       });
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           if (viewport.getView() != null) {
             setMessage(String.format("viewport: w -> %s", viewport.getView().getWidth()));
             super.render(graphics);
           }
         }
       });
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           if (viewport.getView() != null) {
             setMessage(String.format("viewport: h -> %s", viewport.getView().getHeight()));
             super.render(graphics);
           }
         }
       });
   gamestatus.attach(
       new Text() {
         @Override
         public void render(Graphics2D graphics) {
           setMessage(String.format("system count: %s", systems.size()));
           super.render(graphics);
         }
       });
 }