mirror of
https://github.com/kichikuou/system3-sdl2.git
synced 2026-09-22 22:58:12 +03:00
Advance messages by scrolling mouse wheel down
Now the 'A' command accepts mouse wheel down events in addition to keyboard and mouse buttons.
This commit is contained in:
+3
-1
@@ -410,12 +410,14 @@ void NACT::cmd_a()
|
||||
ags->draw_push(text_window);
|
||||
}
|
||||
|
||||
get_wheel(); // clear wheel input
|
||||
|
||||
// キーが押されて離されるまで待機
|
||||
while (!msgskip->skipping()) {
|
||||
if(terminate) {
|
||||
return;
|
||||
}
|
||||
if(get_key()) {
|
||||
if (get_key() || get_wheel() < 0) {
|
||||
break;
|
||||
}
|
||||
sys_sleep(16);
|
||||
|
||||
@@ -149,6 +149,7 @@ protected:
|
||||
uint8 get_key();
|
||||
void get_cursor(int* x, int* y);
|
||||
void set_cursor(int x, int y);
|
||||
int get_wheel();
|
||||
|
||||
SDL_GameController *sdl_gamecontroller = NULL;
|
||||
|
||||
|
||||
+12
-1
@@ -21,7 +21,7 @@ enum TouchState {
|
||||
};
|
||||
|
||||
extern SDL_Window* g_window;
|
||||
static int mousex, mousey;
|
||||
static int mousex, mousey, wheel;
|
||||
static TouchState touch_state = TOUCH_NONE;
|
||||
|
||||
void NACT::handle_event(SDL_Event e)
|
||||
@@ -47,6 +47,10 @@ void NACT::handle_event(SDL_Event e)
|
||||
mousey = e.motion.y * ags->screen_height / ags->window_height;
|
||||
break;
|
||||
|
||||
case SDL_MOUSEWHEEL:
|
||||
wheel += e.wheel.y * (e.wheel.direction == SDL_MOUSEWHEEL_FLIPPED ? -1 : 1);
|
||||
break;
|
||||
|
||||
case SDL_FINGERDOWN:
|
||||
case SDL_FINGERUP:
|
||||
case SDL_FINGERMOTION:
|
||||
@@ -154,6 +158,13 @@ void NACT::set_cursor(int x, int y)
|
||||
SDL_WarpMouseInWindow(g_window, x, y);
|
||||
}
|
||||
|
||||
int NACT::get_wheel()
|
||||
{
|
||||
int val = wheel;
|
||||
wheel = 0;
|
||||
return val;
|
||||
}
|
||||
|
||||
void NACT::show_quit_dialog()
|
||||
{
|
||||
const SDL_MessageBoxButtonData buttons[] = {
|
||||
|
||||
Reference in New Issue
Block a user