Skip to content

Commit 77e7f3e

Browse files
committed
texture path config
1 parent b2af684 commit 77e7f3e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/app/config.rs

+9
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ pub type FrameRate = u32;
88
pub struct Config {
99
pub frame_rate: Option<FrameRate>,
1010
pub preset_path: Option<String>,
11+
pub texture_path: Option<String>,
1112
}
1213

1314
impl Default for Config {
@@ -16,6 +17,7 @@ impl Default for Config {
1617
Self {
1718
// TODO: load from home dir or w/e
1819
preset_path: Some("/usr/local/share/projectM/presets".to_owned()),
20+
texture_path: Some("/usr/local/share/projectM/textures".to_owned()),
1921
frame_rate: Some(60),
2022
}
2123
}
@@ -32,6 +34,13 @@ impl App {
3234
if let Some(frame_rate) = config.frame_rate {
3335
Projectm::set_fps(self.pm, frame_rate)
3436
}
37+
38+
// load textures if provided
39+
if let Some(texture_path) = &config.texture_path {
40+
let mut paths: Vec<String> = Vec::new();
41+
paths.push(texture_path.into());
42+
Projectm::set_texture_search_paths(self.pm, &paths, 1);
43+
}
3544
}
3645

3746
pub fn get_frame_rate(&self) -> FrameRate {

src/main.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ mod app;
22
mod dummy_audio;
33

44
fn main() -> Result<(), String> {
5-
let mut config = app::default_config();
5+
let config = app::default_config();
66
// TODO: parse args here for config
7-
// config.preset_path = Some("/usr/local/share/projectM/presets".to_string());
8-
config.preset_path = Some("./presets/test".to_string());
7+
// config.preset_path = Some("./presets/test".to_string());
98

109
let mut app = app::App::new(Some(config));
1110
app.init();

0 commit comments

Comments
 (0)