diff --git a/Website/Media/background2.jpg b/Website/Media/background2.jpg new file mode 100644 index 0000000..bb41488 Binary files /dev/null and b/Website/Media/background2.jpg differ diff --git a/Website/controllers/ControllerUser.php b/Website/controllers/ControllerUser.php index 61f16a0..85d9f61 100644 --- a/Website/controllers/ControllerUser.php +++ b/Website/controllers/ControllerUser.php @@ -39,6 +39,12 @@ class ControllerUser { echo $this->twig->render($this->vues["home"]); } + + function error() + { + echo $this->twig->render($this->vues["error"]); + } + function themeChoice() { $chapters = $this->mdChapter->getChapters(); @@ -46,6 +52,7 @@ class ControllerUser 'chapters' => $chapters, ]); } + function singleplayer() { echo $this->twig->render($this->vues["singleplayer"]); diff --git a/Website/controllers/FrontController.php b/Website/controllers/FrontController.php index 4788dd5..383fa39 100755 --- a/Website/controllers/FrontController.php +++ b/Website/controllers/FrontController.php @@ -13,6 +13,7 @@ class FrontController // Define routes $router->map('GET', '/', 'ControllerUser#home'); // Route pour la page d'accueil + $router->map('GET', '/error', 'ControllerUser#error'); // Route pour la page d'erreur $router->map('GET|POST', '/[a:action]', 'ControllerUser'); //$router->map('GET', '/admin', 'ControllerAdminAdministrators'); $router->map('POST', '/login/[a:action]', 'ControllerUser'); @@ -27,6 +28,7 @@ class FrontController $router->map('GET', '/admin/questions/[a:action]/[i:id]', 'ControllerAdminQuestions'); $router->map('POST', '/user/players/[a:action]', 'ControllerAdminQuestions'); $router->map('GET', '/user/players/[a:action]/[i:id]', 'ControllerAdminQuestions'); + $router->map('GET', '/lobby', 'ControllerUserLobby'); // Match the current request $match = $router->match(); @@ -44,9 +46,9 @@ class FrontController $action = $match['params']['action']; $id = $match['params']['id']; } - $controller = new $controller; - if (is_callable(array($controller, $action))) { - call_user_func_array(array($controller, $action), array($match['params'])); + $controller = new $controller; + if (is_callable(array($controller,$action))) { + call_user_func_array(array($controller,$action), array($match['params'])); } } } catch (Exception $e) { diff --git a/Website/css/confetti.css b/Website/css/confetti.css new file mode 100644 index 0000000..dfc3824 --- /dev/null +++ b/Website/css/confetti.css @@ -0,0 +1,9 @@ +#confetti { + overflow-y: hidden; + overflow-x: hidden; + width: 100%; + margin: 0; + height: 100%; + position: absolute; + top: 0; + } \ No newline at end of file diff --git a/Website/css/global.css b/Website/css/global.css index 4074c21..d118e6f 100644 --- a/Website/css/global.css +++ b/Website/css/global.css @@ -1,5 +1,6 @@ #bodyStyle{ - background: linear-gradient(to bottom, rgba(37, 34, 71, 1), rgba(37, 35, 72, 1)); + background-image: url('../Media/background2.jpg'); + /*background: linear-gradient(to bottom, rgba(37, 34, 71, 1), rgba(37, 35, 72, 1));*/ } @font-face{ @@ -10,4 +11,5 @@ * { font-family: 'MenuFont'; -} \ No newline at end of file +} + diff --git a/Website/index.php b/Website/index.php index 76806ae..d10ed54 100755 --- a/Website/index.php +++ b/Website/index.php @@ -2,6 +2,8 @@ //chargement config require_once(__DIR__ . '/usages/Config.php'); +require_once(__DIR__ . '/usages/Config_DB.php'); + //chargement for twig require __DIR__ . '/vendor/autoload.php'; diff --git a/Website/js/confetti.js b/Website/js/confetti.js new file mode 100644 index 0000000..a700e0c --- /dev/null +++ b/Website/js/confetti.js @@ -0,0 +1,97 @@ +let W = window.innerWidth; +let H = document.getElementById('confetti').clientHeight; +const canvas = document.getElementById('confetti'); +const context = canvas.getContext("2d"); +const maxConfettis = 25; +const particles = []; + +const possibleColors = [ + "#ff7336", + "#f9e038", + "#02cca4", + "#383082", + "#fed3f5", + "#b1245a", + "#f2733f" +]; + +function randomFromTo(from, to) { + return Math.floor(Math.random() * (to - from + 1) + from); +} + +function confettiParticle() { + this.x = Math.random() * W; // x + this.y = Math.random() * H - H; // y + this.r = randomFromTo(11, 33); // radius + this.d = Math.random() * maxConfettis + 11; + this.color = + possibleColors[Math.floor(Math.random() * possibleColors.length)]; + this.tilt = Math.floor(Math.random() * 33) - 11; + this.tiltAngleIncremental = Math.random() * 0.07 + 0.05; + this.tiltAngle = 0; + + this.draw = function() { + context.beginPath(); + context.lineWidth = this.r / 2; + context.strokeStyle = this.color; + context.moveTo(this.x + this.tilt + this.r / 3, this.y); + context.lineTo(this.x + this.tilt, this.y + this.tilt + this.r / 5); + return context.stroke(); + }; +} + +function Draw() { + const results = []; + + // Magical recursive functional love + requestAnimationFrame(Draw); + + context.clearRect(0, 0, W, window.innerHeight); + + for (var i = 0; i < maxConfettis; i++) { + results.push(particles[i].draw()); + } + + let particle = {}; + let remainingFlakes = 0; + for (var i = 0; i < maxConfettis; i++) { + particle = particles[i]; + + particle.tiltAngle += particle.tiltAngleIncremental; + particle.y += (Math.cos(particle.d) + 3 + particle.r / 2) / 2; + particle.tilt = Math.sin(particle.tiltAngle - i / 3) * 15; + + if (particle.y <= H) remainingFlakes++; + + // If a confetti has fluttered out of view, + // bring it back to above the viewport and let if re-fall. + if (particle.x > W + 30 || particle.x < -30 || particle.y > H) { + particle.x = Math.random() * W; + particle.y = -30; + particle.tilt = Math.floor(Math.random() * 10) - 20; + } + } + + return results; +} + +window.addEventListener( + "resize", + function() { + W = window.innerWidth; + H = window.innerHeight; + canvas.width = window.innerWidth; + canvas.height = window.innerHeight; + }, + false +); + +// Push new confetti objects to `particles[]` +for (var i = 0; i < maxConfettis; i++) { + particles.push(new confettiParticle()); +} + +// Initialize +canvas.width = W; +canvas.height = H; +Draw(); \ No newline at end of file diff --git a/Website/templates/adminAdministrators.twig b/Website/templates/adminAdministrators.twig index 04230bf..228865d 100644 --- a/Website/templates/adminAdministrators.twig +++ b/Website/templates/adminAdministrators.twig @@ -1,7 +1,7 @@
-