diff options
author | Akshay <[email protected]> | 2021-03-23 13:25:49 +0000 |
---|---|---|
committer | Akshay <[email protected]> | 2021-03-23 13:25:49 +0000 |
commit | 005156915c9d1d36500b73b9c44d9179aecd8c2f (patch) | |
tree | 0235ac56cfb49e7a1718db1fdd9c5d347f044508 /src | |
parent | 0ecfaf7b7cf762590d5ba92f57567901c02af15b (diff) |
add logger
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs index 197b200..1f5dc8a 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -17,11 +17,28 @@ use std::{ | |||
17 | io::{Cursor, Read}, | 17 | io::{Cursor, Read}, |
18 | }; | 18 | }; |
19 | 19 | ||
20 | use log::{error, info}; | ||
20 | use obi::Image; | 21 | use obi::Image; |
21 | 22 | ||
22 | pub fn main() { | 23 | pub fn main() { |
23 | let sdl_context = sdl2::init().unwrap(); | 24 | env_logger::init(); |
24 | let ttf_context = sdl2::ttf::init().unwrap(); | 25 | |
26 | let sdl_context = sdl2::init(); | ||
27 | if sdl_context.is_err() { | ||
28 | error!("Unable to find libsdl2 ... Exiting"); | ||
29 | return; | ||
30 | } | ||
31 | let sdl_context = sdl_context.unwrap(); | ||
32 | info!("Initialized SDL context"); | ||
33 | |||
34 | let ttf_context = sdl2::ttf::init(); | ||
35 | if ttf_context.is_err() { | ||
36 | error!("Unable to find SDL2_ttf ... Exiting"); | ||
37 | return; | ||
38 | } | ||
39 | let ttf_context = ttf_context.unwrap(); | ||
40 | info!("Initialized SDL_ttf context"); | ||
41 | |||
25 | let args: Vec<_> = env::args().collect(); | 42 | let args: Vec<_> = env::args().collect(); |
26 | if args.len() < 2 { | 43 | if args.len() < 2 { |
27 | AppState::init(160, 160, &sdl_context, &ttf_context, None).run(); | 44 | AppState::init(160, 160, &sdl_context, &ttf_context, None).run(); |