| @@ -188,7 +188,7 @@ dependencies = [ | |||||
| "block", | "block", | ||||
| "cocoa-foundation", | "cocoa-foundation", | ||||
| "core-foundation 0.9.1", | "core-foundation 0.9.1", | ||||
| "core-graphics 0.22.1", | |||||
| "core-graphics 0.22.2", | |||||
| "foreign-types", | "foreign-types", | ||||
| "libc", | "libc", | ||||
| "objc", | "objc", | ||||
| @@ -261,9 +261,9 @@ dependencies = [ | |||||
| [[package]] | [[package]] | ||||
| name = "core-graphics" | name = "core-graphics" | ||||
| version = "0.22.1" | |||||
| version = "0.22.2" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "fc239bba52bab96649441699533a68de294a101533b0270b2d65aa402b29a7f9" | |||||
| checksum = "269f35f69b542b80e736a20a89a05215c0ce80c2c03c514abb2e318b78379d86" | |||||
| dependencies = [ | dependencies = [ | ||||
| "bitflags", | "bitflags", | ||||
| "core-foundation 0.9.1", | "core-foundation 0.9.1", | ||||
| @@ -512,101 +512,6 @@ version = "0.3.3" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" | checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" | ||||
| [[package]] | |||||
| name = "futures" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "9b3b0c040a1fe6529d30b3c5944b280c7f0dcb2930d2c3062bca967b602583d0" | |||||
| dependencies = [ | |||||
| "futures-channel", | |||||
| "futures-core", | |||||
| "futures-executor", | |||||
| "futures-io", | |||||
| "futures-sink", | |||||
| "futures-task", | |||||
| "futures-util", | |||||
| ] | |||||
| [[package]] | |||||
| name = "futures-channel" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "4b7109687aa4e177ef6fe84553af6280ef2778bdb7783ba44c9dc3399110fe64" | |||||
| dependencies = [ | |||||
| "futures-core", | |||||
| "futures-sink", | |||||
| ] | |||||
| [[package]] | |||||
| name = "futures-core" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "847ce131b72ffb13b6109a221da9ad97a64cbe48feb1028356b836b47b8f1748" | |||||
| [[package]] | |||||
| name = "futures-executor" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "4caa2b2b68b880003057c1dd49f1ed937e38f22fcf6c212188a121f08cf40a65" | |||||
| dependencies = [ | |||||
| "futures-core", | |||||
| "futures-task", | |||||
| "futures-util", | |||||
| ] | |||||
| [[package]] | |||||
| name = "futures-io" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "611834ce18aaa1bd13c4b374f5d653e1027cf99b6b502584ff8c9a64413b30bb" | |||||
| [[package]] | |||||
| name = "futures-macro" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "77408a692f1f97bcc61dc001d752e00643408fbc922e4d634c655df50d595556" | |||||
| dependencies = [ | |||||
| "proc-macro-hack", | |||||
| "proc-macro2", | |||||
| "quote", | |||||
| "syn", | |||||
| ] | |||||
| [[package]] | |||||
| name = "futures-sink" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "f878195a49cee50e006b02b93cf7e0a95a38ac7b776b4c4d9cc1207cd20fcb3d" | |||||
| [[package]] | |||||
| name = "futures-task" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "7c554eb5bf48b2426c4771ab68c6b14468b6e76cc90996f528c3338d761a4d0d" | |||||
| dependencies = [ | |||||
| "once_cell", | |||||
| ] | |||||
| [[package]] | |||||
| name = "futures-util" | |||||
| version = "0.3.8" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "d304cff4a7b99cfb7986f7d43fbe93d175e72e704a8860787cc95e9ffd85cbd2" | |||||
| dependencies = [ | |||||
| "futures-channel", | |||||
| "futures-core", | |||||
| "futures-io", | |||||
| "futures-macro", | |||||
| "futures-sink", | |||||
| "futures-task", | |||||
| "memchr", | |||||
| "pin-project", | |||||
| "pin-utils", | |||||
| "proc-macro-hack", | |||||
| "proc-macro-nested", | |||||
| "slab", | |||||
| ] | |||||
| [[package]] | [[package]] | ||||
| name = "getrandom" | name = "getrandom" | ||||
| version = "0.1.15" | version = "0.1.15" | ||||
| @@ -964,13 +869,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" | checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" | ||||
| [[package]] | [[package]] | ||||
| name = "memmap" | |||||
| version = "0.7.0" | |||||
| name = "memmap2" | |||||
| version = "0.1.0" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "6585fd95e7bb50d6cc31e20d4cf9afb4e2ba16c5846fc76793f11218da9c475b" | |||||
| checksum = "d9b70ca2a6103ac8b665dc150b142ef0e4e89df640c9e6cf295d189c3caebe5a" | |||||
| dependencies = [ | dependencies = [ | ||||
| "libc", | "libc", | ||||
| "winapi 0.3.9", | |||||
| ] | ] | ||||
| [[package]] | [[package]] | ||||
| @@ -1280,38 +1184,6 @@ version = "2.1.0" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" | checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" | ||||
| [[package]] | |||||
| name = "pin-project" | |||||
| version = "1.0.2" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "9ccc2237c2c489783abd8c4c80e5450fc0e98644555b1364da68cc29aa151ca7" | |||||
| dependencies = [ | |||||
| "pin-project-internal", | |||||
| ] | |||||
| [[package]] | |||||
| name = "pin-project-internal" | |||||
| version = "1.0.2" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "f8e8d2bf0b23038a4424865103a4df472855692821aab4e4f5c3312d461d9e5f" | |||||
| dependencies = [ | |||||
| "proc-macro2", | |||||
| "quote", | |||||
| "syn", | |||||
| ] | |||||
| [[package]] | |||||
| name = "pin-project-lite" | |||||
| version = "0.2.0" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "6b063f57ec186e6140e2b8b6921e5f1bd89c7356dda5b33acc5401203ca6131c" | |||||
| [[package]] | |||||
| name = "pin-utils" | |||||
| version = "0.1.0" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" | |||||
| [[package]] | [[package]] | ||||
| name = "pkg-config" | name = "pkg-config" | ||||
| version = "0.3.19" | version = "0.3.19" | ||||
| @@ -1333,18 +1205,6 @@ dependencies = [ | |||||
| "toml", | "toml", | ||||
| ] | ] | ||||
| [[package]] | |||||
| name = "proc-macro-hack" | |||||
| version = "0.5.19" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" | |||||
| [[package]] | |||||
| name = "proc-macro-nested" | |||||
| version = "0.1.6" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" | |||||
| [[package]] | [[package]] | ||||
| name = "proc-macro2" | name = "proc-macro2" | ||||
| version = "1.0.24" | version = "1.0.24" | ||||
| @@ -1623,9 +1483,9 @@ dependencies = [ | |||||
| [[package]] | [[package]] | ||||
| name = "smithay-client-toolkit" | name = "smithay-client-toolkit" | ||||
| version = "0.12.0" | |||||
| version = "0.12.1" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "2ec5c077def8af49f9b5aeeb5fcf8079c638c6615c3a8f9305e2dea601de57f7" | |||||
| checksum = "86d1d080d3dc98d68251d073b231dfaa200fdc2ddebc435b313ad937d0ae9dfd" | |||||
| dependencies = [ | dependencies = [ | ||||
| "andrew", | "andrew", | ||||
| "bitflags", | "bitflags", | ||||
| @@ -1634,7 +1494,7 @@ dependencies = [ | |||||
| "dlib", | "dlib", | ||||
| "lazy_static", | "lazy_static", | ||||
| "log", | "log", | ||||
| "memmap", | |||||
| "memmap2", | |||||
| "nix", | "nix", | ||||
| "wayland-client", | "wayland-client", | ||||
| "wayland-cursor", | "wayland-cursor", | ||||
| @@ -1642,32 +1502,46 @@ dependencies = [ | |||||
| ] | ] | ||||
| [[package]] | [[package]] | ||||
| name = "space-crush" | |||||
| name = "space-crush-app" | |||||
| version = "0.1.0" | version = "0.1.0" | ||||
| dependencies = [ | dependencies = [ | ||||
| "futures", | |||||
| "gl", | "gl", | ||||
| "glc", | "glc", | ||||
| "glutin", | "glutin", | ||||
| "glyph_brush", | "glyph_brush", | ||||
| "log", | "log", | ||||
| "log4rs", | "log4rs", | ||||
| "num_cpus", | |||||
| "ordered-float 2.0.1", | "ordered-float 2.0.1", | ||||
| "rand", | |||||
| "serde", | "serde", | ||||
| "serde_json", | "serde_json", | ||||
| "serde_yaml", | |||||
| "shred", | "shred", | ||||
| "shrev", | "shrev", | ||||
| "smallvec", | "smallvec", | ||||
| "space-crush-common", | |||||
| "specs", | |||||
| "thiserror", | |||||
| ] | |||||
| [[package]] | |||||
| name = "space-crush-common" | |||||
| version = "0.1.0" | |||||
| dependencies = [ | |||||
| "glc", | |||||
| "log", | |||||
| "log4rs", | |||||
| "serde_yaml", | |||||
| "shred", | |||||
| "shrev", | |||||
| "specs", | "specs", | ||||
| "thiserror", | "thiserror", | ||||
| "tokio", | |||||
| "vfs", | "vfs", | ||||
| "vfs-zip", | "vfs-zip", | ||||
| ] | ] | ||||
| [[package]] | |||||
| name = "space-crush-server" | |||||
| version = "0.1.0" | |||||
| [[package]] | [[package]] | ||||
| name = "specs" | name = "specs" | ||||
| version = "0.16.1" | version = "0.16.1" | ||||
| @@ -1758,16 +1632,6 @@ dependencies = [ | |||||
| "winapi 0.3.9", | "winapi 0.3.9", | ||||
| ] | ] | ||||
| [[package]] | |||||
| name = "tokio" | |||||
| version = "0.3.5" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | |||||
| checksum = "a12a3eb39ee2c231be64487f1fcbe726c8f2514876a55480a5ab8559fc374252" | |||||
| dependencies = [ | |||||
| "autocfg", | |||||
| "pin-project-lite", | |||||
| ] | |||||
| [[package]] | [[package]] | ||||
| name = "toml" | name = "toml" | ||||
| version = "0.5.7" | version = "0.5.7" | ||||
| @@ -1866,7 +1730,7 @@ version = "0.2.1" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "d68a369614cd12ca384ca6e75ab0a5ac3a5acbfe8003622e20808a322b9bb652" | checksum = "d68a369614cd12ca384ca6e75ab0a5ac3a5acbfe8003622e20808a322b9bb652" | ||||
| dependencies = [ | dependencies = [ | ||||
| "flate2 1.0.14", | |||||
| "flate2 0.2.20", | |||||
| "vfs", | "vfs", | ||||
| "zip", | "zip", | ||||
| ] | ] | ||||
| @@ -2029,7 +1893,7 @@ dependencies = [ | |||||
| "bitflags", | "bitflags", | ||||
| "cocoa", | "cocoa", | ||||
| "core-foundation 0.9.1", | "core-foundation 0.9.1", | ||||
| "core-graphics 0.22.1", | |||||
| "core-graphics 0.22.2", | |||||
| "core-video-sys", | "core-video-sys", | ||||
| "dispatch", | "dispatch", | ||||
| "instant", | "instant", | ||||
| @@ -2112,9 +1976,9 @@ dependencies = [ | |||||
| [[package]] | [[package]] | ||||
| name = "zip" | name = "zip" | ||||
| version = "0.5.8" | |||||
| version = "0.5.9" | |||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "543adf038106b64cfca4711c82c917d785e3540e04f7996554488f988ec43124" | |||||
| checksum = "cc2896475a242c41366941faa27264df2cb935185a92e059a004d0048feb2ac5" | |||||
| dependencies = [ | dependencies = [ | ||||
| "byteorder", | "byteorder", | ||||
| "bzip2", | "bzip2", | ||||
| @@ -2,13 +2,17 @@ | |||||
| members = [ | members = [ | ||||
| "gl", | "gl", | ||||
| "glc", | "glc", | ||||
| "space-crush", | |||||
| "space-crush-app", | |||||
| "space-crush-common", | |||||
| "space-crush-server", | |||||
| ] | ] | ||||
| default-members = [ | default-members = [ | ||||
| "space-crush", | |||||
| "space-crush-app", | |||||
| ] | ] | ||||
| [patch.crates-io] | [patch.crates-io] | ||||
| gl = { path = "./gl" } | gl = { path = "./gl" } | ||||
| glc = { path = "./glc" } | glc = { path = "./glc" } | ||||
| space-crush = { path = "./space-crush" } | |||||
| space-crush-app = { path = "./space-crush-app" } | |||||
| space-crush-common = { path = "./space-crush-common" } | |||||
| space-crush-server = { path = "./space-crush-server" } | |||||
| @@ -1,28 +1,29 @@ | |||||
| [package] | [package] | ||||
| name = "space-crush" | |||||
| name = "space-crush-app" | |||||
| version = "0.1.0" | version = "0.1.0" | ||||
| authors = ["Bergmann89 <info@bergmann89.de>"] | authors = ["Bergmann89 <info@bergmann89.de>"] | ||||
| edition = "2018" | edition = "2018" | ||||
| [dependencies] | [dependencies] | ||||
| futures = "0.3" | |||||
| # futures = "0.3" | |||||
| gl = { version = "0.1", features = [ "use_log_crate" ] } | gl = { version = "0.1", features = [ "use_log_crate" ] } | ||||
| glc = "0.1" | glc = "0.1" | ||||
| glutin = { version = "0.25", features = [ "serde" ] } | glutin = { version = "0.25", features = [ "serde" ] } | ||||
| glyph_brush = "0.7" | glyph_brush = "0.7" | ||||
| log = { version = "0.4", features = [ "max_level_trace", "release_max_level_warn" ] } | log = { version = "0.4", features = [ "max_level_trace", "release_max_level_warn" ] } | ||||
| log4rs = "0.13" | log4rs = "0.13" | ||||
| num_cpus = "1.13" | |||||
| # num_cpus = "1.13" | |||||
| ordered-float = "2.0" | ordered-float = "2.0" | ||||
| rand = "0.7" | |||||
| serde = { version = "1.0", features = ["derive"] } | |||||
| # rand = "0.7" | |||||
| serde = { version = "1.0", features = [ "derive" ] } | |||||
| serde_json = "1.0" | serde_json = "1.0" | ||||
| serde_yaml = "0.8" | |||||
| # serde_yaml = "0.8" | |||||
| shred = { version = "0.10", features = [ "shred-derive" ] } | shred = { version = "0.10", features = [ "shred-derive" ] } | ||||
| shrev = "1.1" | shrev = "1.1" | ||||
| smallvec = { version = "1.5", features = [ "serde" ] } | smallvec = { version = "1.5", features = [ "serde" ] } | ||||
| space-crush-common = "0.1" | |||||
| specs = "0.16" | specs = "0.16" | ||||
| thiserror = "1.0" | thiserror = "1.0" | ||||
| tokio = "0.3" | |||||
| vfs = "0.4" | |||||
| vfs-zip = "0.2" | |||||
| # tokio = "0.3" | |||||
| # vfs = "0.4" | |||||
| # vfs-zip = "0.2" | |||||
| @@ -4,28 +4,17 @@ use glc::error::Error as GlcError; | |||||
| use glutin::{ContextError as GlutinContextError, CreationError as GlutinCreationError}; | use glutin::{ContextError as GlutinContextError, CreationError as GlutinCreationError}; | ||||
| use glyph_brush::ab_glyph::InvalidFont; | use glyph_brush::ab_glyph::InvalidFont; | ||||
| use serde_json::Error as JsonError; | use serde_json::Error as JsonError; | ||||
| use serde_yaml::Error as YamlError; | |||||
| use space_crush_common::{misc::VfsError, Error as CommonError}; | |||||
| use thiserror::Error; | use thiserror::Error; | ||||
| use vfs::VfsError; | |||||
| use vfs_zip::Error as VfsZipError; | |||||
| #[derive(Debug, Error)] | #[derive(Debug, Error)] | ||||
| pub enum Error { | pub enum Error { | ||||
| #[error("IO Error: {0}")] | #[error("IO Error: {0}")] | ||||
| IoError(IoError), | IoError(IoError), | ||||
| #[error("VFS Error: {0}")] | |||||
| VfsError(VfsError), | |||||
| #[error("VFS ZIP Error: {0}")] | |||||
| VfsZipError(VfsZipError), | |||||
| #[error("JSON Error: {0}")] | #[error("JSON Error: {0}")] | ||||
| JsonError(JsonError), | JsonError(JsonError), | ||||
| #[error("YAML Error: {0}")] | |||||
| YamlError(YamlError), | |||||
| #[error("GLC Error: {0}")] | #[error("GLC Error: {0}")] | ||||
| GlcError(GlcError), | GlcError(GlcError), | ||||
| @@ -38,15 +27,18 @@ pub enum Error { | |||||
| #[error("Invalid Font: {0}")] | #[error("Invalid Font: {0}")] | ||||
| InvalidFont(InvalidFont), | InvalidFont(InvalidFont), | ||||
| #[error("VFS Error: {0}")] | |||||
| VfsError(VfsError), | |||||
| #[error("{0}")] | |||||
| CommonError(CommonError), | |||||
| #[error("Resource is not registered: {0}!")] | #[error("Resource is not registered: {0}!")] | ||||
| ResourceNotRegistered(&'static str), | ResourceNotRegistered(&'static str), | ||||
| #[error("Unable to create OpenGL context!")] | #[error("Unable to create OpenGL context!")] | ||||
| CreateContext, | CreateContext, | ||||
| #[error("Unable to initialize VFS!")] | |||||
| InitVFS, | |||||
| #[error("Font is not set!")] | #[error("Font is not set!")] | ||||
| FontNotSet, | FontNotSet, | ||||
| } | } | ||||
| @@ -57,30 +49,12 @@ impl From<IoError> for Error { | |||||
| } | } | ||||
| } | } | ||||
| impl From<VfsError> for Error { | |||||
| fn from(err: VfsError) -> Self { | |||||
| Self::VfsError(err) | |||||
| } | |||||
| } | |||||
| impl From<VfsZipError> for Error { | |||||
| fn from(err: VfsZipError) -> Self { | |||||
| Self::VfsZipError(err) | |||||
| } | |||||
| } | |||||
| impl From<JsonError> for Error { | impl From<JsonError> for Error { | ||||
| fn from(err: JsonError) -> Self { | fn from(err: JsonError) -> Self { | ||||
| Self::JsonError(err) | Self::JsonError(err) | ||||
| } | } | ||||
| } | } | ||||
| impl From<YamlError> for Error { | |||||
| fn from(err: YamlError) -> Self { | |||||
| Self::YamlError(err) | |||||
| } | |||||
| } | |||||
| impl From<GlcError> for Error { | impl From<GlcError> for Error { | ||||
| fn from(err: GlcError) -> Self { | fn from(err: GlcError) -> Self { | ||||
| Self::GlcError(err) | Self::GlcError(err) | ||||
| @@ -104,3 +78,15 @@ impl From<InvalidFont> for Error { | |||||
| Self::InvalidFont(err) | Self::InvalidFont(err) | ||||
| } | } | ||||
| } | } | ||||
| impl From<VfsError> for Error { | |||||
| fn from(err: VfsError) -> Self { | |||||
| Self::VfsError(err) | |||||
| } | |||||
| } | |||||
| impl From<CommonError> for Error { | |||||
| fn from(err: CommonError) -> Self { | |||||
| Self::CommonError(err) | |||||
| } | |||||
| } | |||||
| @@ -1,3 +1,4 @@ | |||||
| mod error; | |||||
| mod misc; | mod misc; | ||||
| mod render; | mod render; | ||||
| mod resources; | mod resources; | ||||
| @@ -5,7 +6,7 @@ mod systems; | |||||
| use specs::{Dispatcher, DispatcherBuilder, World}; | use specs::{Dispatcher, DispatcherBuilder, World}; | ||||
| use crate::Error; | |||||
| pub use error::Error; | |||||
| use misc::{Events, TextManager, Window}; | use misc::{Events, TextManager, Window}; | ||||
| use render::{Debug, Init, Test}; | use render::{Debug, Init, Test}; | ||||
| @@ -1,12 +1,17 @@ | |||||
| use log::{error, info}; | use log::{error, info}; | ||||
| use space_crush_app::{App, Error}; | |||||
| use space_crush_common::{ | |||||
| misc::{init_logger, Vfs}, | |||||
| Dispatcher, | |||||
| }; | |||||
| use specs::{World, WorldExt}; | use specs::{World, WorldExt}; | ||||
| use space_crush::{init_logger, misc::Vfs, App, Error, Server}; | |||||
| fn main() -> Result<(), Error> { | fn main() -> Result<(), Error> { | ||||
| let vfs = Vfs::new()?; | |||||
| let vfs = Vfs::new(&["space-crush-app"])?; | |||||
| init_logger(&vfs, "log4rs.yml"); | |||||
| init_logger(&vfs); | |||||
| vfs.log_info(); | |||||
| info!("Application started"); | info!("Application started"); | ||||
| @@ -25,11 +30,11 @@ fn run(vfs: Vfs) -> Result<(), Error> { | |||||
| let mut world = World::new(); | let mut world = World::new(); | ||||
| world.insert(vfs); | world.insert(vfs); | ||||
| let mut server = Server::new(&mut world); | |||||
| let mut common = Dispatcher::new(&mut world); | |||||
| let mut app = App::new(&mut world)?; | let mut app = App::new(&mut world)?; | ||||
| while app.is_running() { | while app.is_running() { | ||||
| server.process(&world); | |||||
| common.process(&world); | |||||
| app.process(&world)?; | app.process(&world)?; | ||||
| } | } | ||||
| @@ -26,11 +26,10 @@ use glyph_brush::{ | |||||
| }; | }; | ||||
| use log::warn; | use log::warn; | ||||
| use ordered_float::OrderedFloat; | use ordered_float::OrderedFloat; | ||||
| use space_crush_common::misc::{Vfs, WorldHelper as _}; | |||||
| use specs::World; | use specs::World; | ||||
| use crate::{misc::Vfs, Error}; | |||||
| use super::super::misc::WorldHelper; | |||||
| use crate::{misc::WorldHelper, Error}; | |||||
| /* TextManager */ | /* TextManager */ | ||||
| @@ -1,29 +1,15 @@ | |||||
| use std::any::type_name; | |||||
| use std::iter::Iterator; | use std::iter::Iterator; | ||||
| use glc::{ | use glc::{ | ||||
| shader::{Program, Shader, Type}, | shader::{Program, Shader, Type}, | ||||
| texture::{Data, Target, Texture}, | |||||
| texture::{Data, FilterMag, FilterMin, Target, Texture, Wrap}, | |||||
| }; | }; | ||||
| use shred::{Fetch, FetchMut, Resource}; | |||||
| use shrev::{Event, EventChannel, ReaderId}; | |||||
| use space_crush_common::misc::Vfs; | |||||
| use specs::World; | use specs::World; | ||||
| use crate::{misc::Vfs, Error}; | |||||
| use crate::Error; | |||||
| pub trait WorldHelper { | pub trait WorldHelper { | ||||
| fn resource<R>(&self) -> Result<Fetch<R>, Error> | |||||
| where | |||||
| R: Resource; | |||||
| fn resource_mut<R>(&self) -> Result<FetchMut<R>, Error> | |||||
| where | |||||
| R: Resource; | |||||
| fn register_event_reader<E>(&self) -> Result<ReaderId<E>, Error> | |||||
| where | |||||
| E: Event; | |||||
| fn load_program<I>(&self, iter: I) -> Result<Program, Error> | fn load_program<I>(&self, iter: I) -> Result<Program, Error> | ||||
| where | where | ||||
| I: IntoIterator<Item = (Type, &'static str)>; | I: IntoIterator<Item = (Type, &'static str)>; | ||||
| @@ -32,29 +18,6 @@ pub trait WorldHelper { | |||||
| } | } | ||||
| impl WorldHelper for World { | impl WorldHelper for World { | ||||
| fn resource<R>(&self) -> Result<Fetch<R>, Error> | |||||
| where | |||||
| R: Resource, | |||||
| { | |||||
| self.try_fetch::<R>() | |||||
| .ok_or_else(|| Error::ResourceNotRegistered(type_name::<R>())) | |||||
| } | |||||
| fn resource_mut<R>(&self) -> Result<FetchMut<R>, Error> | |||||
| where | |||||
| R: Resource, | |||||
| { | |||||
| self.try_fetch_mut::<R>() | |||||
| .ok_or_else(|| Error::ResourceNotRegistered(type_name::<R>())) | |||||
| } | |||||
| fn register_event_reader<E>(&self) -> Result<ReaderId<E>, Error> | |||||
| where | |||||
| E: Event, | |||||
| { | |||||
| Ok(self.resource_mut::<EventChannel<E>>()?.register_reader()) | |||||
| } | |||||
| fn load_program<I>(&self, iter: I) -> Result<Program, Error> | fn load_program<I>(&self, iter: I) -> Result<Program, Error> | ||||
| where | where | ||||
| I: IntoIterator<Item = (Type, &'static str)>, | I: IntoIterator<Item = (Type, &'static str)>, | ||||
| @@ -78,6 +41,8 @@ impl WorldHelper for World { | |||||
| let mut texture = Texture::new(Target::Texture2D)?; | let mut texture = Texture::new(Target::Texture2D)?; | ||||
| texture.upload(&data, true)?; | texture.upload(&data, true)?; | ||||
| texture.set_filter(FilterMin::LinearMipmapLinear, FilterMag::Linear)?; | |||||
| texture.set_wrap(Wrap::ClampToEdge, Wrap::ClampToEdge, Wrap::ClampToEdge)?; | |||||
| Ok(texture) | Ok(texture) | ||||
| } | } | ||||
| @@ -1,13 +1,13 @@ | |||||
| use std::string::ToString; | use std::string::ToString; | ||||
| use log::warn; | use log::warn; | ||||
| use space_crush_common::resources::Global; | |||||
| use specs::{ReadExpect, System}; | use specs::{ReadExpect, System}; | ||||
| use crate::{server::resources::Global, Error}; | |||||
| use super::super::{ | |||||
| use crate::{ | |||||
| misc::{Text, TextCache, TextManager}, | misc::{Text, TextCache, TextManager}, | ||||
| resources::State, | resources::State, | ||||
| Error, | |||||
| }; | }; | ||||
| /* Debug */ | /* Debug */ | ||||
| @@ -6,13 +6,13 @@ use glc::{ | |||||
| }; | }; | ||||
| use log::error; | use log::error; | ||||
| use shrev::{EventChannel, ReaderId}; | use shrev::{EventChannel, ReaderId}; | ||||
| use space_crush_common::misc::WorldHelper as _; | |||||
| use specs::{prelude::*, ReadExpect, System, World, WriteExpect}; | use specs::{prelude::*, ReadExpect, System, World, WriteExpect}; | ||||
| use crate::Error; | |||||
| use super::super::{ | |||||
| use crate::{ | |||||
| misc::{MouseEvent, WorldHelper}, | misc::{MouseEvent, WorldHelper}, | ||||
| resources::{Camera, Config, Geometry, State}, | resources::{Camera, Config, Geometry, State}, | ||||
| Error, | |||||
| }; | }; | ||||
| pub struct Init { | pub struct Init { | ||||
| @@ -2,16 +2,16 @@ use glc::{ | |||||
| matrix::{Angle, Matrix4f}, | matrix::{Angle, Matrix4f}, | ||||
| misc::Bindable, | misc::Bindable, | ||||
| shader::{Program, Type, Uniform}, | shader::{Program, Type, Uniform}, | ||||
| texture::{FilterMag, FilterMin, Texture}, | |||||
| texture::Texture, | |||||
| vector::Vector3f, | vector::Vector3f, | ||||
| }; | }; | ||||
| use space_crush_common::{misc::WorldHelper as _, resources::Global}; | |||||
| use specs::{ReadExpect, System, World}; | use specs::{ReadExpect, System, World}; | ||||
| use crate::{server::resources::Global, Error}; | |||||
| use super::super::{ | |||||
| use crate::{ | |||||
| misc::WorldHelper, | misc::WorldHelper, | ||||
| resources::{Camera, Geometry}, | resources::{Camera, Geometry}, | ||||
| Error, | |||||
| }; | }; | ||||
| pub struct Test { | pub struct Test { | ||||
| @@ -32,8 +32,7 @@ impl Test { | |||||
| world.resource::<Camera>()?.bind(0)?; | world.resource::<Camera>()?.bind(0)?; | ||||
| program.unbind(); | program.unbind(); | ||||
| let mut texture = world.load_texture("resources/textures/test.png")?; | |||||
| texture.set_filter(FilterMin::LinearMipmapLinear, FilterMag::Linear)?; | |||||
| let texture = world.load_texture("resources/textures/planet01.png")?; | |||||
| Ok(Self { | Ok(Self { | ||||
| model, | model, | ||||
| @@ -53,6 +52,9 @@ impl<'a> System<'a> for Test { | |||||
| Angle::Deg(10.0 * global.delta), | Angle::Deg(10.0 * global.delta), | ||||
| ); | ); | ||||
| gl::enable(gl::BLEND); | |||||
| gl::blend_func(gl::SRC_ALPHA, gl::ONE_MINUS_SRC_ALPHA); | |||||
| self.texture.bind(); | self.texture.bind(); | ||||
| self.program.bind(); | self.program.bind(); | ||||
| self.program.uniform(1, Uniform::Matrix4f(&self.model)); | self.program.uniform(1, Uniform::Matrix4f(&self.model)); | ||||
| @@ -61,5 +63,7 @@ impl<'a> System<'a> for Test { | |||||
| self.program.unbind(); | self.program.unbind(); | ||||
| self.texture.unbind(); | self.texture.unbind(); | ||||
| gl::disable(gl::BLEND); | |||||
| } | } | ||||
| } | } | ||||
| @@ -2,11 +2,10 @@ use log::warn; | |||||
| use serde::{Deserialize, Serialize}; | use serde::{Deserialize, Serialize}; | ||||
| use serde_json::from_reader; | use serde_json::from_reader; | ||||
| use smallvec::{smallvec, SmallVec}; | use smallvec::{smallvec, SmallVec}; | ||||
| use space_crush_common::misc::{Vfs, WorldHelper as _}; | |||||
| use specs::World; | use specs::World; | ||||
| use crate::{misc::Vfs, Error}; | |||||
| use super::super::misc::{VirtualKeyCode, WorldHelper}; | |||||
| use crate::{misc::VirtualKeyCode, Error}; | |||||
| #[derive(Debug, Default, Serialize, Deserialize)] | #[derive(Debug, Default, Serialize, Deserialize)] | ||||
| pub struct Config { | pub struct Config { | ||||
| @@ -1,11 +1,11 @@ | |||||
| use shrev::{EventChannel, ReaderId}; | use shrev::{EventChannel, ReaderId}; | ||||
| use space_crush_common::misc::WorldHelper; | |||||
| use specs::{prelude::*, ReadExpect, System, World, Write}; | use specs::{prelude::*, ReadExpect, System, World, Write}; | ||||
| use crate::Error; | |||||
| use super::super::{ | |||||
| misc::{KeyboardEvent, MouseEvent, WindowEvent, WorldHelper}, | |||||
| use crate::{ | |||||
| misc::{KeyboardEvent, MouseEvent, WindowEvent}, | |||||
| resources::State, | resources::State, | ||||
| Error, | |||||
| }; | }; | ||||
| pub struct StateUpdate { | pub struct StateUpdate { | ||||
| @@ -0,0 +1,28 @@ | |||||
| [package] | |||||
| name = "space-crush-common" | |||||
| version = "0.1.0" | |||||
| authors = ["Bergmann89 <info@bergmann89.de>"] | |||||
| edition = "2018" | |||||
| [dependencies] | |||||
| # futures = "0.3" | |||||
| # gl = { version = "0.1", features = [ "use_log_crate" ] } | |||||
| glc = "0.1" | |||||
| # glutin = { version = "0.25", features = [ "serde" ] } | |||||
| # glyph_brush = "0.7" | |||||
| log = { version = "0.4", features = [ "max_level_trace", "release_max_level_warn" ] } | |||||
| log4rs = "0.13" | |||||
| # num_cpus = "1.13" | |||||
| # ordered-float = "2.0" | |||||
| # rand = "0.7" | |||||
| # serde = { version = "1.0", features = ["derive"] } | |||||
| # serde_json = "1.0" | |||||
| serde_yaml = "0.8" | |||||
| shred = { version = "0.10", features = [ "shred-derive" ] } | |||||
| shrev = "1.1" | |||||
| # smallvec = { version = "1.5", features = [ "serde" ] } | |||||
| specs = "0.16" | |||||
| thiserror = "1.0" | |||||
| # tokio = "0.3" | |||||
| vfs = "0.4" | |||||
| vfs-zip = "0.2" | |||||
| @@ -0,0 +1,3 @@ | |||||
| mod position; | |||||
| pub use position::Position; | |||||
| @@ -0,0 +1,24 @@ | |||||
| use std::ops::{Deref, DerefMut}; | |||||
| use glc::vector::Vector2f; | |||||
| use specs::{Component, VecStorage}; | |||||
| pub struct Position(pub Vector2f); | |||||
| impl Component for Position { | |||||
| type Storage = VecStorage<Self>; | |||||
| } | |||||
| impl Deref for Position { | |||||
| type Target = Vector2f; | |||||
| fn deref(&self) -> &Self::Target { | |||||
| &self.0 | |||||
| } | |||||
| } | |||||
| impl DerefMut for Position { | |||||
| fn deref_mut(&mut self) -> &mut Self::Target { | |||||
| &mut self.0 | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,24 @@ | |||||
| use std::ops::{Deref, DerefMut}; | |||||
| use glc::vector::Vector2f; | |||||
| use specs::{Component, VecStorage}; | |||||
| pub struct Velocity(pub Vector2f); | |||||
| impl Component for Velocity { | |||||
| type Storage = VecStorage<Self>; | |||||
| } | |||||
| impl Deref for Velocity { | |||||
| type Target = Vector2f; | |||||
| fn deref(&self) -> &Self::Target { | |||||
| &self.0 | |||||
| } | |||||
| } | |||||
| impl DerefMut for Velocity { | |||||
| fn deref_mut(&mut self) -> &mut Self::Target { | |||||
| &mut self.0 | |||||
| } | |||||
| } | |||||
| @@ -1,16 +1,12 @@ | |||||
| pub mod resources; | |||||
| pub mod systems; | |||||
| use specs::{Dispatcher as Inner, DispatcherBuilder, World}; | |||||
| use specs::{Dispatcher, DispatcherBuilder, World}; | |||||
| use crate::{resources::Global, systems::Process}; | |||||
| use resources::Global; | |||||
| use systems::Process; | |||||
| pub struct Server<'a, 'b> { | |||||
| dispatcher: Dispatcher<'a, 'b>, | |||||
| pub struct Dispatcher<'a, 'b> { | |||||
| dispatcher: Inner<'a, 'b>, | |||||
| } | } | ||||
| impl<'a, 'b> Server<'a, 'b> { | |||||
| impl<'a, 'b> Dispatcher<'a, 'b> { | |||||
| pub fn new(world: &mut World) -> Self { | pub fn new(world: &mut World) -> Self { | ||||
| world.insert(Global::default()); | world.insert(Global::default()); | ||||
| @@ -0,0 +1,51 @@ | |||||
| use std::io::Error as IoError; | |||||
| use serde_yaml::Error as YamlError; | |||||
| use thiserror::Error; | |||||
| use vfs::VfsError; | |||||
| use vfs_zip::Error as VfsZipError; | |||||
| #[derive(Debug, Error)] | |||||
| pub enum Error { | |||||
| #[error("IO Error: {0}")] | |||||
| IoError(IoError), | |||||
| #[error("VFS Error: {0}")] | |||||
| VfsError(VfsError), | |||||
| #[error("VFS ZIP Error: {0}")] | |||||
| VfsZipError(VfsZipError), | |||||
| #[error("YAML Error: {0}")] | |||||
| YamlError(YamlError), | |||||
| #[error("Resource is not registered: {0}!")] | |||||
| ResourceNotRegistered(&'static str), | |||||
| #[error("Unable to initialize VFS!")] | |||||
| InitVFS, | |||||
| } | |||||
| impl From<IoError> for Error { | |||||
| fn from(err: IoError) -> Self { | |||||
| Self::IoError(err) | |||||
| } | |||||
| } | |||||
| impl From<VfsError> for Error { | |||||
| fn from(err: VfsError) -> Self { | |||||
| Self::VfsError(err) | |||||
| } | |||||
| } | |||||
| impl From<VfsZipError> for Error { | |||||
| fn from(err: VfsZipError) -> Self { | |||||
| Self::VfsZipError(err) | |||||
| } | |||||
| } | |||||
| impl From<YamlError> for Error { | |||||
| fn from(err: YamlError) -> Self { | |||||
| Self::YamlError(err) | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,9 @@ | |||||
| pub mod components; | |||||
| pub mod dispatcher; | |||||
| pub mod error; | |||||
| pub mod misc; | |||||
| pub mod resources; | |||||
| pub mod systems; | |||||
| pub use dispatcher::Dispatcher; | |||||
| pub use error::Error; | |||||
| @@ -20,8 +20,8 @@ use serde_yaml::from_str; | |||||
| use crate::{misc::Vfs, Error}; | use crate::{misc::Vfs, Error}; | ||||
| pub fn init(vfs: &Vfs) { | |||||
| let (config, err) = match load_from_file(vfs) { | |||||
| pub fn init(vfs: &Vfs, path: &str) { | |||||
| let (config, err) = match load_from_file(vfs, path) { | |||||
| Ok(config) => (config, None), | Ok(config) => (config, None), | ||||
| Err(err) => (default_config(), Some(err)), | Err(err) => (default_config(), Some(err)), | ||||
| }; | }; | ||||
| @@ -33,11 +33,9 @@ pub fn init(vfs: &Vfs) { | |||||
| } | } | ||||
| } | } | ||||
| fn load_from_file(vfs: &Vfs) -> Result<Config, Error> { | |||||
| fn load_from_file(vfs: &Vfs, path: &str) -> Result<Config, Error> { | |||||
| let mut config = String::default(); | let mut config = String::default(); | ||||
| vfs.join("log4rs.yml")? | |||||
| .open_file()? | |||||
| .read_to_string(&mut config)?; | |||||
| vfs.join(path)?.open_file()?.read_to_string(&mut config)?; | |||||
| let mut stderr = stderr(); | let mut stderr = stderr(); | ||||
| let config = from_str::<RawConfig>(&config)?; | let config = from_str::<RawConfig>(&config)?; | ||||
| @@ -0,0 +1,7 @@ | |||||
| mod log; | |||||
| mod vfs; | |||||
| mod world; | |||||
| pub use self::log::init as init_logger; | |||||
| pub use self::vfs::{Vfs, VfsError}; | |||||
| pub use world::WorldHelper; | |||||
| @@ -1,10 +1,11 @@ | |||||
| use std::collections::HashSet; | use std::collections::HashSet; | ||||
| use std::env::{current_dir, current_exe}; | use std::env::{current_dir, current_exe}; | ||||
| use std::fs::File; | use std::fs::File; | ||||
| use std::iter::once; | |||||
| use std::ops::Deref; | use std::ops::Deref; | ||||
| use std::path::PathBuf; | |||||
| use log::info; | use log::info; | ||||
| use vfs::{ | use vfs::{ | ||||
| impls::{overlay::OverlayFS, physical::PhysicalFS}, | impls::{overlay::OverlayFS, physical::PhysicalFS}, | ||||
| VfsPath, | VfsPath, | ||||
| @@ -13,54 +14,65 @@ use vfs_zip::ZipReadOnly as ZipFS; | |||||
| use crate::Error; | use crate::Error; | ||||
| pub use vfs::error::VfsError; | |||||
| #[derive(Clone)] | #[derive(Clone)] | ||||
| pub struct Vfs(pub VfsPath); | |||||
| pub struct Vfs { | |||||
| pub root: VfsPath, | |||||
| pub layers: Vec<PathBuf>, | |||||
| } | |||||
| impl Vfs { | impl Vfs { | ||||
| pub fn new() -> Result<Self, Error> { | |||||
| pub fn new(dirs: &[&str]) -> Result<Self, Error> { | |||||
| let dirs = vec![ | let dirs = vec![ | ||||
| current_exe() | current_exe() | ||||
| .ok() | .ok() | ||||
| .as_ref() | .as_ref() | ||||
| .and_then(|p| p.parent()) | .and_then(|p| p.parent()) | ||||
| .map(|p| p.to_owned()), | .map(|p| p.to_owned()), | ||||
| current_exe() | |||||
| .ok() | |||||
| .as_ref() | |||||
| .and_then(|p| p.parent()) | |||||
| .map(|p| p.join("space-crush")), | |||||
| current_dir().ok(), | current_dir().ok(), | ||||
| current_dir().ok().map(|p| p.join("space-crush")), | |||||
| ] | ] | ||||
| .into_iter() | .into_iter() | ||||
| .filter_map(|d| d); | |||||
| .filter_map(|d| d) | |||||
| .map(|p| once(&"").chain(dirs).map(move |d| p.join(d))) | |||||
| .flatten(); | |||||
| let mut paths = HashSet::new(); | let mut paths = HashSet::new(); | ||||
| let mut layers = Vec::new(); | let mut layers = Vec::new(); | ||||
| let mut overlays = Vec::new(); | |||||
| for dir in dirs.clone() { | for dir in dirs.clone() { | ||||
| if paths.insert(dir.clone()) { | if paths.insert(dir.clone()) { | ||||
| info!("Adding layer to VFS: {}", dir.display()); | |||||
| layers.push(dir.to_owned()); | |||||
| let layer = VfsPath::new(PhysicalFS::new(dir)); | let layer = VfsPath::new(PhysicalFS::new(dir)); | ||||
| layers.push(layer); | |||||
| overlays.push(layer); | |||||
| } | } | ||||
| } | } | ||||
| for dir in dirs { | for dir in dirs { | ||||
| let path = dir.join("resources.bin"); | let path = dir.join("resources.bin"); | ||||
| if path.is_file() && paths.insert(path.to_owned()) { | if path.is_file() && paths.insert(path.to_owned()) { | ||||
| info!("Adding layer to VFS: {}", dir.display()); | |||||
| layers.push(dir.to_owned()); | |||||
| let zip = File::open(path)?; | let zip = File::open(path)?; | ||||
| let layer = VfsPath::new(ZipFS::new_relaxed(zip)?); | let layer = VfsPath::new(ZipFS::new_relaxed(zip)?); | ||||
| layers.push(layer); | |||||
| overlays.push(layer); | |||||
| } | } | ||||
| } | } | ||||
| Ok(Self(VfsPath::new(OverlayFS::new(&layers)))) | |||||
| Ok(Self { | |||||
| root: VfsPath::new(OverlayFS::new(&overlays)), | |||||
| layers, | |||||
| }) | |||||
| } | |||||
| pub fn log_info(&self) { | |||||
| for layer in &self.layers { | |||||
| info!("VFS Layer: {}", layer.display()); | |||||
| } | |||||
| } | } | ||||
| } | } | ||||
| @@ -68,6 +80,6 @@ impl Deref for Vfs { | |||||
| type Target = VfsPath; | type Target = VfsPath; | ||||
| fn deref(&self) -> &Self::Target { | fn deref(&self) -> &Self::Target { | ||||
| &self.0 | |||||
| &self.root | |||||
| } | } | ||||
| } | } | ||||
| @@ -0,0 +1,46 @@ | |||||
| use std::any::type_name; | |||||
| use shred::{Fetch, FetchMut, Resource}; | |||||
| use shrev::{Event, EventChannel, ReaderId}; | |||||
| use specs::World; | |||||
| use crate::Error; | |||||
| pub trait WorldHelper { | |||||
| fn resource<R>(&self) -> Result<Fetch<R>, Error> | |||||
| where | |||||
| R: Resource; | |||||
| fn resource_mut<R>(&self) -> Result<FetchMut<R>, Error> | |||||
| where | |||||
| R: Resource; | |||||
| fn register_event_reader<E>(&self) -> Result<ReaderId<E>, Error> | |||||
| where | |||||
| E: Event; | |||||
| } | |||||
| impl WorldHelper for World { | |||||
| fn resource<R>(&self) -> Result<Fetch<R>, Error> | |||||
| where | |||||
| R: Resource, | |||||
| { | |||||
| self.try_fetch::<R>() | |||||
| .ok_or_else(|| Error::ResourceNotRegistered(type_name::<R>())) | |||||
| } | |||||
| fn resource_mut<R>(&self) -> Result<FetchMut<R>, Error> | |||||
| where | |||||
| R: Resource, | |||||
| { | |||||
| self.try_fetch_mut::<R>() | |||||
| .ok_or_else(|| Error::ResourceNotRegistered(type_name::<R>())) | |||||
| } | |||||
| fn register_event_reader<E>(&self) -> Result<ReaderId<E>, Error> | |||||
| where | |||||
| E: Event, | |||||
| { | |||||
| Ok(self.resource_mut::<EventChannel<E>>()?.register_reader()) | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,28 @@ | |||||
| [package] | |||||
| name = "space-crush-server" | |||||
| version = "0.1.0" | |||||
| authors = ["Bergmann89 <info@bergmann89.de>"] | |||||
| edition = "2018" | |||||
| [dependencies] | |||||
| # futures = "0.3" | |||||
| # gl = { version = "0.1", features = [ "use_log_crate" ] } | |||||
| # glc = "0.1" | |||||
| # glutin = { version = "0.25", features = [ "serde" ] } | |||||
| # glyph_brush = "0.7" | |||||
| # log = { version = "0.4", features = [ "max_level_trace", "release_max_level_warn" ] } | |||||
| # log4rs = "0.13" | |||||
| # num_cpus = "1.13" | |||||
| # ordered-float = "2.0" | |||||
| # rand = "0.7" | |||||
| # serde = { version = "1.0", features = ["derive"] } | |||||
| # serde_json = "1.0" | |||||
| # serde_yaml = "0.8" | |||||
| # shred = { version = "0.10", features = [ "shred-derive" ] } | |||||
| # shrev = "1.1" | |||||
| # smallvec = { version = "1.5", features = [ "serde" ] } | |||||
| # specs = "0.16" | |||||
| # thiserror = "1.0" | |||||
| # tokio = "0.3" | |||||
| # vfs = "0.4" | |||||
| # vfs-zip = "0.2" | |||||
| @@ -0,0 +1,28 @@ | |||||
| root: | |||||
| level: debug | |||||
| appenders: | |||||
| - stdout | |||||
| - file | |||||
| appenders: | |||||
| stdout: | |||||
| kind: console | |||||
| encoder: | |||||
| pattern: "[{d} {h({l:>5})}] {m}{n}" | |||||
| file: | |||||
| kind: rolling_file | |||||
| path: space-crush.log | |||||
| append: true | |||||
| encoder: | |||||
| pattern: "{d} {h({l:<5})}{n} Module: {M}{n} File: {f}:{L}{n} Message: {m}{n}" | |||||
| policy: | |||||
| kind: compound | |||||
| trigger: | |||||
| kind: size | |||||
| limit: 1 mb | |||||
| roller: | |||||
| kind: fixed_window | |||||
| pattern: space-crush-{}.log | |||||
| count: 5 | |||||
| base: 1 | |||||
| @@ -0,0 +1,3 @@ | |||||
| fn main() { | |||||
| println!("Hello, world!"); | |||||
| } | |||||
| @@ -1,7 +0,0 @@ | |||||
| pub mod app; | |||||
| pub mod misc; | |||||
| pub mod server; | |||||
| pub use app::App; | |||||
| pub use misc::{init_logger, Error}; | |||||
| pub use server::Server; | |||||
| @@ -1,7 +0,0 @@ | |||||
| mod error; | |||||
| mod log; | |||||
| mod vfs; | |||||
| pub use self::log::init as init_logger; | |||||
| pub use self::vfs::Vfs; | |||||
| pub use error::Error; | |||||