File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 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;
88pub struct Config {
99 pub frame_rate : Option < FrameRate > ,
1010 pub preset_path : Option < String > ,
11+ pub texture_path : Option < String > ,
1112}
1213
1314impl 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 {
Original file line number Diff line number Diff line change @@ -2,10 +2,9 @@ mod app;
22mod dummy_audio;
33
44fn 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 ( ) ;
You can’t perform that action at this time.
0 commit comments