@@ -14,8 +14,6 @@ use notation_midi::prelude::{
1414 MidiPlugin ,
1515} ;
1616
17- use super :: state:: { NotationState , TabPathes } ;
18-
1917pub struct NotationPlugins ;
2018impl PluginGroup for NotationPlugins {
2119 fn build ( & mut self , group : & mut PluginGroupBuilder ) {
@@ -47,8 +45,9 @@ pub struct NotationApp;
4745impl NotationApp {
4846 pub const TITLE : & ' static str = "Fun Notation" ;
4947
50- pub fn new_app < A : ExtraAssets > ( title : & str ) -> App {
48+ pub fn new_app < A : ExtraAssets > ( args : NotationArgs , title : & str ) -> App {
5149 let mut app = App :: new ( ) ;
50+ app. insert_resource ( args) ;
5251 AssetLoader :: new ( NotationAssetsStates :: Loading )
5352 . continue_to_state ( NotationAssetsStates :: Loaded )
5453 . with_collection :: < NotationAssets > ( )
@@ -89,24 +88,13 @@ impl NotationApp {
8988 app
9089 }
9190
92- #[ cfg( target_arch = "wasm32" ) ]
93- pub fn get_tab_from_url ( ) -> Result < String , String > {
94- web_sys:: window ( )
95- . ok_or ( "No_Window" . to_owned ( ) )
96- . and_then ( |x| x. document ( ) . ok_or ( "No_Document" . to_owned ( ) ) )
97- . and_then ( |x| x. location ( ) . ok_or ( "No_Location" . to_owned ( ) ) )
98- . and_then ( |x| x. search ( ) . map_err ( |e| format ! ( "No_Search:{:?}" , e) ) )
99- . map ( |x| x. trim_start_matches ( '?' ) . to_owned ( ) )
100- }
101-
102- pub fn run_with_extra < A , F > ( tab_pathes : Vec < String > , extra : F )
91+ pub fn run_with_extra < A , F > ( args : NotationArgs , extra : F )
10392 where
10493 A : ExtraAssets ,
10594 F : Fn ( & mut App ) ,
10695 {
107- let mut app = NotationApp :: new_app :: < A > ( Self :: TITLE ) ;
96+ let mut app = NotationApp :: new_app :: < A > ( args , Self :: TITLE ) ;
10897
109- app. insert_resource ( TabPathes ( tab_pathes) ) ;
11098 app. init_resource :: < NotationState > ( ) ;
11199
112100 app. add_startup_system ( Self :: setup_camera) ;
@@ -135,8 +123,8 @@ impl NotationApp {
135123 extra ( & mut app) ;
136124 app. run ( ) ;
137125 }
138- pub fn run < A : ExtraAssets > ( tab_pathes : Vec < String > ) {
139- Self :: run_with_extra :: < A , _ > ( tab_pathes , |_app|{ } )
126+ pub fn run < A : ExtraAssets > ( args : NotationArgs ) {
127+ Self :: run_with_extra :: < A , _ > ( args , |_app|{ } )
140128 }
141129}
142130
0 commit comments