-
-
Save videlais/b7e9cce3a2a3ee38c755 to your computer and use it in GitHub Desktop.
Prototype code for getting Twine working on the Ouya
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> | |
<head> | |
<title>Twine Testing</title> | |
<script src ="js/CocoonJSExtensions/CocoonJS.js"></script> | |
<script src ="js/CocoonJSExtensions/CocoonJS_App.js"></script> | |
<script src ="js/CocoonJSExtensions/CocoonJS_App_ForCocoonJS.js"></script> | |
<script src="js/gamepad.js"></script> | |
<script> | |
var cursorSpeed = 5; | |
CocoonJS.App.onLoadInTheWebViewSucceed.addEventListener(function() | |
{ | |
CocoonJS.App.showTheWebView(0, 0, window.innerWidth, window.innerHeight); | |
setInterval(pollCode, 1000 / 60); | |
}); | |
CocoonJS.App.loadInTheWebView("ouya.html"); | |
function pollCode() { | |
if (Gamepad.moved(0, "LEFT_X") > 0 && Gamepad.moved(0, "LEFT_X") <= 1.2) { | |
CocoonJS.App.forwardAsync("moveDiv(" + cursorSpeed + "," + 0 + ")"); | |
} | |
if (Gamepad.moved(0, "LEFT_X") < 0) { | |
CocoonJS.App.forwardAsync("moveDiv(" + -cursorSpeed + "," + 0 + ")"); | |
} | |
if (Gamepad.moved(0, "LEFT_Y") < 0) { | |
CocoonJS.App.forwardAsync("moveDiv(" + 0 + "," + -cursorSpeed + ")"); | |
} | |
if (Gamepad.moved(0, "LEFT_Y") > 0 && Gamepad.moved(0, "LEFT_Y") <= 1.2) { | |
CocoonJS.App.forwardAsync("moveDiv(" + 0 + "," + cursorSpeed + ")"); | |
} | |
} | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment