Proposition A : sobre, fidèle à la charte (blanc, encre, Inter, filets) ; implémentée dans le mod (0.2.0), maquettes, captures en jeu
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Aucun fichier ne correspond à votre recherche
@@ -15,13 +15,14 @@ Le serveur n'a pas besoin du mod (`displayTest="IGNORE_ALL_VERSION"`), et un jou
|
||||
|
||||
Les captures sont dans `livrable/captures/`.
|
||||
|
||||
## Charte
|
||||
## Charte (proposition A « sobre », branche `design/propositions`)
|
||||
|
||||
- Fond papier `#F2F0E6`, encre `#2D2A26`, filets `#DAD5C8`.
|
||||
- Police Inter (TTF fournie dans le mod, licence OFL : `LICENCE-INTER-OFL.txt`). Le grand titre utilise Inter SemiBold suréchantillonnée, agrandie ×3.
|
||||
- Aucun arrondi, aucune texture vanilla. Les boutons sont des lignes de liste séparées par des filets fins.
|
||||
- Accents francs, utilisés avec retenue : orange `#E8590C` (serveur, surtitres), vert `#2B8A3E` (en ligne), rouge `#C92A2A` (hors ligne, quitter).
|
||||
- Arrière-plan maison : `outils/fond.py` génère `textures/gui/fond.png` (courbes de niveau d'un relief imaginaire, une ligne de crête et un repère orange). La moitié gauche reste vide pour le menu.
|
||||
- Fond blanc `#FFFFFF` (alterné `#F4F4F4`), encre `#111111`, gris `#6B6B6B`, filets `#D9D9D9` (fort : 2 px d'encre au-dessus des listes). Valeurs de la charte relevée (Mind, météo, Hub).
|
||||
- Police Inter (TTF fournie dans le mod, licence OFL : `LICENCE-INTER-OFL.txt`). Grands titres en Inter SemiBold suréchantillonnée ; étiquettes en capitales espacées.
|
||||
- Aucun arrondi, aucune texture vanilla, plus d'image de fond. Les menus sont des listes numérotées séparées par des filets ; l'action principale est une ligne pleine à l'encre.
|
||||
- La couleur ne sert que de signal, toujours avec un texte : succès `#1A5C2A` sur `#F0F7F0`, alerte `#8A1C1C` sur `#FDF2F2`.
|
||||
- Accueil : à droite, l'état du serveur en grands chiffres (joueurs, latence, version, adresse), masqué si l'écran est étroit.
|
||||
- Les deux autres propositions (B, C) et les maquettes sont dans `propositions/`.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
org.gradle.jvmargs=-Xmx2G
|
||||
org.gradle.parallel=true
|
||||
|
||||
mod_version=0.1.0
|
||||
mod_version=0.2.0
|
||||
mod_group_id=com.gastinelclient
|
||||
mod_id=gastinelclient
|
||||
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
"""Génère l'arrière-plan de l'accueil GastinelClient (1920x1080, PNG).
|
||||
|
||||
Papier réchauffé, courbes de niveau fines (relief imaginaire façon Vercors), une ligne de crête
|
||||
à l'encre et un repère orange. La moitié gauche reste presque vide pour le menu.
|
||||
Usage : python outils/fond.py (écrit src/main/resources/assets/gastinelclient/textures/gui/fond.png)
|
||||
"""
|
||||
import os
|
||||
import numpy as np
|
||||
from PIL import Image, ImageDraw
|
||||
|
||||
W, H, SS = 1920, 1080, 2 # sur-échantillonnage x2 pour adoucir les traits
|
||||
PAPIER = np.array([242, 240, 230], float)
|
||||
FILET = np.array([218, 213, 200], float)
|
||||
FILET_FORT = np.array([196, 188, 170], float)
|
||||
|
||||
ys, xs = np.mgrid[0:H * SS, 0:W * SS].astype(float) / SS
|
||||
u, v = xs / W, ys / H
|
||||
|
||||
# Relief : un plateau (falaises) à droite + ondulations douces
|
||||
relief = (
|
||||
1.6 * np.exp(-((u - 0.78) ** 2 / 0.05 + (v - 0.62) ** 2 / 0.09))
|
||||
+ 0.9 * np.exp(-((u - 0.98) ** 2 / 0.02 + (v - 0.25) ** 2 / 0.05))
|
||||
+ 0.25 * np.sin(5.1 * u + 2.3 * v) * np.cos(3.7 * v - 1.2 * u)
|
||||
+ 0.12 * np.sin(13 * u + 7 * v + 1.0)
|
||||
)
|
||||
k = 18.0
|
||||
f = relief * k
|
||||
d = np.abs(f - np.round(f)) # distance à la courbe la plus proche
|
||||
grad = np.hypot(*np.gradient(f, 1.0 / SS)) + 1e-6
|
||||
dist_px = d / grad
|
||||
ligne = np.clip(1.2 - dist_px * 1.4, 0, 1)
|
||||
maitresse = (np.round(f).astype(int) % 5 == 0)
|
||||
|
||||
# Masque : rien sous le menu à gauche, apparition progressive vers la droite
|
||||
masque = np.clip((u - 0.34) / 0.22, 0, 1) ** 1.5
|
||||
|
||||
img = np.ones((H * SS, W * SS, 3)) * PAPIER
|
||||
coul = np.where(maitresse[..., None], FILET_FORT, FILET)
|
||||
a = (ligne * masque)[..., None]
|
||||
img = img * (1 - a) + coul * a
|
||||
|
||||
pil = Image.fromarray(img.astype(np.uint8)).resize((W, H), Image.LANCZOS)
|
||||
dr = ImageDraw.Draw(pil)
|
||||
|
||||
# Ligne de crête (encre), polyline anguleuse : pas d'arrondi
|
||||
crete = [(1010, 820), (1120, 760), (1185, 772), (1260, 690), (1330, 668), (1372, 600),
|
||||
(1460, 596), (1520, 640), (1600, 560), (1700, 548), (1770, 610), (1920, 590)]
|
||||
dr.line(crete, fill=(45, 42, 38), width=2)
|
||||
# Repère du spawn : carré orange franc + filet vertical
|
||||
sx, sy = 1460, 596
|
||||
dr.line([(sx, sy - 120), (sx, sy - 8)], fill=(45, 42, 38), width=1)
|
||||
dr.rectangle([sx - 6, sy - 6 - 120, sx + 6, sy + 6 - 120], fill=(232, 89, 12))
|
||||
# Croix de repérage dans les coins (filets fins)
|
||||
for cx, cy in [(1840, 80), (1840, 1000), (760, 80), (760, 1000)]:
|
||||
dr.line([(cx - 10, cy), (cx + 10, cy)], fill=(160, 152, 136), width=1)
|
||||
dr.line([(cx, cy - 10), (cx, cy + 10)], fill=(160, 152, 136), width=1)
|
||||
|
||||
out = os.path.join(os.path.dirname(__file__), "..", "src", "main", "resources", "assets",
|
||||
"gastinelclient", "textures", "gui", "fond.png")
|
||||
pil.save(out, optimize=True)
|
||||
print("écrit", os.path.normpath(out), pil.size)
|
||||
@@ -0,0 +1,20 @@
|
||||
# Proposition A · Sobre, fidèle à la charte (implémentée sur cette branche)
|
||||
|
||||
**Idée** : la charte relevée telle quelle (Mind, météo, Hub) : fond blanc, encre `#111`, gris `#6b6b6b`, filets `#d9d9d9`, Inter, aucun arrondi. Les menus sont des listes numérotées (01, 02…) entre filets, l'action principale est une ligne pleine à l'encre. La couleur ne sert que de signal, toujours avec un texte (vert « En ligne », rouge sombre « Sauvegarder et quitter »). L'accueil gagne un panneau « État du serveur » en grands chiffres, façon météo.
|
||||
|
||||
**Différences avec la 0.1.0** : plus de papier beige ni de fond « courbes de niveau » ni d'orange ; barre du haut « GASTINEL / Rubrique » ; titres plus grands ; étiquettes en capitales espacées ; jauges fines dans les options.
|
||||
|
||||
## Ce qui a changé dans le code (commit de cette proposition)
|
||||
- `ui/Charte` : nouvelles couleurs, fond blanc uni, `etiquette()` (capitales espacées), `carre()`, `jauge()`.
|
||||
- `ui/Bouton` : rendu MENU / PRIMAIRE revu (numéro, pastille d'état), nouveau genre `ALERTE`, CADRE blanc à filet d'encre.
|
||||
- `ecrans/EcranGastinel` : barre du haut, en-tête et pied de page.
|
||||
- `ecrans/AccueilScreen` : panneau d'état à droite (masqué si l'écran est étroit).
|
||||
- `ecrans/PauseGastinel`, `OptionsSimplesScreen`, `ServeursScreen` : restyle (jauges, trait de saisie, filets forts).
|
||||
- `core/Libelles.fraction()` + test JUnit.
|
||||
- Supprimés : `textures/gui/fond.png`, `outils/fond.py`. Version passée à 0.2.0 dans `gradle.properties`.
|
||||
|
||||
**Pas fait** (vu dans les maquettes, mais plus long) : l'écran Solo reste celui de Minecraft (la maquette montre un tableau maison, ~½ jour) ; le texte « Jouer sur le serveur Gastinel » reste le nom configuré.
|
||||
|
||||
## Effort
|
||||
Fait en une session (environ ½ jour). Build Gradle vert, tests JUnit verts ; captures en jeu (client de test sans compte, Xvfb) dans `en-jeu/`. Le jar de test `gastinelclient-neoforge-1.21.1-0.2.0.jar` est posé ici (non versionné).
|
||||
En dev, le pied de page affiche « GastinelClient 0.1.0 » : c'est la version lue par le client de développement, le jar construit porte bien 0.2.0.
|
||||
|
Après Largeur: | Hauteur: | Taille: 59 KiB |
|
Après Largeur: | Hauteur: | Taille: 59 KiB |
|
Après Largeur: | Hauteur: | Taille: 30 KiB |
|
Après Largeur: | Hauteur: | Taille: 17 KiB |
|
Après Largeur: | Hauteur: | Taille: 278 KiB |
|
Après Largeur: | Hauteur: | Taille: 279 KiB |
@@ -0,0 +1,168 @@
|
||||
<!doctype html>
|
||||
<html lang="fr"><head><meta charset="utf-8"><title>Proposition A · Sobre</title>
|
||||
<link rel="stylesheet" href="../commun/base.css">
|
||||
<style>
|
||||
:root{--fond:#fff;--alt:#f4f4f4;--encre:#111;--gris:#6b6b6b;--filet:#d9d9d9;--ok:#1a5c2a;--okf:#f0f7f0;--ko:#8a1c1c;--kof:#fdf2f2}
|
||||
.ecran{background:var(--fond);color:var(--encre)}
|
||||
.barre{position:absolute;left:0;right:0;top:0;height:72px;border-bottom:1px solid var(--filet);display:flex;align-items:center;justify-content:space-between;padding:0 120px}
|
||||
.code{font:600 15px Inter;letter-spacing:.18em;text-transform:uppercase}
|
||||
.gris{color:var(--gris)}
|
||||
.pied{position:absolute;left:120px;right:120px;bottom:0;height:72px;border-top:1px solid var(--filet);display:flex;align-items:center;justify-content:space-between;font-size:18px;color:var(--gris)}
|
||||
.pied b{color:var(--encre);font-weight:600}
|
||||
h1{font:700 128px/1 Inter;letter-spacing:-.04em}
|
||||
h2{font:700 64px/1 Inter;letter-spacing:-.02em}
|
||||
.etiq{font:600 15px Inter;letter-spacing:.08em;text-transform:uppercase;color:var(--gris)}
|
||||
.liste{border-top:2px solid var(--encre)}
|
||||
.ligne{display:flex;align-items:center;height:64px;border-bottom:1px solid var(--filet);padding:0 20px;font-size:24px;gap:20px}
|
||||
.ligne .num{font:600 14px Inter;letter-spacing:.1em;color:var(--gris);width:28px}
|
||||
.ligne .fl{margin-left:auto;font-size:24px}
|
||||
.ligne.prim{background:var(--encre);color:#fff;height:96px;border-bottom-color:var(--encre)}
|
||||
.ligne.prim .num{color:#9a9a9a}
|
||||
.ligne.prim small{display:block;font-size:18px;color:#bdbdbd;margin-top:6px}
|
||||
.carre{display:inline-block;width:12px;height:12px;background:#3fbf5f;margin-right:8px;vertical-align:1px}
|
||||
.survol{background:var(--alt);box-shadow:inset 3px 0 0 var(--encre)}
|
||||
.bouton{display:inline-flex;align-items:center;justify-content:center;height:56px;padding:0 32px;border:1px solid var(--encre);font:600 20px Inter;background:#fff}
|
||||
.bouton.noir{background:var(--encre);color:#fff}
|
||||
.bouton.off{border-color:var(--filet);color:#b3b3b3}
|
||||
.focus{outline:3px solid var(--encre);outline-offset:3px}
|
||||
table{border-collapse:collapse;width:100%}
|
||||
th{font:600 14px Inter;letter-spacing:.08em;text-transform:uppercase;color:var(--gris);text-align:left;padding:0 20px 12px;border-bottom:2px solid var(--encre)}
|
||||
td{height:72px;padding:0 20px;border-bottom:1px solid var(--filet);font-size:22px}
|
||||
tr.sel td{background:var(--encre);color:#fff}
|
||||
tr.sel td.gris{color:#bdbdbd}
|
||||
.chiffre{font:700 200px/1 Inter;letter-spacing:-.05em}
|
||||
.cases{display:grid;grid-template-columns:repeat(3,1fr);border-top:1px solid var(--filet)}
|
||||
.cases div{padding:24px 24px 24px 0;border-right:1px solid var(--filet);margin-right:24px}
|
||||
.cases div:last-child{border:0}
|
||||
.cases b{display:block;font:700 44px Inter;letter-spacing:-.02em;margin-top:10px}
|
||||
.reg{display:flex;align-items:center;height:72px;border-bottom:1px solid var(--filet);font-size:22px;gap:12px}
|
||||
.reg .v{margin-left:auto;font-weight:600;min-width:120px;text-align:right;margin-right:12px}
|
||||
.pm{width:48px;height:48px;border:1px solid var(--encre);display:flex;align-items:center;justify-content:center;font-size:26px}
|
||||
.jauge{width:200px;height:4px;background:var(--filet);position:relative;margin-right:16px}
|
||||
.jauge i{position:absolute;left:0;top:0;bottom:0;background:var(--encre)}
|
||||
.bascule{display:flex;border:1px solid var(--encre)}
|
||||
.bascule span{width:72px;height:46px;display:flex;align-items:center;justify-content:center;font-size:18px}
|
||||
.bascule .on{background:var(--encre);color:#fff}
|
||||
.signal{display:inline-block;padding:6px 12px;font-size:17px;font-weight:600}
|
||||
.signal.ok{background:var(--okf);color:var(--ok)}
|
||||
.signal.ko{background:var(--kof);color:var(--ko)}
|
||||
</style></head><body>
|
||||
|
||||
<!-- ============ TITRE ============ -->
|
||||
<p class="legende">A · Écran titre</p>
|
||||
<section class="ecran" id="titre">
|
||||
<div class="barre"><span class="code">Gastinel</span><span class="code gris">Minecraft 1.21.1 · NeoForge</span></div>
|
||||
<div style="position:absolute;left:120px;top:190px;width:640px">
|
||||
<p class="etiq" style="margin-bottom:20px">Serveur Minecraft</p>
|
||||
<h1>Gastinel</h1>
|
||||
<p class="gris" style="font-size:24px;margin:24px 0 48px">Le serveur des amis, dans le Vercors.</p>
|
||||
<div class="liste">
|
||||
<div class="ligne prim"><span class="num">01</span><div>Jouer sur le serveur Gastinel<small><span class="carre"></span>En ligne · 3 joueurs sur 20 · 15 ms</small></div><span class="fl">→</span></div>
|
||||
<div class="ligne survol"><span class="num">02</span>Solo<span class="fl">→</span></div>
|
||||
<div class="ligne"><span class="num">03</span>Autres serveurs</div>
|
||||
<div class="ligne"><span class="num">04</span>Options</div>
|
||||
<div class="ligne"><span class="num">05</span>Quitter</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="position:absolute;left:880px;top:72px;bottom:72px;border-left:1px solid var(--filet)"></div>
|
||||
<div style="position:absolute;left:960px;top:190px;width:840px">
|
||||
<p class="etiq">État du serveur · en direct</p>
|
||||
<div style="display:flex;align-items:flex-end;gap:24px;margin:24px 0 8px"><span class="chiffre">3</span><span style="font-size:36px;font-weight:600;padding-bottom:28px">/ 20 joueurs</span></div>
|
||||
<p style="margin-bottom:48px"><span class="signal ok">En ligne</span></p>
|
||||
<div class="cases">
|
||||
<div><span class="etiq">Latence</span><b>15 ms</b></div>
|
||||
<div><span class="etiq">Version</span><b>1.21.1</b></div>
|
||||
<div><span class="etiq">Adresse</span><b style="font-size:30px;padding-top:12px">gastinel.me</b></div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pied"><span>GastinelClient <b>0.2.0</b></span><span>Mods</span></div>
|
||||
</section>
|
||||
|
||||
<!-- ============ SOLO ============ -->
|
||||
<p class="legende">A · Solo (choix du monde)</p>
|
||||
<section class="ecran" id="solo">
|
||||
<div class="barre"><span class="code">Gastinel <span class="gris">/ Solo</span></span><span class="code gris">← Retour</span></div>
|
||||
<div style="position:absolute;left:120px;right:120px;top:150px">
|
||||
<div style="display:flex;align-items:flex-end;justify-content:space-between;margin-bottom:48px"><h2>Mondes</h2><span class="bouton">+ Créer un monde</span></div>
|
||||
<table>
|
||||
<tr><th>Nom</th><th>Mode</th><th>Dernière partie</th><th>Version</th></tr>
|
||||
<tr class="sel"><td><b>New World</b></td><td class="gris">Survie</td><td class="gris">Aujourd'hui, 14 h 02</td><td class="gris">1.21.1</td></tr>
|
||||
<tr><td>Test redstone</td><td class="gris">Créatif</td><td class="gris">12 octobre</td><td class="gris">1.21.1</td></tr>
|
||||
<tr><td>Vercors 1:1</td><td class="gris">Créatif</td><td class="gris">3 octobre</td><td class="gris">1.21.1</td></tr>
|
||||
<tr><td>Ancien monde</td><td class="gris">Survie</td><td class="gris">28 juin</td><td class="gris">1.20.4</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div style="position:absolute;left:120px;right:120px;bottom:120px;display:flex;gap:16px"><span class="bouton noir focus">Jouer « New World »</span><span class="bouton">Modifier</span><span class="bouton">Recréer</span><span class="bouton" style="margin-left:auto;color:var(--ko);border-color:var(--ko)">Supprimer</span></div>
|
||||
<div class="pied"><span>4 mondes</span><span>Entrée : jouer · Suppr : supprimer</span></div>
|
||||
</section>
|
||||
|
||||
<!-- ============ MULTI ============ -->
|
||||
<p class="legende">A · Autres serveurs (multijoueur)</p>
|
||||
<section class="ecran" id="multi">
|
||||
<div class="barre"><span class="code">Gastinel <span class="gris">/ Autres serveurs</span></span><span class="code gris">← Retour</span></div>
|
||||
<div style="position:absolute;left:120px;right:120px;top:150px">
|
||||
<h2 style="margin-bottom:48px">Autres serveurs</h2>
|
||||
<p class="etiq" style="margin-bottom:12px">Adresse</p>
|
||||
<div style="display:flex;gap:16px;align-items:center;margin-bottom:72px">
|
||||
<div style="flex:1;height:64px;border-bottom:2px solid var(--encre);display:flex;align-items:center;font-size:26px;color:#9a9a9a">play.exemple.fr</div>
|
||||
<span class="bouton noir">Rejoindre</span><span class="bouton">Enregistrer</span>
|
||||
</div>
|
||||
<table>
|
||||
<tr><th>Serveur enregistré</th><th>Adresse</th><th>État</th><th style="text-align:right">Joueurs</th></tr>
|
||||
<tr><td><b>Serveur de Léo</b></td><td class="gris">leo.ddns.net</td><td><span class="signal ok">En ligne · 42 ms</span></td><td style="text-align:right">2 / 10</td></tr>
|
||||
<tr><td><b>Hypixel</b></td><td class="gris">mc.hypixel.net</td><td><span class="signal ok">En ligne · 96 ms</span></td><td style="text-align:right">31 204</td></tr>
|
||||
<tr><td><b>Ancien serveur</b></td><td class="gris">192.168.1.20</td><td><span class="signal ko">Hors ligne</span></td><td style="text-align:right" class="gris">—</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<div class="pied"><span>Le serveur Gastinel est sur l'accueil.</span><span>Liste complète de Minecraft</span></div>
|
||||
</section>
|
||||
|
||||
<!-- ============ OPTIONS ============ -->
|
||||
<p class="legende">A · Options</p>
|
||||
<section class="ecran" id="options">
|
||||
<div class="barre"><span class="code">Gastinel <span class="gris">/ Options</span></span><span class="code gris">← Retour</span></div>
|
||||
<div style="position:absolute;left:120px;right:120px;top:150px">
|
||||
<h2 style="margin-bottom:56px">Options</h2>
|
||||
<div style="display:grid;grid-template-columns:1fr 1fr;gap:0 96px">
|
||||
<div><p class="etiq" style="padding-bottom:12px;border-bottom:2px solid var(--encre)">Image</p>
|
||||
<div class="reg">Distance d'affichage<span class="jauge" style="margin-left:auto"><i style="width:37%"></i></span><span class="v" style="margin-left:0">12 tronçons</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Champ de vision<span class="jauge" style="margin-left:auto"><i style="width:30%"></i></span><span class="v" style="margin-left:0">80°</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Luminosité<span class="jauge" style="margin-left:auto"><i style="width:50%"></i></span><span class="v" style="margin-left:0">50 %</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Taille de l'interface<span class="v">Auto</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Plein écran<span class="bascule" style="margin-left:auto"><span>Non</span><span class="on">Oui</span></span></div>
|
||||
<div class="reg">Synchro verticale<span class="bascule" style="margin-left:auto"><span class="on">Non</span><span>Oui</span></span></div>
|
||||
</div>
|
||||
<div><p class="etiq" style="padding-bottom:12px;border-bottom:2px solid var(--encre)">Son et souris</p>
|
||||
<div class="reg">Volume général<span class="jauge" style="margin-left:auto"><i style="width:80%"></i></span><span class="v" style="margin-left:0">80 %</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Musique<span class="jauge" style="margin-left:auto"><i style="width:35%"></i></span><span class="v" style="margin-left:0">35 %</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Blocs et ambiance<span class="jauge" style="margin-left:auto"><i style="width:100%"></i></span><span class="v" style="margin-left:0">100 %</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
<div class="reg">Sensibilité de la souris<span class="jauge" style="margin-left:auto"><i style="width:50%"></i></span><span class="v" style="margin-left:0">50 %</span><span class="pm">−</span><span class="pm">+</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="pied"><span>Enregistré automatiquement</span><span><b>Toutes les options de Minecraft →</b></span></div>
|
||||
</section>
|
||||
|
||||
<!-- ============ PAUSE ============ -->
|
||||
<p class="legende">A · Pause</p>
|
||||
<section class="ecran monde" id="pause">
|
||||
<div style="position:absolute;inset:0;background:rgba(0,0,0,.18)"></div>
|
||||
<div style="position:absolute;left:0;top:0;bottom:0;width:800px;background:#fff;border-right:1px solid var(--encre)">
|
||||
<div class="barre" style="right:auto;width:800px"><span class="code">Gastinel</span><span class="code gris">Échap : reprendre</span></div>
|
||||
<div style="position:absolute;left:120px;right:120px;top:190px">
|
||||
<h1 style="font-size:104px;margin-bottom:48px">Pause</h1>
|
||||
<div class="liste">
|
||||
<div class="ligne prim"><span class="num">01</span><div>Reprendre<small>Monde : New World</small></div><span class="fl">→</span></div>
|
||||
<div class="ligne"><span class="num">02</span>Options</div>
|
||||
<div class="ligne survol"><span class="num">03</span>Progrès<span class="fl">→</span></div>
|
||||
<div class="ligne"><span class="num">04</span>Statistiques</div>
|
||||
<div class="ligne"><span class="num">05</span>Ouvrir en réseau local</div>
|
||||
<div class="ligne"><span class="num">06</span>Mods</div>
|
||||
</div>
|
||||
<div class="ligne" style="margin-top:40px;border-top:1px solid var(--ko);border-bottom-color:var(--ko);color:var(--ko);font-weight:600">Sauvegarder et quitter</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<script src="../commun/nav.js"></script>
|
||||
</body></html>
|
||||
|
Après Largeur: | Hauteur: | Taille: 54 KiB |
|
Après Largeur: | Hauteur: | Taille: 55 KiB |
|
Après Largeur: | Hauteur: | Taille: 625 KiB |
|
Après Largeur: | Hauteur: | Taille: 53 KiB |
|
Après Largeur: | Hauteur: | Taille: 66 KiB |
@@ -45,4 +45,10 @@ public final class Libelles {
|
||||
public static int borne(int v, int min, int max) {
|
||||
return Math.max(min, Math.min(max, v));
|
||||
}
|
||||
|
||||
/** Position de v entre min et max, ramenée dans [0, 1] (pour une jauge). */
|
||||
public static double fraction(int v, int min, int max) {
|
||||
if (max <= min) return 0;
|
||||
return Math.max(0, Math.min(1, (v - min) / (double) (max - min)));
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,8 @@ import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* Écran d'accueil Gastinel : Solo, Serveur Gastinel (un clic), Autres serveurs, Options, Quitter.
|
||||
* Le bouton du serveur affiche son état en direct (ping comme la liste multijoueur vanilla).
|
||||
* Le bouton du serveur affiche son état en direct (ping comme la liste multijoueur vanilla) ;
|
||||
* sur un écran assez large, un panneau à droite le détaille en grands chiffres (proposition A).
|
||||
*/
|
||||
public class AccueilScreen extends EcranGastinel {
|
||||
private final ServerStatusPinger pinger = new ServerStatusPinger();
|
||||
@@ -30,29 +31,32 @@ public class AccueilScreen extends EcranGastinel {
|
||||
super("Accueil", null);
|
||||
}
|
||||
|
||||
private int hautBloc() {
|
||||
return Math.max(34, (this.height - 24 - 168) / 2 + 12);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
this.gastinel = serveurGastinel();
|
||||
int m = marge(), l = colonne();
|
||||
int bloc = 46 + 32 + 4 * 21;
|
||||
int y = Math.max(14, (this.height - 24 - bloc) / 2) + 46;
|
||||
int y = hautBloc() + 58;
|
||||
|
||||
addRenderableWidget(new Bouton(m, y, l, 21, "Solo", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new SelectWorldScreen(this))));
|
||||
y += 21;
|
||||
addRenderableWidget(new Bouton(m, y, l, 32, Config.nom(), Bouton.Genre.PRIMAIRE, this::rejoindreGastinel)
|
||||
.sousTitre(this::sousTitreServeur, () -> couleurEtat));
|
||||
y += 32;
|
||||
addRenderableWidget(new Bouton(m, y, l, 21, "Autres serveurs", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new ServeursScreen(this))));
|
||||
y += 21;
|
||||
addRenderableWidget(new Bouton(m, y, l, 21, "Options", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))));
|
||||
y += 21;
|
||||
addRenderableWidget(new Bouton(m, y, l, 21, "Quitter", Bouton.Genre.MENU, () -> this.minecraft.stop()));
|
||||
addRenderableWidget(new Bouton(m, y, l, 30, Config.nom(), Bouton.Genre.PRIMAIRE, this::rejoindreGastinel)
|
||||
.numero(1).sousTitre(this::sousTitreServeur, () -> Charte.CLAIR).pastille(() -> enLigne() ? Charte.PASTILLE : null));
|
||||
y += 30;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Solo", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new SelectWorldScreen(this))).numero(2));
|
||||
y += 20;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Autres serveurs", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new ServeursScreen(this))).numero(3));
|
||||
y += 20;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Options", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))).numero(4));
|
||||
y += 20;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Quitter", Bouton.Genre.MENU, () -> this.minecraft.stop()).numero(5));
|
||||
|
||||
String mods = "Mods";
|
||||
lien(this.width - m - this.font.width(Charte.txt(mods)), this.height - 20, mods,
|
||||
lien(this.width - m - this.font.width(Charte.txt(mods)), this.height - 16, mods,
|
||||
() -> this.minecraft.setScreen(new ModListScreen(this)));
|
||||
|
||||
// Relancé à chaque retour sur l'accueil : l'état affiché reste frais.
|
||||
@@ -61,6 +65,11 @@ public class AccueilScreen extends EcranGastinel {
|
||||
lancerPing();
|
||||
}
|
||||
|
||||
private boolean enLigne() {
|
||||
ServerData d = this.gastinel;
|
||||
return d != null && d.players != null;
|
||||
}
|
||||
|
||||
/** Reprend l'entrée de la liste multijoueur si elle existe (garde le choix du pack de ressources). */
|
||||
private ServerData serveurGastinel() {
|
||||
String adr = Libelles.nettoyerAdresse(Config.adresse());
|
||||
@@ -80,13 +89,13 @@ public class AccueilScreen extends EcranGastinel {
|
||||
ServerData d = this.gastinel;
|
||||
Thread t = new Thread(() -> {
|
||||
try {
|
||||
pinger.pingServer(d, () -> {}, () -> { etat = "Hors ligne pour le moment"; couleurEtat = Charte.ROUGE; });
|
||||
pinger.pingServer(d, () -> {}, () -> { etat = "Hors ligne pour le moment"; couleurEtat = Charte.ALERTE; });
|
||||
} catch (UnknownHostException e) {
|
||||
etat = "Adresse introuvable";
|
||||
couleurEtat = Charte.ROUGE;
|
||||
couleurEtat = Charte.ALERTE;
|
||||
} catch (Exception e) {
|
||||
etat = "Hors ligne pour le moment";
|
||||
couleurEtat = Charte.ROUGE;
|
||||
couleurEtat = Charte.ALERTE;
|
||||
}
|
||||
}, "GastinelClient ping");
|
||||
t.setDaemon(true);
|
||||
@@ -96,7 +105,7 @@ public class AccueilScreen extends EcranGastinel {
|
||||
private String sousTitreServeur() {
|
||||
ServerData d = this.gastinel;
|
||||
if (d != null && d.players != null) {
|
||||
couleurEtat = Charte.VERT;
|
||||
couleurEtat = Charte.SUCCES;
|
||||
return Libelles.enLigne(d.players.online(), d.players.max(), d.ping);
|
||||
}
|
||||
return etat;
|
||||
@@ -126,11 +135,52 @@ public class AccueilScreen extends EcranGastinel {
|
||||
public void render(GuiGraphics g, int mx, int my, float pt) {
|
||||
super.render(g, mx, my, pt);
|
||||
int m = marge(), l = colonne();
|
||||
int bloc = 46 + 32 + 4 * 21;
|
||||
int y = Math.max(14, (this.height - 24 - bloc) / 2);
|
||||
Charte.texte(g, this.font, Charte.gras("SERVEUR MINECRAFT"), m, y, Charte.ORANGE);
|
||||
Charte.grandTitre(g, this.font, "Gastinel", m - 1, y + 12, 3f, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 45, Charte.ENCRE);
|
||||
int y = hautBloc();
|
||||
barre(g, m, this.width, null);
|
||||
Charte.etiquette(g, this.font, "Serveur Minecraft", m, y, Charte.DOUX);
|
||||
Charte.grandTitre(g, this.font, "Gastinel", m - 2, y + 12, 4f, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 57, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 56, Charte.ENCRE); // filet fort de 2 px au-dessus de la liste
|
||||
panneauEtat(g, m, l, y);
|
||||
piedDePage(g);
|
||||
}
|
||||
|
||||
/** Panneau de droite : état du serveur en grands chiffres. Masqué si l'écran est trop étroit. */
|
||||
private void panneauEtat(GuiGraphics g, int m, int l, int y) {
|
||||
int xs = m + l + m;
|
||||
int x = xs + m, larg = this.width - m - x;
|
||||
if (larg < 150) return;
|
||||
g.fill(xs, 25, xs + 1, this.height - 22, Charte.FILET);
|
||||
Charte.etiquette(g, this.font, "État du serveur · en direct", x, y, Charte.DOUX);
|
||||
ServerData d = this.gastinel;
|
||||
boolean ok = enLigne();
|
||||
String grand = ok ? String.valueOf(d.players.online()) : "—";
|
||||
Charte.grandTitre(g, this.font, grand, x - 2, y + 16, 6f, Charte.ENCRE);
|
||||
int lg = (int) (this.font.width(Charte.titre(grand)) * 6f);
|
||||
if (ok) {
|
||||
Charte.texte(g, this.font, Charte.gras("/ " + d.players.max() + (d.players.max() > 1 ? " joueurs" : " joueur")),
|
||||
x + lg + 6, y + 56, Charte.ENCRE);
|
||||
}
|
||||
// Signal : texte coloré sur fond pâle, jamais la couleur seule.
|
||||
String sig = ok ? "En ligne" : etat;
|
||||
int ls = this.font.width(Charte.gras(sig)) + 10, sy = y + 76;
|
||||
g.fill(x, sy, x + ls, sy + 14, ok ? Charte.SUCCES_FOND : (couleurEtat == Charte.ALERTE ? Charte.ALERTE_FOND : Charte.ALTERNE));
|
||||
Charte.texte(g, this.font, Charte.gras(sig), x + 5, sy + 3, ok ? Charte.SUCCES : couleurEtat);
|
||||
// Trois cases séparées par des filets
|
||||
int cy = sy + 30, lc = Math.min(90, larg * 2 / 7); // la 3e case (adresse) prend le reste
|
||||
Charte.filet(g, x, x + larg, cy, Charte.FILET);
|
||||
String[][] cases = {
|
||||
{"Latence", ok && d.ping >= 0 ? d.ping + " ms" : "—"},
|
||||
{"Version", d != null && d.version != null && ok ? d.version.getString() : "1.21.1"},
|
||||
{"Adresse", Libelles.adresseCourte(d != null ? d.ip : Config.adresse())}};
|
||||
for (int i = 0; i < 3; i++) {
|
||||
int cx = x + i * lc;
|
||||
if (i > 0) g.fill(cx - 8, cy, cx - 7, cy + 40, Charte.FILET);
|
||||
Charte.etiquette(g, this.font, cases[i][0], cx, cy + 10, Charte.DOUX);
|
||||
String v = cases[i][1];
|
||||
int lv = i < 2 ? lc - 12 : larg - 2 * lc;
|
||||
while (v.length() > 1 && this.font.width(Charte.titre(v)) * 1.5f > lv) v = v.substring(0, v.length() - 1);
|
||||
Charte.grandTitre(g, this.font, v, cx, cy + 24, 1.5f, Charte.ENCRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.fml.ModList;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/** Base des écrans Gastinel hors partie : fond maison, marges, pied de page. */
|
||||
/** Base des écrans Gastinel : fond blanc, barre du haut, en-tête, pied de page. */
|
||||
public abstract class EcranGastinel extends Screen {
|
||||
@Nullable protected final Screen parent;
|
||||
|
||||
@@ -30,24 +30,32 @@ public abstract class EcranGastinel extends Screen {
|
||||
@Override
|
||||
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
|
||||
if (this.minecraft != null && this.minecraft.level != null) {
|
||||
// En partie : voile de papier (pas de flou), le monde reste deviné derrière.
|
||||
g.fill(0, 0, this.width, this.height, 0xF0F2F0E6);
|
||||
// En partie : voile blanc presque opaque (pas de flou), le monde reste deviné derrière.
|
||||
g.fill(0, 0, this.width, this.height, 0xF5FFFFFF);
|
||||
} else {
|
||||
Charte.fond(g, this.width, this.height);
|
||||
}
|
||||
}
|
||||
|
||||
/** En-tête : petit libellé orange + titre. Renvoie le y sous l'en-tête. */
|
||||
protected int entete(GuiGraphics g, int x, int y, String surtitre, String titre) {
|
||||
Charte.texte(g, this.font, Charte.gras(surtitre.toUpperCase()), x, y, Charte.ORANGE);
|
||||
Charte.grandTitre(g, this.font, titre, x, y + 14, 2f, Charte.ENCRE);
|
||||
Charte.filet(g, x, x + colonne(), y + 38, Charte.ENCRE);
|
||||
/** Barre du haut : « GASTINEL / Rubrique » à gauche, filet sur toute la largeur. */
|
||||
protected void barre(GuiGraphics g, int x, int largeur, String rubrique) {
|
||||
int l = Charte.etiquette(g, this.font, "Gastinel", x, 9, Charte.ENCRE);
|
||||
if (rubrique != null && !rubrique.isEmpty()) {
|
||||
Charte.etiquette(g, this.font, "/ " + rubrique, x + l + 4, 9, Charte.DOUX);
|
||||
}
|
||||
Charte.filet(g, 0, largeur, 24, Charte.FILET);
|
||||
}
|
||||
|
||||
/** En-tête : barre du haut + grand titre. Renvoie le y sous l'en-tête (y + 46, comme avant). */
|
||||
protected int entete(GuiGraphics g, int x, int y, String rubrique, String titre) {
|
||||
barre(g, x, this.width, rubrique);
|
||||
Charte.grandTitre(g, this.font, titre, x - 1, y + 18, 2f, Charte.ENCRE);
|
||||
return y + 46;
|
||||
}
|
||||
|
||||
protected void piedDePage(GuiGraphics g) {
|
||||
int m = marge(), y = this.height - 18;
|
||||
Charte.filet(g, m, this.width - m, y - 5, Charte.FILET);
|
||||
int m = marge(), y = this.height - 14;
|
||||
Charte.filet(g, m, this.width - m, y - 8, Charte.FILET);
|
||||
String v = ModList.get().getModContainerById("gastinelclient")
|
||||
.map(c -> c.getModInfo().getVersion().toString()).orElse("?");
|
||||
Charte.texte(g, this.font, Charte.txt("Minecraft " + SharedConstants.getCurrentVersion().getName()
|
||||
|
||||
@@ -13,6 +13,7 @@ import net.minecraft.sounds.SoundSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.DoubleSupplier;
|
||||
import java.util.function.IntFunction;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
@@ -21,7 +22,7 @@ import java.util.function.Supplier;
|
||||
* des curseurs vanilla. « Toutes les options » ouvre l'écran complet de Minecraft.
|
||||
*/
|
||||
public class OptionsSimplesScreen extends EcranGastinel {
|
||||
private record Ligne(String nom, Supplier<String> valeur, int x, int y, int l) {}
|
||||
private record Ligne(String nom, Supplier<String> valeur, int x, int y, int l, DoubleSupplier part) {}
|
||||
private record Rubrique(String nom, int x, int y) {}
|
||||
|
||||
private final List<Ligne> lignes = new ArrayList<>();
|
||||
@@ -56,9 +57,9 @@ public class OptionsSimplesScreen extends EcranGastinel {
|
||||
y = pasDouble(x2, y, l, "Blocs et ambiance", o().getSoundSourceOptionInstance(SoundSource.BLOCKS), 0.05);
|
||||
pasDouble(x2, y, l, "Sensibilité de la souris", o().sensitivity(), 0.05);
|
||||
|
||||
lien(m, this.height - 20, "← Retour", this::onClose);
|
||||
lien(m, this.height - 16, "← Retour", this::onClose);
|
||||
String tout = "Toutes les options de Minecraft";
|
||||
lien(this.width - m - this.font.width(Charte.txt(tout)), this.height - 20, tout,
|
||||
lien(this.width - m - this.font.width(Charte.txt(tout)), this.height - 16, tout,
|
||||
() -> this.minecraft.setScreen(new OptionsScreen(this, o())));
|
||||
}
|
||||
|
||||
@@ -70,12 +71,22 @@ public class OptionsSimplesScreen extends EcranGastinel {
|
||||
/** Pas entier, borné sur les limites de l'option (une valeur hors bornes serait remise par défaut). */
|
||||
private int pas(int x, int y, int l, String nom, OptionInstance<Integer> opt, int pas, IntFunction<String> format) {
|
||||
Runnable apres = opt == o().guiScale() ? () -> this.minecraft.resizeDisplay() : () -> {};
|
||||
ajouterPas(x, y, l, nom, () -> format.apply(opt.get()),
|
||||
ajouterPas(x, y, l, nom, () -> format.apply(opt.get()), fraction(opt),
|
||||
() -> { opt.set(borner(opt, opt.get() - pas)); apres.run(); },
|
||||
() -> { opt.set(borner(opt, opt.get() + pas)); apres.run(); });
|
||||
return y + 20;
|
||||
}
|
||||
|
||||
/** Position dans les bornes de l'option, pour la jauge ; null si les bornes sont inconnues (ex. taille de l'interface). */
|
||||
private DoubleSupplier fraction(OptionInstance<Integer> opt) {
|
||||
if (opt == o().guiScale()) return null;
|
||||
int min, max;
|
||||
if (opt.values() instanceof OptionInstance.IntRange r) { min = r.minInclusive(); max = r.maxInclusive(); }
|
||||
else if (opt.values() instanceof OptionInstance.ClampingLazyMaxIntRange r) { min = r.minInclusive(); max = r.maxInclusive(); }
|
||||
else return null;
|
||||
return () -> Libelles.fraction(opt.get(), min, max);
|
||||
}
|
||||
|
||||
private static int borner(OptionInstance<Integer> opt, int v) {
|
||||
if (opt.values() instanceof OptionInstance.IntRange r) return Libelles.borne(v, r.minInclusive(), r.maxInclusive());
|
||||
if (opt.values() instanceof OptionInstance.ClampingLazyMaxIntRange r) return Libelles.borne(v, r.minInclusive(), r.maxInclusive());
|
||||
@@ -83,20 +94,20 @@ public class OptionsSimplesScreen extends EcranGastinel {
|
||||
}
|
||||
|
||||
private int pasDouble(int x, int y, int l, String nom, OptionInstance<Double> opt, double pas) {
|
||||
ajouterPas(x, y, l, nom, () -> Libelles.pourcent(opt.get()),
|
||||
ajouterPas(x, y, l, nom, () -> Libelles.pourcent(opt.get()), opt::get,
|
||||
() -> opt.set(Libelles.pas01(opt.get(), -pas)),
|
||||
() -> opt.set(Libelles.pas01(opt.get(), pas)));
|
||||
return y + 20;
|
||||
}
|
||||
|
||||
private void ajouterPas(int x, int y, int l, String nom, Supplier<String> valeur, Runnable moins, Runnable plus) {
|
||||
lignes.add(new Ligne(nom, valeur, x, y, l - 42));
|
||||
private void ajouterPas(int x, int y, int l, String nom, Supplier<String> valeur, DoubleSupplier part, Runnable moins, Runnable plus) {
|
||||
lignes.add(new Ligne(nom, valeur, x, y, l - 42, part));
|
||||
addRenderableWidget(new Bouton(x + l - 38, y + 2, 17, 15, "−", Bouton.Genre.CADRE, moins));
|
||||
addRenderableWidget(new Bouton(x + l - 17, y + 2, 17, 15, "+", Bouton.Genre.CADRE, plus));
|
||||
}
|
||||
|
||||
private int bascule(int x, int y, int l, String nom, OptionInstance<Boolean> opt) {
|
||||
lignes.add(new Ligne(nom, () -> "", x, y, l - 42));
|
||||
lignes.add(new Ligne(nom, () -> "", x, y, l - 42, null));
|
||||
Bouton[] b = new Bouton[1];
|
||||
b[0] = addRenderableWidget(new Bouton(x + l - 38, y + 2, 38, 15, opt.get() ? "Oui" : "Non", Bouton.Genre.CADRE, () -> {
|
||||
opt.set(!opt.get());
|
||||
@@ -108,26 +119,31 @@ public class OptionsSimplesScreen extends EcranGastinel {
|
||||
@Override
|
||||
public void render(GuiGraphics g, int mx, int my, float pt) {
|
||||
super.render(g, mx, my, pt);
|
||||
entete(g, marge(), 16, "Réglages", "Options");
|
||||
entete(g, marge(), 16, "Options", "Options");
|
||||
int m = marge();
|
||||
int l = Math.min(colonne(), (this.width - 2 * m - 24) / 2);
|
||||
for (Rubrique r : rubriques) {
|
||||
Charte.texte(g, this.font, Charte.gras(r.nom().toUpperCase()), r.x(), r.y(), Charte.DOUX);
|
||||
Charte.etiquette(g, this.font, r.nom(), r.x(), r.y(), Charte.DOUX);
|
||||
Charte.filet(g, r.x(), r.x() + l, r.y() + 11, Charte.ENCRE);
|
||||
Charte.filet(g, r.x(), r.x() + l, r.y() + 12, Charte.ENCRE);
|
||||
}
|
||||
for (Ligne li : lignes) {
|
||||
Charte.texte(g, this.font, Charte.txt(li.nom()), li.x(), li.y() + 6, Charte.ENCRE);
|
||||
String v = li.valeur().get();
|
||||
int vx = li.x() + li.l();
|
||||
if (!v.isEmpty()) {
|
||||
int w = this.font.width(Charte.gras(v));
|
||||
Charte.texte(g, this.font, Charte.gras(v), li.x() + li.l() - w, li.y() + 6, Charte.ENCRE);
|
||||
vx -= this.font.width(Charte.gras(v));
|
||||
Charte.texte(g, this.font, Charte.gras(v), vx, li.y() + 6, Charte.ENCRE);
|
||||
}
|
||||
if (li.part() != null) {
|
||||
// Jauge entre le nom et la valeur, seulement s'il y a la place.
|
||||
int debut = li.x() + this.font.width(Charte.txt(li.nom())) + 8, fin = vx - 8;
|
||||
int lj = Math.min(60, fin - debut);
|
||||
if (lj >= 20) Charte.jauge(g, fin - lj, li.y() + 9, lj, li.part().getAsDouble());
|
||||
}
|
||||
Charte.filet(g, li.x(), li.x() + li.l() + 42, li.y() + 19, Charte.FILET);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
|
||||
super.renderBackground(g, mx, my, pt);
|
||||
// Deux colonnes : on estompe les courbes de niveau pour que les réglages restent lisibles.
|
||||
if (this.minecraft.level == null) g.fill(0, 0, this.width, this.height, 0xC8F2F0E6);
|
||||
Charte.filet(g, m, this.width - m, this.height - 22, Charte.FILET);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -12,7 +12,7 @@ import net.minecraft.network.chat.Component;
|
||||
import net.neoforged.neoforge.client.gui.ModListScreen;
|
||||
|
||||
/**
|
||||
* Menu pause simplifié : un panneau de papier à gauche, le monde visible à droite (sans flou).
|
||||
* Menu pause simplifié : un panneau blanc à gauche, le monde visible à droite (sans flou).
|
||||
* Reprendre, Options, Progrès, Statistiques, (Ouvrir en réseau local), Mods, Quitter.
|
||||
*/
|
||||
public class PauseGastinel extends EcranGastinel {
|
||||
@@ -26,37 +26,38 @@ public class PauseGastinel extends EcranGastinel {
|
||||
|
||||
private int haut() {
|
||||
int n = 5 + (lanPossible() ? 1 : 0);
|
||||
return Math.max(14, (this.height - (46 + 30 + n * 20 + 12 + 20)) / 2);
|
||||
return Math.max(14, (this.height - (58 + 30 + n * 20 + 14 + 20)) / 2 + 8);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
int m = marge(), l = colonne();
|
||||
boolean solo = this.minecraft.isLocalServer();
|
||||
int y = haut() + 46;
|
||||
int y = haut() + 58;
|
||||
int n = 1;
|
||||
|
||||
addRenderableWidget(new Bouton(m, y, l, 30, "Reprendre", Bouton.Genre.PRIMAIRE, this::reprendre)
|
||||
.sousTitre(this::lieu, () -> Charte.DOUX));
|
||||
.numero(n++).sousTitre(this::lieu, () -> Charte.CLAIR));
|
||||
y += 30;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Options", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))));
|
||||
() -> this.minecraft.setScreen(new OptionsSimplesScreen(this))).numero(n++));
|
||||
y += 20;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Progrès", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new AdvancementsScreen(this.minecraft.player.connection.getAdvancements(), this))));
|
||||
() -> this.minecraft.setScreen(new AdvancementsScreen(this.minecraft.player.connection.getAdvancements(), this))).numero(n++));
|
||||
y += 20;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Statistiques", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new StatsScreen(this, this.minecraft.player.getStats()))));
|
||||
() -> this.minecraft.setScreen(new StatsScreen(this, this.minecraft.player.getStats()))).numero(n++));
|
||||
y += 20;
|
||||
if (lanPossible()) {
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Ouvrir en réseau local", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new ShareToLanScreen(this))));
|
||||
() -> this.minecraft.setScreen(new ShareToLanScreen(this))).numero(n++));
|
||||
y += 20;
|
||||
}
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, "Mods", Bouton.Genre.MENU,
|
||||
() -> this.minecraft.setScreen(new ModListScreen(this))));
|
||||
y += 20 + 12;
|
||||
() -> this.minecraft.setScreen(new ModListScreen(this))).numero(n++));
|
||||
y += 20 + 14;
|
||||
addRenderableWidget(new Bouton(m, y, l, 20, solo ? "Sauvegarder et quitter" : "Se déconnecter",
|
||||
Bouton.Genre.PRIMAIRE, this::quitter).accent(Charte.ROUGE));
|
||||
Bouton.Genre.ALERTE, this::quitter));
|
||||
}
|
||||
|
||||
private boolean lanPossible() {
|
||||
@@ -96,8 +97,8 @@ public class PauseGastinel extends EcranGastinel {
|
||||
@Override
|
||||
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
|
||||
int p = panneau();
|
||||
g.fill(0, 0, this.width, this.height, 0x33000000); // monde légèrement assombri, sans flou
|
||||
g.fill(0, 0, p, this.height, 0xF2F2F0E6);
|
||||
g.fill(0, 0, this.width, this.height, 0x2E000000); // monde légèrement assombri, sans flou
|
||||
g.fill(0, 0, p, this.height, Charte.FOND);
|
||||
g.fill(p, 0, p + 1, this.height, Charte.ENCRE);
|
||||
}
|
||||
|
||||
@@ -105,8 +106,12 @@ public class PauseGastinel extends EcranGastinel {
|
||||
public void render(GuiGraphics g, int mx, int my, float pt) {
|
||||
super.render(g, mx, my, pt);
|
||||
int m = marge(), l = colonne(), y = haut();
|
||||
Charte.texte(g, this.font, Charte.gras("GASTINEL"), m, y, Charte.ORANGE);
|
||||
Charte.grandTitre(g, this.font, "Pause", m - 1, y + 12, 3f, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 45, Charte.ENCRE);
|
||||
Charte.etiquette(g, this.font, "Gastinel", m, 9, Charte.ENCRE);
|
||||
String echap = "Échap : reprendre";
|
||||
Charte.etiquette(g, this.font, echap, m + l - Charte.largeurEtiquette(this.font, echap), 9, Charte.DOUX);
|
||||
Charte.filet(g, 0, panneau(), 24, Charte.FILET);
|
||||
Charte.grandTitre(g, this.font, "Pause", m - 2, y, 4f, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 56, Charte.ENCRE);
|
||||
Charte.filet(g, m, m + l, y + 57, Charte.ENCRE);
|
||||
}
|
||||
}
|
||||
@@ -86,9 +86,9 @@ public class ServeursScreen extends EcranGastinel {
|
||||
}
|
||||
}
|
||||
|
||||
lien(m, this.height - 20, "← Retour", this::onClose);
|
||||
lien(m, this.height - 16, "← Retour", this::onClose);
|
||||
String complet = "Liste complète de Minecraft (modifier, supprimer)";
|
||||
lien(this.width - m - this.font.width(Charte.txt(complet)), this.height - 20, complet,
|
||||
lien(this.width - m - this.font.width(Charte.txt(complet)), this.height - 16, complet,
|
||||
() -> this.minecraft.setScreen(new JoinMultiplayerScreen(this)));
|
||||
}
|
||||
|
||||
@@ -139,18 +139,24 @@ public class ServeursScreen extends EcranGastinel {
|
||||
int m = marge(), l = colonne();
|
||||
int y = entete(g, m, 16, "Multijoueur", "Autres serveurs");
|
||||
// Case d'adresse : cadre fin dessiné par nous (pas de bordure vanilla)
|
||||
g.renderOutline(m, y, l, 22, adresse != null && adresse.isFocused() ? Charte.ENCRE : Charte.FILET_FORT);
|
||||
// Case d'adresse : simple trait de 2 px dessous (à l'encre quand elle a le focus).
|
||||
int c = adresse != null && adresse.isFocused() ? Charte.ENCRE : Charte.FILET_FORT;
|
||||
g.fill(m, y + 20, m + l, y + 22, c);
|
||||
int ly = y + 26 + 30;
|
||||
Charte.texte(g, this.font, Charte.gras("ENREGISTRÉS"), m, ly, Charte.DOUX);
|
||||
int le = Charte.etiquette(g, this.font, "Enregistrés", m, ly, Charte.DOUX), fin = m + l;
|
||||
if (!message.isEmpty()) {
|
||||
Charte.texte(g, this.font, Charte.txt(message), m + this.font.width(Charte.gras("ENREGISTRÉS")) + 10, ly, Charte.DOUX);
|
||||
Charte.texte(g, this.font, Charte.txt(message), m + le + 10, ly, Charte.DOUX);
|
||||
fin = Math.max(fin, m + le + 10 + this.font.width(Charte.txt(message)));
|
||||
}
|
||||
Charte.filet(g, m, fin, ly + 11, Charte.ENCRE);
|
||||
Charte.filet(g, m, fin, ly + 12, Charte.ENCRE);
|
||||
Charte.filet(g, m, this.width - m, this.height - 22, Charte.FILET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderBackground(GuiGraphics g, int mx, int my, float pt) {
|
||||
super.renderBackground(g, mx, my, pt);
|
||||
int m = marge(), l = colonne();
|
||||
g.fill(m, 16 + 46, m + l, 16 + 46 + 22, Charte.CARTE);
|
||||
g.fill(m, 16 + 46, m + l, 16 + 46 + 20, Charte.ALTERNE);
|
||||
}
|
||||
}
|
||||
@@ -10,19 +10,22 @@ import net.minecraft.network.chat.Component;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
/**
|
||||
* Bouton plat de la charte : angles droits, filets fins, pas de texture.
|
||||
* MENU : ligne de liste alignée à gauche ; PRIMAIRE : comme MENU avec barre d'accent et sous-titre ;
|
||||
* CADRE : petit bouton encadré centré ; LIEN : texte seul souligné au survol.
|
||||
* Bouton plat de la charte : angles droits, filets de 1 px, pas de texture.
|
||||
* MENU : ligne de liste (numéro gris, texte, filet dessous ; survol = fond alterné + barre d'encre + flèche).
|
||||
* PRIMAIRE : ligne pleine à l'encre, texte blanc, sous-titre gris clair.
|
||||
* ALERTE : ligne au texte rouge sombre entre deux filets rouges (quitter).
|
||||
* CADRE : bouton encadré 1 px, plein à l'encre au survol. LIEN : texte seul souligné au survol.
|
||||
*/
|
||||
public class Bouton extends AbstractButton {
|
||||
public enum Genre { MENU, PRIMAIRE, CADRE, LIEN }
|
||||
public enum Genre { MENU, PRIMAIRE, ALERTE, CADRE, LIEN }
|
||||
|
||||
private final Genre genre;
|
||||
private final Runnable action;
|
||||
private Supplier<String> sousTitre = null;
|
||||
private Supplier<Integer> couleurSousTitre = () -> Charte.DOUX;
|
||||
private int accent = Charte.ORANGE;
|
||||
private Supplier<Integer> pastille = null;
|
||||
private String droite = null;
|
||||
private int numero = 0;
|
||||
|
||||
public Bouton(int x, int y, int l, int h, String texte, Genre genre, Runnable action) {
|
||||
super(x, y, l, h, Component.literal(texte));
|
||||
@@ -36,7 +39,11 @@ public class Bouton extends AbstractButton {
|
||||
return this;
|
||||
}
|
||||
|
||||
public Bouton accent(int c) { this.accent = c; return this; }
|
||||
/** Petit carré de couleur devant le sous-titre (état du serveur) ; null = pas de carré. */
|
||||
public Bouton pastille(Supplier<Integer> c) { this.pastille = c; return this; }
|
||||
|
||||
/** Numéro gris « 01 » en tête de ligne (0 = aucun). */
|
||||
public Bouton numero(int n) { this.numero = n; return this; }
|
||||
|
||||
/** Petit texte gris aligné à droite (ex. adresse d'un serveur). */
|
||||
public Bouton droite(String s) { this.droite = s; return this; }
|
||||
@@ -49,38 +56,58 @@ public class Bouton extends AbstractButton {
|
||||
Font f = Minecraft.getInstance().font;
|
||||
boolean s = this.active && this.isHoveredOrFocused();
|
||||
int x = getX(), y = getY(), l = getWidth(), h = getHeight();
|
||||
int encre = this.active ? Charte.ENCRE : Charte.FILET_FORT;
|
||||
String t = getMessage().getString();
|
||||
int ty = y + (h - 8) / 2;
|
||||
switch (genre) {
|
||||
case MENU, PRIMAIRE -> {
|
||||
if (s) g.fill(x, y, x + l, y + h, Charte.SURVOL);
|
||||
boolean prim = genre == Genre.PRIMAIRE;
|
||||
if (prim || s) g.fill(x, y, x + (prim ? 3 : 2), y + h, prim ? accent : Charte.ENCRE);
|
||||
int tx = x + 12;
|
||||
int encre = prim ? Charte.FOND : (this.active ? Charte.ENCRE : Charte.FILET_FORT);
|
||||
if (prim) g.fill(x, y, x + l, y + h, Charte.ENCRE);
|
||||
else if (s) {
|
||||
g.fill(x, y, x + l, y + h, Charte.ALTERNE);
|
||||
g.fill(x, y, x + 1, y + h, Charte.ENCRE);
|
||||
}
|
||||
int tx = x + 8;
|
||||
if (numero > 0) {
|
||||
Charte.texte(g, f, Charte.gras(String.format("%02d", numero)), tx, ty, prim ? Charte.FILET_FORT : Charte.DOUX);
|
||||
tx += 22;
|
||||
}
|
||||
if (sousTitre != null) {
|
||||
Charte.texte(g, f, Charte.gras(t), tx, y + h / 2 - 10, encre);
|
||||
Charte.texte(g, f, Charte.txt(sousTitre.get()), tx, y + h / 2 + 2, couleurSousTitre.get());
|
||||
Charte.texte(g, f, Charte.txt(t), tx, y + h / 2 - 10, encre);
|
||||
int sx = tx;
|
||||
if (pastille != null && pastille.get() != null) {
|
||||
Charte.carre(g, sx, y + h / 2 + 4, 5, pastille.get());
|
||||
sx += 9;
|
||||
}
|
||||
Charte.texte(g, f, Charte.txt(sousTitre.get()), sx, y + h / 2 + 2, couleurSousTitre.get());
|
||||
} else {
|
||||
Charte.texte(g, f, prim ? Charte.gras(t) : Charte.txt(t), tx, y + (h - 8) / 2, encre);
|
||||
Charte.texte(g, f, Charte.txt(t), tx, ty, encre);
|
||||
}
|
||||
if (droite != null) {
|
||||
Component d = Charte.txt(droite);
|
||||
Charte.texte(g, f, d, x + l - 22 - f.width(d), y + (h - 8) / 2, Charte.DOUX);
|
||||
Charte.texte(g, f, d, x + l - 22 - f.width(d), ty, Charte.DOUX);
|
||||
}
|
||||
if (s) Charte.texte(g, f, Charte.txt("→"), x + l - 14, y + (h - 8) / 2, Charte.ENCRE);
|
||||
Charte.filet(g, x, x + l, y + h - 1, Charte.FILET);
|
||||
if (s || prim) Charte.texte(g, f, Charte.txt("→"), x + l - 14, ty, encre);
|
||||
if (!prim) Charte.filet(g, x, x + l, y + h - 1, Charte.FILET);
|
||||
}
|
||||
case ALERTE -> {
|
||||
if (s) g.fill(x, y, x + l, y + h, Charte.ALERTE_FOND);
|
||||
Charte.filet(g, x, x + l, y, Charte.ALERTE);
|
||||
Charte.filet(g, x, x + l, y + h - 1, Charte.ALERTE);
|
||||
Charte.texte(g, f, Charte.gras(t), x + 8, ty, Charte.ALERTE);
|
||||
if (s) Charte.texte(g, f, Charte.txt("→"), x + l - 14, ty, Charte.ALERTE);
|
||||
}
|
||||
case CADRE -> {
|
||||
if (s) g.fill(x, y, x + l, y + h, Charte.ENCRE);
|
||||
else g.fill(x, y, x + l, y + h, Charte.CARTE);
|
||||
g.renderOutline(x, y, l, h, s ? Charte.ENCRE : Charte.FILET_FORT);
|
||||
int encre = this.active ? Charte.ENCRE : Charte.FILET_FORT;
|
||||
g.fill(x, y, x + l, y + h, s ? Charte.ENCRE : Charte.FOND);
|
||||
g.renderOutline(x, y, l, h, this.active ? Charte.ENCRE : Charte.FILET);
|
||||
Component c = Charte.txt(t);
|
||||
Charte.texte(g, f, c, x + (l - f.width(c)) / 2, y + (h - 8) / 2, s ? Charte.PAPIER : encre);
|
||||
Charte.texte(g, f, c, x + (l - f.width(c)) / 2, ty, s ? Charte.FOND : encre);
|
||||
}
|
||||
case LIEN -> {
|
||||
Component c = Charte.txt(t);
|
||||
Charte.texte(g, f, c, x, y + (h - 8) / 2, s ? Charte.ENCRE : Charte.DOUX);
|
||||
if (s) Charte.filet(g, x, x + f.width(c), y + (h - 8) / 2 + 9, Charte.ENCRE);
|
||||
Charte.texte(g, f, c, x, ty, s ? Charte.ENCRE : Charte.DOUX);
|
||||
if (s) Charte.filet(g, x, x + f.width(c), ty + 9, Charte.ENCRE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,30 +8,31 @@ import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
/**
|
||||
* Charte Gastinel : papier réchauffé, encre presque noire, filets fins, aucun arrondi,
|
||||
* police Inter, et quelques couleurs franches réservées aux éléments clés.
|
||||
* Charte Gastinel (proposition A, « sobre ») : fond blanc, encre #111, gris #6b6b6b, filets #d9d9d9,
|
||||
* police Inter, aucun arrondi, filets de 1 px. La couleur ne sert que de signal (en ligne, hors ligne).
|
||||
* Valeurs reprises de la charte relevée (Mind, météo, Hub).
|
||||
*/
|
||||
public final class Charte {
|
||||
private Charte() {}
|
||||
|
||||
// Couleurs (ARGB)
|
||||
public static final int PAPIER = 0xFFF2F0E6;
|
||||
public static final int CARTE = 0xFFF8F7F1;
|
||||
public static final int SURVOL = 0xFFE9E5D9;
|
||||
public static final int ENCRE = 0xFF2D2A26;
|
||||
public static final int DOUX = 0xFF6F6A61;
|
||||
public static final int FILET = 0xFFDAD5C8;
|
||||
public static final int FILET_FORT = 0xFFB9B1A0;
|
||||
// Accents francs (avec retenue)
|
||||
public static final int ORANGE = 0xFFE8590C;
|
||||
public static final int VERT = 0xFF2B8A3E;
|
||||
public static final int ROUGE = 0xFFC92A2A;
|
||||
public static final int FOND = 0xFFFFFFFF;
|
||||
public static final int ALTERNE = 0xFFF4F4F4;
|
||||
public static final int ENCRE = 0xFF111111;
|
||||
public static final int DOUX = 0xFF6B6B6B;
|
||||
public static final int CLAIR = 0xFFBDBDBD; // texte secondaire sur fond encre
|
||||
public static final int FILET = 0xFFD9D9D9;
|
||||
public static final int FILET_FORT = 0xFF8C8C8C;
|
||||
// Signaux (jamais seuls : toujours avec un texte)
|
||||
public static final int SUCCES = 0xFF1A5C2A;
|
||||
public static final int SUCCES_FOND = 0xFFF0F7F0;
|
||||
public static final int ALERTE = 0xFF8A1C1C;
|
||||
public static final int ALERTE_FOND = 0xFFFDF2F2;
|
||||
public static final int PASTILLE = 0xFF3FBF5F; // carré « en ligne » sur fond encre
|
||||
|
||||
public static final ResourceLocation INTER = rl("inter");
|
||||
public static final ResourceLocation INTER_GRAS = rl("inter_gras");
|
||||
public static final ResourceLocation INTER_TITRE = rl("inter_titre");
|
||||
public static final ResourceLocation FOND = rl("textures/gui/fond.png");
|
||||
private static final int FOND_L = 1920, FOND_H = 1080;
|
||||
|
||||
private static ResourceLocation rl(String p) {
|
||||
return ResourceLocation.fromNamespaceAndPath(GastinelClient.MODID, p);
|
||||
@@ -63,12 +64,37 @@ public final class Charte {
|
||||
g.pose().popPose();
|
||||
}
|
||||
|
||||
/** Arrière-plan « à lui » : papier + courbes de niveau, calé à droite, recouvrant tout l'écran. */
|
||||
/** Arrière-plan : blanc uni. */
|
||||
public static void fond(GuiGraphics g, int w, int h) {
|
||||
g.fill(0, 0, w, h, PAPIER);
|
||||
float k = Math.max(w / (float) FOND_L, h / (float) FOND_H);
|
||||
int dw = Math.round(FOND_L * k), dh = Math.round(FOND_H * k);
|
||||
g.blit(FOND, w - dw, (h - dh) / 2, dw, dh, 0f, 0f, FOND_L, FOND_H, FOND_L, FOND_H);
|
||||
g.fill(0, 0, w, h, FOND);
|
||||
}
|
||||
|
||||
/** Étiquette en capitales, lettrage espacé (« GASTINEL », « ÉTAT DU SERVEUR »). Renvoie la largeur. */
|
||||
public static int etiquette(GuiGraphics g, Font f, String s, int x, int y, int couleur) {
|
||||
int cx = x;
|
||||
for (char ch : s.toUpperCase().toCharArray()) {
|
||||
Component c = gras(String.valueOf(ch));
|
||||
g.drawString(f, c, cx, y, couleur, false);
|
||||
cx += f.width(c) + 1;
|
||||
}
|
||||
return cx - x;
|
||||
}
|
||||
|
||||
public static int largeurEtiquette(Font f, String s) {
|
||||
int l = 0;
|
||||
for (char ch : s.toUpperCase().toCharArray()) l += f.width(gras(String.valueOf(ch))) + 1;
|
||||
return l;
|
||||
}
|
||||
|
||||
/** Pastille carrée (aucun arrondi). */
|
||||
public static void carre(GuiGraphics g, int x, int y, int c, int couleur) {
|
||||
g.fill(x, y, x + c, y + c, couleur);
|
||||
}
|
||||
|
||||
/** Jauge fine : piste grise, partie remplie à l'encre. */
|
||||
public static void jauge(GuiGraphics g, int x, int y, int l, double part) {
|
||||
g.fill(x, y, x + l, y + 2, FILET);
|
||||
g.fill(x, y, x + (int) Math.round(l * Math.max(0, Math.min(1, part))), y + 2, ENCRE);
|
||||
}
|
||||
|
||||
/** Filet horizontal fin. */
|
||||
|
||||
|
Avant Largeur: | Hauteur: | Taille: 438 KiB |
@@ -26,5 +26,8 @@ class LibellesTest {
|
||||
assertEquals(1.0, Libelles.pas01(0.98, 0.05));
|
||||
assertEquals(0.0, Libelles.pas01(0.02, -0.05));
|
||||
assertEquals(32, Libelles.borne(40, 2, 32));
|
||||
assertEquals(0.5, Libelles.fraction(17, 2, 32));
|
||||
assertEquals(1.0, Libelles.fraction(40, 2, 32));
|
||||
assertEquals(0.0, Libelles.fraction(5, 5, 5));
|
||||
}
|
||||
}
|
||||