11use projectm_rs:: core:: { projectm, projectm_handle} ;
2- use projectm_rs:: playlist;
32use sdl2:: video:: GLProfile ;
43
4+ pub mod config;
55pub mod main_loop;
6-
7- pub struct Config {
8- pub preset_path : Option < String > ,
9- }
10-
11- impl Default for Config {
12- fn default ( ) -> Self {
13- // default preset path
14- Self {
15- // load from home dir or w/e
16- preset_path : Some ( String :: from ( "/usr/local/share/projectM/presets" ) ) ,
17- }
18- }
19- }
6+ pub mod playlist;
7+ pub mod video;
208
219pub struct App {
2210 pm : projectm_handle ,
23- playlist : playlist:: Playlist ,
11+ playlist : projectm_rs :: playlist:: Playlist ,
2412 sdl_context : sdl2:: Sdl ,
2513 gl_context : sdl2:: video:: GLContext ,
2614 window : sdl2:: video:: Window ,
2715}
2816
17+ pub fn default_config ( ) -> config:: Config {
18+ config:: Config :: default ( )
19+ }
20+
2921impl App {
30- pub fn new ( config : Option < Config > ) -> Self {
22+ pub fn new ( config : Option < crate :: app :: config :: Config > ) -> Self {
3123 // setup sdl
3224 let sdl_context = sdl2:: init ( ) . unwrap ( ) ;
3325 let video_subsystem = sdl_context. video ( ) . unwrap ( ) ;
@@ -62,7 +54,7 @@ impl App {
6254 // initialize projectM
6355 let pm = projectm:: create ( ) ;
6456 // and a preset playlist
65- let mut playlist = projectm_rs:: playlist:: Playlist :: create ( pm) ;
57+ let playlist = projectm_rs:: playlist:: Playlist :: create ( pm) ;
6658
6759 // get/set window size
6860 let ( width, height) = window. drawable_size ( ) ; // highDPI aware
@@ -83,18 +75,4 @@ impl App {
8375
8476 this
8577 }
86-
87- pub fn load_config ( & mut self , config : Config ) {
88- // load presets if provided
89- if let Some ( preset_path) = config. preset_path {
90- self . add_preset_path ( & preset_path) ;
91- }
92- }
93-
94- /// Add presets to the playlist recursively skipping duplicates.
95- pub fn add_preset_path ( & mut self , preset_path : & str ) {
96- self . playlist . add_path ( preset_path, true ) ;
97- println ! ( "added preset path: {}" , preset_path) ;
98- println ! ( "playlist size: {}" , self . playlist. len( ) ) ;
99- }
10078}
0 commit comments