Skip to content

Commit

Permalink
add bootstrap buttons and forms
Browse files Browse the repository at this point in the history
  • Loading branch information
nadarbreicq committed Mar 23, 2024
1 parent d20fd9c commit 12b8b0d
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 32 deletions.
64 changes: 48 additions & 16 deletions docs/pages/calculateur-score-2024/calculateur-score-2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,54 @@ layout: default
title: Calculateur de Score
nav_order: 5
---
<form id="formScore">
<label>Plantes valides: <input type="number" id="plantesValides" min="0" value="0"></label><br>
<label>Plantes en pot: <input type="number" id="plantesEnPot" min="0" value="0"></label><br>
<label>Plantes en jardinière: <input type="number" id="plantesEnJardiniere" min="0" value="0"></label><br>
<label>Panneaux solaires orientés: <input type="number" id="panneauxSolaires" min="0" value="0"></label><br>
<label>Zones de pollinisation: <input type="number" id="zonesPollinisation" min="0" value="0"></label><br>
<label>Zones de pollinisation avec contact: <input type="number" id="zonesPollinisationAvecContact" min="0" value="0"></label><br>
<label>Robot dans l'aire valide: <input type="checkbox" id="robotDansAireValide"></label><br>
<label>Equipe non forfait (1pt): <input type="checkbox" id="equipeNonForfait"></label><br>
<label>Score estimé: <input type="number" id="scoreEstime" min="0" value="0"></label><br>
<button type="button" onclick="calculerEtAfficherScore()">Calculer le Score</button>
</form>
<div id="scoreSansBonus">Score sans bonus : 0</div>
<div id="bonus">Bonus : 0</div>
<div id="scorePollinisation">Score de Pollinisation : 0</div>
<div id="scoreTotal">Score total : 0</div>

# Calculateur de Score 2024

<div class="container mt-5">
<form id="formScore">
<div class="form-group">
<label for="plantesValides">Plantes valides:</label>
<input type="number" class="form-control" id="plantesValides" min="0" value="0">
</div>
<div class="form-group">
<label for="plantesEnPot">Plantes en pot:</label>
<input type="number" class="form-control" id="plantesEnPot" min="0" value="0">
</div>
<div class="form-group">
<label for="plantesEnJardiniere">Plantes en jardinière:</label>
<input type="number" class="form-control" id="plantesEnJardiniere" min="0" value="0">
</div>
<div class="form-group">
<label for="panneauxSolaires">Panneaux solaires orientés:</label>
<input type="number" class="form-control" id="panneauxSolaires" min="0" value="0">
</div>
<div class="form-group">
<label for="zonesPollinisation">Zones de pollinisation:</label>
<input type="number" class="form-control" id="zonesPollinisation" min="0" value="0">
</div>
<div class="form-group">
<label for="zonesPollinisationAvecContact">Zones de pollinisation avec contact:</label>
<input type="number" class="form-control" id="zonesPollinisationAvecContact" min="0" value="0">
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="robotDansAireValide">
<label class="form-check-label" for="robotDansAireValide">Robot dans l'aire valide</label>
</div>
<div class="form-group form-check">
<input type="checkbox" class="form-check-input" id="equipeNonForfait">
<label class="form-check-label" for="equipeNonForfait">Equipe non forfait (1pt)</label>
</div>
<div class="form-group">
<label for="scoreEstime">Score estimé:</label>
<input type="number" class="form-control" id="scoreEstime" min="0" value="0">
</div>
<button type="button" class="btn btn-primary mt-4" onclick="calculerEtAfficherScore()">Calculer le Score</button>
</form>
<div id="scoreSansBonus" class="mt-3">Score sans bonus : 0</div>
<div id="bonus" class="mt-3">Bonus : 0</div>
<div id="scorePollinisation" class="mt-3">Score de Pollinisation : 0</div>
<div id="scoreTotal" class="mt-3">Score total : 0</div>
</div>


<script src="calculateur-score-2024.js"></script>
20 changes: 17 additions & 3 deletions docs/pages/strategy-2024/generateur-2024.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,24 @@ nav_order: 4

<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.9.1/p5.js"></script>
<script src="https://cdn.jsdelivr.net/npm/quicksettings@latest/quicksettings.min.js"></script>
<script src="p5.gui.js"></script>
<script src="p5.gui.js"></script>
<link rel="stylesheet" type="text/css" href="style.css">

