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
Adds Controls Config file as a JSON #7
Conversation
why was this here lmao
I'll probably make Mouse Controls at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also lots of indentation inconsistencies.
| #pragma warning disable CS8600 | ||
| JsonNode doc = JsonNode.Parse(File.ReadAllText(controlsPath)); | ||
| if (doc != null) | ||
| Controls.HandleCustomControls(doc); | ||
| } | ||
|
|
||
| // wait for tasks to finish | ||
| { | ||
| foreach (var task in tasks) | ||
| #pragma warning restore CS8600 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why pragma instead of !?
| #pragma warning disable CS8604 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just handle nullability?
| #pragma warning disable CS8604 | ||
| // i probably should have handled it a bit better but :(, im just hoping that this isn't the slowest code in the game. - Viv | ||
| public static void HandleCustomControls(JsonNode root) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it not be better to deserialize to a type-checked object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This existing code is extremely volatile and will cause problems if even minor issues are present.
|
Hey thanks for writing this all out! This is a great start, but I also agree with steviegt6 on a few issues:
|
|
just tested this out, seems like the pause menu isn't working at least for keyboard a quick look through the changes I'm not quite sure what the issue is I have tried both a debug build and a release build on linux and both can't open it |
|
Regarding this, I think in order to use a Json-deserializing structure it would require rewriting things in terms of solely buttons, similar to the structure within Celeste itself, i.e.: I'm going to rewrite it terms of that but I'm not sure whether or not I should then include Deadzones for things like Joystick/Triggers |
|
You can write your own (de)serializers. |
feat: Add guide for Linux and MacOS users
|
I ended up doing an implementation getting it working, based on the ideas here! Appreciate the first pass that was done, thank you! It's still missing Mouse to aim, but I think that could be added as a separate PR (and probably part of Foster somehow). |
Adds a controls config file as a JSON.
Tested against Windows 10 with Controller and Keyboard
Supports deadzones for joysticks/triggers
Please send feedback if you have concerns