diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..6d53b70 Binary files /dev/null and b/favicon.ico differ diff --git a/favicon.php b/favicon.php index 16c34ce..2757755 100644 --- a/favicon.php +++ b/favicon.php @@ -2,43 +2,15 @@ header('Content-Type: image/x-icon'); const SIZE = 16; -const WALL = 1; -const GROUND = 0; -$favicon = imagecreatetruecolor(SIZE, SIZE); -$wallColor = imagecolorallocate($favicon, 165, 80, 30); -$groundColor = imagecolorallocate($favicon, 203, 162, 133); +$x = filter_input(INPUT_GET, "x", FILTER_SANITIZE_NUMBER_INT); +$y = filter_input(INPUT_GET, "y", FILTER_SANITIZE_NUMBER_INT); -imagefill($favicon, 0, 0, $wallColor); +$favicon = imagecreatefrombmp("favicon.ico"); -$maze = array(); -for ($y = 0; $y < SIZE; $y++) { - $maze[$y] = array(); - for ($x = 0; $x < SIZE; $x++) { - $maze[$y][$x] = WALL; - } -} +$red = imagecolorallocate($favicon, 255, 0, 0); +imagesetpixel($favicon, $x, $y, $red); -function dig($position) { - global $maze; - global $favicon; - global $groundColor; - $directions = [[0, 1], [0, -1], [1, 0], [-1, 0]]; - shuffle($directions); - foreach ($directions as $direction) { - $step1 = [$position[0] + $direction[0], $position[1] + $direction[1]]; - $step2 = [$step1[0] + $direction[0], $step1[1] + $direction[1]]; - if (0 <= $step2[1] and $step2[1] < SIZE and 0 <= $step2[0] and $step2[0] < SIZE and $maze[$step2[1]][$step2[0]] == WALL) { - $maze[$step1[1]][$step1[0]] = GROUND; - imagesetpixel($favicon, $step1[0], $step1[1], $groundColor); - $maze[$step2[1]][$step2[0]] = GROUND; - imagesetpixel($favicon, $step2[0], $step2[1], $groundColor); - dig($step2); - } - } -} - -dig([1, 1]); imagebmp($favicon); imagedestroy($favicon); ?> \ No newline at end of file diff --git a/index.html b/index.html index 07e1caa..6019afc 100644 --- a/index.html +++ b/index.html @@ -4,7 +4,7 @@ Daedalus - + @@ -12,8 +12,8 @@ diff --git a/main.js b/main.js index 5092d26..386f86e 100644 --- a/main.js +++ b/main.js @@ -122,6 +122,12 @@ if (!dev) { mazeCollisionner.add(clone); } + setInterval(() => { + let x = Math.floor(8 + camera.position.x * 16 / mazeWidth) + let y = Math.floor(8 + camera.position.z * 16 / mazeWidth) + favicon.href = `favicon.php?x=${x}&y=${y}` + }, 1000); + } // Ground