Created
July 14, 2021 07:26
-
-
Save SealtielFreak/12637e551efa298bd82533484547abd1 to your computer and use it in GitHub Desktop.
Brython and MelonJS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<script src="https://cdn.jsdelivr.net/npm/brython@3/brython.min.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/brython@3/brython_stdlib.js"></script> | |
<script src="https://cdn.jsdelivr.net/npm/melonjs/dist/melonjs.js"></script> | |
<title>Brython and MelonJS</title> | |
</head> | |
<body onload="brython()"> | |
<div id="screen"></div> | |
<script type="text/python"> | |
from browser import document, window | |
melon = window.me | |
err = melon.video.init(1218, 562, {"parent": "screen", "scale": "auto"}) | |
if not err: | |
window.alert("Your browser does not support HTML5 canvas.") | |
melon.game.world.addChild(melon.ColorLayer.new("background", "#202020")) | |
melon.game.world.addChild(melon.Text.new( | |
609, 281, { | |
"font": "Arial", | |
"size": 160, | |
"fillStyle": "#FFFFFF", | |
"textBaseline" : "middle", | |
"textAlign" : "center", | |
"text" : "Hello World !" | |
} | |
)) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment