Skip to content

Commit

Permalink
Update for Defold 1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aglitchman committed Apr 25, 2024
1 parent 87b4c25 commit 9dcf43c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 15 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Feel free to ask questions: [the topic about this asset is on the Defold forum](

| Tool Version | Defold Version | Status |
| -------------- | -------------- | ------------- |
| 1.4.0 | 1.6.3 | Tested ✅ |
| 1.5.0 | 1.8.0 | Tested ✅ |

### Supported Platforms

Expand Down
2 changes: 1 addition & 1 deletion game.project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
title = playable_ad_example
version = 1.4.0
version = 1.5.0

[bootstrap]
main_collection = /example/main.collectionc
Expand Down
22 changes: 10 additions & 12 deletions playable_ad/manifests/web/engine_template.html
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
var ArchiveJsRequest = function () {
this.responseType = "text";
};
ArchiveJsRequest.DONE = 4;
ArchiveJsRequest.prototype.open = function (method, url) {
this.url = url;
};
Expand All @@ -171,7 +172,7 @@
self.onerror();
} else {
var data = ARCHIVEJS_DATA[self.url];
self.readyState = 4;
self.readyState = 4; // = ArchiveJsRequest.DONE
self.status = 200;

time1 = new Date().getTime();
Expand Down Expand Up @@ -234,15 +235,12 @@
</head>
<body>
{{#playable_ad.enabled}}
<div id="running-from-file-warning" merge="keep"></div>
<div id="app-container">
<div id="running-from-file-warning" merge="keep"></div>
</div>
<script id="engine-loader" src="dmloader.js" embed="compress"></script>
<script data-src="{{exe-name}}_archive.js" embed></script>
<script id="engine-setup" type="text/javascript">
// TEMPORARY WORKAROUND FOR THE DEFOLD ISSUE 8479
navigator.getGamepads = null;
navigator.webkitGetGamepads = null;
//

<script id="engine-start" type="text/javascript">
// The playable ad verification system of ad platforms requires the target URL to be exposed directly in the JS code.
// So we have to place `mraid.open()` and `FbPlayableAd.onCTAClick()` in this function.
function doClick() {
Expand Down Expand Up @@ -275,10 +273,10 @@
(function() {
// Defold does not currently have a public API to hook the game startup.
// Therefore, we override this function to figure that:
var old_preloadAndCallMain = Module._preloadAndCallMain;
Module._preloadAndCallMain = function () {
var old_callMain = Module._callMain;
Module._callMain = function () {
if (!Module._archiveLoaded) {
old_preloadAndCallMain();
old_callMain();
return;
}

Expand All @@ -295,7 +293,7 @@
if (!started) {
started = true;
console.log("mraid support: start game.");
old_preloadAndCallMain();
old_callMain();
}
}

Expand Down
2 changes: 1 addition & 1 deletion playable_ad/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "defold-playable-ads",
"version": "1.4.0",
"version": "1.5.0",
"main": "gulpfile.js",
"author": "Artsiom Trubchyk <[email protected]>",
"license": "MIT",
Expand Down

0 comments on commit 9dcf43c

Please sign in to comment.