mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-05-05 16:54:08 +00:00
camera rotation by device orientation in 3D
This commit is contained in:
parent
93813f4cf1
commit
4a65e11c1d
@ -643,6 +643,9 @@ void mainloopiter() {
|
|||||||
View = cspin(0, 2, -mouseaim_x) * cspin(1, 2, -mouseaim_y) * View;
|
View = cspin(0, 2, -mouseaim_x) * cspin(1, 2, -mouseaim_y) * View;
|
||||||
mouseaim_x = mouseaim_y = 0;
|
mouseaim_x = mouseaim_y = 0;
|
||||||
#endif
|
#endif
|
||||||
|
#if CAP_ORIENTATION
|
||||||
|
apply_orientation();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if(smooth_scrolling && !shmup::on && !rug::rugged) {
|
if(smooth_scrolling && !shmup::on && !rug::rugged) {
|
||||||
|
@ -1096,7 +1096,7 @@ void spinEdge(ld aspd) {
|
|||||||
while(downspin > +M_PI) downspin -= 2*M_PI;
|
while(downspin > +M_PI) downspin -= 2*M_PI;
|
||||||
aspd = (1 + 2 * abs(downspin)) * aspd;
|
aspd = (1 + 2 * abs(downspin)) * aspd;
|
||||||
}
|
}
|
||||||
else if(WDIM == 2 && GDIM == 3 && vid.fixed_yz) {
|
else if(WDIM == 2 && GDIM == 3 && vid.fixed_yz && !CAP_ORIENTATION) {
|
||||||
aspd = 999999;
|
aspd = 999999;
|
||||||
if(straightDownSeek) {
|
if(straightDownSeek) {
|
||||||
if(straightDownPoint[0])
|
if(straightDownPoint[0])
|
||||||
|
30
init.cpp
30
init.cpp
@ -223,6 +223,31 @@ int touchedAt;
|
|||||||
void shareScore(MOBPAR_FORMAL);
|
void shareScore(MOBPAR_FORMAL);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CAP_ORIENTATION
|
||||||
|
int first_check, last_check;
|
||||||
|
transmatrix main_last_orientation;
|
||||||
|
|
||||||
|
void apply_orientation() {
|
||||||
|
if(ticks > last_check + 2000) first_check = ticks;
|
||||||
|
last_check = ticks;
|
||||||
|
transmatrix T = MirrorX * hr::getOrientation() * MirrorX;
|
||||||
|
if(ticks < first_check + 500)
|
||||||
|
main_last_orientation = T;
|
||||||
|
else {
|
||||||
|
transmatrix next_orientation = T;
|
||||||
|
View = main_last_orientation * View;
|
||||||
|
if(WDIM == 2 && vid.fixed_yz) {
|
||||||
|
if(View[0][2] || View[1][2] || View[2][2]) {
|
||||||
|
View = cspin(0, 2, -atan2(View[0][2], View[2][2])) * View;
|
||||||
|
View = cspin(1, 2, -atan2(View[1][2], View[2][2])) * View;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
View = inverse(next_orientation) * View;
|
||||||
|
main_last_orientation = next_orientation;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void mobile_draw(MOBPAR_FORMAL) {
|
void mobile_draw(MOBPAR_FORMAL) {
|
||||||
|
|
||||||
apply_memory_reserve();
|
apply_memory_reserve();
|
||||||
@ -234,6 +259,9 @@ void mobile_draw(MOBPAR_FORMAL) {
|
|||||||
|
|
||||||
ors::check_orientation();
|
ors::check_orientation();
|
||||||
|
|
||||||
|
if(DIM == 3 && !shmup::on && !rug::rugged)
|
||||||
|
apply_orientation();
|
||||||
|
|
||||||
if(playermoved && vid.sspeed > -4.99)
|
if(playermoved && vid.sspeed > -4.99)
|
||||||
centerpc(tdiff / 1000.0 * exp(vid.sspeed));
|
centerpc(tdiff / 1000.0 * exp(vid.sspeed));
|
||||||
|
|
||||||
@ -339,7 +367,7 @@ void mobile_draw(MOBPAR_FORMAL) {
|
|||||||
if(lclicked && !clicked) {
|
if(lclicked && !clicked) {
|
||||||
if(rug::rugged)
|
if(rug::rugged)
|
||||||
rug::select();
|
rug::select();
|
||||||
else if(ors::mode && !verylongclick)
|
else if((ors::mode || DIM == 3) && !verylongclick)
|
||||||
normal_reaction = true;
|
normal_reaction = true;
|
||||||
else
|
else
|
||||||
pushScreen(showStereo);
|
pushScreen(showStereo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user