Skip to content

Commit b59c4a3

Browse files
committed
Separate also the path for the sound files
Continuing the previous commit's work
1 parent e422286 commit b59c4a3

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/config.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ pub const CHESS_ALPHA: Font = iced::Font::with_name("Chess Alpha");
1616
//pub const FONT_DIRECTORY: &str = "font/";
1717
pub const PUZZLES_DIRECTORY: &str = "puzzles/";
1818
pub const TRANSLATIONS_DIRECTORY: &str = "./translations/";
19-
pub const SETTINGS_FILE: &str = "settings.json";
2019
pub const PIECES_DIRECTORY: &str = "pieces/";
20+
pub const SETTINGS_FILE: &str = "settings.json";
21+
pub const ONE_PIECE_SOUND_FILE: &str = "1piece.ogg";
22+
pub const TWO_PIECES_SOUND_FILE: &str = "2piece.ogg";
2123

2224
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
2325
pub enum GameMode {

src/main.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ use rand::thread_rng;
3232
use rand::seq::SliceRandom;
3333

3434
mod config;
35+
use config::{ONE_PIECE_SOUND_FILE, TWO_PIECES_SOUND_FILE};
36+
3537
mod styles;
3638
mod search_tab;
3739
pub mod download_db;
@@ -139,8 +141,8 @@ impl SoundPlayback {
139141
pub fn init_sound() -> Option<Self> {
140142
let mut sound_playback = None;
141143
if let Ok((stream, handle)) = OutputStream::try_default() {
142-
let one_pieces_sound = StdFile::open("1piece.ogg");
143-
let two_pieces_sound = StdFile::open("2pieces.ogg");
144+
let one_pieces_sound = StdFile::open(ONE_PIECE_SOUND_FILE);
145+
let two_pieces_sound = StdFile::open(TWO_PIECES_SOUND_FILE);
144146

145147
if let (Ok(one_piece), Ok(two_piece)) = (one_pieces_sound, two_pieces_sound) {
146148
sound_playback = Some(

0 commit comments

Comments
 (0)