game brython start

main
joak 1 year ago
parent 5e4a506d12
commit e9229e875c

@ -3,12 +3,38 @@
<head>
<title></title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="../style.css">
<link rel="stylesheet" type="text/css" href="../static/game-style.css">
<link rel="stylesheet" type="text/css" href="style.css">
<meta http-equiv="Cross-Origin-Embedder-Policy" content="require-corp">
<meta http-equiv="Cross-Origin-Opener-Policy" content="same-origin">
<script type="text/javascript" src="../static/brython.min.js">
</script>
<script type="text/javascript" src="../static/brython_stdlib.js">
</script>
<script>
if (!crossOriginIsolated) SharedArrayBuffer = ArrayBuffer;
</script>
</head>
<body>
<div id="content"><p>i deleted it woops. i want to write a paragraph about my mindfulness
game here.</p>
</div>
<body onload="brython()">
<script type="text/python">
from browser import self as _self, bind, console
# implementation of blocking time.sleep()
def sleep(secs):
sab = _self.SharedArrayBuffer.new(128 * _self.Int32Array.BYTES_PER_ELEMENT)
buffer = _self.Int32Array.new(sab)
_self.Atomics.store(buffer, 0, -1)
_self.send({'status': 'sleep', 'seconds': secs, 'buffer': sab})
# block until main program resets buffer[0] to 1
_self.Atomics.wait(buffer, 0, -1)
sleep(1)
print("hello world")
sleep(3)
print("hello world")
</script>
</body>
</html>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -0,0 +1,3 @@
pre{
text-align: left;
}
Loading…
Cancel
Save