<div id="ui-container"></div>
<div id="ui-container" class="container">
<div id="checkboxContainer" class="col mb-2">
<!-- Les cases à cocher seront ajoutées ici par p5.js -->
</div>
<div id="buttonsContainer" class="col mb-2">
<!-- Les boutons seront ajoutés ici par p5.js -->
</div>
<div id="robotContainer" class="col mb-2">
<!-- Les boutons de la simu robot ajoutés ici par p5.js -->
</div>
<div id="fileInputContainer" class="col mb-2">
<!-- L'input de fichier sera ajouté ici par p5.js -->
</div>
</div>

<div id="p5-container"></div>

<script src="sketch.js"></script>
<script src="sketch.js"></script>
43 changes: 30 additions & 13 deletions docs/pages/strategy-2024/sketch.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,39 +61,51 @@ function draw() {
}

function setupUI() {
// Initialisation des checkboxes avec style Bootstrap
cb_POI = createCheckbox("POIs", afficherPOI);
cb_POI.parent('ui-container');
cb_POI.parent('checkboxContainer');
cb_POI.changed(majPOI);
cb_POI.class('form-check-label');

cb_DeleteOption = createCheckbox("Delete Mode", deleteOption);
cb_DeleteOption.parent('ui-container');
cb_DeleteOption.parent('checkboxContainer');
cb_DeleteOption.changed(majDeleteOption);
cb_DeleteOption.class('form-check-label');

// Initialisation des boutons avec style Bootstrap
let btnClear = createButton("Clear Stratégie");
btnClear.parent('ui-container');
btnClear.parent('buttonsContainer');
btnClear.mousePressed(clearStrategie);
btnClear.class('btn btn-warning mr-2');

let btnSave = createButton("Quick save");
btnSave.parent('ui-container');
btnSave.parent('buttonsContainer');
btnSave.mousePressed(saveStrategie);
btnSave.class('btn btn-success mr-2');

let btnLoad = createButton("Quick load");
btnLoad.parent('ui-container');
btnLoad.parent('buttonsContainer');
btnLoad.mousePressed(loadStrategie);
btnLoad.class('btn btn-info mr-2');

let btnExport = createButton('Export JSON');
btnExport.parent('ui-container');
btnExport.parent('buttonsContainer');
btnExport.mousePressed(exporterStrategie);
btnExport.class('btn btn-primary mr-2');

let btnExportCPP = createButton('Export CPP');
btnExportCPP.parent('ui-container');
btnExportCPP.parent('buttonsContainer');
btnExportCPP.mousePressed(exporterCPP);
btnExportCPP.class('btn btn-secondary mr-2');

// Initialisation de l'input de fichier
let inputImport = createFileInput(handleFile);
inputImport.parent('ui-container');
inputImport.parent('fileInputContainer');

// Contrôles de lecture
let btnLecture = createButton('Play');
btnLecture.parent('ui-container');
btnLecture.parent('robotContainer');
btnLecture.class('btn btn-light mr-2');
btnLecture.mousePressed(() => {
if (etatRobot !== 'lecture') { // Si le robot n'est pas déjà en lecture, réinitialisez sa position
positionRobot = 0;
Expand All @@ -102,21 +114,26 @@ function setupUI() {
});

let btnPause = createButton('Pause');
btnPause.parent('robotContainer');
btnPause.class('btn btn-light mr-2');
btnPause.mousePressed(() => etatRobot = 'pause');
btnPause.parent('ui-container');

let btnStop = createButton('Stop');
btnStop.parent('robotContainer');
btnStop.class('btn btn-light mr-2');
btnStop.mousePressed(() => {
etatRobot = 'arrêté';
positionRobot = 0; // Réinitialiser la position du robot
});
btnStop.parent('ui-container');

let curseurVitesse = createSlider(0, 100, 50); // Min, Max, Valeur par défaut
// Curseur de vitesse
let curseurVitesse = createSlider(0, 100, 50);
curseurVitesse.parent('robotContainer');
curseurVitesse.class('custom-range');
curseurVitesse.input(() => vitesseRobot = curseurVitesse.value() / 100);
curseurVitesse.parent('ui-container');
}


function drawRobot() {
if (pointsStrategie.length > 1 && (etatRobot === 'lecture' || etatRobot === 'pause')) {
let indexActuel = Math.floor(positionRobot);
Expand Down

0 comments on commit 12b8b0d

Please sign in to comment.