Merge pull request #6982 from howard-stearns/update-away-for-image-overlay

Update away.js to use an image instead of text.
This commit is contained in:
Seth Alves 2016-02-01 07:04:11 -08:00
commit f5ccf19f41

View file

@ -13,12 +13,11 @@
// //
// 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_DATA = { var OVERLAY_DATA = {
text: "Paused:\npress any key to continue", imageURL: "http://hifi-content.s3.amazonaws.com/alan/production/images/images/Overlay-Viz-blank.png",
font: {size: 75}, color: {red: 255, green: 255, blue: 255},
color: {red: 200, green: 255, blue: 255}, alpha: 1
alpha: 0.9
}; };
// ANIMATION // ANIMATION
@ -64,10 +63,24 @@ function stopAwayAnimation() {
} }
// OVERLAY // OVERLAY
var overlay = Overlays.addOverlay("text", OVERLAY_DATA); var overlay = Overlays.addOverlay("image", OVERLAY_DATA);
function showOverlay() { function showOverlay() {
var screen = Controller.getViewportDimensions(); var properties = {visible: true},
Overlays.editOverlay(overlay, {visible: true, x: screen.x / 4, y: screen.y / 4}); // Update for current screen size, keeping overlay proportions constant.
screen = Controller.getViewportDimensions(),
screenRatio = screen.x / screen.y;
if (screenRatio < OVERLAY_RATIO) {
properties.width = screen.x;
properties.height = screen.x / OVERLAY_RATIO;
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);
} }
function hideOverlay() { function hideOverlay() {
Overlays.editOverlay(overlay, {visible: false}); Overlays.editOverlay(overlay, {visible: false});