Compare commits
6 Commits
3ad5811566
...
7a3e8fac3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a3e8fac3c | ||
|
|
137218e2c1 | ||
|
|
ad96b9c04d | ||
| e3747fd5a4 | |||
| 7b0cd8c728 | |||
| dc064dd8f3 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
|||||||
|
Test
|
||||||
31
README.md
31
README.md
@@ -1,20 +1,23 @@
|
|||||||
règles :
|
Règles :
|
||||||
un rayon laser constant
|
Un rayon laser constant
|
||||||
un ou plusieurs spawn
|
Un ou plusieurs laser
|
||||||
laser non movibles, on/off
|
Laser non movibles, on/off
|
||||||
mirroirs orientables
|
Mirroirs orientables
|
||||||
prisme
|
Prisme (dédouble le laser ou le renvoi selon l'angle)
|
||||||
vitre colorée (rjb)
|
Vitre colorée fixe ou placable par le joueur (r,j,b)
|
||||||
bouton allumable par laser spécifique (interaction porte, mirroir, etc)
|
Bouton allumable par clique souris (interaction porte, mirroir, etc)
|
||||||
|
Bouton allumable par laser spécifique (interaction porte, mirroir, etc)
|
||||||
|
|
||||||
|
|
||||||
rayon :
|
Rayon :
|
||||||
rouge - allumage bouton
|
Blanc -> rebondis seulement sur les mirroirs et s'arrête contre les murs
|
||||||
bleu - base
|
Rouge -> Allumage boutons
|
||||||
jaune - traverse tout
|
Bleu -> Rebondis sur toutes les surfaces
|
||||||
|
Jaune -> Traverse tout (mirroir compris)
|
||||||
|
|
||||||
|
|
||||||
systeme de placement d'objet par grille
|
Systeme de placement d'objet par grille
|
||||||
|
|
||||||
|
Comptes utilisateur
|
||||||
|
|
||||||
optionnel : timer, tableau de score,
|
Optionnel : timer, tableau de score,
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
use axum::{routing::get, Router};
|
use axum::{Router, response::Html, routing::get};
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
|
use std::path::Path;
|
||||||
|
use tokio::fs::File;
|
||||||
|
use tokio::io::{self, AsyncReadExt};
|
||||||
|
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let app = Router::new().route("/", get(|| async { "Hello, world!" }));
|
let app = Router::new().route("/", get(handler));
|
||||||
|
|
||||||
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
|
||||||
println!("listening on {}", addr);
|
println!("listening on {}", addr);
|
||||||
@@ -12,3 +15,17 @@ async fn main() {
|
|||||||
.await
|
.await
|
||||||
.unwrap();
|
.unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn handler() -> Html<String> {
|
||||||
|
let html_content = read_html_from_file("../web/templates/view/index.html")
|
||||||
|
.await
|
||||||
|
.unwrap_or_else(|_| "<h1>Error loading HTML file</h1>".to_string());
|
||||||
|
Html(html_content)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn read_html_from_file<P: AsRef<Path>>(path: P) -> io::Result<String> {
|
||||||
|
let mut file = File::open(path).await?;
|
||||||
|
let mut contents = String::new();
|
||||||
|
file.read_to_string(&mut contents).await?;
|
||||||
|
Ok(contents)
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user