mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-22 22:10:20 +00:00
vr:: you can still click the map while an UI is shown
This commit is contained in:
parent
f9740e5ee3
commit
0ffd31e4b4
@ -609,7 +609,7 @@ EX bool need_mouseh = false;
|
|||||||
EX void fix_mouseh() {
|
EX void fix_mouseh() {
|
||||||
if(0) ;
|
if(0) ;
|
||||||
#if CAP_VR
|
#if CAP_VR
|
||||||
else if(vrhr::active() && which_pointer && !vrhr::in_menu())
|
else if(vrhr::active() && which_pointer && !vrhr::targeting_menu)
|
||||||
vrhr::compute_point(which_pointer, mouseh, mouseover, vrhr::pointer_distance);
|
vrhr::compute_point(which_pointer, mouseh, mouseover, vrhr::pointer_distance);
|
||||||
#endif
|
#endif
|
||||||
else if(!need_mouseh) ;
|
else if(!need_mouseh) ;
|
||||||
|
37
vr.cpp
37
vr.cpp
@ -341,19 +341,25 @@ void track_all() {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(in_menu() && which_pointer == i) {
|
if(which_pointer == i) {
|
||||||
hyperpoint h1 = sm * hmd_at_ui * vrdata.pose_matrix[i] * sm * C0;
|
if(in_menu()) {
|
||||||
hyperpoint h2 = sm * hmd_at_ui * vrdata.pose_matrix[i] * sm * point31(0, 0, -0.01);
|
hyperpoint h1 = sm * hmd_at_ui * vrdata.pose_matrix[i] * sm * C0;
|
||||||
ld p = ilerp(h1[2], h2[2], -ui_depth);
|
hyperpoint h2 = sm * hmd_at_ui * vrdata.pose_matrix[i] * sm * point31(0, 0, -0.01);
|
||||||
hyperpoint pxo = lerp(h1, h2, p);
|
ld p = ilerp(h1[2], h2[2], -ui_depth);
|
||||||
hyperpoint px = pxo;
|
hyperpoint pxo = lerp(h1, h2, p);
|
||||||
px[0] /= ui_size * ui_size_unit;
|
hyperpoint px = pxo;
|
||||||
px[1] /= -ui_size * ui_size_unit;
|
px[0] /= ui_size * ui_size_unit;
|
||||||
px[0] += current_display->xsize/2;
|
px[1] /= -ui_size * ui_size_unit;
|
||||||
px[1] += current_display->ysize/2;
|
px[0] += current_display->xsize/2;
|
||||||
mousex = px[0];
|
px[1] += current_display->ysize/2;
|
||||||
mousey = px[1];
|
targeting_menu = px[0] >= 0 && px[1] >= 0 && px[1] <= vid.xres && px[1] <= vid.xres;
|
||||||
pointer_distance = hdist(pxo, h1);
|
if(targeting_menu) {
|
||||||
|
mousex = px[0];
|
||||||
|
mousey = px[1];
|
||||||
|
pointer_distance = hdist(pxo, h1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else targeting_menu = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(hdist(vrdata.pose_matrix[i] * C0, vrdata.last_pose_matrix[i] * C0) > .05) {
|
if(hdist(vrdata.pose_matrix[i] * C0, vrdata.last_pose_matrix[i] * C0) > .05) {
|
||||||
@ -362,18 +368,19 @@ void track_all() {
|
|||||||
which_pointer = i;
|
which_pointer = i;
|
||||||
println(hlog, "setting which_pointer to ", i);
|
println(hlog, "setting which_pointer to ", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!in_menu()) hmd_at_ui = hmd_at;
|
if(!in_menu()) hmd_at_ui = hmd_at;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EX bool targeting_menu;
|
||||||
|
|
||||||
EX void send_click() {
|
EX void send_click() {
|
||||||
holdmouse = false;
|
holdmouse = false;
|
||||||
fix_mouseh();
|
fix_mouseh();
|
||||||
println(hlog, "sending a click, getcstat = ", getcstat, " in menu = ", in_menu());
|
println(hlog, "sending a click, getcstat = ", getcstat, " in menu = ", in_menu());
|
||||||
if(in_menu())
|
if(in_menu() && targeting_menu)
|
||||||
handlekey(getcstat, getcstat);
|
handlekey(getcstat, getcstat);
|
||||||
else
|
else
|
||||||
handlekey('-', '-');
|
handlekey('-', '-');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user