-
Notifications
You must be signed in to change notification settings - Fork 827
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
Implement quick spell cycling #6861
Changes from all commits
bb8f9a8
2f58a26
b45c72d
f5495bb
f72675f
f7526b3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,7 @@ bool FetchMessage_Real(SDL_Event *event, uint16_t *modState) | |
case SDL_TEXTEDITING: | ||
case SDL_TEXTINPUT: | ||
case SDL_WINDOWEVENT: | ||
case SDL_MOUSEWHEEL: | ||
#else | ||
case SDL_ACTIVEEVENT: | ||
#endif | ||
|
@@ -120,25 +121,6 @@ bool FetchMessage_Real(SDL_Event *event, uint16_t *modState) | |
*event = e; | ||
break; | ||
#ifndef USE_SDL1 | ||
case SDL_MOUSEWHEEL: | ||
#ifdef _DEBUG | ||
if (IsConsoleOpen()) { | ||
*event = e; | ||
break; | ||
} | ||
#endif | ||
// This is a hack, mousewheel events should be handled directly by their consumers instead. | ||
event->type = SDL_KEYDOWN; | ||
if (e.wheel.y > 0) { | ||
event->key.keysym.sym = (SDL_GetModState() & KMOD_CTRL) != 0 ? SDLK_KP_PLUS : SDLK_UP; | ||
Comment on lines
-130
to
-133
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm super happy to see this gone, thank you! 🎉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes this logic is also removed. You can still zoom with the +/- keys. |
||
} else if (e.wheel.y < 0) { | ||
event->key.keysym.sym = (SDL_GetModState() & KMOD_CTRL) != 0 ? SDLK_KP_MINUS : SDLK_DOWN; | ||
} else if (e.wheel.x > 0) { | ||
event->key.keysym.sym = SDLK_LEFT; | ||
} else if (e.wheel.x < 0) { | ||
event->key.keysym.sym = SDLK_RIGHT; | ||
} | ||
break; | ||
#if SDL_VERSION_ATLEAST(2, 0, 4) | ||
case SDL_AUDIODEVICEADDED: | ||
return FalseAvail("SDL_AUDIODEVICEADDED", e.adevice.which); | ||
|
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 looks.... more complicated than it needs to be, at least at first glance.
Have you considered just creating 2 separate functions, "NextSkill" and "PreviousSkill", instead of combining both here?
Also, isn't there something in C++ like a "circular iterator" that we could tap into? Then, it would be a matter of walking forward or backward on it, while checking for the first valid spell occurrence using those predicate lambdas.
I don't know..... this might be me just misremembering how awful C++ is, but this looks incredibly convoluted for such a simple operation conceptually. Maybe we are just lacking some abstraction here.
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.
I haven't given it much thought.
But I don't know anything about a circular iterator.
If you want you can give it a try to improve it. 🙂