-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed game starting completely dark. #740
Conversation
I think the correct one would be |
Have already looked there after trying The example at https://serde.rs/attr-default.html is using the function Updating the patch to use the function, which also fixes it, but have hoped there is something that looks cleaner, or that there is a way it could pick default brightness value directly from EngineOptions::Default::default() |
6469ec8
to
150963a
Compare
Allright. I looked once more at the documentation but the following fact is more or less undocumented unfortunately (extracted it from this PR: serde-rs/serde#780). The |
This is a basic example derived from the serde docs: https://play.rust-lang.org/?version=stable&mode=debug&edition=2015&gist=32cf9cdb1d074b04b27d2e36f4366c77 |
ok.. so how i had it fixed originally by removing Edit: actually it gets added with or without |
150963a
to
ddbf822
Compare
Th for recognizing and the fix BTW. I created a PR for serde docs to clarify this: serde-rs/serde-rs.github.io#84 |
When starting game directly without ja2-launcher and no brightness setting defined in json or command line it would default to 0.0, and whole screen would turn completely dark.
I'd appreciate if someone with more experience in rust and serde_json would check this to confirm this is correct solution. Apparently serde(default) would set this value to 0.0 instead of using what was defined here: https://github.com/ja2-stracciatella/ja2-stracciatella/blob/master/rust/src/stracciatella.rs#L196
I thought serde(default) is just supposed to add line to json if not present using the default value from that line... apparently not.
Edit: this was introduced by changes from my pull request #734