Ejemplo n.º 1
0
  @Override
  public void initResources() {

    final int MARGIN = 30;
    int x = container.getWidth();
    int y = container.getHeight();
    Image tmp = ResourceManager.getImage("butRetour");

    int larg = tmp.getWidth();
    int haut = tmp.getHeight();
    int yBut = y - haut - MARGIN;

    shapeListeServers = new Rectangle(MARGIN, 50, x / 2 - MARGIN - 10, yBut - 50);

    listeServers =
        new ListeDeroulante(
            container,
            ResourceManager.getImage("transparent"),
            (int) shapeListeServers.getX() + 5,
            (int) shapeListeServers.getY() + 5);
    listeServers.setScrolled(true);
    listeServers.setMaxElementsToDraw((int) shapeListeServers.getHeight() / 20);

    butRetour =
        new MouseOverArea(
            container, ResourceManager.getImage("butRetour"), MARGIN, yBut, larg, haut);
    butRetour.setMouseOverImage(ResourceManager.getImage("butRetourOver"));

    butCreerServer =
        new MouseOverArea(container, tmp, tmp.getWidth() + MARGIN * 2, yBut, larg, haut);
    butCreerServer.setMouseOverImage(ResourceManager.getImage("MenuJouerOver"));

    timerRefreshServers = new Timer(7000);
  }
Ejemplo n.º 2
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);
  }
Ejemplo n.º 3
0
  public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {

    if ((startKnopf.isMouseOver())) {
      menüSchriftStart = schriftRot;
      if (Mouse.isButtonDown(0)) {
        knopfGedrueckt.play();
        sbg.enterState(1);
      }
    } else {
      menüSchriftStart = schriftSchwarz;
    }
    if (optionenKnopf.isMouseOver()) {
      menüSchriftOptionen = schriftRot;
      if (Mouse.isButtonDown(0)) {
        knopfGedrueckt.play();
        sbg.enterState(2);
      }
    } else {
      menüSchriftOptionen = schriftSchwarz;
    }
    if (creditsKnopf.isMouseOver()) {
      menüSchriftCredits = schriftRot;
      if (Mouse.isButtonDown(0)) {
        knopfGedrueckt.play();
        sbg.enterState(3);
      }
    } else {
      menüSchriftCredits = schriftSchwarz;
    }
  }
 @Override
 public void render(GameContainer container, StateBasedGame game, Graphics g)
     throws SlickException {
   image.draw();
   startButton.render(container, g);
   endButton.render(container, g);
   wtfButton.render(container, g);
 }
Ejemplo n.º 5
0
 @Override
 public void render(GUIContext container, Graphics g) {
   g.setColor(Color.black);
   g.drawRect(x, y, width, height);
   area.render(container, g);
   g.drawString("" + shortcut, x + 2, y + 2);
 }
 @Override
 public void render(GUIContext container, Graphics g) {
   fond.draw(getX(), getY(), getWidth(), getHeight());
   super.render(container, g);
   for (PanelSenateur s : senateurs) {
     s.render(container, g);
   }
 }
Ejemplo n.º 7
0
 public SpellButton(GUIContext container, int x, int y, int size) {
   super(container);
   this.height = size;
   this.width = size;
   this.x = x;
   this.y = y;
   try {
     spellImage = new Image("data/img/spells/spell1.bmp");
     spellImagemo = new Image("data/img/spells/spell1mo.bmp");
     spellImageoc = new Image("data/img/spells/spell1oc.bmp");
   } catch (SlickException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
   area = new MouseOverArea(container, spellImage, x, y, width, height);
   area.setMouseOverImage(spellImagemo);
   area.setMouseDownImage(spellImageoc);
 }
Ejemplo n.º 8
0
  @Override
  public void mouseReleased(int but, int x, int y) {

    if (butRetour.isMouseOver()) gotoPreviousView();
    else if (butCreerServer.isMouseOver()) {
      if (server == null) {
        // On le creer
        server = new Server("Serveur jeu Drol");
        Thread tmp = new Thread(server);
        tmp.start();
        System.out.println("Serveur demarrer");
      } else {
        // On le supprime
        server.stopServer();
        server = null;
        System.out.println("Serveur arreter");
      }
    }
  }
 @Override
 public void mouseMoved(int oldx, int oldy, int newx, int newy) {
   super.mouseMoved(oldx, oldy, newx, newy);
   if (newx < getX() + getWidth()
       && newx > getX()
       && newy > getY()
       && newy < getY() + getHeight()) {
     mouseInto = true;
   } else {
     mouseInto = false;
   }
 }
 @Override
 public void render(GUIContext container, Graphics g) {
   super.render(container, g);
   if (mouseInto) {
     if (senateur.estHommeEtat()) {
       g.setColor(couleurHE);
     } else {
       g.setColor(Color.black);
     }
     int xnom =
         (getX() + 50 - g.getFont().getWidth(senateur.getNom()) / 2 < 0)
             ? 0
             : getX() + 50 - g.getFont().getWidth(senateur.getNom()) / 2;
     g.drawString(senateur.getNom(), xnom, getY() - 20);
     infos.render(container, g);
   }
   senateur.getImage().draw(getX() + 10, getY(), 80, 80);
   if (senateur.getTitre() != null) {
     senateur
         .getTitre()
         .getIcon()
         .render(container, g, getX() + getWidth() - IconeTitre.LARGEUR_IMAGE, getY());
   }
 }