Polish tactile et menu : bouton FIRE, mise à l'échelle du menu, boucle musique vérifiée

- TouchControls : bouton FIRE (MOUSE_RIGHT maintenu) — le tir primaire était
  injoignable sur Android
- Menu : mise à l'échelle uniforme sous le logo (5 options débordaient du
  repère 1080 gui fixe de 2017) — desktop 3 options inchangé (s=1)
- Boucle musique vérifiée en jeu : play id=0 loop=true -> MediaPlayer
- Test émulateur : tir visuel confirmé (projectile Lanka, énergie -1/tir)
This commit is contained in:
Siphonight 2026-11-15 15:11:46 +01:00
parent 728436498d
commit 90e1428ff5
3 changed files with 41 additions and 15 deletions

View File

@ -11,13 +11,20 @@ lignée du jeu amont (0.2.2 en 2017, abandonné).
inatteignable depuis le menu) inatteignable depuis le menu)
- Exterminate : écran de victoire "Mission accomplished" + retour menu - Exterminate : écran de victoire "Mission accomplished" + retour menu
(même boucle que la Défense — `completeMission` seul ne montrait rien) (même boucle que la Défense — `completeMission` seul ne montrait rien)
- HUD tactile : bouton **FIRE** (tir primaire maintenu = MOUSE_RIGHT — le
tir au fusil était impossible sur Android)
### Corrigé ### Corrigé
- Menu principal : débordement vertical avec 5 options (le layout 2017 était
figé sur un repère 1080 gui) — le menu se met maintenant à l'échelle sous
le logo (barres, textes et surlignages uniformément, `s=0.80` à 5 options,
rendu identique à l'original sur desktop 3 options)
- `CameraMovement` : suivait la cible en monde non-multiplié par - `CameraMovement` : suivait la cible en monde non-multiplié par
`Screen.scale` (ne rendait correctement qu'à l'échelle 1 du desktop 2017) — `Screen.scale` (ne rendait correctement qu'à l'échelle 1 du desktop 2017) —
classe réparée et documentée (sans usage actuel, SmartCamera partout) classe réparée et documentée (sans usage actuel, SmartCamera partout)
- Menu 5 options : déborde légèrement en bas (barre Quit proche de la barre
de geste) — polish restant ### Confirmé
- Boucle musique Android fonctionnelle (`play id=0 loop=true` → MediaPlayer)
## [0.4.0] — 2026-11-15 ## [0.4.0] — 2026-11-15

View File

@ -37,8 +37,9 @@ import com.ezardlabs.dethsquare.Vector2;
* *
* Boutons : A / D (déplacement), JUMP (saut + double saut), 1-4 (pouvoirs de * Boutons : A / D (déplacement), JUMP (saut + double saut), 1-4 (pouvoirs de
* Frost — injectent ALPHA_1..ALPHA_4, mêmes coûts d'énergie que sur desktop), * Frost — injectent ALPHA_1..ALPHA_4, mêmes coûts d'énergie que sur desktop),
* II (pause = ÉCHAP, ouvre le menu en jeu). Le bouton d'ATTAQUE n'existe pas : * FIRE (tir primaire maintenu = MOUSE_RIGHT, tire dans la direction du
* toucher n'importe où hors bouton = clic maintenu (mélée), comme sur desktop. * regard), II (pause = ÉCHAP, ouvre le menu en jeu). Les touches hors bouton
* restent le "clic maintenu" (mélée + menus), comme sur desktop.
* *
* Rendu : rectangles translucides (white.png teinté) + labels texte police * Rendu : rectangles translucides (white.png teinté) + labels texte police
* bitmap du jeu. Sprites dédiés à dessiner plus tard (voir TODO.md). * bitmap du jeu. Sprites dédiés à dessiner plus tard (voir TODO.md).
@ -52,6 +53,7 @@ public class TouchControls extends Script {
new Button("A", KeyCode.A, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.035f), new Button("A", KeyCode.A, HSide.LEFT, 0.035f, VSide.BOTTOM, 0.035f),
new Button("D", KeyCode.D, HSide.LEFT, 0.135f, VSide.BOTTOM, 0.035f), new Button("D", KeyCode.D, HSide.LEFT, 0.135f, VSide.BOTTOM, 0.035f),
new Button("JUMP", KeyCode.SPACE, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.215f), new Button("JUMP", KeyCode.SPACE, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.215f),
new Button("FIRE", KeyCode.MOUSE_RIGHT, HSide.RIGHT, 0.035f, VSide.BOTTOM, 0.035f),
new Button("II", KeyCode.ESCAPE, HSide.LEFT, 0.035f, VSide.TOP, 0.045f), new Button("II", KeyCode.ESCAPE, HSide.LEFT, 0.035f, VSide.TOP, 0.045f),
// Pouvoirs de Frost : colonne gauche entre II (haut) et A/D (bas). // Pouvoirs de Frost : colonne gauche entre II (haut) et A/D (bas).
// Coûts d'énergie identiques au desktop (5/10/25/50) — l'injection // Coûts d'énergie identiques au desktop (5/10/25/50) — l'injection

View File

@ -5,6 +5,7 @@ import com.ezardlabs.dethsquare.GuiRenderer;
import com.ezardlabs.dethsquare.GuiText; import com.ezardlabs.dethsquare.GuiText;
import com.ezardlabs.dethsquare.Input; import com.ezardlabs.dethsquare.Input;
import com.ezardlabs.dethsquare.Input.KeyCode; import com.ezardlabs.dethsquare.Input.KeyCode;
import com.ezardlabs.dethsquare.Screen;
import com.ezardlabs.dethsquare.Script; import com.ezardlabs.dethsquare.Script;
import com.ezardlabs.dethsquare.TextureAtlas; import com.ezardlabs.dethsquare.TextureAtlas;
import com.ezardlabs.dethsquare.Time; import com.ezardlabs.dethsquare.Time;
@ -57,40 +58,56 @@ public class Menu extends Script {
public void start() { public void start() {
runWhenPaused = true; runWhenPaused = true;
pieces = new GameObject[options.length]; pieces = new GameObject[options.length];
/*
* Mise à l'échelle du menu : avec l'arrivée des niveaux Exterminate et
* Survival (5 options), le menu 2017 (768 gui de haut pour 5 options)
* débordait de l'écran Android. On calcule l'espace GUI réellement
* visible sous le logo (logo : y 15..240 gui), et on scale
* uniformément barres/textes/surlignages si nécessaire. À 3 options
* (desktop 2017), s = 1 : rendu identique à l'original.
*/
float guiVisibleHeight = Screen.height / (Screen.width / 1920f);
final float LOGO_BOTTOM = 240f; // bas du logo MainMenuLevel (900x225 @ y15)
float height = (options.length - 1) * 156 + 144;
float s = Math.min(1f, (guiVisibleHeight - LOGO_BOTTOM - 8f) / height);
float y0 = LOGO_BOTTOM + 8f;
float pieceWidth = 816 * s;
float pieceHeight = 156 * s;
float spacing = 156 * s;
pieces[0] = GameObject.instantiate( pieces[0] = GameObject.instantiate(
new GameObject("Menu Piece 0", new GuiRenderer("images/menus/main/top.png", 816, 156)), new Vector2()); new GameObject("Menu Piece 0", new GuiRenderer("images/menus/main/top.png", pieceWidth, pieceHeight)), new Vector2());
for (int i = 1; i < pieces.length - 1; i++) { for (int i = 1; i < pieces.length - 1; i++) {
pieces[i] = GameObject.instantiate( pieces[i] = GameObject.instantiate(
new GameObject("Menu Piece " + i, new GuiRenderer("images/menus/main/middle.png", 816, 156)), new GameObject("Menu Piece " + i, new GuiRenderer("images/menus/main/middle.png", pieceWidth, pieceHeight)),
new Vector2()); new Vector2());
} }
pieces[pieces.length - 1] = GameObject.instantiate(new GameObject("Menu Piece " + (pieces.length - 1), pieces[pieces.length - 1] = GameObject.instantiate(new GameObject("Menu Piece " + (pieces.length - 1),
new GuiRenderer("images/menus/main/bottom.png", 816, 144)), new Vector2()); new GuiRenderer("images/menus/main/bottom.png", pieceWidth, 144 * s)), new Vector2());
texts = new GameObject[options.length]; texts = new GameObject[options.length];
guiTexts = new GuiText[options.length]; guiTexts = new GuiText[options.length];
for (int i = 0; i < texts.length; i++) { for (int i = 0; i < texts.length; i++) {
guiTexts[i] = new GuiText(options[i], TextureAtlas.load("fonts"), 50, 1); guiTexts[i] = new GuiText(options[i], TextureAtlas.load("fonts"), 50 * s, 1);
texts[i] = GameObject.instantiate(new GameObject("Menu Option", guiTexts[i]), new Vector2()); texts[i] = GameObject.instantiate(new GameObject("Menu Option", guiTexts[i]), new Vector2());
} }
highlights = new GameObject[options.length]; highlights = new GameObject[options.length];
for (int i = 0; i < highlights.length - 1; i++) { for (int i = 0; i < highlights.length - 1; i++) {
highlights[i] = GameObject.instantiate( highlights[i] = GameObject.instantiate(
new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight.png", 156, 66)), new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight.png", 156 * s, 66 * s)),
new Vector2()); new Vector2());
} }
highlights[highlights.length - 1] = GameObject.instantiate( highlights[highlights.length - 1] = GameObject.instantiate(
new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight_bottom.png", 414, 66)), new GameObject("Menu Highlight", new GuiRenderer("images/menus/main/highlight_bottom.png", 414 * s, 66 * s)),
new Vector2()); new Vector2());
float height = (options.length - 1) * 156 + 144;
for (int i = 0; i < options.length; i++) { for (int i = 0; i < options.length; i++) {
pieces[i].transform.position.set(960 - 408, 540 - height / 2 + 156 * i); pieces[i].transform.position.set(960 - pieceWidth / 2 + offset.x, y0 + spacing * i);
highlights[i].transform.position.set(pieces[i].transform.position.offset(i == texts.length - 1 ? 66 : 636, highlights[i].transform.position.set(pieces[i].transform.position.offset(
i == texts.length - 1 ? 54 : 25)); (i == texts.length - 1 ? 66 : 636) * s, (i == texts.length - 1 ? 54 : 25) * s));
texts[i].transform.position.set( texts[i].transform.position.set(
pieces[i].transform.position.offset(150, 40 + (i == texts.length - 1 ? 28 : 0))); pieces[i].transform.position.offset(150 * s, (40 + (i == texts.length - 1 ? 28 : 0)) * s));
} }
if (startOpen) { if (startOpen) {
open(); open();