コード例 #1
0
  @Override
  public void render(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {
    int nb = 0;
    if (server != null) {
      nb = server.getPartie().size();
      g.drawString("Server : ON", 5, 5);
    } else g.drawString("Server : OFF", 5, 5);
    g.drawString(
        "Listes des parties ouvertes : " + nb,
        shapeListeServers.getX()
            + shapeListeServers.getWidth() / 2
            - container.getDefaultFont().getWidth("Listes des parties ouvertes :" + nb) / 2,
        shapeListeServers.getY()
            - container.getDefaultFont().getHeight("Listes des parties ouvertes :" + nb)
            - 2);

    g.setDrawMode(Graphics.MODE_COLOR_MULTIPLY);
    g.setColor(Color.gray);
    g.fill(shapeListeServers);
    g.setDrawMode(Graphics.MODE_NORMAL);

    g.setColor(Color.white);
    g.draw(shapeListeServers);

    listeServers.renderString(container, g);

    butRetour.render(container, g);
    butCreerServer.render(container, g);

    super.render(container, game, g);
  }
コード例 #2
0
 private void mettreAJourListePartie() {
   listeServers.clearList();
   for (Partie v : server.getPartie())
     if (v != null) {
       String type = "Salon";
       if (v instanceof Jeu) type = "jeu";
       listeServers.addElement(
           new ElementString(
               container,
               ResourceManager.getImage("transparent")
                   .getScaledCopy(10, container.getDefaultFont().getHeight("1") + 2),
               0,
               0,
               "Id: "
                   + v.getId()
                   + " Nb joueurs: "
                   + v.getListeDesJoueursDansLaPartie().size()
                   + " instance: "
                   + type));
     }
 }