mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 19:59:28 +02:00
slight improvement to Away to have the paused overlay follow your view in HMD
This commit is contained in:
parent
95c92f7a27
commit
501d23021f
1 changed files with 34 additions and 10 deletions
|
@ -13,7 +13,9 @@
|
||||||
//
|
//
|
||||||
// Goes into "paused" when the '.' key (and automatically when started in HMD), and normal when pressing any key.
|
// Goes into "paused" when the '.' key (and automatically when started in HMD), and normal when pressing any key.
|
||||||
// See MAIN CONTROL, below, for what "paused" actually does.
|
// See MAIN CONTROL, below, for what "paused" actually does.
|
||||||
var OVERLAY_RATIO = 1920 / 1080;
|
var OVERLAY_WIDTH = 1920;
|
||||||
|
var OVERLAY_HEIGHT = 1080;
|
||||||
|
var OVERLAY_RATIO = OVERLAY_WIDTH / OVERLAY_HEIGHT;
|
||||||
var OVERLAY_DATA = {
|
var OVERLAY_DATA = {
|
||||||
imageURL: "http://hifi-content.s3.amazonaws.com/alan/production/images/images/Overlay-Viz-blank.png",
|
imageURL: "http://hifi-content.s3.amazonaws.com/alan/production/images/images/Overlay-Viz-blank.png",
|
||||||
color: {red: 255, green: 255, blue: 255},
|
color: {red: 255, green: 255, blue: 255},
|
||||||
|
@ -69,16 +71,25 @@ function showOverlay() {
|
||||||
// Update for current screen size, keeping overlay proportions constant.
|
// Update for current screen size, keeping overlay proportions constant.
|
||||||
screen = Controller.getViewportDimensions(),
|
screen = Controller.getViewportDimensions(),
|
||||||
screenRatio = screen.x / screen.y;
|
screenRatio = screen.x / screen.y;
|
||||||
if (screenRatio < OVERLAY_RATIO) {
|
|
||||||
properties.width = screen.x;
|
if (HMD.active) {
|
||||||
properties.height = screen.x / OVERLAY_RATIO;
|
var lookAt = HMD.getHUDLookAtPosition2D();
|
||||||
properties.x = 0;
|
properties.width = OVERLAY_WIDTH;
|
||||||
properties.y = (screen.y - properties.height) / 2;
|
properties.height = OVERLAY_HEIGHT;
|
||||||
|
properties.x = lookAt.x - OVERLAY_WIDTH / 2;
|
||||||
|
properties.y = lookAt.y - OVERLAY_HEIGHT / 2;
|
||||||
} else {
|
} else {
|
||||||
properties.height = screen.y;
|
if (screenRatio < OVERLAY_RATIO) {
|
||||||
properties.width = screen.y * OVERLAY_RATIO;
|
properties.width = screen.x;
|
||||||
properties.y = 0;
|
properties.height = screen.x / OVERLAY_RATIO;
|
||||||
properties.x = (screen.x - properties.width) / 2;
|
properties.x = 0;
|
||||||
|
properties.y = (screen.y - properties.height) / 2;
|
||||||
|
} else {
|
||||||
|
properties.height = screen.y;
|
||||||
|
properties.width = screen.y * OVERLAY_RATIO;
|
||||||
|
properties.y = 0;
|
||||||
|
properties.x = (screen.x - properties.width) / 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Overlays.editOverlay(overlay, properties);
|
Overlays.editOverlay(overlay, properties);
|
||||||
}
|
}
|
||||||
|
@ -87,6 +98,17 @@ function hideOverlay() {
|
||||||
}
|
}
|
||||||
hideOverlay();
|
hideOverlay();
|
||||||
|
|
||||||
|
function maybeMoveOverlay() {
|
||||||
|
if (HMD.active && isAway) {
|
||||||
|
var lookAt = HMD.getHUDLookAtPosition2D();
|
||||||
|
var properties = {visible: true};
|
||||||
|
properties.width = OVERLAY_WIDTH;
|
||||||
|
properties.height = OVERLAY_HEIGHT;
|
||||||
|
properties.x = lookAt.x - OVERLAY_WIDTH / 2;
|
||||||
|
properties.y = lookAt.y - OVERLAY_HEIGHT / 2;
|
||||||
|
Overlays.editOverlay(overlay, properties);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// MAIN CONTROL
|
// MAIN CONTROL
|
||||||
var wasMuted, isAway;
|
var wasMuted, isAway;
|
||||||
|
@ -164,6 +186,8 @@ function maybeGoAway() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Script.update.connect(maybeMoveOverlay);
|
||||||
|
|
||||||
Script.update.connect(maybeGoAway);
|
Script.update.connect(maybeGoAway);
|
||||||
Controller.mousePressEvent.connect(goActive);
|
Controller.mousePressEvent.connect(goActive);
|
||||||
Controller.keyPressEvent.connect(maybeGoActive);
|
Controller.keyPressEvent.connect(maybeGoActive);
|
||||||
|
|
Loading…
Reference in a new issue