dialog:: mouse control in matrix dialog

This commit is contained in:
Zeno Rogue 2023-08-14 04:50:13 +02:00
parent 3a3317d0be
commit 9ab2b2bbd8
3 changed files with 14 additions and 3 deletions

View File

@ -702,7 +702,7 @@ EX int sc_ticks, sc_ticks2;
EX bool mouseaiming(bool shmupon) {
return
(GDIM == 3 && !shmupon) || (rug::rugged && (lctrlclick ^ rug::mouse_control_rug));
(GDIM == 3 && !shmupon) || (rug::rugged && (lctrlclick ^ rug::mouse_control_rug)) || (cmode & sm::MOUSEAIM);
}
/* visualization only -- the HyperRogue movement keys should move the camera */
@ -753,6 +753,7 @@ EX void mainloopiter() {
mousepan = cmode & sm::NORMAL;
if((cmode & sm::PANNING) && !hiliteclick) mousepan = true;
if(cmode & sm::MOUSEAIM) mousepan = true;
if(cmode & sm::SHOWCURSOR) mousepan = false;
mousepan = mousepan && mouseaiming(false) && mouseaim_sensitivity;
if(mousepan != oldmousepan) {
@ -775,7 +776,7 @@ EX void mainloopiter() {
SDL_ShowCursor(SDL_ENABLE);
SDL_WarpMouse(vid.xres/2, vid.yres/2);
#endif
mouseaim_x = mouseaim_y = 0;
mouseaim_x = mouseaim_y = 0;
}
#endif
}
@ -907,7 +908,7 @@ EX void mainloopiter() {
}
#endif
if(mouseaiming(shmup::on)) {
if(mouseaiming(shmup::on) && !(cmode & sm::MOUSEAIM)) {
#if CAP_MOUSEGRAB
rug::using_rugview urv;
dynamicval<bool> ds(didsomething, didsomething);

View File

@ -1178,6 +1178,15 @@ EX namespace dialog {
rot_but(0, 2, "rotate in XZ", 'y');
rot_but(1, 2, "rotate in YZ", 'x');
}
addBoolItem("mouse control", dialogflags & sm::MOUSEAIM, 'm');
dialog::add_action([this] { dialogflags ^= sm::MOUSEAIM; });
if(dialogflags & sm::MOUSEAIM) {
*edit_matrix = cspin(0, 2, mouseaim_x) * *edit_matrix;
*edit_matrix = cspin(1, 2, mouseaim_y) * *edit_matrix;
mouseaim_x = mouseaim_y = 0;
}
static string formula;
formula = "?";
anims::get_parameter_animation(anims::find_param(edit_matrix), formula);

View File

@ -5791,6 +5791,7 @@ namespace sm {
static const int EDIT_BEFORE_WALLS = (1<<25); // mouseover targets before walls
static const int EDIT_INSIDE_WALLS = (1<<26); // mouseover targets inside walls
static const int DIALOG_WIDE = (1<<27); // make dialogs wide
static const int MOUSEAIM = (1<<28); // mouse aiming active here
}
#endif