Last active
December 24, 2021 07:05
-
-
Save erodozer/9b3c39ba4bfce6535182788c3fbeaaa8 to your computer and use it in GitHub Desktop.
Godot Instant Games on Facebook
This file contains hidden or 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> | |
<head> | |
<meta charset='utf-8' /> | |
<meta name='viewport' content='width=device-width, user-scalable=no' /> | |
<title>fb-instant-godot</title> | |
</head> | |
<body> | |
<canvas id='canvas'></canvas> | |
<script src="https://connect.facebook.net/en_US/fbinstant.7.0.js"></script> | |
<script src="$GODOT_URL"></script> | |
<script type='text/javascript'> | |
const engine = new Engine($GODOT_CONFIG); | |
(async function() { | |
await FBInstant.initializeAsync(); | |
await engine.startGame({ | |
'onProgress': function (current, total) { | |
if (total > 0) { | |
const progress = current / (total * 1.0); | |
console.log(progress); | |
FBInstant.setLoadingProgress(progress * 100); | |
} | |
}, | |
}); | |
await FBInstant.startGameAsync(); | |
})(); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To use, simply add an HTML5 export option to your Godot project and set the custom HTML shell like so