Phase 4 : Interfaces graphiques

This commit is contained in:
Erwann PHILIPPE 2025-03-06 15:24:29 +01:00
parent e6c955d51a
commit 7dd79ff3b1
65 changed files with 290 additions and 1 deletions

View file

@ -1,6 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <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"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

BIN
media/boules/boule.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 906 B

BIN
media/fonds/fondarene.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 KiB

BIN
media/fonds/fondchoix.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
media/murs/mur.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
media/sons/ambiance.wav Normal file

Binary file not shown.

BIN
media/sons/death.wav Normal file

Binary file not shown.

BIN
media/sons/fight.wav Normal file

Binary file not shown.

BIN
media/sons/go.wav Normal file

Binary file not shown.

BIN
media/sons/hurt.wav Normal file

Binary file not shown.

BIN
media/sons/precedent.wav Normal file

Binary file not shown.

BIN
media/sons/suivant.wav Normal file

Binary file not shown.

BIN
media/sons/welcome.wav Normal file

Binary file not shown.

View 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
View 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
View 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
View 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);
}
}