Switch from glutin to sdl2
This commit is contained in:
parent
3738c5a0c0
commit
9f04c09a8f
|
@ -2,17 +2,17 @@
|
||||||
name = "steven"
|
name = "steven"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cgmath 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"collision 0.5.1 (git+https://github.com/csherratt/collision-rs?rev=f80825e)",
|
"collision 0.5.1 (git+https://github.com/csherratt/collision-rs?rev=f80825e)",
|
||||||
"flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
"flate2 0.2.13 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"glutin 0.4.9 (git+https://github.com/tomaka/glutin?rev=8ae2df68e)",
|
|
||||||
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hyper 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"image 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"sdl2 0.16.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_json 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"steven_gl 0.0.1",
|
"steven_gl 0.0.1",
|
||||||
|
@ -22,11 +22,6 @@ dependencies = [
|
||||||
"zip 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
"zip 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "android_glue"
|
|
||||||
version = "0.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bitflags"
|
name = "bitflags"
|
||||||
version = "0.3.3"
|
version = "0.3.3"
|
||||||
|
@ -44,7 +39,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "0.5.0"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -61,16 +56,7 @@ name = "bzip2-sys"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cgl"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gleam 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -84,17 +70,6 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cocoa"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"objc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "collision"
|
name = "collision"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
@ -120,38 +95,6 @@ dependencies = [
|
||||||
"url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-foundation-sys"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "core-graphics"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "crossbeam"
|
|
||||||
version = "0.1.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "deque"
|
name = "deque"
|
||||||
version = "0.3.1"
|
version = "0.3.1"
|
||||||
|
@ -160,31 +103,6 @@ dependencies = [
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dlib"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libloading 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dwmapi-sys"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dylib"
|
|
||||||
version = "0.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "enum_primitive"
|
name = "enum_primitive"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -212,19 +130,9 @@ dependencies = [
|
||||||
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"miniz-sys 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fs2"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gcc"
|
name = "gcc"
|
||||||
version = "0.3.25"
|
version = "0.3.26"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -254,58 +162,11 @@ dependencies = [
|
||||||
"xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gl_generator"
|
|
||||||
version = "0.5.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"xml-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "gleam"
|
|
||||||
version = "0.2.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glob"
|
name = "glob"
|
||||||
version = "0.2.11"
|
version = "0.2.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "glutin"
|
|
||||||
version = "0.4.9"
|
|
||||||
source = "git+https://github.com/tomaka/glutin?rev=8ae2df68e#8ae2df68e19ca71453af5e11de9ca807ef7adcb4"
|
|
||||||
dependencies = [
|
|
||||||
"android_glue 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cgl 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"cocoa 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"core-foundation 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"core-graphics 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"dwmapi-sys 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gdi32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"gl_generator 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"objc 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"osmesa-sys 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"shared_library 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"shell32-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"user32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-client 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-kbd 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-window 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"x11-dl 2.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hpack"
|
name = "hpack"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -399,16 +260,6 @@ name = "libc"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "libloading"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libressl-pnacl-sys"
|
name = "libressl-pnacl-sys"
|
||||||
version = "2.1.6"
|
version = "2.1.6"
|
||||||
|
@ -430,30 +281,11 @@ name = "lzw"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "malloc_buf"
|
|
||||||
version = "0.0.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "matches"
|
name = "matches"
|
||||||
version = "0.1.2"
|
version = "0.1.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "memmap"
|
|
||||||
version = "0.2.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"fs2 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mime"
|
name = "mime"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
|
@ -467,7 +299,7 @@ name = "miniz-sys"
|
||||||
version = "0.1.7"
|
version = "0.1.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -498,21 +330,13 @@ dependencies = [
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "objc"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"malloc_buf 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "openssl"
|
name = "openssl"
|
||||||
version = "0.7.8"
|
version = "0.7.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -536,20 +360,11 @@ name = "openssl-sys-extras"
|
||||||
version = "0.7.8"
|
version = "0.7.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gcc 0.3.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
"gcc 0.3.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"openssl-sys 0.7.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "osmesa-sys"
|
|
||||||
version = "0.0.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"shared_library 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pkg-config"
|
name = "pkg-config"
|
||||||
version = "0.3.8"
|
version = "0.3.8"
|
||||||
|
@ -611,6 +426,27 @@ dependencies = [
|
||||||
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2"
|
||||||
|
version = "0.16.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"num 0.1.31 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"sdl2-sys 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "sdl2-sys"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "0.1.20"
|
version = "0.1.20"
|
||||||
|
@ -630,24 +466,6 @@ dependencies = [
|
||||||
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shared_library"
|
|
||||||
version = "0.1.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "shell32-sys"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solicit"
|
name = "solicit"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
|
@ -686,17 +504,6 @@ dependencies = [
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tempfile"
|
|
||||||
version = "1.1.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"kernel32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "time"
|
||||||
version = "0.1.34"
|
version = "0.1.34"
|
||||||
|
@ -768,57 +575,6 @@ dependencies = [
|
||||||
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rustc-serialize 0.3.18 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-client"
|
|
||||||
version = "0.5.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"crossbeam 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-scanner 0.5.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-sys 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-kbd"
|
|
||||||
version = "0.3.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"memmap 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-client 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-scanner"
|
|
||||||
version = "0.5.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-sys"
|
|
||||||
version = "0.5.9"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"dlib 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 0.1.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wayland-window"
|
|
||||||
version = "0.2.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"tempfile 1.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"wayland-client 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
|
@ -829,15 +585,6 @@ name = "winapi-build"
|
||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "x11-dl"
|
|
||||||
version = "2.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"dylib 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "xml-rs"
|
name = "xml-rs"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
|
@ -846,14 +593,6 @@ dependencies = [
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "xml-rs"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "zip"
|
name = "zip"
|
||||||
version = "0.1.16"
|
version = "0.1.16"
|
||||||
|
|
|
@ -4,7 +4,7 @@ version = "0.0.1"
|
||||||
authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
|
authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glutin = {git = "https://github.com/tomaka/glutin", rev = "8ae2df68e"}
|
sdl2 = "0.16.1"
|
||||||
byteorder = "0.5.0"
|
byteorder = "0.5.0"
|
||||||
hyper = "0.8.0"
|
hyper = "0.8.0"
|
||||||
serde = "0.7.0"
|
serde = "0.7.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
extern crate steven_gl as gl;
|
extern crate steven_gl as gl;
|
||||||
use glutin;
|
use sdl2;
|
||||||
|
|
||||||
use std::ops::BitOr;
|
use std::ops::BitOr;
|
||||||
use std::ffi;
|
use std::ffi;
|
||||||
|
@ -22,8 +22,8 @@ use std::ptr;
|
||||||
use std::ops::{Deref, DerefMut};
|
use std::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
/// Inits the gl library. This should be called once a context is ready.
|
/// Inits the gl library. This should be called once a context is ready.
|
||||||
pub fn init(window: &mut glutin::Window) {
|
pub fn init(vid: & sdl2::VideoSubsystem) {
|
||||||
gl::load_with(|s| window.get_proc_address(s) as *const _);
|
gl::load_with(|s| vid.gl_get_proc_address(s) as *const _);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dsed to specify how the vertices will be handled
|
/// Dsed to specify how the vertices will be handled
|
||||||
|
|
110
src/main.rs
110
src/main.rs
|
@ -15,7 +15,7 @@
|
||||||
#![recursion_limit="200"]
|
#![recursion_limit="200"]
|
||||||
#![feature(const_fn)]
|
#![feature(const_fn)]
|
||||||
|
|
||||||
extern crate glutin;
|
extern crate sdl2;
|
||||||
extern crate image;
|
extern crate image;
|
||||||
extern crate time;
|
extern crate time;
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
@ -75,7 +75,6 @@ pub struct Game {
|
||||||
resource_manager: Arc<RwLock<resources::Manager>>,
|
resource_manager: Arc<RwLock<resources::Manager>>,
|
||||||
console: Arc<Mutex<console::Console>>,
|
console: Arc<Mutex<console::Console>>,
|
||||||
should_close: bool,
|
should_close: bool,
|
||||||
mouse_pos: (i32, i32),
|
|
||||||
|
|
||||||
server: server::Server,
|
server: server::Server,
|
||||||
focused: bool,
|
focused: bool,
|
||||||
|
@ -159,22 +158,27 @@ fn main() {
|
||||||
resource_manager.write().unwrap().tick();
|
resource_manager.write().unwrap().tick();
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut window = glutin::WindowBuilder::new()
|
let sdl = sdl2::init().unwrap();
|
||||||
.with_title("Steven".to_string())
|
let sdl_video = sdl.video().unwrap();
|
||||||
.with_dimensions(854, 480)
|
|
||||||
.with_gl(glutin::GlRequest::Specific(glutin::Api::OpenGl, (3, 2)))
|
sdl_video.gl_set_swap_interval(1);
|
||||||
.with_gl_profile(glutin::GlProfile::Core)
|
|
||||||
.with_depth_buffer(24)
|
let window = sdl2::video::WindowBuilder::new(&sdl_video, "Steven", 854, 480)
|
||||||
.with_stencil_buffer(0)
|
.opengl()
|
||||||
.with_vsync()
|
.resizable()
|
||||||
.build()
|
.build()
|
||||||
.expect("Could not create Glutin window.");
|
.expect("Could not create sdl window.");
|
||||||
|
let gl_attr = sdl_video.gl_attr();
|
||||||
|
gl_attr.set_stencil_size(0);
|
||||||
|
gl_attr.set_depth_size(24);
|
||||||
|
gl_attr.set_context_major_version(3);
|
||||||
|
gl_attr.set_context_minor_version(2);
|
||||||
|
gl_attr.set_context_profile(sdl2::video::GLProfile::Core);
|
||||||
|
|
||||||
unsafe {
|
let gl_context = window.gl_create_context().unwrap();
|
||||||
window.make_current().expect("Could not set current context.");
|
window.gl_make_current(&gl_context).expect("Could not set current context.");
|
||||||
}
|
|
||||||
|
|
||||||
gl::init(&mut window);
|
gl::init(&sdl_video);
|
||||||
|
|
||||||
let renderer = render::Renderer::new(resource_manager.clone());
|
let renderer = render::Renderer::new(resource_manager.clone());
|
||||||
let mut ui_container = ui::Container::new();
|
let mut ui_container = ui::Container::new();
|
||||||
|
@ -194,11 +198,11 @@ fn main() {
|
||||||
resource_manager: resource_manager.clone(),
|
resource_manager: resource_manager.clone(),
|
||||||
console: con,
|
console: con,
|
||||||
should_close: false,
|
should_close: false,
|
||||||
mouse_pos: (0, 0),
|
|
||||||
chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures),
|
chunk_builder: chunk_builder::ChunkBuilder::new(resource_manager, textures),
|
||||||
connect_reply: None,
|
connect_reply: None,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let mut events = sdl.event_pump().unwrap();
|
||||||
while !game.should_close {
|
while !game.should_close {
|
||||||
{
|
{
|
||||||
game.resource_manager.write().unwrap().tick();
|
game.resource_manager.write().unwrap().tick();
|
||||||
|
@ -208,7 +212,7 @@ fn main() {
|
||||||
let diff = now - last_frame;
|
let diff = now - last_frame;
|
||||||
last_frame = now;
|
last_frame = now;
|
||||||
let delta = (diff.num_nanoseconds().unwrap() as f64) / frame_time;
|
let delta = (diff.num_nanoseconds().unwrap() as f64) / frame_time;
|
||||||
let (width, height) = window.get_inner_size_pixels().unwrap();
|
let (width, height) = window.size();
|
||||||
|
|
||||||
game.tick(delta);
|
game.tick(delta);
|
||||||
game.server.tick(&mut game.renderer, delta);
|
game.server.tick(&mut game.renderer, delta);
|
||||||
|
@ -225,31 +229,36 @@ fn main() {
|
||||||
ui_container.tick(&mut game.renderer, delta, width as f64, height as f64);
|
ui_container.tick(&mut game.renderer, delta, width as f64, height as f64);
|
||||||
game.renderer.tick(&mut game.server.world, delta, width, height);
|
game.renderer.tick(&mut game.server.world, delta, width, height);
|
||||||
|
|
||||||
let _ = window.swap_buffers();
|
window.gl_swap_window();
|
||||||
|
|
||||||
for event in window.poll_events() {
|
for event in events.poll_iter() {
|
||||||
handle_window_event(&window, &mut game, &mut ui_container, event)
|
handle_window_event(&window, &mut game, &mut ui_container, event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_window_event(window: &glutin::Window,
|
fn handle_window_event(window: &sdl2::video::Window,
|
||||||
game: &mut Game,
|
game: &mut Game,
|
||||||
ui_container: &mut ui::Container,
|
ui_container: &mut ui::Container,
|
||||||
event: glutin::Event) {
|
event: sdl2::event::Event) {
|
||||||
use glutin::{Event, VirtualKeyCode};
|
use sdl2::event::Event;
|
||||||
|
use sdl2::keyboard::Keycode;
|
||||||
|
use sdl2::mouse::Mouse;
|
||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
match event {
|
|
||||||
Event::Closed => game.should_close = true,
|
|
||||||
|
|
||||||
Event::MouseMoved((x, y)) => {
|
let mouse = window.subsystem().sdl().mouse();
|
||||||
game.mouse_pos = (x, y);
|
|
||||||
let (width, height) = window.get_inner_size_pixels().unwrap();
|
match event {
|
||||||
|
Event::Quit{..} => game.should_close = true,
|
||||||
|
|
||||||
|
Event::MouseMotion{x, y, xrel, yrel, ..} => {
|
||||||
|
let (width, height) = window.size();
|
||||||
if game.focused {
|
if game.focused {
|
||||||
window.set_cursor_state(glutin::CursorState::Hide).unwrap();
|
if !mouse.relative_mouse_mode() {
|
||||||
window.set_cursor_position((width/2) as i32, (height/2) as i32).unwrap();
|
mouse.set_relative_mouse_mode(true);
|
||||||
|
}
|
||||||
let s = 2000.0 + 0.01;
|
let s = 2000.0 + 0.01;
|
||||||
let (rx, ry) = ((x-(width/2) as i32) as f64 / s, (y-(height/2) as i32) as f64 / s);
|
let (rx, ry) = (xrel as f64 / s, yrel as f64 / s);
|
||||||
game.server.yaw -= rx;
|
game.server.yaw -= rx;
|
||||||
game.server.pitch -= ry;
|
game.server.pitch -= ry;
|
||||||
if game.server.pitch < (PI/2.0) + 0.01 {
|
if game.server.pitch < (PI/2.0) + 0.01 {
|
||||||
|
@ -262,51 +271,52 @@ fn handle_window_event(window: &glutin::Window,
|
||||||
ui_container.hover_at(game, x as f64, y as f64, width as f64, height as f64);
|
ui_container.hover_at(game, x as f64, y as f64, width as f64, height as f64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::MouseInput(glutin::ElementState::Released, glutin::MouseButton::Left) => {
|
Event::MouseButtonUp{mouse_btn: Mouse::Left, x, y, ..} => {
|
||||||
let (x, y) = game.mouse_pos;
|
let (width, height) = window.size();
|
||||||
let (width, height) = window.get_inner_size_pixels().unwrap();
|
|
||||||
|
|
||||||
if game.server.is_connected() && !game.focused {
|
if game.server.is_connected() && !game.focused {
|
||||||
game.focused = true;
|
game.focused = true;
|
||||||
window.set_cursor_state(glutin::CursorState::Hide).unwrap();
|
mouse.set_relative_mouse_mode(true);
|
||||||
window.set_cursor_position((width/2) as i32, (height/2) as i32).unwrap();
|
mouse.warp_mouse_in_window(&window, (width/2) as i32, (height/2) as i32);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if !game.focused {
|
if !game.focused {
|
||||||
ui_container.click_at(game, x as f64, y as f64, width as f64, height as f64);
|
ui_container.click_at(game, x as f64, y as f64, width as f64, height as f64);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::MouseWheel(delta, _) => {
|
Event::MouseWheel{x, y, ..} => {
|
||||||
let (x, y) = match delta {
|
|
||||||
glutin::MouseScrollDelta::LineDelta(x, y) => (x, y),
|
|
||||||
glutin::MouseScrollDelta::PixelDelta(x, y) => (x, y),
|
|
||||||
};
|
|
||||||
|
|
||||||
game.screen_sys.on_scroll(x as f64, y as f64);
|
game.screen_sys.on_scroll(x as f64, y as f64);
|
||||||
}
|
}
|
||||||
Event::KeyboardInput(glutin::ElementState::Released, _, Some(VirtualKeyCode::Escape)) => {
|
Event::KeyUp{keycode: Some(Keycode::Escape), ..} => {
|
||||||
if game.focused {
|
if game.focused {
|
||||||
window.set_cursor_state(glutin::CursorState::Normal).unwrap();
|
mouse.set_relative_mouse_mode(false);
|
||||||
game.focused = false;
|
game.focused = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::KeyboardInput(glutin::ElementState::Pressed, _, Some(VirtualKeyCode::Grave)) => {
|
Event::KeyDown{keycode: Some(Keycode::Backquote), ..} => {
|
||||||
game.console.lock().unwrap().toggle();
|
game.console.lock().unwrap().toggle();
|
||||||
}
|
}
|
||||||
Event::KeyboardInput(state, key, virt) => {
|
Event::KeyDown{keycode: Some(key), ..} => {
|
||||||
if game.focused {
|
if game.focused {
|
||||||
if let Some(virt) = virt {
|
game.server.key_press(true, key);
|
||||||
game.server.key_press(state == glutin::ElementState::Pressed, virt);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
ui_container.key_press(game, virt, key, state == glutin::ElementState::Pressed);
|
ui_container.key_press(game, key, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Event::ReceivedCharacter(c) => {
|
Event::KeyUp{keycode: Some(key), ..} => {
|
||||||
|
if game.focused {
|
||||||
|
game.server.key_press(false, key);
|
||||||
|
} else {
|
||||||
|
ui_container.key_press(game, key, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Event::TextInput{text, ..} => {
|
||||||
if !game.focused {
|
if !game.focused {
|
||||||
|
for c in text.chars() {
|
||||||
ui_container.key_type(game, c);
|
ui_container.key_type(game, c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
_ => (),
|
_ => (),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ use console;
|
||||||
use render;
|
use render;
|
||||||
use auth;
|
use auth;
|
||||||
use cgmath::{self, Vector};
|
use cgmath::{self, Vector};
|
||||||
use glutin::VirtualKeyCode;
|
use sdl2::keyboard::Keycode;
|
||||||
|
|
||||||
pub struct Server {
|
pub struct Server {
|
||||||
conn: Option<protocol::Conn>,
|
conn: Option<protocol::Conn>,
|
||||||
|
@ -41,7 +41,7 @@ pub struct Server {
|
||||||
pub yaw: f64,
|
pub yaw: f64,
|
||||||
pub pitch: f64,
|
pub pitch: f64,
|
||||||
|
|
||||||
pressed_keys: HashMap<VirtualKeyCode, bool>,
|
pressed_keys: HashMap<Keycode, bool>,
|
||||||
|
|
||||||
tick_timer: f64,
|
tick_timer: f64,
|
||||||
}
|
}
|
||||||
|
@ -224,16 +224,16 @@ impl Server {
|
||||||
|
|
||||||
if self.world.is_chunk_loaded((self.position.x as i32) >> 4, (self.position.z as i32) >> 4) {
|
if self.world.is_chunk_loaded((self.position.x as i32) >> 4, (self.position.z as i32) >> 4) {
|
||||||
let mut speed = 4.317 / 60.0;
|
let mut speed = 4.317 / 60.0;
|
||||||
if self.is_key_pressed(VirtualKeyCode::LShift) {
|
if self.is_key_pressed(Keycode::LShift) {
|
||||||
speed = 5.612 / 60.0;
|
speed = 5.612 / 60.0;
|
||||||
}
|
}
|
||||||
// TODO: only do this for flying
|
// TODO: only do this for flying
|
||||||
speed *= 2.5;
|
speed *= 2.5;
|
||||||
|
|
||||||
if self.is_key_pressed(VirtualKeyCode::Space) {
|
if self.is_key_pressed(Keycode::Space) {
|
||||||
self.position.y += speed * delta;
|
self.position.y += speed * delta;
|
||||||
}
|
}
|
||||||
if self.is_key_pressed(VirtualKeyCode::LControl) {
|
if self.is_key_pressed(Keycode::LCtrl) {
|
||||||
self.position.y -= speed * delta;
|
self.position.y -= speed * delta;
|
||||||
}
|
}
|
||||||
self.position.x += forward * yaw.cos() * delta * speed;
|
self.position.x += forward * yaw.cos() * delta * speed;
|
||||||
|
@ -256,23 +256,23 @@ impl Server {
|
||||||
use std::f64::consts::PI;
|
use std::f64::consts::PI;
|
||||||
let mut forward = 0.0f64;
|
let mut forward = 0.0f64;
|
||||||
let mut yaw = self.yaw - (PI/2.0);
|
let mut yaw = self.yaw - (PI/2.0);
|
||||||
if self.is_key_pressed(VirtualKeyCode::W) || self.is_key_pressed(VirtualKeyCode::S) {
|
if self.is_key_pressed(Keycode::W) || self.is_key_pressed(Keycode::S) {
|
||||||
forward = 1.0;
|
forward = 1.0;
|
||||||
if self.is_key_pressed(VirtualKeyCode::S) {
|
if self.is_key_pressed(Keycode::S) {
|
||||||
yaw += PI;
|
yaw += PI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let mut change = 0.0;
|
let mut change = 0.0;
|
||||||
if self.is_key_pressed(VirtualKeyCode::A) {
|
if self.is_key_pressed(Keycode::A) {
|
||||||
change = (PI / 2.0) / (forward.abs() + 1.0);
|
change = (PI / 2.0) / (forward.abs() + 1.0);
|
||||||
}
|
}
|
||||||
if self.is_key_pressed(VirtualKeyCode::D) {
|
if self.is_key_pressed(Keycode::D) {
|
||||||
change = -(PI / 2.0) / (forward.abs() + 1.0);
|
change = -(PI / 2.0) / (forward.abs() + 1.0);
|
||||||
}
|
}
|
||||||
if self.is_key_pressed(VirtualKeyCode::A) || self.is_key_pressed(VirtualKeyCode::D) {
|
if self.is_key_pressed(Keycode::A) || self.is_key_pressed(Keycode::D) {
|
||||||
forward = 1.0;
|
forward = 1.0;
|
||||||
}
|
}
|
||||||
if self.is_key_pressed(VirtualKeyCode::S) {
|
if self.is_key_pressed(Keycode::S) {
|
||||||
yaw -= change;
|
yaw -= change;
|
||||||
} else {
|
} else {
|
||||||
yaw += change;
|
yaw += change;
|
||||||
|
@ -295,11 +295,11 @@ impl Server {
|
||||||
self.write_packet(packet);
|
self.write_packet(packet);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn key_press(&mut self, down: bool, key: VirtualKeyCode) {
|
pub fn key_press(&mut self, down: bool, key: Keycode) {
|
||||||
self.pressed_keys.insert(key, down);
|
self.pressed_keys.insert(key, down);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_key_pressed(&self, key: VirtualKeyCode) -> bool {
|
fn is_key_pressed(&self, key: Keycode) -> bool {
|
||||||
self.pressed_keys.get(&key).map(|v| *v).unwrap_or(false)
|
self.pressed_keys.get(&key).map(|v| *v).unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ use std::rc::Rc;
|
||||||
use rand;
|
use rand;
|
||||||
use render;
|
use render;
|
||||||
use format;
|
use format;
|
||||||
use glutin::VirtualKeyCode;
|
use sdl2::keyboard::Keycode;
|
||||||
|
|
||||||
const SCALED_WIDTH: f64 = 854.0;
|
const SCALED_WIDTH: f64 = 854.0;
|
||||||
const SCALED_HEIGHT: f64 = 480.0;
|
const SCALED_HEIGHT: f64 = 480.0;
|
||||||
|
@ -68,10 +68,10 @@ impl Element {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn key_press(&mut self, game: &mut ::Game, key: Option<VirtualKeyCode>, raw: u8, down: bool) -> Vec<Rc<ClickFunc>> {
|
fn key_press(&mut self, game: &mut ::Game, key: Keycode, down: bool) -> Vec<Rc<ClickFunc>> {
|
||||||
match *self {
|
match *self {
|
||||||
$(
|
$(
|
||||||
Element::$name(ref mut val) => val.key_press(game, key, raw, down),
|
Element::$name(ref mut val) => val.key_press(game, key, down),
|
||||||
)+
|
)+
|
||||||
_ => unimplemented!(),
|
_ => unimplemented!(),
|
||||||
}
|
}
|
||||||
|
@ -489,8 +489,8 @@ impl Container {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn key_press(&mut self, game: &mut ::Game, key: Option<VirtualKeyCode>, raw: u8, down: bool) {
|
pub fn key_press(&mut self, game: &mut ::Game, key: Keycode, down: bool) {
|
||||||
if key == Some(VirtualKeyCode::Tab) {
|
if key == Keycode::Tab {
|
||||||
if !down {
|
if !down {
|
||||||
self.cycle_focus();
|
self.cycle_focus();
|
||||||
}
|
}
|
||||||
|
@ -499,7 +499,7 @@ impl Container {
|
||||||
let mut callbacks = None;
|
let mut callbacks = None;
|
||||||
for (_, e) in &mut self.elements {
|
for (_, e) in &mut self.elements {
|
||||||
if e.is_focused() {
|
if e.is_focused() {
|
||||||
callbacks = Some(e.key_press(game, key, raw, down));
|
callbacks = Some(e.key_press(game, key, down));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ pub trait UIElement {
|
||||||
fn unwrap_ref(&Element) -> &Self;
|
fn unwrap_ref(&Element) -> &Self;
|
||||||
fn unwrap_ref_mut(&mut Element) -> &mut Self;
|
fn unwrap_ref_mut(&mut Element) -> &mut Self;
|
||||||
|
|
||||||
fn key_press(&mut self, _game: &mut ::Game, _key: Option<VirtualKeyCode>, _raw: u8, _down: bool) -> Vec<Rc<ClickFunc>> {
|
fn key_press(&mut self, _game: &mut ::Game, _key: Keycode, _down: bool) -> Vec<Rc<ClickFunc>> {
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,14 +149,12 @@ impl TextBox {
|
||||||
|
|
||||||
impl UIElement for TextBox {
|
impl UIElement for TextBox {
|
||||||
|
|
||||||
fn key_press(&mut self, _game: &mut ::Game, key: Option<VirtualKeyCode>, _raw: u8, down: bool) -> Vec<Rc<ClickFunc>> {
|
fn key_press(&mut self, _game: &mut ::Game, key: Keycode, down: bool) -> Vec<Rc<ClickFunc>> {
|
||||||
if let Some(key) = key {
|
|
||||||
match (key, down) {
|
match (key, down) {
|
||||||
(VirtualKeyCode::Back, false) => {self.input.pop();},
|
(Keycode::Backspace, false) => {self.input.pop();},
|
||||||
(VirtualKeyCode::Return, false) => return self.submit_funcs.clone(),
|
(Keycode::Return, false) => return self.submit_funcs.clone(),
|
||||||
_ => {},
|
_ => {},
|
||||||
}
|
}
|
||||||
}
|
|
||||||
vec![]
|
vec![]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue