File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ pub type FrameRate = u32;
8
8
pub struct Config {
9
9
pub frame_rate : Option < FrameRate > ,
10
10
pub preset_path : Option < String > ,
11
+ pub texture_path : Option < String > ,
11
12
}
12
13
13
14
impl Default for Config {
@@ -16,6 +17,7 @@ impl Default for Config {
16
17
Self {
17
18
// TODO: load from home dir or w/e
18
19
preset_path : Some ( "/usr/local/share/projectM/presets" . to_owned ( ) ) ,
20
+ texture_path : Some ( "/usr/local/share/projectM/textures" . to_owned ( ) ) ,
19
21
frame_rate : Some ( 60 ) ,
20
22
}
21
23
}
@@ -32,6 +34,13 @@ impl App {
32
34
if let Some ( frame_rate) = config. frame_rate {
33
35
Projectm :: set_fps ( self . pm , frame_rate)
34
36
}
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
+ }
35
44
}
36
45
37
46
pub fn get_frame_rate ( & self ) -> FrameRate {
Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ mod app;
2
2
mod dummy_audio;
3
3
4
4
fn main ( ) -> Result < ( ) , String > {
5
- let mut config = app:: default_config ( ) ;
5
+ let config = app:: default_config ( ) ;
6
6
// 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());
9
8
10
9
let mut app = app:: App :: new ( Some ( config) ) ;
11
10
app. init ( ) ;
You can’t perform that action at this time.
0 commit comments