aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAkshay <[email protected]>2021-03-23 13:25:49 +0000
committerAkshay <[email protected]>2021-03-23 13:25:49 +0000
commit005156915c9d1d36500b73b9c44d9179aecd8c2f (patch)
tree0235ac56cfb49e7a1718db1fdd9c5d347f044508
parent0ecfaf7b7cf762590d5ba92f57567901c02af15b (diff)
add logger
l---------.direnv/flake-profile2
-rw-r--r--.direnv/flake-profile.rc4
-rw-r--r--Cargo.lock130
-rw-r--r--Cargo.toml2
-rw-r--r--src/main.rs21
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
32export NIX_CC 32export NIX_CC
33NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 33NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1
34export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 34export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu
35NIX_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' 35NIX_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'
36export NIX_CFLAGS_COMPILE 36export NIX_CFLAGS_COMPILE
37NIX_ENFORCE_NO_NATIVE=1 37NIX_ENFORCE_NO_NATIVE=1
38export NIX_ENFORCE_NO_NATIVE 38export NIX_ENFORCE_NO_NATIVE
@@ -63,6 +63,8 @@ RANLIB=ranlib
63export RANLIB 63export RANLIB
64READELF=readelf 64READELF=readelf
65export READELF 65export READELF
66RUST_LOG=info
67export RUST_LOG
66RUST_SRC_PATH=/nix/store/wfv522w143y3yxx8ap3fkpjk9cnh1w3a-rust-lib-src 68RUST_SRC_PATH=/nix/store/wfv522w143y3yxx8ap3fkpjk9cnh1w3a-rust-lib-src
67export RUST_SRC_PATH 69export RUST_SRC_PATH
68SDL2_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' 70SDL2_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'
diff --git a/Cargo.lock b/Cargo.lock
index 317c95f..bf0c4c1 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -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]]
4name = "aho-corasick"
5version = "0.7.15"
6source = "registry+https://github.com/rust-lang/crates.io-index"
7checksum = "7404febffaa47dac81aa44dba71523c9d069b1bdc50a77db41195149e17f68e5"
8dependencies = [
9 "memchr",
10]
11
12[[package]]
13name = "atty"
14version = "0.2.14"
15source = "registry+https://github.com/rust-lang/crates.io-index"
16checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8"
17dependencies = [
18 "hermit-abi",
19 "libc",
20 "winapi",
21]
22
23[[package]]
4name = "bitflags" 24name = "bitflags"
5version = "1.2.1" 25version = "1.2.1"
6source = "registry+https://github.com/rust-lang/crates.io-index" 26source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -31,12 +51,46 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
31checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" 51checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
32 52
33[[package]] 53[[package]]
54name = "cfg-if"
55version = "1.0.0"
56source = "registry+https://github.com/rust-lang/crates.io-index"
57checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
58
59[[package]]
60name = "env_logger"
61version = "0.8.3"
62source = "registry+https://github.com/rust-lang/crates.io-index"
63checksum = "17392a012ea30ef05a610aa97dfb49496e71c9f676b27879922ea5bdf60d9d3f"
64dependencies = [
65 "atty",
66 "humantime",
67 "log",
68 "regex",
69 "termcolor",
70]
71
72[[package]]
34name = "funty" 73name = "funty"
35version = "1.2.0" 74version = "1.2.0"
36source = "registry+https://github.com/rust-lang/crates.io-index" 75source = "registry+https://github.com/rust-lang/crates.io-index"
37checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e" 76checksum = "1847abb9cb65d566acd5942e94aea9c8f547ad02c98e1649326fc0e8910b8b1e"
38 77
39[[package]] 78[[package]]
79name = "hermit-abi"
80version = "0.1.18"
81source = "registry+https://github.com/rust-lang/crates.io-index"
82checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c"
83dependencies = [
84 "libc",
85]
86
87[[package]]
88name = "humantime"
89version = "2.1.0"
90source = "registry+https://github.com/rust-lang/crates.io-index"
91checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4"
92
93[[package]]
40name = "lazy_static" 94name = "lazy_static"
41version = "1.4.0" 95version = "1.4.0"
42source = "registry+https://github.com/rust-lang/crates.io-index" 96source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -49,6 +103,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
49checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a" 103checksum = "03b07a082330a35e43f63177cc01689da34fbffa0105e1246cf0311472cac73a"
50 104
51[[package]] 105[[package]]
106name = "log"
107version = "0.4.14"
108source = "registry+https://github.com/rust-lang/crates.io-index"
109checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
110dependencies = [
111 "cfg-if 1.0.0",
112]
113
114[[package]]
115name = "memchr"
116version = "2.3.4"
117source = "registry+https://github.com/rust-lang/crates.io-index"
118checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525"
119
120[[package]]
52name = "obi" 121name = "obi"
53version = "0.1.0" 122version = "0.1.0"
54dependencies = [ 123dependencies = [
@@ -63,9 +132,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
63checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb" 132checksum = "643f8f41a8ebc4c5dc4515c82bb8abd397b527fc20fd681b7c011c2aee5d44fb"
64 133
65[[package]] 134[[package]]
135name = "regex"
136version = "1.4.5"
137source = "registry+https://github.com/rust-lang/crates.io-index"
138checksum = "957056ecddbeba1b26965114e191d2e8589ce74db242b6ea25fc4062427a5c19"
139dependencies = [
140 "aho-corasick",
141 "memchr",
142 "regex-syntax",
143]
144
145[[package]]
146name = "regex-syntax"
147version = "0.6.23"
148source = "registry+https://github.com/rust-lang/crates.io-index"
149checksum = "24d5f089152e60f62d28b835fbff2cd2e8dc0baf1ac13343bef92ab7eed84548"
150
151[[package]]
66name = "sdl-tests" 152name = "sdl-tests"
67version = "0.1.0" 153version = "0.1.0"
68dependencies = [ 154dependencies = [
155 "env_logger",
156 "log",
69 "obi", 157 "obi",
70 "sdl2", 158 "sdl2",
71] 159]
@@ -88,7 +176,7 @@ version = "0.34.3"
88source = "registry+https://github.com/rust-lang/crates.io-index" 176source = "registry+https://github.com/rust-lang/crates.io-index"
89checksum = "28d81feded049b9c14eceb4a4f6d596a98cebbd59abdba949c5552a015466d33" 177checksum = "28d81feded049b9c14eceb4a4f6d596a98cebbd59abdba949c5552a015466d33"
90dependencies = [ 178dependencies = [
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"
100checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" 188checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
101 189
102[[package]] 190[[package]]
191name = "termcolor"
192version = "1.1.2"
193source = "registry+https://github.com/rust-lang/crates.io-index"
194checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4"
195dependencies = [
196 "winapi-util",
197]
198
199[[package]]
103name = "version-compare" 200name = "version-compare"
104version = "0.0.10" 201version = "0.0.10"
105source = "registry+https://github.com/rust-lang/crates.io-index" 202source = "registry+https://github.com/rust-lang/crates.io-index"
106checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1" 203checksum = "d63556a25bae6ea31b52e640d7c41d1ab27faba4ccb600013837a3d0b3994ca1"
107 204
108[[package]] 205[[package]]
206name = "winapi"
207version = "0.3.9"
208source = "registry+https://github.com/rust-lang/crates.io-index"
209checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
210dependencies = [
211 "winapi-i686-pc-windows-gnu",
212 "winapi-x86_64-pc-windows-gnu",
213]
214
215[[package]]
216name = "winapi-i686-pc-windows-gnu"
217version = "0.4.0"
218source = "registry+https://github.com/rust-lang/crates.io-index"
219checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
220
221[[package]]
222name = "winapi-util"
223version = "0.1.5"
224source = "registry+https://github.com/rust-lang/crates.io-index"
225checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178"
226dependencies = [
227 "winapi",
228]
229
230[[package]]
231name = "winapi-x86_64-pc-windows-gnu"
232version = "0.4.0"
233source = "registry+https://github.com/rust-lang/crates.io-index"
234checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
235
236[[package]]
109name = "wyz" 237name = "wyz"
110version = "0.2.0" 238version = "0.2.0"
111source = "registry+https://github.com/rust-lang/crates.io-index" 239source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/Cargo.toml b/Cargo.toml
index 48976e7..5fa2e12 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,3 +9,5 @@ edition = "2018"
9[dependencies] 9[dependencies]
10sdl2 = {version = "0.34", features = ["ttf"]} 10sdl2 = {version = "0.34", features = ["ttf"]}
11obi = { path = "../obi" } 11obi = { path = "../obi" }
12env_logger = "0.8.3"
13log = "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
20use log::{error, info};
20use obi::Image; 21use obi::Image;
21 22
22pub fn main() { 23pub 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();