2026-10-18 01:54:06 +03:00
|
|
|
|
//! Bundled piece sets, board themes and sounds (see THIRD_PARTY_NOTICES.md).
|
|
|
|
|
|
|
|
|
|
|
|
use crate::i18n::tr;
|
|
|
|
|
|
use egui::{Color32, Rect};
|
|
|
|
|
|
use serde::{Deserialize, Serialize};
|
|
|
|
|
|
use shakmaty::{Color, Piece, Role};
|
|
|
|
|
|
|
|
|
|
|
|
macro_rules! piece_set {
|
|
|
|
|
|
($name:literal) => {
|
|
|
|
|
|
[
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wK.svg")).as_slice(),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wQ.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wR.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wB.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wN.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/wP.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bK.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bQ.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bR.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bB.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bN.svg")),
|
|
|
|
|
|
include_bytes!(concat!("../assets/pieces/", $name, "/bP.svg")),
|
|
|
|
|
|
]
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
|
|
|
|
|
|
pub enum PieceSet {
|
|
|
|
|
|
#[default]
|
|
|
|
|
|
Cburnett,
|
|
|
|
|
|
Merida,
|
|
|
|
|
|
Mpchess,
|
|
|
|
|
|
Chessnut,
|
|
|
|
|
|
Fantasy,
|
|
|
|
|
|
Celtic,
|
|
|
|
|
|
Spatial,
|
|
|
|
|
|
Rhosgfx,
|
|
|
|
|
|
Shapes,
|
|
|
|
|
|
KiwenSuwi,
|
|
|
|
|
|
Firi,
|
|
|
|
|
|
Pixel,
|
|
|
|
|
|
Letter,
|
|
|
|
|
|
Pirouetti,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
Governor,
|
|
|
|
|
|
Kosal,
|
|
|
|
|
|
Metaltops,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl PieceSet {
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
pub const ALL: [PieceSet; 17] = [
|
2026-10-18 01:54:06 +03:00
|
|
|
|
PieceSet::Cburnett,
|
|
|
|
|
|
PieceSet::Merida,
|
|
|
|
|
|
PieceSet::Mpchess,
|
|
|
|
|
|
PieceSet::Chessnut,
|
|
|
|
|
|
PieceSet::Fantasy,
|
|
|
|
|
|
PieceSet::Celtic,
|
|
|
|
|
|
PieceSet::Spatial,
|
|
|
|
|
|
PieceSet::Rhosgfx,
|
|
|
|
|
|
PieceSet::Shapes,
|
|
|
|
|
|
PieceSet::KiwenSuwi,
|
|
|
|
|
|
PieceSet::Firi,
|
|
|
|
|
|
PieceSet::Pixel,
|
|
|
|
|
|
PieceSet::Letter,
|
|
|
|
|
|
PieceSet::Pirouetti,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
PieceSet::Governor,
|
|
|
|
|
|
PieceSet::Kosal,
|
|
|
|
|
|
PieceSet::Metaltops,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
pub fn name(self) -> &'static str {
|
|
|
|
|
|
match self {
|
|
|
|
|
|
PieceSet::Cburnett => "cburnett",
|
|
|
|
|
|
PieceSet::Merida => "merida",
|
|
|
|
|
|
PieceSet::Mpchess => "mpchess",
|
|
|
|
|
|
PieceSet::Chessnut => "chessnut",
|
|
|
|
|
|
PieceSet::Fantasy => "fantasy",
|
|
|
|
|
|
PieceSet::Celtic => "celtic",
|
|
|
|
|
|
PieceSet::Spatial => "spatial",
|
|
|
|
|
|
PieceSet::Rhosgfx => "rhosgfx",
|
|
|
|
|
|
PieceSet::Shapes => "shapes",
|
|
|
|
|
|
PieceSet::KiwenSuwi => "kiwen-suwi",
|
|
|
|
|
|
PieceSet::Firi => "firi",
|
|
|
|
|
|
PieceSet::Pixel => "pixel",
|
|
|
|
|
|
PieceSet::Letter => "letter",
|
|
|
|
|
|
PieceSet::Pirouetti => "pirouetti",
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
PieceSet::Governor => "governor",
|
|
|
|
|
|
PieceSet::Kosal => "kosal",
|
|
|
|
|
|
PieceSet::Metaltops => "metaltops",
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn files(self) -> [&'static [u8]; 12] {
|
|
|
|
|
|
match self {
|
|
|
|
|
|
PieceSet::Cburnett => piece_set!("cburnett"),
|
|
|
|
|
|
PieceSet::Merida => piece_set!("merida"),
|
|
|
|
|
|
PieceSet::Mpchess => piece_set!("mpchess"),
|
|
|
|
|
|
PieceSet::Chessnut => piece_set!("chessnut"),
|
|
|
|
|
|
PieceSet::Fantasy => piece_set!("fantasy"),
|
|
|
|
|
|
PieceSet::Celtic => piece_set!("celtic"),
|
|
|
|
|
|
PieceSet::Spatial => piece_set!("spatial"),
|
|
|
|
|
|
PieceSet::Rhosgfx => piece_set!("rhosgfx"),
|
|
|
|
|
|
PieceSet::Shapes => piece_set!("shapes"),
|
|
|
|
|
|
PieceSet::KiwenSuwi => piece_set!("kiwen-suwi"),
|
|
|
|
|
|
PieceSet::Firi => piece_set!("firi"),
|
|
|
|
|
|
PieceSet::Pixel => piece_set!("pixel"),
|
|
|
|
|
|
PieceSet::Letter => piece_set!("letter"),
|
|
|
|
|
|
PieceSet::Pirouetti => piece_set!("pirouetti"),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
PieceSet::Governor => piece_set!("governor"),
|
|
|
|
|
|
PieceSet::Kosal => piece_set!("kosal"),
|
|
|
|
|
|
PieceSet::Metaltops => piece_set!("metaltops"),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn index(piece: Piece) -> usize {
|
|
|
|
|
|
let r = match piece.role {
|
|
|
|
|
|
Role::King => 0,
|
|
|
|
|
|
Role::Queen => 1,
|
|
|
|
|
|
Role::Rook => 2,
|
|
|
|
|
|
Role::Bishop => 3,
|
|
|
|
|
|
Role::Knight => 4,
|
|
|
|
|
|
Role::Pawn => 5,
|
|
|
|
|
|
};
|
|
|
|
|
|
if piece.color == Color::White {
|
|
|
|
|
|
r
|
|
|
|
|
|
} else {
|
|
|
|
|
|
r + 6
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn uri(self, piece: Piece) -> String {
|
|
|
|
|
|
format!("bytes://pieces/{}/{}.svg", self.name(), Self::index(piece))
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn paint(self, ui: &egui::Ui, piece: Piece, rect: Rect) {
|
|
|
|
|
|
egui::Image::new(self.uri(piece)).paint_at(ui, rect);
|
|
|
|
|
|
}
|
2026-10-21 19:57:54 +03:00
|
|
|
|
|
|
|
|
|
|
pub fn paint_tinted(self, ui: &egui::Ui, piece: Piece, rect: Rect, tint: egui::Color32) {
|
|
|
|
|
|
egui::Image::new(self.uri(piece))
|
|
|
|
|
|
.tint(tint)
|
|
|
|
|
|
.paint_at(ui, rect);
|
|
|
|
|
|
}
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Registers all bundled SVGs with egui's byte loader.
|
|
|
|
|
|
pub fn install(ctx: &egui::Context) {
|
|
|
|
|
|
egui_extras::install_image_loaders(ctx);
|
|
|
|
|
|
for set in PieceSet::ALL {
|
|
|
|
|
|
for (i, bytes) in set.files().into_iter().enumerate() {
|
|
|
|
|
|
ctx.include_bytes(format!("bytes://pieces/{}/{i}.svg", set.name()), bytes);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
for (name, bytes) in TEXTURES {
|
|
|
|
|
|
ctx.include_bytes(format!("bytes://boards/{name}"), *bytes);
|
|
|
|
|
|
}
|
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
|
|
|
|
// Arrows (→ ⇄ ↔) are only in egui's monospace font, and three evaluation signs
|
|
|
|
|
|
// (⩲ ⩱ ⌓) in none: the last fallbacks of the text.
|
|
|
|
|
|
let mut fonts = egui::FontDefinitions::default();
|
|
|
|
|
|
fonts.font_data.insert(
|
|
|
|
|
|
"nag-symbols".into(),
|
|
|
|
|
|
std::sync::Arc::new(egui::FontData::from_static(include_bytes!(
|
|
|
|
|
|
"../assets/fonts/NotoSansMath-nag.ttf"
|
|
|
|
|
|
))),
|
|
|
|
|
|
);
|
Move notation: Latin letters, figurines or the interface language's letters
Settings › Board & pieces: Nf3, ♘f3 as on Lichess, or Кр Ф Л С К (German
K D T L S, French R D T F C, Spanish and Italian R D T A C; in English the
Latin letters), with a sample per option and a line of a game. Only the shown
label changes (san::show): the game, PGN, copied games, the analysis written
into a game, the reference cache and every comparison stay Latin SAN. Applied
in the move list, engine lines, the reference tab, board search and the
analysis report. The figurines are egui's chess glyphs cut out to a 4.7 KB
font, a little smaller and on the baseline. Latin remains the default.
Reviewed by the designer and the tester agents.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:18:53 +03:00
|
|
|
|
// Figurines in move notation (♔♕♖♗♘): a copy of egui's icon glyphs, a little
|
|
|
|
|
|
// smaller and on the baseline (the icons themselves stay as they are).
|
|
|
|
|
|
fonts.font_data.insert(
|
|
|
|
|
|
"figurine".into(),
|
|
|
|
|
|
std::sync::Arc::new(
|
|
|
|
|
|
egui::FontData::from_static(include_bytes!("../assets/fonts/figurines.ttf")).tweak(
|
|
|
|
|
|
egui::FontTweak {
|
|
|
|
|
|
scale: 0.85,
|
|
|
|
|
|
y_offset: -1.0,
|
|
|
|
|
|
..Default::default()
|
|
|
|
|
|
},
|
|
|
|
|
|
),
|
|
|
|
|
|
),
|
|
|
|
|
|
);
|
|
|
|
|
|
for family in [egui::FontFamily::Proportional, egui::FontFamily::Monospace] {
|
|
|
|
|
|
if let Some(list) = fonts.families.get_mut(&family) {
|
|
|
|
|
|
list.insert(1, "figurine".into());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
Translation of game comments
When a game's comments are in another language, ChessPenguin offers to translate
them into the reader's: with the ChatGPT Plus/Pro subscription (Sign in with
ChatGPT: OAuth with PKCE in the browser, a loopback callback, tokens refreshed
one at a time), or an OpenAI-compatible API key (DeepSeek, OpenAI, Gemini, a
model on this computer with Ollama or LM Studio, another address). After the
first consent, games in other languages are translated as they are opened;
[Original | Translation] (Ctrl+Shift+T) switches back.
Only comment text is sent; the model gets strict instructions and a glossary,
and every answer must keep the moves and squares of the original, or the
comment stays in the original with a mark. Translations are never written to
the PGN; a cache keeps them per language. Keys and tokens live in a 0600 file
apart from the settings. Settings › Translation holds the target language,
when to translate, the connection, permissions and the cache.
Also: the monospace font and three glyphs of Noto Sans Math are text fallbacks,
so arrows and the evaluation signs ⩲ ⩱ ⌓ no longer show as boxes.
Reviewed by the designer and the tester agents (two rounds).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:03:03 +03:00
|
|
|
|
let mono = fonts
|
|
|
|
|
|
.families
|
|
|
|
|
|
.get(&egui::FontFamily::Monospace)
|
|
|
|
|
|
.and_then(|f| f.first())
|
|
|
|
|
|
.cloned();
|
|
|
|
|
|
for family in [egui::FontFamily::Proportional, egui::FontFamily::Monospace] {
|
|
|
|
|
|
if let Some(list) = fonts.families.get_mut(&family) {
|
|
|
|
|
|
if let Some(m) = &mono
|
|
|
|
|
|
&& !list.contains(m)
|
|
|
|
|
|
{
|
|
|
|
|
|
list.push(m.clone());
|
|
|
|
|
|
}
|
|
|
|
|
|
list.push("nag-symbols".into());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
ctx.set_fonts(fonts);
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
|
|
|
|
|
|
pub enum BoardThemeId {
|
|
|
|
|
|
#[default]
|
|
|
|
|
|
Brown,
|
|
|
|
|
|
Blue,
|
|
|
|
|
|
Green,
|
|
|
|
|
|
Tournament,
|
|
|
|
|
|
Sand,
|
|
|
|
|
|
Coral,
|
|
|
|
|
|
Grey,
|
|
|
|
|
|
Purple,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
Ic,
|
|
|
|
|
|
Ncf,
|
|
|
|
|
|
Ice,
|
|
|
|
|
|
Navy,
|
|
|
|
|
|
Mint,
|
|
|
|
|
|
Emerald,
|
|
|
|
|
|
Orange,
|
|
|
|
|
|
Rose,
|
|
|
|
|
|
Dusk,
|
|
|
|
|
|
Night,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
Wood,
|
|
|
|
|
|
Wood2,
|
|
|
|
|
|
Wood3,
|
|
|
|
|
|
Wood4,
|
|
|
|
|
|
Maple,
|
|
|
|
|
|
Maple2,
|
|
|
|
|
|
Leather,
|
|
|
|
|
|
Marble,
|
|
|
|
|
|
BlueMarble,
|
|
|
|
|
|
Blue2,
|
|
|
|
|
|
Blue3,
|
|
|
|
|
|
Canvas,
|
|
|
|
|
|
Metal,
|
|
|
|
|
|
Olive,
|
|
|
|
|
|
Stone,
|
|
|
|
|
|
GreenPlastic,
|
|
|
|
|
|
PurpleDiag,
|
|
|
|
|
|
PinkPyramid,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
Horsey,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug)]
|
|
|
|
|
|
pub struct BoardTheme {
|
|
|
|
|
|
pub light: Color32,
|
|
|
|
|
|
pub dark: Color32,
|
|
|
|
|
|
/// Full-board image (8×8 squares, a1 dark) drawn instead of flat squares.
|
|
|
|
|
|
pub texture: Option<&'static str>,
|
|
|
|
|
|
pub last_move: Color32,
|
|
|
|
|
|
pub selected: Color32,
|
|
|
|
|
|
pub dot: Color32,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// Board image textures from Lichess (see THIRD_PARTY_NOTICES.md).
|
|
|
|
|
|
const TEXTURES: &[(&str, &[u8])] = &[
|
|
|
|
|
|
("wood.jpg", include_bytes!("../assets/boards/wood.jpg")),
|
|
|
|
|
|
("wood2.jpg", include_bytes!("../assets/boards/wood2.jpg")),
|
|
|
|
|
|
("wood3.jpg", include_bytes!("../assets/boards/wood3.jpg")),
|
|
|
|
|
|
("wood4.jpg", include_bytes!("../assets/boards/wood4.jpg")),
|
|
|
|
|
|
("maple.jpg", include_bytes!("../assets/boards/maple.jpg")),
|
|
|
|
|
|
("maple2.jpg", include_bytes!("../assets/boards/maple2.jpg")),
|
|
|
|
|
|
(
|
|
|
|
|
|
"leather.jpg",
|
|
|
|
|
|
include_bytes!("../assets/boards/leather.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
("marble.jpg", include_bytes!("../assets/boards/marble.jpg")),
|
|
|
|
|
|
(
|
|
|
|
|
|
"blue-marble.jpg",
|
|
|
|
|
|
include_bytes!("../assets/boards/blue-marble.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
("blue2.jpg", include_bytes!("../assets/boards/blue2.jpg")),
|
|
|
|
|
|
("blue3.jpg", include_bytes!("../assets/boards/blue3.jpg")),
|
|
|
|
|
|
(
|
|
|
|
|
|
"canvas2.jpg",
|
|
|
|
|
|
include_bytes!("../assets/boards/canvas2.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
("metal.jpg", include_bytes!("../assets/boards/metal.jpg")),
|
|
|
|
|
|
("olive.jpg", include_bytes!("../assets/boards/olive.jpg")),
|
|
|
|
|
|
("grey.jpg", include_bytes!("../assets/boards/grey.jpg")),
|
|
|
|
|
|
(
|
|
|
|
|
|
"green-plastic.png",
|
|
|
|
|
|
include_bytes!("../assets/boards/green-plastic.png"),
|
|
|
|
|
|
),
|
|
|
|
|
|
(
|
|
|
|
|
|
"purple-diag.png",
|
|
|
|
|
|
include_bytes!("../assets/boards/purple-diag.png"),
|
|
|
|
|
|
),
|
|
|
|
|
|
(
|
|
|
|
|
|
"pink-pyramid.png",
|
|
|
|
|
|
include_bytes!("../assets/boards/pink-pyramid.png"),
|
|
|
|
|
|
),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
("horsey.jpg", include_bytes!("../assets/boards/horsey.jpg")),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
impl BoardThemeId {
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
pub const ALL: [BoardThemeId; 37] = [
|
2026-10-18 01:54:06 +03:00
|
|
|
|
BoardThemeId::Brown,
|
|
|
|
|
|
BoardThemeId::Blue,
|
|
|
|
|
|
BoardThemeId::Green,
|
|
|
|
|
|
BoardThemeId::Tournament,
|
|
|
|
|
|
BoardThemeId::Sand,
|
|
|
|
|
|
BoardThemeId::Coral,
|
|
|
|
|
|
BoardThemeId::Grey,
|
|
|
|
|
|
BoardThemeId::Purple,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
BoardThemeId::Ic,
|
|
|
|
|
|
BoardThemeId::Ncf,
|
|
|
|
|
|
BoardThemeId::Ice,
|
|
|
|
|
|
BoardThemeId::Navy,
|
|
|
|
|
|
BoardThemeId::Mint,
|
|
|
|
|
|
BoardThemeId::Emerald,
|
|
|
|
|
|
BoardThemeId::Orange,
|
|
|
|
|
|
BoardThemeId::Rose,
|
|
|
|
|
|
BoardThemeId::Dusk,
|
|
|
|
|
|
BoardThemeId::Night,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
BoardThemeId::Wood,
|
|
|
|
|
|
BoardThemeId::Wood2,
|
|
|
|
|
|
BoardThemeId::Wood3,
|
|
|
|
|
|
BoardThemeId::Wood4,
|
|
|
|
|
|
BoardThemeId::Maple,
|
|
|
|
|
|
BoardThemeId::Maple2,
|
|
|
|
|
|
BoardThemeId::Leather,
|
|
|
|
|
|
BoardThemeId::Marble,
|
|
|
|
|
|
BoardThemeId::BlueMarble,
|
|
|
|
|
|
BoardThemeId::Blue2,
|
|
|
|
|
|
BoardThemeId::Blue3,
|
|
|
|
|
|
BoardThemeId::Canvas,
|
|
|
|
|
|
BoardThemeId::Metal,
|
|
|
|
|
|
BoardThemeId::Olive,
|
|
|
|
|
|
BoardThemeId::Stone,
|
|
|
|
|
|
BoardThemeId::GreenPlastic,
|
|
|
|
|
|
BoardThemeId::PurpleDiag,
|
|
|
|
|
|
BoardThemeId::PinkPyramid,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
BoardThemeId::Horsey,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
pub fn label(self) -> String {
|
|
|
|
|
|
let (key, n): (&'static str, Option<&str>) = match self {
|
|
|
|
|
|
BoardThemeId::Brown => ("Brown", None),
|
|
|
|
|
|
BoardThemeId::Blue => ("Blue", None),
|
|
|
|
|
|
BoardThemeId::Green => ("Green", None),
|
|
|
|
|
|
BoardThemeId::Tournament => ("Tournament", None),
|
|
|
|
|
|
BoardThemeId::Sand => ("Sand", None),
|
|
|
|
|
|
BoardThemeId::Coral => ("Coral", None),
|
|
|
|
|
|
BoardThemeId::Grey => ("Grey", None),
|
|
|
|
|
|
BoardThemeId::Purple => ("Purple", None),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
BoardThemeId::Ic => ("IC", None),
|
|
|
|
|
|
BoardThemeId::Ncf => ("NCF", None),
|
|
|
|
|
|
BoardThemeId::Ice => ("Ice", None),
|
|
|
|
|
|
BoardThemeId::Navy => ("Navy", None),
|
|
|
|
|
|
BoardThemeId::Mint => ("Mint", None),
|
|
|
|
|
|
BoardThemeId::Emerald => ("Emerald", None),
|
|
|
|
|
|
BoardThemeId::Orange => ("Orange", None),
|
|
|
|
|
|
BoardThemeId::Rose => ("Rose", None),
|
|
|
|
|
|
BoardThemeId::Dusk => ("Dusk", None),
|
|
|
|
|
|
BoardThemeId::Night => ("Night", None),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
BoardThemeId::Wood => ("Wood", None),
|
|
|
|
|
|
BoardThemeId::Wood2 => ("Wood", Some("2")),
|
|
|
|
|
|
BoardThemeId::Wood3 => ("Wood", Some("3")),
|
|
|
|
|
|
BoardThemeId::Wood4 => ("Wood", Some("4")),
|
|
|
|
|
|
BoardThemeId::Maple => ("Maple", None),
|
|
|
|
|
|
BoardThemeId::Maple2 => ("Maple", Some("2")),
|
|
|
|
|
|
BoardThemeId::Leather => ("Leather", None),
|
|
|
|
|
|
BoardThemeId::Marble => ("Marble", None),
|
|
|
|
|
|
BoardThemeId::BlueMarble => ("Blue marble", None),
|
|
|
|
|
|
BoardThemeId::Blue2 => ("Blue", Some("2")),
|
|
|
|
|
|
BoardThemeId::Blue3 => ("Blue", Some("3")),
|
|
|
|
|
|
BoardThemeId::Canvas => ("Canvas", None),
|
|
|
|
|
|
BoardThemeId::Metal => ("Metal", None),
|
|
|
|
|
|
BoardThemeId::Olive => ("Olive", None),
|
|
|
|
|
|
BoardThemeId::Stone => ("Stone", None),
|
|
|
|
|
|
BoardThemeId::GreenPlastic => ("Green plastic", None),
|
|
|
|
|
|
BoardThemeId::PurpleDiag => ("Purple diagonal", None),
|
|
|
|
|
|
BoardThemeId::PinkPyramid => ("Pink pyramid", None),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
BoardThemeId::Horsey => ("Sketch", None),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
};
|
|
|
|
|
|
match n {
|
|
|
|
|
|
Some(n) => format!("{} {n}", tr(key)),
|
|
|
|
|
|
None => tr(key).to_string(),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn theme(self) -> BoardTheme {
|
|
|
|
|
|
let rgb = |(r, g, b): (u8, u8, u8)| Color32::from_rgb(r, g, b);
|
|
|
|
|
|
let (light, dark, texture) = match self {
|
|
|
|
|
|
BoardThemeId::Brown => (rgb((240, 217, 181)), rgb((181, 136, 99)), None),
|
|
|
|
|
|
BoardThemeId::Blue => (rgb((222, 227, 230)), rgb((140, 162, 173)), None),
|
|
|
|
|
|
BoardThemeId::Green => (rgb((255, 255, 221)), rgb((134, 166, 102)), None),
|
|
|
|
|
|
BoardThemeId::Tournament => (rgb((238, 238, 210)), rgb((118, 150, 86)), None),
|
|
|
|
|
|
BoardThemeId::Sand => (rgb((240, 228, 196)), rgb((200, 168, 110)), None),
|
|
|
|
|
|
BoardThemeId::Coral => (rgb((177, 228, 185)), rgb((112, 162, 163)), None),
|
|
|
|
|
|
BoardThemeId::Grey => (rgb((217, 217, 217)), rgb((154, 154, 154)), None),
|
|
|
|
|
|
BoardThemeId::Purple => (rgb((232, 224, 240)), rgb((159, 144, 176)), None),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
// The colours of the Lichess "ic" and "ncf-board" boards.
|
|
|
|
|
|
BoardThemeId::Ic => (rgb((236, 236, 236)), rgb((193, 193, 142)), None),
|
|
|
|
|
|
BoardThemeId::Ncf => (rgb((187, 207, 255)), rgb((84, 119, 202)), None),
|
|
|
|
|
|
BoardThemeId::Ice => (rgb((222, 234, 240)), rgb((122, 157, 178)), None),
|
|
|
|
|
|
BoardThemeId::Navy => (rgb((220, 226, 236)), rgb((70, 96, 140)), None),
|
|
|
|
|
|
BoardThemeId::Mint => (rgb((222, 241, 230)), rgb((118, 178, 148)), None),
|
|
|
|
|
|
BoardThemeId::Emerald => (rgb((226, 236, 218)), rgb((74, 132, 100)), None),
|
|
|
|
|
|
BoardThemeId::Orange => (rgb((250, 228, 196)), rgb((208, 139, 72)), None),
|
|
|
|
|
|
BoardThemeId::Rose => (rgb((242, 220, 220)), rgb((190, 126, 138)), None),
|
|
|
|
|
|
BoardThemeId::Dusk => (rgb((204, 186, 176)), rgb((112, 102, 122)), None),
|
|
|
|
|
|
BoardThemeId::Night => (rgb((128, 136, 146)), rgb((68, 74, 84)), None),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
BoardThemeId::Wood => (
|
|
|
|
|
|
rgb((215, 161, 91)),
|
|
|
|
|
|
rgb((154, 88, 35)),
|
|
|
|
|
|
Some("bytes://boards/wood.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Wood2 => (
|
|
|
|
|
|
rgb((151, 124, 79)),
|
|
|
|
|
|
rgb((121, 95, 48)),
|
|
|
|
|
|
Some("bytes://boards/wood2.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Wood3 => (
|
|
|
|
|
|
rgb((186, 173, 157)),
|
|
|
|
|
|
rgb((129, 94, 56)),
|
|
|
|
|
|
Some("bytes://boards/wood3.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Wood4 => (
|
|
|
|
|
|
rgb((191, 158, 104)),
|
|
|
|
|
|
rgb((134, 91, 54)),
|
|
|
|
|
|
Some("bytes://boards/wood4.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Maple => (
|
|
|
|
|
|
rgb((224, 190, 146)),
|
|
|
|
|
|
rgb((180, 111, 60)),
|
|
|
|
|
|
Some("bytes://boards/maple.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Maple2 => (
|
|
|
|
|
|
rgb((222, 193, 151)),
|
|
|
|
|
|
rgb((167, 114, 85)),
|
|
|
|
|
|
Some("bytes://boards/maple2.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Leather => (
|
|
|
|
|
|
rgb((206, 206, 198)),
|
|
|
|
|
|
rgb((192, 140, 18)),
|
|
|
|
|
|
Some("bytes://boards/leather.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Marble => (
|
|
|
|
|
|
rgb((126, 150, 128)),
|
|
|
|
|
|
rgb((97, 120, 97)),
|
|
|
|
|
|
Some("bytes://boards/marble.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::BlueMarble => (
|
|
|
|
|
|
rgb((229, 224, 212)),
|
|
|
|
|
|
rgb((148, 158, 174)),
|
|
|
|
|
|
Some("bytes://boards/blue-marble.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Blue2 => (
|
|
|
|
|
|
rgb((129, 151, 173)),
|
|
|
|
|
|
rgb((96, 118, 138)),
|
|
|
|
|
|
Some("bytes://boards/blue2.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Blue3 => (
|
|
|
|
|
|
rgb((189, 200, 211)),
|
|
|
|
|
|
rgb((68, 114, 163)),
|
|
|
|
|
|
Some("bytes://boards/blue3.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Canvas => (
|
|
|
|
|
|
rgb((203, 206, 223)),
|
|
|
|
|
|
rgb((114, 130, 156)),
|
|
|
|
|
|
Some("bytes://boards/canvas2.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Metal => (
|
|
|
|
|
|
rgb((177, 177, 177)),
|
|
|
|
|
|
rgb((119, 119, 119)),
|
|
|
|
|
|
Some("bytes://boards/metal.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Olive => (
|
|
|
|
|
|
rgb((173, 166, 148)),
|
|
|
|
|
|
rgb((132, 124, 106)),
|
|
|
|
|
|
Some("bytes://boards/olive.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::Stone => (
|
|
|
|
|
|
rgb((169, 169, 169)),
|
|
|
|
|
|
rgb((136, 136, 136)),
|
|
|
|
|
|
Some("bytes://boards/grey.jpg"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::GreenPlastic => (
|
|
|
|
|
|
rgb((241, 246, 178)),
|
|
|
|
|
|
rgb((89, 147, 93)),
|
|
|
|
|
|
Some("bytes://boards/green-plastic.png"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::PurpleDiag => (
|
|
|
|
|
|
rgb((227, 216, 238)),
|
|
|
|
|
|
rgb((151, 123, 178)),
|
|
|
|
|
|
Some("bytes://boards/purple-diag.png"),
|
|
|
|
|
|
),
|
|
|
|
|
|
BoardThemeId::PinkPyramid => (
|
|
|
|
|
|
rgb((237, 238, 191)),
|
|
|
|
|
|
rgb((242, 117, 117)),
|
|
|
|
|
|
Some("bytes://boards/pink-pyramid.png"),
|
|
|
|
|
|
),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
BoardThemeId::Horsey => (
|
|
|
|
|
|
rgb((239, 222, 198)),
|
|
|
|
|
|
rgb((151, 112, 81)),
|
|
|
|
|
|
Some("bytes://boards/horsey.jpg"),
|
|
|
|
|
|
),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
};
|
|
|
|
|
|
BoardTheme {
|
|
|
|
|
|
light,
|
|
|
|
|
|
dark,
|
|
|
|
|
|
texture,
|
|
|
|
|
|
last_move: Color32::from_rgba_unmultiplied(155, 199, 0, 105),
|
|
|
|
|
|
selected: Color32::from_rgba_unmultiplied(20, 85, 30, 125),
|
|
|
|
|
|
dot: Color32::from_rgba_unmultiplied(20, 85, 30, 110),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize, Default)]
|
|
|
|
|
|
pub enum SoundSet {
|
|
|
|
|
|
#[default]
|
|
|
|
|
|
Sfx,
|
|
|
|
|
|
Piano,
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
Futuristic,
|
|
|
|
|
|
Nes,
|
|
|
|
|
|
Wood,
|
|
|
|
|
|
Glass,
|
|
|
|
|
|
Clicks,
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl SoundSet {
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
pub const ALL: [SoundSet; 7] = [
|
|
|
|
|
|
SoundSet::Sfx,
|
|
|
|
|
|
SoundSet::Piano,
|
|
|
|
|
|
SoundSet::Futuristic,
|
|
|
|
|
|
SoundSet::Nes,
|
|
|
|
|
|
SoundSet::Wood,
|
|
|
|
|
|
SoundSet::Glass,
|
|
|
|
|
|
SoundSet::Clicks,
|
|
|
|
|
|
];
|
2026-10-18 01:54:06 +03:00
|
|
|
|
|
|
|
|
|
|
pub fn label(self) -> &'static str {
|
|
|
|
|
|
match self {
|
|
|
|
|
|
SoundSet::Sfx => "SFX",
|
|
|
|
|
|
SoundSet::Piano => tr("Piano"),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
SoundSet::Futuristic => tr("Futuristic"),
|
|
|
|
|
|
SoundSet::Nes => "NES",
|
|
|
|
|
|
SoundSet::Wood => tr("Wood"),
|
|
|
|
|
|
SoundSet::Glass => tr("Glass"),
|
|
|
|
|
|
SoundSet::Clicks => tr("Clicks"),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
|
|
|
|
|
|
pub enum Sound {
|
|
|
|
|
|
Move,
|
|
|
|
|
|
Capture,
|
|
|
|
|
|
Check,
|
|
|
|
|
|
Checkmate,
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn sound_bytes(set: SoundSet, sound: Sound) -> &'static [u8] {
|
|
|
|
|
|
macro_rules! s {
|
|
|
|
|
|
($set:literal, $f:literal) => {
|
|
|
|
|
|
include_bytes!(concat!("../assets/sounds/", $set, "/", $f, ".ogg")).as_slice()
|
|
|
|
|
|
};
|
|
|
|
|
|
}
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
// The Lichess sets have no checkmate sound of their own (it is the check sound there).
|
2026-10-18 01:54:06 +03:00
|
|
|
|
match (set, sound) {
|
|
|
|
|
|
(SoundSet::Sfx, Sound::Move) => s!("sfx", "Move"),
|
|
|
|
|
|
(SoundSet::Sfx, Sound::Capture) => s!("sfx", "Capture"),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
(SoundSet::Sfx, Sound::Check | Sound::Checkmate) => s!("sfx", "Check"),
|
2026-10-18 01:54:06 +03:00
|
|
|
|
(SoundSet::Piano, Sound::Move) => s!("piano", "Move"),
|
|
|
|
|
|
(SoundSet::Piano, Sound::Capture) => s!("piano", "Capture"),
|
ChessPenguin 0.3.0: more piece sets, boards and sounds; fix silent checkmate sound
- Piece sets governor, kosal, metaltops (from PyChess); boards Sketch (Lichess
horsey), IC, NCF and eight own flat palettes; sound sets Futuristic, NES
(Lichess) and Wood, Glass, Clicks (Kenney, CC0).
- The bundled checkmate sounds were git symlinks copied as text; Lichess sets now
play the check sound for mate. Tests check every sound and piece file.
- Version 0.3.0, changelog and AppStream release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-18 14:50:32 +03:00
|
|
|
|
(SoundSet::Piano, Sound::Check | Sound::Checkmate) => s!("piano", "Check"),
|
|
|
|
|
|
(SoundSet::Futuristic, Sound::Move) => s!("futuristic", "Move"),
|
|
|
|
|
|
(SoundSet::Futuristic, Sound::Capture) => s!("futuristic", "Capture"),
|
|
|
|
|
|
(SoundSet::Futuristic, Sound::Check | Sound::Checkmate) => s!("futuristic", "Check"),
|
|
|
|
|
|
(SoundSet::Nes, Sound::Move) => s!("nes", "Move"),
|
|
|
|
|
|
(SoundSet::Nes, Sound::Capture) => s!("nes", "Capture"),
|
|
|
|
|
|
(SoundSet::Nes, Sound::Check | Sound::Checkmate) => s!("nes", "Check"),
|
|
|
|
|
|
(SoundSet::Wood, Sound::Move) => s!("wood", "Move"),
|
|
|
|
|
|
(SoundSet::Wood, Sound::Capture) => s!("wood", "Capture"),
|
|
|
|
|
|
(SoundSet::Wood, Sound::Check) => s!("wood", "Check"),
|
|
|
|
|
|
(SoundSet::Wood, Sound::Checkmate) => s!("wood", "Checkmate"),
|
|
|
|
|
|
(SoundSet::Glass, Sound::Move) => s!("glass", "Move"),
|
|
|
|
|
|
(SoundSet::Glass, Sound::Capture) => s!("glass", "Capture"),
|
|
|
|
|
|
(SoundSet::Glass, Sound::Check) => s!("glass", "Check"),
|
|
|
|
|
|
(SoundSet::Glass, Sound::Checkmate) => s!("glass", "Checkmate"),
|
|
|
|
|
|
(SoundSet::Clicks, Sound::Move) => s!("clicks", "Move"),
|
|
|
|
|
|
(SoundSet::Clicks, Sound::Capture) => s!("clicks", "Capture"),
|
|
|
|
|
|
(SoundSet::Clicks, Sound::Check) => s!("clicks", "Check"),
|
|
|
|
|
|
(SoundSet::Clicks, Sound::Checkmate) => s!("clicks", "Checkmate"),
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
|
|
mod tests {
|
|
|
|
|
|
use super::*;
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn every_sound_is_a_real_ogg_file() {
|
|
|
|
|
|
// Lichess keeps some sounds as git symlinks; a copied link is a few bytes of text.
|
|
|
|
|
|
for set in SoundSet::ALL {
|
|
|
|
|
|
for s in [Sound::Move, Sound::Capture, Sound::Check, Sound::Checkmate] {
|
|
|
|
|
|
let b = sound_bytes(set, s);
|
|
|
|
|
|
assert!(b.starts_with(b"OggS") && b.len() > 1000, "{set:?} {s:?}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[test]
|
|
|
|
|
|
fn every_piece_file_is_an_svg() {
|
|
|
|
|
|
for set in PieceSet::ALL {
|
|
|
|
|
|
for f in set.files() {
|
|
|
|
|
|
let head = String::from_utf8_lossy(&f[..f.len().min(400)]);
|
|
|
|
|
|
assert!(head.contains("<svg") || head.contains("<?xml"), "{set:?}");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2026-10-18 01:54:06 +03:00
|
|
|
|
}
|
|
|
|
|
|
}
|