|
|
@@ -10,9 +10,9 @@ extern crate reqwest;
|
|
10
|
10
|
extern crate toml;
|
|
11
|
11
|
extern crate xdg;
|
|
12
|
12
|
|
|
|
13
|
+pub mod args;
|
|
13
|
14
|
#[macro_use]
|
|
14
|
15
|
pub mod context;
|
|
15
|
|
-
|
|
16
|
16
|
pub mod buffer;
|
|
17
|
17
|
pub mod config;
|
|
18
|
18
|
pub mod coord;
|
|
|
@@ -26,7 +26,6 @@ pub mod tile_atlas;
|
|
26
|
26
|
pub mod tile_loader;
|
|
27
|
27
|
pub mod tile_source;
|
|
28
|
28
|
|
|
29
|
|
-use clap::Arg;
|
|
30
|
29
|
use coord::ScreenCoord;
|
|
31
|
30
|
use glutin::{ControlFlow, ElementState, Event, GlContext, MouseButton, MouseScrollDelta, VirtualKeyCode, WindowEvent};
|
|
32
|
31
|
use map_view_gl::MapViewGl;
|
|
|
@@ -178,36 +177,7 @@ fn dur_to_sec(dur: Duration) -> f64 {
|
|
178
|
177
|
fn main() {
|
|
179
|
178
|
env_logger::init();
|
|
180
|
179
|
|
|
181
|
|
- let matches = clap::App::new("DeltaMap")
|
|
182
|
|
- .version(crate_version!())
|
|
183
|
|
- .author(crate_authors!())
|
|
184
|
|
- .about(crate_description!())
|
|
185
|
|
- .arg(Arg::with_name("config")
|
|
186
|
|
- .short("c")
|
|
187
|
|
- .long("config")
|
|
188
|
|
- .value_name("FILE")
|
|
189
|
|
- .help("Set a custom config file")
|
|
190
|
|
- .takes_value(true))
|
|
191
|
|
- .arg(Arg::with_name("fps")
|
|
192
|
|
- .long("fps")
|
|
193
|
|
- .value_name("FPS")
|
|
194
|
|
- .validator(|s| {
|
|
195
|
|
- s.parse::<f64>()
|
|
196
|
|
- .map(|_| ())
|
|
197
|
|
- .map_err(|e| format!("{}", e))
|
|
198
|
|
- })
|
|
199
|
|
- .help("Set target frames per second (default is 60). \
|
|
200
|
|
- This should equal the refresh rate of the display.")
|
|
201
|
|
- .takes_value(true))
|
|
202
|
|
- .arg(Arg::with_name("offline")
|
|
203
|
|
- .long("offline")
|
|
204
|
|
- .help("Do not use the network. \
|
|
205
|
|
- Try to load tiles from the offline file system cache."))
|
|
206
|
|
- .arg(Arg::with_name("sync")
|
|
207
|
|
- .long("sync")
|
|
208
|
|
- .help("Load tiles in a synchronous fashion. \
|
|
209
|
|
- Interaction is not possible while tiles are loading."))
|
|
210
|
|
- .get_matches();
|
|
|
180
|
+ let matches = args::parse();
|
|
211
|
181
|
|
|
212
|
182
|
let config = if let Some(config_path) = matches.value_of_os("config") {
|
|
213
|
183
|
config::Config::from_toml_file(config_path).unwrap()
|