Skip to content

Commit 255bed5

Browse files
authored
Merge pull request #234 from 0xsequence/webgl-demo
Added WebGL demo build, changes to the Demo scene
2 parents 75732e9 + d9bad19 commit 255bed5

40 files changed

+6994
-5395
lines changed

Assets/WebGLTemplates/SequenceReact/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7-
<title>Vite + React + TS</title>
7+
<title>Sequence Unity Demo</title>
88
</head>
99
<body>
1010
<div id="root"></div>

Assets/WebGLTemplates/SequenceReact/src/App.css

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@
88

99
.container {
1010
position: relative;
11-
/* The container determains the size. */
12-
width: 800px;
13-
height: 600px;
1411
}
1512

1613
.container > .loading-overlay {
@@ -20,7 +17,7 @@
2017
left: 0;
2118
width: 100%;
2219
height: 100%;
23-
background: grey;
20+
background: #1a1a1a;
2421
/* We'll set the following Flex properties in order to center the text. */
2522
display: flex;
2623
justify-content: center;

Assets/WebGLTemplates/SequenceReact/src/App.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,11 @@ import "./App.css";
5252

5353
useEffect(() => {
5454
addEventListener("GoogleSignIn", handleGoogleSignIn);
55+
window.addEventListener("resize", handleResize);
56+
handleResize()
5557
return () => {
5658
removeEventListener("GoogleSignIn", handleGoogleSignIn);
59+
window.removeEventListener("resize", handleResize);
5760
};
5861
}, []);
5962

@@ -68,6 +71,23 @@ import "./App.css";
6871
setShowLogin(false);
6972
};
7073

74+
const handleResize = () => {
75+
const container = document.querySelector('.container') as any;
76+
77+
let w = window.innerWidth * 0.98;
78+
let h = window.innerHeight * 0.98;
79+
80+
const r = 600 / 960;
81+
if (w * r > window.innerHeight) {
82+
w = Math.min(w, Math.ceil(h / r));
83+
}
84+
85+
h = Math.floor(w * r);
86+
87+
container.style.width = w + "px";
88+
container.style.height = h + "px";
89+
}
90+
7191
return (
7292
<div className="outer-container">
7393
<div className="container">

Assets/WebGLTemplates/SequenceReact/src/index.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
color-scheme: light dark;
77
color: rgba(255, 255, 255, 0.87);
8-
background-color: #242424;
8+
background-color: #1a1a1a;
99

1010
font-synthesis: none;
1111
text-rendering: optimizeLegibility;

Demo/Build/Demo.data

14.9 MB
Binary file not shown.

Demo/Build/Demo.framework.js

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/Build/Demo.loader.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Demo/Build/Demo.wasm

26.3 MB
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"Keys":["com.unity.services.core.version"],"Values":[{"m_Value":"1.4.0","m_IsReadOnly":true}]}

Demo/index.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Sequence Unity Demo</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/main.tsx"></script>
12+
</body>
13+
</html>

0 commit comments

Comments
 (0)