Title screen: licence line and a link to the repository at the bottom

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Richard ZinkandClaude Opus 5.5 committed 2026-11-03 13:06:58 +01:00
1 parent 6e257e4034
commit f298e13d6e
6 files changed
+34

No files matched your search

+21
View File
@@ -201,8 +201,11 @@ enum Btn {
Mission(usize),
StartMission,
Goals,
Repo,
}
pub const REPO_URL: &str = "https://git.familie-zink.org/zink/dungeoncraft";
pub enum MenuAction {
None,
Consumed,
@@ -221,6 +224,7 @@ pub enum MenuAction {
CloudDelete(String),
EditName, // the name field was tapped (touch: ask with a browser dialog)
StartMission(usize),
OpenRepo,
}
pub struct Menu {
@@ -403,6 +407,7 @@ impl Menu {
MenuAction::Consumed
}
Some(Btn::NameField) => MenuAction::EditName,
Some(Btn::Repo) => MenuAction::OpenRepo,
Some(Btn::Campaign) => {
self.page = Some(Page::Campaign);
self.scroll = 0;
@@ -502,6 +507,22 @@ impl Menu {
gfx.text(&hint, grid_center(sw, gfx.measure(&hint, SMALL())), sh - CH() * 8.0, SMALL(), DIM);
let credit = tr("help.font");
gfx.text(&credit, grid_center(sw, gfx.measure(&credit, SMALL())), sh - CH() * 7.0, SMALL(), DIM);
self.draw_license(gfx);
}
// licence and repository link at the bottom of the screen (title and login)
pub fn draw_license(&mut self, gfx: &Gfx) {
let (sw, sh) = (sw(), sh());
let (mx, my) = mouse();
let lic = tr("menu.license");
gfx.text(&lic, grid_center(sw, gfx.measure(&lic, SMALL())), sh - CH() * 2.5, SMALL(), DIM);
let url = REPO_URL.trim_start_matches("https://");
let w = gfx.measure(url, SMALL());
let r = Rect::new(grid_center(sw, w), sh - CH() * 1.5, w, GH * SMALL() + 2.0);
let hot = r.contains(vec2(mx, my));
gfx.text(url, r.x, r.y, SMALL(), if hot { FRAME_HI } else { Color::new(0.5, 0.7, 1.0, 1.0) });
draw_rectangle(r.x, r.y + GH * SMALL(), r.w, (SMALL()).max(1.0), if hot { FRAME_HI } else { Color::new(0.5, 0.7, 1.0, 0.6) });
self.buttons.push((r, Btn::Repo));
}
// New game: choose the map size (width and height separately)