8 Commits

Author SHA1 Message Date
M1n-0
edbeda7fae testfile 2026-03-31 09:23:35 +02:00
M1n-0
2f26815cd4 testfile 2026-03-31 09:23:18 +02:00
GreyRav
ccea905b69 fix : change port 2026-03-30 15:25:37 +02:00
GreyRav
3a8219f867 fix : html + css display 2026-03-30 15:22:43 +02:00
Sysy's
b2c18ac45e Add hero page HTML and responsive CSS
Add a new landing view and stylesheet for MirrorGame. Creates web/templates/view/index.html (hero layout with image, play button, and left/right ad banner iframes) and web/assets/css/index.css (CSS variables, Inter font import, hero layout, responsive breakpoints, and .hero-play-button styles). Provides responsive behavior and positioning for ads and hero components.
2026-03-30 15:22:43 +02:00
GreyRav
7a3e8fac3c fix : path to index.html 2026-03-30 12:40:05 +02:00
GreyRav
137218e2c1 add : all folder + files for backend project 2026-03-30 11:55:00 +02:00
GreyRav
ad96b9c04d add : gitignore for target forlder 2026-03-30 11:55:00 +02:00
7 changed files with 345 additions and 69 deletions

49
backend/Cargo.lock generated
View File

@@ -91,6 +91,7 @@ dependencies = [
"axum-server",
"serde",
"tokio",
"tower-http",
"tracing-subscriber",
]
@@ -256,6 +257,12 @@ dependencies = [
"pin-project-lite",
]
[[package]]
name = "http-range-header"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c"
[[package]]
name = "httparse"
version = "1.10.1"
@@ -366,6 +373,16 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a"
[[package]]
name = "mime_guess"
version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e"
dependencies = [
"mime",
"unicase",
]
[[package]]
name = "mio"
version = "1.2.0"
@@ -661,6 +678,32 @@ dependencies = [
"tracing",
]
[[package]]
name = "tower-http"
version = "0.6.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8"
dependencies = [
"bitflags",
"bytes",
"futures-core",
"futures-util",
"http",
"http-body",
"http-body-util",
"http-range-header",
"httpdate",
"mime",
"mime_guess",
"percent-encoding",
"pin-project-lite",
"tokio",
"tokio-util",
"tower-layer",
"tower-service",
"tracing",
]
[[package]]
name = "tower-layer"
version = "0.3.3"
@@ -719,6 +762,12 @@ dependencies = [
"tracing-log",
]
[[package]]
name = "unicase"
version = "2.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142"
[[package]]
name = "unicode-ident"
version = "1.0.24"

View File

@@ -9,3 +9,4 @@ axum-server = "0.8.0"
serde = "1.0.228"
tokio = { version = "1.50.0", features = ["full"] }
tracing-subscriber = "0.3.23"
tower-http = { version = "0.6", features = ["fs"] }

View File

@@ -1,14 +0,0 @@
struct Laser {
color : array,
}
struct Mirror {
color : array,
x : int,
y : int,
}
struct Spawn {
x : int,
y : int,
}

View File

@@ -1,14 +1,34 @@
use axum::{routing::get, Router};
use axum::{Router, response::Html, routing::get};
use std::net::SocketAddr;
use std::path::Path;
use tokio::fs::File;
use tokio::io::{self, AsyncReadExt};
use tower_http::services::ServeDir;
#[tokio::main]
async fn main() {
let app = Router::new().route("/", get(|| async { "Hello, world!" }));
let app = Router::new()
.route("/", get(handler))
.nest_service("/assets", ServeDir::new("../web/assets"));
let addr = SocketAddr::from(([127, 0, 0, 1], 3000));
let addr = SocketAddr::from(([127, 0, 0, 1], 3500));
println!("listening on {}", addr);
axum_server::bind(addr)
.serve(app.into_make_service())
.await
.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)
}

View File

@@ -1,52 +0,0 @@
use sqlite::Connection;
pub struct DataBase {
connection: Connection,
}
impl DataBase {
pub fn open(name: String) -> DataBase {
let connection = sqlite::open(name + ".db").unwrap();
DataBase { connection }
}
fn data_execute(&self, arg: String){
self.connection.execute(arg).unwrap();
}
fn create_table(&self, table: String){
self.data_execute("CREATE TABLE ".to_owned() + &table + ";");
}
fn add_column(&self, table: String, arg: String){
self.data_execute("ALTER TABLE ".to_owned() + &table + " ADD " + &arg + ";");
}
}
pub fn main() {
let db = DataBase::open(String::from("test"));
db.create_table("test".to_string());
db.add_column("test".to_string(), "name TEXT".to_string());
// println!("Hello, world!");
// let connection = sqlite::open("test.db").unwrap();
// let query = "
// CREATE TABLE users (name TEXT, age INTEGER);
// INSERT INTO users VALUES ('Alice', 42);
// INSERT INTO users VALUES ('Bob', 69);
// ";
// connection.execute(query).unwrap();
}
// struct User {
// name : string,
// level : int,
// }
// impl User {
// fn Create(&self){
// }
// }

View File

