Skip to content

Commit

Permalink
Update files
Browse files Browse the repository at this point in the history
  • Loading branch information
leikareipa committed Jan 15, 2024
1 parent 7cbfab9 commit a85e18f
Show file tree
Hide file tree
Showing 13 changed files with 908 additions and 342 deletions.
780 changes: 607 additions & 173 deletions experimental/w95/distributable/w95-api.js

Large diffs are not rendered by default.

17 changes: 12 additions & 5 deletions experimental/w95/distributable/w95-assets.js

Large diffs are not rendered by default.

388 changes: 249 additions & 139 deletions experimental/w95/distributable/w95-widgets.js

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion experimental/w95/distributable/w95.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
body {
background-color: rgb(0, 128, 128);
background-color: black;
color: whitesmoke;
width: 100vw;
height: 100vh;
Expand All @@ -18,6 +18,10 @@ canvas {
height: 100%;
}

canvas[data-w95-app="Desktop"] {
background-color: teal;
}

.w95-dom-element {
position: absolute;
background-color: white;
Expand All @@ -38,6 +42,11 @@ canvas {
filter: grayscale(1);
}

#w95-debug-layer {
width: 100%;
height: 100%;
}

#w95-debug-layer * {
z-index: 1;
pointer-events: none;
Expand Down
22 changes: 12 additions & 10 deletions experimental/w95/samples/test-app/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ export default {
const widgetDisable = w95.state(false);
const tabIndex = w95.state(1);
const tab2Index = w95.state(0);
const radioGroupIndex = w95.state(1);
const dropdownIndex = w95.state(2);
const isCheckChecked = w95.state(false);
const groupItemCheckIdx = w95.state(0);

return {
get width() { return appWidth.now },
get height() { return appHeight.now },
Expand All @@ -70,7 +69,7 @@ export default {
// Center the window on the screen.
this.move({
x: ~~((w95.shell.display.width / 2) - (appWidth.now / 2)),
y: Math.max(0, ~~((w95.shell.display.height / 2) - (appHeight.now / 2))),
y: Math.max(0, ~~((w95.shell.display.height / 2) - (appHeight.now / 2) - ((w95.registry.get("taskbar-height") || 0) / 2))),
});
},
Form() {
Expand Down Expand Up @@ -203,9 +202,9 @@ export default {
w95.widget.radioGroup({
x: 10,
y: 38,
itemIndex: radioGroupIndex.now,
itemIndex: (w95.registry.get("render-scale") - 1),
newItemIndex(idx) {
radioGroupIndex.set(idx);
w95.registry.set("render-scale", (idx + 1)),
w95.shell.display.scale = (idx + 1);
},
items: {
Expand Down Expand Up @@ -283,7 +282,7 @@ export default {
w95.widget.label({
x: 9,
y: 7,
text: "1.) Use the \b#no-debug\b URL\nhash to disable the DOM\ndebug layer.",
text: "1.) Use the #no-debug URL\nhash to disable the DOM\ndebug layer.",
}),
w95.widget.label({
x: 9,
Expand All @@ -296,7 +295,7 @@ export default {
text: "on GitHub",
color: (
widgetDisable.now
? w95.palette.named.darkGray
? w95.palette.named.dimgray
: w95.palette.named.blue
),
styleHints: [
Expand All @@ -317,7 +316,6 @@ export default {
w95.widget.label({
x: 7,
y: 95,
color: w95.palette.named.darkGray,
text: "* This software is not associated\nwith Microsoft.",
}),
]
Expand Down Expand Up @@ -384,9 +382,9 @@ export default {
--Introibo ad altare Dei.
Halted, he peered down the dark winding stairs and called up coarsely:
Halted, \bhe p\veer\bed down\v the dark winding stairs and called up coarsely:
--Come up, Kinch. Come up, you fearful Jesuit.
--Come up, Kinch. \r{red}Come up\r{}, you fearful Jesuit.
Solemnly he came forward and mounted the round gunrest. He faced about and blessed gravely thrice the tower, the surrounding country and the awaking mountains. Then, catching sight of Stephen Dedalus, he bent towards him and made rapid crosses in the air, gurgling in his throat and shaking his head. Stephen Dedalus, displeased and sleepy, leaned his arms on the top of the staircase and looked coldly at the shaking gurgling face that blessed him, equine in its length, and at the light untonsured hair, grained and hued like pale oak.
Expand Down Expand Up @@ -604,11 +602,13 @@ export default {
},
}, {hideIf: !isNameQueryDialogOpen.now}),
customWarning({
parent: this,
onReject() {
isCustomWarningDialogOpen.set(false);
},
}, {hideIf: !isCustomWarningDialogOpen.now}),
w95.shell.popup({
parent: this,
icon: w95.icon.warning,
title: "Warning",
text: "Something went wrong, but I'm not sure what.",
Expand All @@ -632,6 +632,7 @@ export default {
],
}, {hideIf: !isWarningDialogOpen.now}),
w95.shell.popup({
parent: this,
icon: w95.icon.question,
title: "Question",
text: "He prodded a fork into the kidney and slapped it over: then fitted the\nteapot on the tray. Its hump bumped as he took it up. Everything on it?",
Expand All @@ -656,6 +657,7 @@ export default {
],
}, {hideIf: !isQuestionDialogOpen.now}),
w95.shell.popup({
parent: this,
icon: w95.icon.error,
title: "Error",
text: "The NTVDM CPU has encountered an illegal instruction.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
*
*/

export const customWarning = w95.widget(function({
export const customWarning = w95.widget(function customWarning({
parent = undefined,
onReject = undefined,
} = {})
{
w95.debug?.assert(typeof onAccept === "undefined");
w95.debug?.assert(parent?._what === "w95-widget");
w95.debug?.assert(typeof onReject === "function");

const isYesDisabled = w95.state(false);
Expand All @@ -22,6 +23,7 @@ export const customWarning = w95.widget(function({
get height() { return 0 },
Form() {
return w95.shell.popup({
parent,
icon: w95.icon.warning,
title: "Warning",
text: "Oops! That was a mistake. The best option now would be\nto click Cancel to go back in time.\n\nWhat do you say?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

export const embeddedIframe = w95.widget(function({
export const embeddedIframe = w95.widget(function embeddedIframe({
x = 0,
y = 0,
width = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

export const nameQuery = w95.widget(function({
export const nameQuery = w95.widget(function nameQuery({
x = 0,
y = 0,
width = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const renderOptions = {
],
};

export const rotatingCube = w95.widget(function({
export const rotatingCube = w95.widget(function rotatingCube({
x = 0,
y = 0,
width = 100,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import testApp from "../app.js";

export const spawnButton = w95.widget(function({
export const spawnButton = w95.widget(function spawnButton({
x = 0,
y = 0,
width = 100,
Expand Down
12 changes: 6 additions & 6 deletions experimental/w95/samples/test-app/custom-widgets/statistics.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*
*/

export const statistics = w95.widget(function({
export const statistics = w95.widget(function statistics({
x = 0,
y = 0,
width = 100,
Expand All @@ -18,11 +18,11 @@ export const statistics = w95.widget(function({
w95.debug?.assert(typeof height === "number");

const clockCounter = w95.state(1);
const tickCounter = w95.state(1, {repaintOnChange: false});
const ngons = w95.state(0, {repaintOnChange: false});
const apps = w95.state(0, {repaintOnChange: false});
const repaintCount = w95.state(0, {repaintOnChange: false});
const renderTime = w95.state(0, {repaintOnChange: false});
const tickCounter = w95.keep(1);
const ngons = w95.keep(0);
const apps = w95.keep(0);
const repaintCount = w95.keep(0);
const renderTime = w95.keep(0);

return {
get x() { return x },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/


export const twoStateButton = w95.widget(function({
export const twoStateButton = w95.widget(function twoStateButton({
x = 0,
y = 0,
width = 100,
Expand Down
4 changes: 3 additions & 1 deletion experimental/w95/samples/test-app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import testApp from "./app.js";
import {dither_shader} from "./dither-shader.js";

const taskbar = w95.shell.taskbar();
const desktop = w95.shell.desktop([
w95.widget.desktopIcon({
x: 5,
Expand All @@ -53,9 +54,10 @@

w95.registry.set("num-windows-spawned", 0);
w95.registry.set("is-debug-enabled", false);
w95.registry.set("render-scale", ~~document.body.dataset.w95Scale);
w95.shell.display.screenShader = dither_shader;
w95.shell.boot();
w95.shell.run([desktop, testApp]);
w95.shell.run([desktop, taskbar, testApp]);
</script>
</body>
</html>

0 comments on commit a85e18f

Please sign in to comment.