Updates to enhance GitHub Actions continuous integration:
* ci: add macOS app bundle packaging using cargo-bundle, closes#352
based on https://github.com/EndlessSkyCommunity/ESLauncher2/blob/master/Cargo.toml
* ci: add web target, building using wasm-pack (for #446)
* ci: refactor and cleanup targets, split out instead of using matrix
* main: save config in consistent OS-specific dirs::config_dir()
Instead of storing and loading in the current working directory, change
to a consistent dedicated configuration directory. This is necessary for
.app launching since cwd is set to /. To preserve compatibility with
existing installations, if conf.cfg exists in cwd then it will be used instead,
but otherwise we will use the operating system specific config dirs:
// Lin: Some(/home/alice/.config)
// Win: Some(C:\Users\Alice\AppData\Roaming)
// Mac: Some(/Users/Alice/Library/Application Support)
* macos: add icons based on screenshotted logo
* macos: add Cmd-Q to quit
* Add getrandom with js feature for JavaScript web compatibility
* Update to rand 0.8.0, closes#440
* Update to rand_pcg 0.3.0, closes#434
* Update rsa_public_encrypt_pkcs1 to 0.3.0, updates rand 0.8.0
Replace std::time with the `instant` crate, which bridges to std::time on
native but on wasm calls performance.now() instead of panicking.
A step towards 🕸️ Web support #446
* logo: replace SystemTime/UNIX_EPOCH with Instant
Steven used multisampled textures from the beginning, but this caused
incompatibilities: https://github.com/Thinkofname/steven/issues/74.
Subsequently fixed by increasing the number of samples, but increasing
it beyond the limit caused more incompatibilities, so it was clamped to
the maximum samples reported as supported by the system.
Fast-forward to now, as part of adding WebGL support (#446), the use of
multisampled textures via the glTexImage2DMultisample() call is
unsupported on this platform. Replace the following:
* glTexImage2DMultisample -> glTexImage2D
* TEXTURE_2D_MULTISAMPLE -> TEXTURE_2D
* sampler2DMS -> sampler2D
This disables the custom multisampling anti-aliasing algorithm (MSAA)
implemented in the chunk fragment shader, increasing compatibility:
* Update to glow release, remove image_2d_sample()
MSAA may be added back at a later date using multisampled renderbuffers
instead, see #442.
A small step for #446🕸️ Web support, use web-sys to interface to the web.
Previously, we would try to use glutin on the web, which is not supported;
now glutin is only used on native: fixes#171 could not find Context in platform_impl.
winit is still used on both, but the GL context is created with web-sys and glow
(on the web), and created with glutin and used with glow (on native). stdweb is
no longer used, being replaced by web-sys.
Substantial refactoring to allow reusing the code between web/native:
* settings: use VirtualKeyCode from winit, not reexported from glutin
* std_or_web: remove broken localstoragefs/stdweb, add File placeholder
* render: disable skin_thread on wasm since we don't have threads
* gl: use glow types in gl wrapper (integers in native, but Web*Key in web)
* gl: web-sys WebGlUniformLocation does not implement Copy trait, so glow::UniformLocation doesn't so gl::Uniform can't
* gl: refactor context initialization, pass glow::Context to gl::init for consistency between native/web
* gl: update to glow with panicking tex_image_2d_multisample web-sys wrapper
* glsl: use shader version in GLSL for WebGL 2 and OpenGL 3.2
* shaders: add explicit float/int type conversions, required for WebGL
* shaders: specify mediump precision, required for WebGL
* shaders: specify fragment shader output locations for WebGL
* main: refactor handle_window_event to take a winit window, not glutin context
* main: handle resize outside of handle_window_event since it updates the glutin window (the only event which does this)
* main: use winit events in handle_window_event not reexported glutin events
* main: refactor game loop handling into tick_all()
* main: create winit window for WebGL, and use winit_window from glutin
* main: restore console_error_panic_hook, mistakingly removed in (#260)
* main: remove force setting env RUST_BACKTRACE=1, no longer can set env on web
* www: index.js: fix wasm import path
* www: npm update, npm audit fix
* www: update readme to link to status on #446🕸️ Web support
Replaces the use of gl_generator with the glow wrapper:
* Add glow dependency, based on glow 0.6.1
* Pin version of glow fork for https://github.com/iceiix/glow/pull/1 until #442 renderbuffer
* Remove gl module, steven_gl
Porting details:
* Initialize glow in src/gl/mod.rs
* Call gl methods on glow context
* glow uses camelcase
* Import glow::HasContext trait, finds draw_elements etc.
* Fix mismatched types, glow uses Option and &str instead of raw pointers
* Fix uniform_location, glow already returns Some(u32)
* uniform_location: convert i32 to u32 for Uniform
* Fix attribute_location
* Fix shader creation Result u32 type
* Fix passing GLvoid and 2d/3d
* Fix missing Options type mismatches
* Offsets are i32 in glow, not GLvoid
* Fix clear_buffer using _f32_slice
* Delete methods are singular not plural
* glBufferData -> buffer_data_u8_slice
* buffer_sub_data_u8_slice
* Update more glow method wrapper names found by reviewing glow native platform
* Remove unused multi_draw_elements, can be replaced by draw_elements in a loop and it has no WebGL equivalent
* glow implements glMapBufferRange
* Remove unused read_buffer
* glow's deletes automatically pass 1 and take no reference
* shader_source() accepts &str directly; removes last of std::ptr
* Pass uniform Option<u32>
* Fix bool passing normalized parameter
* Fix draw_buffers parameter
* Stop unnecessarily returning context from gl::init
* Getting shader info is unsafe
* Unwrapping static mut is unsafe
* Use unsafe raw pointers for global mutable context
* Fix initializing GL objects wrappers from glow wrappers
* Unbinding framebuffers uses None
* Uppercase global to fix warning
* Shaders return Some instead of None
* Unbox the context to a raw pointer
* Use tex_image_2d_multisample added in glow fork
* Implement uniform_location, fixing unwrap None failed
* Add tex_sub_image_3d, using PixelUnpackData::Slice
* set_matrix4: transmute the Matrix4 since it is repr(C)
* get_pixels -> get_tex_image -> glGetTexImage, with PixelPackData::Slice
* Wrap sub_image_2d (glTexSubImage2D) and fix warnings
* Implement set_float_multi_raw and set_matrix4_multi, using from_raw_parts
* Update for ModifiersChanged event
* Consistently use logical position and size
CursorMoved gives us a PhysicalPosition, which needs to be converted
to LogicalPosition to properly track the mouse movement. Change the
width/height passed to be a LogicalSize instead of a PhysicalPosition,
matching the LogicalPosition.
Closes#425 build(deps): bump wasm-bindgen from 0.2.68 to 0.2.69
Closes#426 build(deps): bump structopt from 0.3.20 to 0.3.21
Closes#427 build(deps): bump serde_json from 1.0.59 to 1.0.60
Closes#428 build(deps): bump serde from 1.0.117 to 1.0.118
Closes#433 build(deps): bump reqwest from 0.10.9 to 0.10.10
Bump cfg-if to 1.0.0 (closes#412)
Bump serde to 1.0.117 (closes#416)
Bump serde_json to 1.0.59 (closes#413)
Bump structopt to 0.3.20 (closes#414)
Bump flate2 to 1.0.19 (closes#420)
Bump reqwest to 0.10.9 (closes#423)
Closes#372 bump log from 0.4.8 to 0.4.11
Closes#387 bump reqwest from 0.10.6 to 0.10.8
Closes#391 bump wasm-bindgen from 0.2.64 to 0.2.68
Closes#403 bump serde_json from 1.0.56 to 1.0.58
Closes#405 bump flate2 from 1.0.16 to 1.0.18
Closes#409 bump structopt from 0.3.15 to 0.3.19
Bump flate2 to 1.0.16, closes#350
Bump serde_json to 1.0.56, closes#349
Bump wasm-bindgen to 0.2.64, closes#348
gl: Bump libc to 0.2.71
protocol: Bump hex to 0.4.2
protocol: Bump aes to 0.4.0
protocol: Bump cfb8 to 0.4.0
protocol: Bump num-traits to 0.2.12
Thanks to @mwkroening (#317) and @martijnberger (#323) for helping fix this update.
* Update to glutin 0.22.0 and winit 0.20.0 release, removing alpha pinning
* scale_factor() replaces hidpi_factor()
* Listen for ScaleFactorChanged, separate from Resized event
* Fix getting physical size of window
* Fix logical mouse event coordinates
Update to structopt 0.3.15, closes#330
Update to base64 0.12.2, closes#329
Update to zip 0.5.6, closes#328
Update to serde_json 1.0.55, closes#327
Update to reqwest 0.10.6, closes#321
Update to flate2 1.0.14, closes#303
Update to byteorder 1.3.4, closes#285
The git dependency was only for wasm32-unknown-emscripten support:
https://github.com/aweinstock314/rust-clipboard/pull/62
but #92 changes to using wasm32-unknown-unknown instead, a better
supported path (though still incomplete in this project, see #171)
Closes#276 Bump serde_json from 1.0.44 to 1.0.45
Closes#274 Bump structopt from 0.3.7 to 0.3.8
Closes#273 Bump image from 0.22.3 to 0.22.4
Closes#272 Bump rand from 0.7.2 to 0.7.3
Closes#270 Bump num-traits from 0.2.10 to 0.2.11
Closes#269 Bump reqwest from 0.10.0 to 0.10.1
Completes the move of the protocol implementation into a new
crate, named steven_protocol, in the protocol/ subdirectory.
* Add Cargo.toml for steven_protocol
* Add steven_protocol entrypoint in protocol/src/lib.rs
* Use steven_protocol in main
* Remove protocol in main, replaced by steven_protocol
* Remove unused dependencies moved into steven_protocol
Update from glutin 0.21.x fork to glutin 0.22.0-alpha5 and corresponding
compatible version of winit. This removes our custom temporary wasm_stub
branches, back to mainline glutin and winit, and is a step towards WebAssembly
compatibility, most importantly merging the game loop and event loops as
required by winit _which now supports wasm_. Not yet functional on the web
because other web dependencies have to be added, see #171 and #34, but native
functionality is preserved.
* Update for 0.22 glutin API changes:
* Move game logic into event loop, run() replacing poll_events()
* Specify fullscreen Borderless mode
* Pass generic parameter of Event through handle_window_event
* hidpi_factor() replaces get_hidpi_factor()
* with_inner_size() replaces with_dimensions()
* No longer need to unwrap() LogicalSize
* set_cursor_grab/visible() replaces grab/hide_cursor()
* Fix modifiers deprecated warnings by destructuring only event fields we use, ignoring the rest with '..'
* Remove unnecessary mutability from events_loop
* Listen for ModifiersChanged event, fixing deprecated modifiers field
* Change to stdweb for web backend, replacing web-sys
* Pin to glutin =0.22.0-alpha5 and winit =0.20.0-alpha6
* Closes#237 Bump base64 from 0.10.1 to 0.11.0
* Closes#241 Bump flate2 from 1.0.12 to 1.0.13
* Closes#245 Bump num-traits from 0.2.8 to 0.2.10
* Closes#248 Bump serde_json from 1.0.41 to 1.0.44
* Closes#249 Bump serde from 1.0.102 to 1.0.104
* Closes#251 Bump web-sys from 0.3.30 to 0.3.33
* Closes#254 Bump structopt from 0.3.3 to 0.3.7
* Bump cfg-if from 0.1.9 to 0.1.10
* `cargo update` all modules
Closes#196 Bump web-sys from 0.3.24 to 0.3.25
Closes#200 Bump reqwest from 0.9.18 to 0.9.19
Closes#202 Bump log from 0.4.6 to 0.4.8
Closes#203 Bump serde from 1.0.94 to 1.0.98
Closes#187 Bump web-sys from 0.3.22 to 0.3.24
Closes#188 Bump flate2 from 1.0.7 to 1.0.9
Closes#189 Bump structopt from 0.2.16 to 0.2.18
Closes#190 Bump serde from 1.0.92 to 1.0.94
Closes#192 Bump serde_json from 1.0.39 to 1.0.40
`cargo update` updates smallvec (and others) used by collision:
Closes#193 [Security] Bump smallvec from 0.6.9 to 0.6.10
Logging from the `log` facade goes to the colorized in-game GUI console (opened with the backtick key), as well as standard output using `println!` on the native build. To make this work on the wasm build, web-sys is used to access the `console` object, to call `console.log`, `console.warn`, and so on corresponding to the log levels. Extends #92, fails later (see also #115) but now outputs the starting up message:
[main.rs:206][INFO] Starting steven
* Add println! logging to console.log on wasm
* Initialize logger before config (called 'console variables' for some reason) to avoid having to disable it to reach the first logging statement
* Add web-sys crate for browser console access, wasm32-only
* Refactor logger to call println_level on both web/native
* Add multiple log levels, console.warn etc., matching console_log crate
https://github.com/iamcodemaker/console_log#details
Updating the glutin dependency to a 0.21.0-based branch, based on the migration guide at:
https://gentz.rocks/posts/glutin-v0-21-0-migration-guide/
* Remove glutin::ContextTrait
* Create window with ContextBuilder instead of WindowedContext::new
* Add .window() accessor on WindowContext, since it now dereferences to Context
In order to not break wasm32-unknown-unknown compilation, a minor fork is used of glutin v0.21.0 and a corresponding version of winit: https://github.com/iceiix/glutin/pull/1https://github.com/iceiix/winit/pull/2
- with stubs to compile (but not run, see issue #115)
Movement packets were handled incorrectly, because although the fields are specified as integers they are actually fixed-point values, which need to be converted to floating-point before use. These fields were converted with `as f64`, but they actually need to be scaled. To fix this add several new types, FixedPoint5 for 5-bit fractional fixed-point and FixedPoint12 for 12-bit. Both are parameterized by an integer type: FixedPoint5<i32> and FixedPoint5<i8> for 1.7.10/1.8.9, FixedPoint12<i16> for 1.9+. This moves the calculation into the packet field parsing, so it no longer has to be calculated in src/server/mod.rs since the scaling is taken care of as part of the field type. This fixes the long-standing invisible or actually misplaced players bug on 1.7.10 and 1.8.9, closes#139.
* Add new FixedPoint5<T> type for 1.7/8, https://wiki.vg/Data_types#Fixed-point_numbers
* Add FixedPoint12<i16> for 1.9+, moving type conversion into packet type
https://wiki.vg/index.php?title=Protocol#Entity_Relative_Move
* Add num-traits 0.2.6 dependency for NumCast to use instead of From
* Use FixedPoint5<i32> in spawn object, experience orb, global entity, mob, player, teleport
* Use FixedPoint5<i8> and FixedPoint12<i16> in entity move, look and move
* Update packet handling bouncer functions, using f64::from for each conversion
* Add structopt dependency
* Add command-line --server argument to connect to server on startup
* Don't show login/server screen (which pings servers) when connecting to a server from command-line
Closes#116 Bump cfg-if from 0.1.6 to 0.1.7
Closes#120 Bump cfb8 from 0.3.1 to 0.3.2
Closes#122 Bump flate2 from 1.0.6 to 1.0.7
Closes#124 Bump serde from 1.0.89 to 1.0.90
Closes#127 Bump zip from 0.5.0 to 0.5.2
Note this only is the first step in web support, although the project compiles, it doesn't run!
Merging now to avoid branch divergence, until dependencies can be updated for wasm support.
* Add instructions to build for wasm32-unknown-unknown with wasm-pack in www/
* Update to rust-clipboard fork to compile with emscripten
https://github.com/aweinstock314/rust-clipboard/pull/62
* Exclude reqwest dependency in wasm32
* Exclude compiling clipboard pasting on wasm32
* Exclude reqwest-using code from wasm32
* Install wasm target with rustup in Travis CI
* Update to collision 0.19.0
Fixes wasm incompatibility in deprecated rustc-serialize crate: https://github.com/rustgd/collision-rs/issues/106
error[E0046]: not all trait items implemented, missing: `encode`
--> github.com-1ecc6299db9ec823/rustc-serialize-0.3.24/src/serialize.rs:1358:1
* Increase travis_wait time even further, try 120 minutes
* Set RUST_BACKTRACE=1 in main
* Remove unused unneeded bzip2 features in zip crate
To fix wasm32-unknown-unknown target compile error:
error[E0432]: unresolved imports `libc::c_int`, `libc::c_uint`, `libc::c_void`, `libc::c_char`
--> src/github.com-1ecc6299db9ec823/bzip2-sys-0.1.7/lib.rs:5:12
|
5 | use libc::{c_int, c_uint, c_void, c_char};
| ^^^^^ ^^^^^^ ^^^^^^ ^^^^^^ no `c_char` in the root
| | | |
| | | no `c_void` in the root
| | no `c_uint` in the root
| no `c_int` in the root
* flate2 use Rust backend
* Add console_error_panic_hook module for wasm backtraces
* Build using wasm-pack, wasm-bindgen, run with wasm-app
* Update to miniz_oxide 0.2.1, remove patch for https://github.com/Frommi/miniz_oxide/issues/42
* Update to official clipboard crate since https://github.com/aweinstock314/rust-clipboard/pull/62 was merged, but git revision pending release
* Update to branch of glutin attempting to build for wasm
https://github.com/iceiix/glutin/pull/1
* Update winit dependency of glutin to git master
https://github.com/iceiix/winit/pull/2
* Update to glutin branch with working (compiles, doesn't run) wasm_stub
* Add app name in title on web page
* Add wasm to Travis-CI test matrix
* Update glutin to fix Windows EGL compilation on AppVeyor
97797352b5
Closes#100 Bump serde from 1.0.84 to 1.0.85
Closes#101 Bump serde_json from 1.0.36 to 1.0.37
Closes#102 Bump reqwest from 0.9.8 to 0.9.9
Closes#103 Bump base64 from 0.10.0 to 0.10.1
* Add glutin dependency
* Create a glutin window
* Use the glutin window, basics work
* Store DPI factor on game object, update on Resized
* Use physical size for rendering only. Fixes UI scaled too small
Fixes https://github.com/iceiix/steven/pull/35#issuecomment-442683373
See also https://github.com/iceiix/steven/issues/22
* Begin adding mouse input events
* Listen for DeviceEvents
* Call hover_at on mouse motion
* Listen for CursorMoved window event, hovering works
Glutin has separate WindowEvent::CursorMoved and
DeviceEvent::MouseMotion events, for absolute cursor and relative mouse
motion, respectively, instead of SDL's Event::MouseMotion for both.
* Use tuple pattern matching instead of nested if for MouseInput
* Implement left clicking
* Use grab_cursor() to capture the cursor
* Hide the cursor when grabbing
* Implement MouseWheel event
* Listen for keyboard input, escape key release
* Keyboard input: console toggling, glutin calls backquote 'grave'
* Implement fullscreen in glutin, updates https://github.com/iceiix/steven/pull/31
* Update settings for glutin VirtualKeyCode
* Keyboard controls (note: must clear conf.cfg to use correct bindings)
* Move DeviceEvent match arm up higher for clarity
* Remove SDL
* Pass physical dimensions to renderer tick so blit_framebuffer can use full size but the ui is still sized logically.
* Listen for DeviceEvent::Text
* Implement text input using ReceivedCharacter window event, works
https://github.com/iceiix/steven/pull/35#issuecomment-443247267
* Request specific version of OpenGL, version 3.2
* Request OpenGL 3.2 but fallback to OpenGL ES 2.0 if available (not tested)
* Set core profile and depth 24-bits, stencil 0-bits
* Allow changing vsync, but require restarting (until https://github.com/tomaka/glutin/issues/693)
* Clarify specific Rust version requirement
* Import glutin::* in handle_window_event() to avoid overly repetitive code
* Linux in VM fix: manually calculate delta in MouseMotion
For the third issue on https://github.com/iceiix/steven/pull/35#issuecomment-443084458https://github.com/tomaka/glutin/issues/1084 MouseMotion event returns absolute instead of relative values, when running Linux in a VM
* Heuristic to detect absolute/relative MouseMotion from delta:(xrel, yrel); use a higher scaling factor
* Add clipboard pasting with clipboard crate instead of sdl2
https://github.com/iceiix/steven/pull/35#issuecomment-443307295
* Add handwritten RSA PKCS1 encryption using num-bigint and simple_asn1
* Add more logging to compare OpenSSL with/without side-by-side
* Log message and ciphertext in hex
* Print N and e as hexadecimal integers
* Fix bad encryption caused by zeros in PKCS1 padding
PS field in https://tools.ietf.org/html/rfc8017#section-7.2.1
Must be nonzero
* Use rand fill instead of rand_bytes
* Remove OpenSSL!
* Update CI scripts and docs to not install OpenSSL
* Remove copying OpenSSL DLLs (libeay and ssleay) in AppVeyor script
* Change rsa_public_encrypt_pkcs1 to return a Result<Vec<u8>, String>
* Add error checking, returning Err<String> on failure; RFC comments
* Add the required message representative range checking
* Use expect() instead of unwrap() on from_der
* Map the ASN.1 error to a String to return it from rsa_public_encrypt_pkcs1() instead of panicking
* Move RSA to a new crate, rsa_public_encrypt_pkcs1
https://github.com/iceiix/rsa_public_encrypt_pkcs1
* Update to rsa_public_encrypt_pkcs1 with simple_asn 0.1.0
https://github.com/iceiix/rsa_public_encrypt_pkcs1/issues/1
* Update to published version of rsa_public_encrypt_pkcs1, 0.1.0
* Remove unnecessarily added blank line
* Remove libssl-dev from .travis.yml
* Encrypt with both RustCrypto cfb8 and OpenSSL
* Switch to RustCrypto for decrypting
* Show encryption for both RustCrypto and OpenSSL, for comparison...
* Correct off-by-one error in encryption, cfb8 doesn't need extra byte
* Remove OpenSSL for symmetric crypto
* Update Cargo.lock
An old version of hyper was used before (0.8.0), in the process of updating to hyper 0.12.11, found this higher-level replacement/wrapper, reqwest 0.9.4 which is simpler to use than the latest hyper and serves the purpose of a simple HTTP client well
* Begin updating to hyper 0.12.11
https://github.com/iceiix/steven/issues/4#issuecomment-425759778
* Use type variables for hyper::Client
* Fix setting header syntax, Content-Type: application/json, 17->13
* Parse strings into URLs with url.parse::<hyper::Uri>().unwrap()
b20971cb4e/examples/client.rs (L25)
* Use hyper::Request::post() then client.request() since client.post() removed
* wait() on the ResponseFuture to get the Result
* try! to unwrap the Result
* status() is now a method
* Concatenate body chunks unwrap into bytes, then parse JSON from byte slice, instead of from_reader which didn't compile
* Replace send() with wait() on ResponseFuture
* Parse HeaderValue to u64
* Slices implement std::io::Read trait
* Read into_bytes() instead of read_to_end()
* Disable boxed logger for now to workaround 'expected function, found macro'
* Remove unnecessary mutability, warnings
* Hack to parse twice to avoid double move
* Use hyper-rustls pure Rust implementation for TLS for HTTPS in hyper
* Start converting to reqwest: add Protocol::Error and reqwest::Error conversion
* Use reqwest, replacing hyper, in protocol
* Convert resources to use reqwest instead of hyper
* Convert skin download to reqwest, instead of hyper
* Remove hyper
* Revert unnecessary variable name change req/body to reduce diff
* Revert unnecessary whitespace change to reduce diff, align indentation on .
* Fix authenticating to server, wrong method and join URL
* Update Cargo.lock
* Replace find() with get()
* Update for renamed as_string->as_str and as_boolean->as_bool
https://github.com/serde-rs/json/releases/tag/v0.8.0
Value::as_string() has been renamed to as_str() and Value::as_boolean() has been renamed to as_bool() to improve consistency
https://github.com/serde-rs/json/issues/126
* No serde_json::Value::I64/U64/F64 anymore, only Number
* Update from lookup() to pointer(), using JSON pointer syntax
https://github.com/iceiix/steven/pull/6#issuecomment-432472123
* Remove unused and removed ObjectBuilder import
* Use into_iter().collect() to convert BTreeMap to serde_json::Map
* Change parse_rules to accept serde_json::Map instead of BTreeMap
* Remove unused serde_json macro_use
* Update Cargo.lock