-
Notifications
You must be signed in to change notification settings - Fork 42
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
WIP Command-line reform #403
Conversation
@NQNStudios Thoughts? |
My command-line arg code is kind of a mess. It can definitely be improved with a good library on the back-end. If Clara is a part of Catch, that seems like a great option. Flags are probably better than subcommands, because when you mis-type a subcommand currently, boe tries to open it as a file, which is never correct. Starting the subcommands with a |
Be careful for how the apple events snatch up command-line arguments which will then also be processed by our own arg processing. That tripped me up at least once |
It is part of Catch, but it is archived and no longer maintained. I would assume Catch v3 is no longer using it, but as we require C++11 support we can't upgrade past v2 anyway. Clara is also not very flexible, but it might be "good enough" for our needs.
…what? |
I mentioned the apple events weirdness here:
and addressed it with this change: For some reason the apple event that's set up to handle when a file gets dragged onto the app icon, also handles direct command line argument. So when I launched with "replay file.xml" it was trying to load a party called "replay" |
You're saying that MacOS sends an open file event to the application when it finds a command line argument? That doesn't even make sense… I don't get it… |
It seemed pretty outrageous to me too, but I just patched around it and moved on. 😢 |
fe0e897
to
7be1ad9
Compare
Okay, so I've rebased this to squash all the random fixup commits, but I'd still like to figure out how to make the replay speed thing work before I merge this. Any ideas, @NQNStudios ? |
I checked this branch out, built, and made a quick recording. Parts of the replay are visually messed up, like when the splash screen ends I see the startup button that gets clicked drawn on top of it, but the menu doesn't get a chance to draw itself in full first. (That's been the case all along--I didn't really mind it myself). But when my party gets into a scenario and I'm replaying with So I'm thinking that what you've done does work, but certain things the replay system replays, happen outside of If we do change animations to not have their own event loops, then this way of specifying replay FPS is gonna mess those up and make them last forever. |
Do you have a better way of specifying replay FPS? |
Still thinking about this. The cleanest way I've come up with so far, would be to put an fps_limiter in replay.cpp and have |
Okay, I'll try that. |
The start menu still probably won't draw with this, because the issue there I'm guessing is that the splash screen ends in the same frame the button action gets picked up, so sleeping in pop_next_action() would just draw the splash screen longer. |
…s make it optional
This makes use of the Clara command-line library included with Catch to do proper parsing of command-line arguments.
This fixes an issue where the scenario editor complains about a missing file when launched from Xcode, because Xcode passes an unrecognized argument which is interpreted as a filename. The Clara parser seems to ignore unrecognized arguments, so using it makes this work. It does unfortunately require using flag syntax instead of subcommand style for the replay system.
If this looks mostly okay, it might be better to update to the Lyra library instead, which is similar in substance but is still being maintained. Unlike Clara, Lyra has support for subcommands, so we wouldn't need to change the existing command-line syntax. I don't know if it ignores unrecognized arguments like Lyra does.
Alternatively, we could consider using Boost.ProgramOptions for command-line parser. This is a much bulkier library, however.