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 | |
parent | 0ecfaf7b7cf762590d5ba92f57567901c02af15b (diff) |
add logger
l--------- | .direnv/flake-profile | 2 | ||||
-rw-r--r-- | .direnv/flake-profile.rc | 4 | ||||
-rw-r--r-- | Cargo.lock | 130 | ||||
-rw-r--r-- | Cargo.toml | 2 | ||||
-rw-r--r-- | src/main.rs | 21 |
5 files changed, 154 insertions, 5 deletions
diff --git a/.direnv/flake-profile b/.direnv/flake-profile index af84f4a..de6df3e 120000 --- a/.direnv/flake-profile +++ b/.direnv/flake-profile | |||
@@ -1 +1 @@ | |||
/nix/store/ygpg4qzcxw9qla4gfmr9mql4nk779acv-nix-shell-env \ No newline at end of file | /nix/store/x8d6jx9xq1ad59257ajm59fpfldwa8ag-nix-shell-env \ No newline at end of file | ||
diff --git a/.direnv/flake-profile.rc b/.direnv/flake-profile.rc index 7c49caf..a7bc4e1 100644 --- a/.direnv/flake-profile.rc +++ b/.direnv/flake-profile.rc | |||
@@ -32,7 +32,7 @@ NIX_CC=/nix/store/ca37d3qrydh0wpw40kswsx30j8dyzxh2-gcc-wrapper-10.2.0 | |||
32 | export NIX_CC | 32 | export NIX_CC |
33 | NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 | 33 | NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 |
34 | export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu | 34 | export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu |
35 | NIX_CFLAGS_COMPILE=' -frandom-seed=ygpg4qzcxw -isystem /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include -isystem /nix/store/5sphs39wg8gyy5pcrcml5pyj1wrn9jil-libGL-1.3.2-dev/include -isystem /nix/store/skwk7hmzwpjvhgjf1y633l01p114xc6n-libglvnd-1.3.2-dev/include -isystem /nix/store/3y6j0k82fdp3ifnq655yv1ad1ih7r70j-libX11-1.7.0-dev/include -isystem /nix/store/vjimy2jlifszmmms664373jdw0yiz4ln-xorgproto-2020.1/include -isystem /nix/store/6xg7mhwh2k7i27r44lx679diwd7ahq6d-libxcb-1.14-dev/include -isystem /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include -isystem /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include -isystem /nix/store/5sphs39wg8gyy5pcrcml5pyj1wrn9jil-libGL-1.3.2-dev/include -isystem /nix/store/skwk7hmzwpjvhgjf1y633l01p114xc6n-libglvnd-1.3.2-dev/include -isystem /nix/store/3y6j0k82fdp3ifnq655yv1ad1ih7r70j-libX11-1.7.0-dev/include -isystem /nix/store/vjimy2jlifszmmms664373jdw0yiz4ln-xorgproto-2020.1/include -isystem /nix/store/6xg7mhwh2k7i27r44lx679diwd7ahq6d-libxcb-1.14-dev/include -isystem /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include' | 35 | NIX_CFLAGS_COMPILE=' -frandom-seed=x8d6jx9xq1 -isystem /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include -isystem /nix/store/5sphs39wg8gyy5pcrcml5pyj1wrn9jil-libGL-1.3.2-dev/include -isystem /nix/store/skwk7hmzwpjvhgjf1y633l01p114xc6n-libglvnd-1.3.2-dev/include -isystem /nix/store/3y6j0k82fdp3ifnq655yv1ad1ih7r70j-libX11-1.7.0-dev/include -isystem /nix/store/vjimy2jlifszmmms664373jdw0yiz4ln-xorgproto-2020.1/include -isystem /nix/store/6xg7mhwh2k7i27r44lx679diwd7ahq6d-libxcb-1.14-dev/include -isystem /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include -isystem /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include -isystem /nix/store/5sphs39wg8gyy5pcrcml5pyj1wrn9jil-libGL-1.3.2-dev/include -isystem /nix/store/skwk7hmzwpjvhgjf1y633l01p114xc6n-libglvnd-1.3.2-dev/include -isystem /nix/store/3y6j0k82fdp3ifnq655yv1ad1ih7r70j-libX11-1.7.0-dev/include -isystem /nix/store/vjimy2jlifszmmms664373jdw0yiz4ln-xorgproto-2020.1/include -isystem /nix/store/6xg7mhwh2k7i27r44lx679diwd7ahq6d-libxcb-1.14-dev/include -isystem /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include' |
36 | export NIX_CFLAGS_COMPILE | 36 | export NIX_CFLAGS_COMPILE |
37 | NIX_ENFORCE_NO_NATIVE=1 | 37 | NIX_ENFORCE_NO_NATIVE=1 |
38 | export NIX_ENFORCE_NO_NATIVE | 38 | export NIX_ENFORCE_NO_NATIVE |
@@ -63,6 +63,8 @@ RANLIB=ranlib | |||
63 | export RANLIB | 63 | export RANLIB |
64 | READELF=readelf | 64 | READELF=readelf |
65 | export READELF | 65 | export READELF |
66 | RUST_LOG=info | ||
67 | export RUST_LOG | ||
66 | RUST_SRC_PATH=/nix/store/wfv522w143y3yxx8ap3fkpjk9cnh1w3a-rust-lib-src | 68 | RUST_SRC_PATH=/nix/store/wfv522w143y3yxx8ap3fkpjk9cnh1w3a-rust-lib-src |
67 | export RUST_SRC_PATH | 69 | export RUST_SRC_PATH |
68 | SDL2_PATH='/nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2 /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2 /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2' | 70 | SDL2_PATH='/nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2 /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2 /nix/store/gkqv9ia81dmmjqcn46ih5yirbzjy7s9p-SDL2-2.0.14-dev/include/SDL2 /nix/store/qx325fjgyhy5cql0fkbkzzbi9dpd2cb8-SDL2_ttf-2.0.15/include/SDL2' |
@@ -1,6 +1,26 @@ | |||
1 | # This file is automatically @generated by Cargo. | 1 | # This file is automatically @generated by Cargo. |
2 | # It is not intended for manual editing. | 2 | # It is not intended for manual editing. |
3 | [[package]] | 3 | [[package]] |
4 | name = "aho-corasick" | ||
5 | version = "0.7.15" | ||
6 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
7 | checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5" | ||
8 | dependencies = [ | ||
9 | "memchr", | ||
10 | ] | ||
11 | |||
12 | [[package]] | ||
13 | name = "atty" | ||
14 | version = "0.2.14" | ||
15 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
16 | checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" | ||
17 | dependencies = [ | ||
18 | "hermit-abi", | ||
19 | "libc", | ||
20 | "winapi", | ||
21 | ] | ||
22 | |||
23 | [[package]] | ||
4 | name = "bitflags" | 24 | name = "bitflags" |
5 | version = "1.2.1" | 25 | version = "1.2.1" |
6 | source = "registry+https://github.com/rust-lang/crates.io-index" | 26 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -31,12 +51,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
31 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" | 51 | checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" |
32 | 52 | ||
33 | [[package]] | 53 | [[package]] |
54 | name = "cfg-if" | ||
55 | version = "1.0.0" | ||
56 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
57 | checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" | ||
58 | |||
59 | [[package]] | ||
60 | name = "env_logger" | ||
61 | version = "0.8.3" | ||
62 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
63 | checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f" | ||
64 | dependencies = [ | ||
65 | "atty", | ||
66 | "humantime", | ||
67 | "log", | ||
68 | "regex", | ||
69 | "termcolor", | ||
70 | ] | ||
71 | |||
72 | [[package]] | ||
34 | name = "funty" | 73 | name = "funty" |
35 | version = "1.2.0" | 74 | version = "1.2.0" |
36 | source = "registry+https://github.com/rust-lang/crates.io-index" | 75 | source = "registry+https://github.com/rust-lang/crates.io-index" |
37 | checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" | 76 | checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" |
38 | 77 | ||
39 | [[package]] | 78 | [[package]] |
79 | name = "hermit-abi" | ||
80 | version = "0.1.18" | ||
81 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
82 | checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" | ||
83 | dependencies = [ | ||
84 | "libc", | ||
85 | ] | ||
86 | |||
87 | [[package]] | ||
88 | name = "humantime" | ||
89 | version = "2.1.0" | ||
90 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
91 | checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" | ||
92 | |||
93 | [[package]] | ||
40 | name = "lazy_static" | 94 | name = "lazy_static" |
41 | version = "1.4.0" | 95 | version = "1.4.0" |
42 | source = "registry+https://github.com/rust-lang/crates.io-index" | 96 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -49,6 +103,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
49 | checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" | 103 | checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" |
50 | 104 | ||
51 | [[package]] | 105 | [[package]] |
106 | name = "log" | ||
107 | version = "0.4.14" | ||
108 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
109 | checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" | ||
110 | dependencies = [ | ||
111 | "cfg-if 1.0.0", | ||
112 | ] | ||
113 | |||
114 | [[package]] | ||
115 | name = "memchr" | ||
116 | version = "2.3.4" | ||
117 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
118 | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" | ||
119 | |||
120 | [[package]] | ||
52 | name = "obi" | 121 | name = "obi" |
53 | version = "0.1.0" | 122 | version = "0.1.0" |
54 | dependencies = [ | 123 | dependencies = [ |
@@ -63,9 +132,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
63 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" | 132 | checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" |
64 | 133 | ||
65 | [[package]] | 134 | [[package]] |
135 | name = "regex" | ||
136 | version = "1.4.5" | ||
137 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
138 | checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19" | ||
139 | dependencies = [ | ||
140 | "aho-corasick", | ||
141 | "memchr", | ||
142 | "regex-syntax", | ||
143 | ] | ||
144 | |||
145 | [[package]] | ||
146 | name = "regex-syntax" | ||
147 | version = "0.6.23" | ||
148 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
149 | checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548" | ||
150 | |||
151 | [[package]] | ||
66 | name = "sdl-tests" | 152 | name = "sdl-tests" |
67 | version = "0.1.0" | 153 | version = "0.1.0" |
68 | dependencies = [ | 154 | dependencies = [ |
155 | "env_logger", | ||
156 | "log", | ||
69 | "obi", | 157 | "obi", |
70 | "sdl2", | 158 | "sdl2", |
71 | ] | 159 | ] |
@@ -88,7 +176,7 @@ version = "0.34.3" | |||
88 | source = "registry+https://github.com/rust-lang/crates.io-index" | 176 | source = "registry+https://github.com/rust-lang/crates.io-index" |
89 | checksum = "28d81feded049b9c14eceb4a4f6d596a98cebbd59abdba949c5552a015466d33" | 177 | checksum = "28d81feded049b9c14eceb4a4f6d596a98cebbd59abdba949c5552a015466d33" |
90 | dependencies = [ | 178 | dependencies = [ |
91 | "cfg-if", | 179 | "cfg-if 0.1.10", |
92 | "libc", | 180 | "libc", |
93 | "version-compare", | 181 | "version-compare", |
94 | ] | 182 | ] |
@@ -100,12 +188,52 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||
100 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" | 188 | checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" |
101 | 189 | ||
102 | [[package]] | 190 | [[package]] |
191 | name = "termcolor" | ||
192 | version = "1.1.2" | ||
193 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
194 | checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" | ||
195 | dependencies = [ | ||
196 | "winapi-util", | ||
197 | ] | ||
198 | |||
199 | [[package]] | ||
103 | name = "version-compare" | 200 | name = "version-compare" |
104 | version = "0.0.10" | 201 | version = "0.0.10" |
105 | source = "registry+https://github.com/rust-lang/crates.io-index" | 202 | source = "registry+https://github.com/rust-lang/crates.io-index" |
106 | checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" | 203 | checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" |
107 | 204 | ||
108 | [[package]] | 205 | [[package]] |
206 | name = "winapi" | ||
207 | version = "0.3.9" | ||
208 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
209 | checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" | ||
210 | dependencies = [ | ||
211 | "winapi-i686-pc-windows-gnu", | ||
212 | "winapi-x86_64-pc-windows-gnu", | ||
213 | ] | ||
214 | |||
215 | [[package]] | ||
216 | name = "winapi-i686-pc-windows-gnu" | ||
217 | version = "0.4.0" | ||
218 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
219 | checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" | ||
220 | |||
221 | [[package]] | ||
222 | name = "winapi-util" | ||
223 | version = "0.1.5" | ||
224 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
225 | checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" | ||
226 | dependencies = [ | ||
227 | "winapi", | ||
228 | ] | ||
229 | |||
230 | [[package]] | ||
231 | name = "winapi-x86_64-pc-windows-gnu" | ||
232 | version = "0.4.0" | ||
233 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
234 | checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" | ||
235 | |||
236 | [[package]] | ||
109 | name = "wyz" | 237 | name = "wyz" |
110 | version = "0.2.0" | 238 | version = "0.2.0" |
111 | source = "registry+https://github.com/rust-lang/crates.io-index" | 239 | source = "registry+https://github.com/rust-lang/crates.io-index" |
@@ -9,3 +9,5 @@ edition = "2018" | |||
9 | [dependencies] | 9 | [dependencies] |
10 | sdl2 = {version = "0.34", features = ["ttf"]} | 10 | sdl2 = {version = "0.34", features = ["ttf"]} |
11 | obi = { path = "../obi" } | 11 | obi = { path = "../obi" } |
12 | env_logger = "0.8.3" | ||
13 | log = "0.4.0" | ||
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(); |