@@ -0,0 +1,244 @@
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100..900&display=swap');
* {
--clr-light-a0: #ffffff;
--clr-light-a10: #f4f4f4;
--clr-light-a20: #e0e0e0;
--clr-light-a30: #c2c2c2;
--clr-light-a40: #a3a3a3;
--clr-light-a50: #858585;
--clr-dark: #000000;
--clr-surface-a0: #FFF6E5;
--clr-surface-a10: #f7f7f7;
--clr-surface-a20: #DADEEF;
--clr-surface-a30: #e0e0e0;
--clr-surface-a40: #d1d1d1;
--clr-surface-a50: #c2c2c2;
box-sizing: border-box;
}
html {
font-size: 100%;
}
body {
background-color: var(--clr-surface-a0);
font-family: 'Inter', sans-serif;
margin: 0;
padding: 0;
}
.hero {
position: relative;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
min-height: 100vh;
gap: 3rem;
padding: 2rem clamp(1rem, 4vw, 3rem);
box-sizing: border-box;
background: var(--clr-surface-a10);
}
.adsbanner {
position: absolute;
top: 50%;
left: clamp(0.75rem, 3vw, 2.5rem);
transform: translateY(-50%);
z-index: 5;
width: clamp(160px, 22vw, 300px);
aspect-ratio: 9 / 16;
box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}
.adsbanner.is-hidden {
display: none;
}
.leftadsbanner {
position: absolute;
top: 50%;
right: clamp(0.75rem, 3vw, 2.5rem);
transform: translateY(-50%);
z-index: 5;
width: clamp(160px, 22vw, 300px);
aspect-ratio: 9 / 16;
}
.hero-content {
max-width: 90vw;
text-align: left;
display: flex;
flex-direction: column;
align-items: center;
background: var(--clr-surface-a20);
border-radius: 1.5rem;
padding: 2rem clamp(2rem, 8vw, 10rem);
box-shadow: 0px 0px 27px 14px rgba(0,0,0,0.2);
}
.hero-content-text {
width: 100%;
}
.hero h1 {
color: var(--clr-dark);
font-size: clamp(2.5rem, 7vw, 4rem);
margin: 0 0 1rem 0;
line-height: 1.1;
word-break: break-word;
text-shadow: none;
}
.hero-content button {
margin-top: 2rem;
align-self: center;
}
.hero img {
max-width: 400px;
width: 35vw;
min-width: 180px;
height: auto;
border-radius: 1.5rem;
box-shadow: 0 6px 32px rgba(0,0,0,.10);
flex-shrink: 1;
background: var(--clr-surface-a0);
}
/* --- RESPONSIVE HERO-PLAY-BUTTON FIXES --- */
@media (max-width: 900px) {
.hero {
flex-direction: column;
text-align: center;
gap: 2rem;
padding: 1.5rem;
}
.hero-content {
max-width: 100vw;
text-align: center;
padding: 2rem;
}
.hero-content {
align-items: center;
}
.adsbanner {
left: 1rem;
width: clamp(130px, 24vw, 220px);
}
.leftadsbanner {
right: 1rem;
width: clamp(130px, 24vw, 220px);
}
.hero img {
max-width: 70vw;
min-width: 0;
}
.hero-play-button {
padding: 1rem 4vw;
font-size: 1.1rem;
min-width: min(220px, 70vw);
max-width: 90vw;
}
.hero-play-button svg {
width: 2em;
height: 1em;
min-width: 1.25em;
min-height: 1em;
margin-right: 0.5em;
flex-shrink: 0;
}
}
@media (max-width: 600px) {
.hero {
min-height: 70vh;
padding: 0.5rem;
}
.hero-content {
padding: 1.5rem;
}
.hero h1 {
font-size: clamp(2rem, 9vw, 2.5rem);
}
.hero p {
font-size: clamp(1rem, 5vw, 1.15rem);
}
.adsbanner {
top: 1rem;
left: 0.75rem;
transform: none;
width: clamp(110px, 30vw, 170px);
border-radius: 1rem;
}
.leftadsbanner {
right: 0.75rem;
width: clamp(110px, 30vw, 170px);
border-radius: 1rem;
}
.hero img {
max-width: 100%;
border-radius: 1rem;
box-shadow: 0 2px 12px rgba(0,0,0,.07);
}
.hero-play-button {
padding: 0.85rem 3vw;
min-width: min(120px, 92vw);
max-width: 96vw;
font-size: 1rem;
}
.hero-play-button svg {
width: 1.3em;
height: 1em;
min-width: 1em;
min-height: 1em;
margin-right: 0.45em;
flex-shrink: 0;
}
}
.hero-play-button {
font-family: inherit;
font-size: 20px;
background: #8ea3fd;
color: white;
padding: 1rem 10rem;
display: flex;
align-items: center;
justify-content: center; /* Ensure SVG/button content is horizontally centered */
border: none;
border-radius: 50px;
overflow: hidden;
transition: all 0.2s;
cursor: pointer;
box-shadow: 0 2px 8px rgba(30, 80, 255, 0.10);
/* Button grows/shrinks with container at low widths */
width: 100%;
max-width: 500px;
min-width: 180px;
box-sizing: border-box;
}
.hero-play-button:hover {
background: #7286e0;
transform: translateY(-2px);
}
.hero-play-button:active {
transform: scale(0.95);
}
.hero-play-button svg {
width: 2em;
height: 1em;
min-width: 1.2em;
min-height: 1em;
margin-right: 0.6em;
color: var(--clr-surface-a0);
flex-shrink: 0;
flex-grow: 0;
display: inline-block;
vertical-align: middle;
}

File diff suppressed because one or more lines are too long