Use screen width/height utils

This commit is contained in:
Vortrex
2022-05-22 13:29:08 -05:00
parent 7e2b9b12e6
commit f4b404aa78
2 changed files with 5 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ let errorDialog = {
function initErrorDialogGUI() { function initErrorDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`); logToConsole(LOG_DEBUG, `[VRR.GUI] Creating error GUI ...`);
errorDialog.window = mexui.window(game.width/2-200, game.height/2-70, 500, 140, 'ERROR', { errorDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'ERROR', {
main: { main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
transitionTime: 500, transitionTime: 500,
@@ -34,7 +34,7 @@ function initErrorDialogGUI() {
}, },
}); });
errorDialog.messageLabel = errorDialog.window.text(15, 50, 470, 75, 'Error Message', { errorDialog.messageLabel = errorDialog.window.text(15, 50, 370, 20, 'Error Message', {
main: { main: {
textSize: 10.0, textSize: 10.0,
textAlign: 0.5, textAlign: 0.5,
@@ -70,7 +70,7 @@ function showErrorGUI(errorMessage, errorTitle, buttonText) {
mexui.setInput(true); mexui.setInput(true);
errorDialog.messageLabel.text = errorMessage; errorDialog.messageLabel.text = errorMessage;
errorDialog.okayButton.text = buttonText; errorDialog.okayButton.text = buttonText;
errprDialog.window.title = errorTitle; errorDialog.window.title = errorTitle;
errorDialog.window.shown = true; errorDialog.window.shown = true;
} }

View File

@@ -17,7 +17,7 @@ let infoDialog = {
function initInfoDialogGUI() { function initInfoDialogGUI() {
logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`); logToConsole(LOG_DEBUG, `[VRR.GUI] Creating info dialog GUI ...`);
infoDialog.window = mexui.window(game.width/2-200, game.height/2-70, 400, 140, 'Information', { infoDialog.window = mexui.window(getScreenWidth()/2-200, getScreenHeight()/2-70, 400, 140, 'Information', {
main: { main: {
backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha), backgroundColour: toColour(secondaryColour[0], secondaryColour[1], secondaryColour[2], windowAlpha),
}, },
@@ -70,7 +70,7 @@ function closeInfoDialog() {
// =========================================================================== // ===========================================================================
function showInfo(infoMessage, infoTitle, buttonText) { function showInfoGUI(infoMessage, infoTitle, buttonText) {
closeAllWindows(); closeAllWindows();
logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`); logToConsole(LOG_DEBUG, `[VRR.GUI] Showing info dialog window. Info: ${infoTitle} - ${infoMessage}`);
mexui.setInput(true); mexui.setInput(true);