Phase 4 : Interfaces graphiques
|
|
@ -1,6 +1,11 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry including="boules/|fonds/|murs/|personnages/|sons/" kind="src" path="media"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
|
||||
<attributes>
|
||||
<attribute name="module" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
|
|
|||
BIN
media/boules/boule.gif
Normal file
|
After Width: | Height: | Size: 906 B |
BIN
media/fonds/fondarene.jpg
Normal file
|
After Width: | Height: | Size: 494 KiB |
BIN
media/fonds/fondchoix.jpg
Normal file
|
After Width: | Height: | Size: 60 KiB |
BIN
media/murs/mur.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso1marche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/personnages/perso1marche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/personnages/perso1marche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1marche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1marche3d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1marche3d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1marche4d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1marche4d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1mort1d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso1mort1d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso1mort2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso1mort2d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso1touche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/personnages/perso1touche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
BIN
media/personnages/perso1touche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso1touche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso2marche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche3d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche3d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche4d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2marche4d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2mort1d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2mort1d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2mort2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2mort2d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2touche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2touche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2touche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso2touche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3marche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3marche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3marche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3marche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3marche3d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3marche3d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3marche4d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3marche4d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3mort1d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3mort1d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3mort2d0.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3mort2d1.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
media/personnages/perso3touche1d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3touche1d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3touche2d0.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/personnages/perso3touche2d1.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
media/sons/ambiance.wav
Normal file
BIN
media/sons/death.wav
Normal file
BIN
media/sons/fight.wav
Normal file
BIN
media/sons/go.wav
Normal file
BIN
media/sons/hurt.wav
Normal file
BIN
media/sons/precedent.wav
Normal file
BIN
media/sons/suivant.wav
Normal file
BIN
media/sons/welcome.wav
Normal file
20
src/controleur/Controle.java
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
package controleur;
|
||||
import vue.EntreeJeu;
|
||||
|
||||
public class Controle {
|
||||
private EntreeJeu frmEntreeJeu ;
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
*/
|
||||
private Controle() {
|
||||
this.frmEntreeJeu = new EntreeJeu() ;
|
||||
this.frmEntreeJeu.setVisible(true);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
new Controle();
|
||||
}
|
||||
|
||||
}
|
||||
75
src/vue/Arene.java
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
package vue;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.EventQueue;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
import javax.swing.ScrollPaneConstants;
|
||||
|
||||
public class Arene extends JFrame {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JPanel contentPane;
|
||||
private JTextField textField;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public Arene() {
|
||||
setTitle("Arene");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.getContentPane().setPreferredSize(new Dimension(800, 729));
|
||||
this.pack();
|
||||
this.setResizable(false);
|
||||
setBounds(100, 100, 808, 757);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("");
|
||||
String chemin = "fonds/fondarene.jpg";
|
||||
URL ressourceURL = getClass().getClassLoader().getResource(chemin);
|
||||
|
||||
if (ressourceURL != null) {
|
||||
String ressource = URLDecoder.decode(ressourceURL.getPath(), StandardCharsets.UTF_8);
|
||||
lblNewLabel.setIcon(new ImageIcon(ressource));
|
||||
} else {
|
||||
System.out.println("❌ Image non trouvée !");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
lblNewLabel.setBounds(0, 0, 792, 590);
|
||||
contentPane.add(lblNewLabel);
|
||||
|
||||
textField = new JTextField();
|
||||
textField.setBounds(0, 590, 792, 31);
|
||||
contentPane.add(textField);
|
||||
textField.setColumns(10);
|
||||
|
||||
JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
scrollPane.setBounds(0, 620, 792, 98);
|
||||
contentPane.add(scrollPane);
|
||||
|
||||
JTextArea textArea = new JTextArea();
|
||||
scrollPane.setViewportView(textArea);
|
||||
}
|
||||
}
|
||||
91
src/vue/ChoixJoueur.java
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
package vue;
|
||||
import java.awt.EventQueue;
|
||||
import java.net.URL;
|
||||
import java.net.URLDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.ImageIcon;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
public class ChoixJoueur extends JFrame {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JPanel contentPane;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public ChoixJoueur() {
|
||||
setTitle("Choice");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
this.getContentPane().setPreferredSize(new Dimension(400, 275));
|
||||
this.pack();
|
||||
this.setResizable(false);
|
||||
setBounds(100, 100, 412, 300);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("");
|
||||
String chemin = "fonds/fondchoix.jpg";
|
||||
URL ressourceURL = getClass().getClassLoader().getResource(chemin);
|
||||
|
||||
if (ressourceURL != null) {
|
||||
String ressource = URLDecoder.decode(ressourceURL.getPath(), StandardCharsets.UTF_8);
|
||||
lblNewLabel.setIcon(new ImageIcon(ressource));
|
||||
} else {
|
||||
System.out.println("❌ Image non trouvée !");
|
||||
}
|
||||
|
||||
lblNewLabel.setBounds(0, 0, 396, 261);
|
||||
contentPane.add(lblNewLabel);
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("");
|
||||
lblNewLabel_1.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
System.out.println("Suivant");
|
||||
}
|
||||
});
|
||||
lblNewLabel_1.setBackground(new Color(128, 255, 0));
|
||||
lblNewLabel_1.setBounds(293, 108, 93, 81);
|
||||
contentPane.add(lblNewLabel_1);
|
||||
|
||||
JLabel lblNewLabel_1_1 = new JLabel("");
|
||||
lblNewLabel_1_1.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
System.out.println("Précédent");
|
||||
}
|
||||
});
|
||||
lblNewLabel_1_1.setBackground(new Color(128, 255, 0));
|
||||
lblNewLabel_1_1.setBounds(10, 96, 93, 81);
|
||||
contentPane.add(lblNewLabel_1_1);
|
||||
|
||||
JLabel lblNewLabel_2 = new JLabel("");
|
||||
lblNewLabel_2.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
Arene arena = new Arene();
|
||||
arena.setVisible(true);
|
||||
ChoixJoueur.this.dispose();
|
||||
}
|
||||
});
|
||||
lblNewLabel_2.setBounds(293, 200, 103, 61);
|
||||
contentPane.add(lblNewLabel_2);
|
||||
}
|
||||
|
||||
}
|
||||
98
src/vue/EntreeJeu.java
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
package vue;
|
||||
import java.awt.EventQueue;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JTextField;
|
||||
import java.awt.Font;
|
||||
import javax.swing.JButton;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ActionEvent;
|
||||
|
||||
public class EntreeJeu extends JFrame {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
private JPanel contentPane;
|
||||
private JTextField textField;
|
||||
|
||||
/**
|
||||
* Launch the application.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Create the frame.
|
||||
*/
|
||||
public EntreeJeu() {
|
||||
setTitle("Urban Marginal");
|
||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||
setBounds(100, 100, 330, 160);
|
||||
contentPane = new JPanel();
|
||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
|
||||
setContentPane(contentPane);
|
||||
contentPane.setLayout(null);
|
||||
|
||||
JLabel lblNewLabel = new JLabel("Start a server :");
|
||||
lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
lblNewLabel.setBounds(10, 11, 131, 14);
|
||||
contentPane.add(lblNewLabel);
|
||||
|
||||
JButton btnNewButton = new JButton("Start");
|
||||
|
||||
btnNewButton.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
Arene areneJeu = new Arene();
|
||||
areneJeu.setVisible(true);
|
||||
EntreeJeu.this.dispose();
|
||||
}
|
||||
});
|
||||
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
btnNewButton.setBounds(211, 7, 89, 23);
|
||||
contentPane.add(btnNewButton);
|
||||
|
||||
JLabel lblNewLabel_1 = new JLabel("");
|
||||
lblNewLabel_1.setBounds(20, 36, 46, 14);
|
||||
contentPane.add(lblNewLabel_1);
|
||||
|
||||
JLabel lblNewLabel_2 = new JLabel("Connect an existing server :");
|
||||
lblNewLabel_2.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
lblNewLabel_2.setBounds(10, 36, 176, 14);
|
||||
contentPane.add(lblNewLabel_2);
|
||||
|
||||
JLabel lblNewLabel_3 = new JLabel("IP server :");
|
||||
lblNewLabel_3.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
lblNewLabel_3.setBounds(10, 61, 68, 14);
|
||||
contentPane.add(lblNewLabel_3);
|
||||
|
||||
textField = new JTextField();
|
||||
textField.setText("127.0.0.1");
|
||||
textField.setBounds(88, 59, 98, 20);
|
||||
contentPane.add(textField);
|
||||
textField.setColumns(10);
|
||||
|
||||
JButton btnNewButton_1 = new JButton("Connect");
|
||||
btnNewButton_1.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
ChoixJoueur choixJoueur = new ChoixJoueur();
|
||||
choixJoueur.setVisible(true);
|
||||
EntreeJeu.this.dispose();
|
||||
}
|
||||
});
|
||||
btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
btnNewButton_1.setBounds(211, 57, 89, 23);
|
||||
contentPane.add(btnNewButton_1);
|
||||
|
||||
JButton btnNewButton_2 = new JButton("Exit");
|
||||
btnNewButton_2.addActionListener(new ActionListener() {
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
System.exit(0);
|
||||
}
|
||||
});
|
||||
btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 12));
|
||||
btnNewButton_2.setBounds(211, 91, 89, 23);
|
||||
contentPane.add(btnNewButton_2);
|
||||
}
|
||||
}
|
||||