Skip to content

Commit 81e9e99

Browse files
committed
allow config to override screen dimensions
1 parent 843b205 commit 81e9e99

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

tools/testmc/main.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ Object.defineProperty(globalThis, "screen", {
124124

125125
if (config.Screen) {
126126
value = new config.Screen({});
127-
width = value.width,
127+
width = value.width;
128128
height = value.height;
129129
}
130130
Object.defineProperty(globalThis, "screen", {
@@ -134,8 +134,8 @@ Object.defineProperty(globalThis, "screen", {
134134
value
135135
});
136136

137-
screen = new Screen({width: width ?? 240, height: height ?? 320});
138-
screen.configure({show: true});
137+
screen = new Screen({width: config.mc_width ?? width ?? 240, height: config.mc_height ?? height ?? 320});
138+
screen.configure({show: ((undefined === config.mc_width) && (undefined === config.mc_height)) || ((width === config.mc_width) && (height === config.mc_height))});
139139

140140
return screen;
141141
},
@@ -146,10 +146,8 @@ Object.defineProperty(globalThis, "screen", {
146146
writable: true,
147147
value
148148
});
149-
150-
screen = new Screen({width: value.width, height: value.height});
151-
152-
return screen;
149+
150+
screen = new Screen({width: config.mc_width ?? value.width, height: config.mc_height ?? value.height});
153151
}
154152
});
155153

0 commit comments

Comments
 (0)