Skip to content

Commit

Permalink
Build 0.5.32
Browse files Browse the repository at this point in the history
  • Loading branch information
williammalone committed Mar 30, 2016
1 parent 91a4082 commit ad8f351
Show file tree
Hide file tree
Showing 33 changed files with 19,250 additions and 1 deletion.
41 changes: 41 additions & 0 deletions archive/0.5.32/css/blocksjs.css
@@ -0,0 +1,41 @@
#BlocksGame, .BlocksGame {
width: 100%;
height: 100%;
/* Turn off tap highlight in Mobile Safari */
-webkit-tap-highlight-color: rgba(0,0,0,0);
position: relative;
}

#BlocksGameContainer {
display: block;
width: 100%;
height: 100%;
position: relative;
}

#BlocksInteractionContainer {
display: block;
width: 100%;
height: 100%;
position: relative;
}

.BlocksCanvas {
position: absolute;
width: 100%;
height: 100%;
/* Turn off text highlight */
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.BlocksField {
position: absolute;
background-color: #fff;
border: 0px;
padding-left: 5px;
}
111 changes: 111 additions & 0 deletions archive/0.5.32/index.html
@@ -0,0 +1,111 @@
<!DOCTYPE html>
<html>
<head>
<title>BLOCKSJS Game</title>

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']); // Production
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

<!-- Create viewport meta tag. Content will be set by player object in JavaScript. -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui">
<!-- Set standalone mode so the URL bar and Button bar are hidden when run from Home Screen. -->
<meta name="apple-mobile-web-app-capable" content="yes">
<!-- Set the iOS status bar to black. -->
<meta name="apple-mobile-web-app-status-bar-style" content="black">

<!-- BlocksJS Framework CSS START -->
<link rel="stylesheet" href="css/blocksjs.css">
<!-- BlocksJS Framework CSS END -->

<style>
html {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}

body {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
</head>

<body oncontextmenu="return false">

<div id="BlocksGame"></div>

<!-- BlocksJS Framework JS START -->
<script src="js/blocks.js"></script>
<script src="js/block.js"></script>
<script src="js/container.js"></script>
<script src="js/camera.js"></script>
<script src="js/controller.js"></script>
<script src="js/clock.js"></script>
<script src="js/game.js"></script>
<script src="js/layer.js"></script>
<script src="js/motor.js"></script>
<script src="js/slice.js"></script>
<script src="js/speaker.js"></script>
<script src="js/preloader.js"></script>
<script src="js/eventDispatcher.js"></script>
<script src="js/speaker.js"></script>
<script src="js/storage.js"></script>
<script src="js/introScreen.js"></script>
<script src="js/virtualKeyboard.js"></script>
<script src="js/loadingScreen.js"></script>
<script src="js/toolbox.js"></script>
<!-- BlocksJS Framework JS END -->

<!-- BlocksJS Game JS START -->

<!-- BlocksJS Game JS END -->

<script>

(function () {

"use strict";

var game = BLOCKS.game();

// Method to write to Google Analytics
game.ga = function (obj) {

var str,
arr = ["_trackEvent"];

arr.push(String(obj.category));
arr.push(String(obj.action));
if (obj.label) {
arr.push(String(obj.label));
if (obj.value) {
arr.push(parseInt(obj.value, 10));
}
}

// Send to Google Analytics
_gaq.push(arr);

if (JSON) {
BLOCKS.log("Analytics: " + JSON.stringify(obj));
}
};
}());

</script>
</body>
</html>
235 changes: 235 additions & 0 deletions archive/0.5.32/js/block.js
@@ -0,0 +1,235 @@
/*
Copyright (c) 2013 William Malone (www.williammalone.com)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

/*global window */

var BLOCKS;

if (BLOCKS === undefined) {
BLOCKS = {};
}

BLOCKS.block = function (options) {

"use strict";

var block = BLOCKS.eventDispatcher(),

// Private Properties
slicesArr = [],
slicesObj = {},
curSlice,
motors = [],
// The order of properties matters in cases of dependencies
properties = ["stack", "worldX", "worldY", "x", "y", "scale", "scaleX", "scaleY", "width", "height", "centerRegistrationPoint", "mirrorX", "mirrorY", "angle", "alpha", "layer", "visible", "dirty", "justTapped", "justNotTapped", "dragging", "justReleased", "tapPos", "cropWidth", "cropHeight", "frameOffsetX", "frameOffsetY", "offsetX", "offsetY", "minHotspot", "hotspots", "currentFrameIndex"],
methods = ["update", "render", "show", "hide", "pause", "unpause", "reset", "stop", "play", "isPointInside", "getBounds", "getBoundingBox", "isRectInside", "gotoLastFrame", "gotoFrame"],

motorDestroyed = function (motor) {

var i;

motor.removeEventListener("destroyed", motorDestroyed);

for (i = 0 ; i < motors.length; i += 1) {
if (motors[i] === motor) {
motors.splice(i, 1);
}
break;
}
};

options = options || {};

// Block Specific Public Properties
block.name = options.name;

// BLock Specific Public Methods
block.addSlice = function (spec) {

var i, slice;

slice = BLOCKS.slice(spec);

if (!spec.name) {
slice.name = "unnamedSlice" + slicesArr.length;
}

slicesArr.push(slice);
slicesObj[spec.name] = slice;

slice.addEventListener("complete", function () {
block.dispatchEvent("complete");
});

// If first slice then set the block to this slice
if (slicesArr.length === 1) {
// Assign the properties of the spec to the new slice
for (i = 0; i < properties.length; i += 1) {
if (options[properties[i]] !== undefined) {
slice[properties[i]] = options[properties[i]];
}
}
block.setSlice(spec.name);
}

return slice;
};

block.removeSlice = function (name, destroyOptions) {

if (slicesObj[name]) {
slicesObj[name].destroy(destroyOptions);
slicesObj[name] = null;
}
};

block.getSlice = function (name) {

if (name === undefined) {
return curSlice;
} else {
return slicesObj[name];
}
};

block.setSlice = function (name, callback) {

var i, newSlice;

newSlice = slicesObj[name];

if (newSlice && newSlice !== curSlice) {

// If there is a current slice
if (curSlice) {
// Assign the properties of the current slice to the new slice
for (i = 0; i < properties.length; i += 1) {
if (properties[i] !== "width" && properties[i] !== "height" && properties[i] !== "offsetX" && properties[i] !== "offsetY") {
newSlice[properties[i]] = curSlice[properties[i]];
}
}
}
// Make the new slice the block's current slice
curSlice = newSlice;

// If the current slice is an animation then reset and autoplay it
curSlice.reset();
if (curSlice.autoPlay) {
curSlice.play(callback);
}

curSlice.dirty = true;

return true;
} else {
// If slice does not exist or it is already set then do nothing
return false;
}
};

block.motorize = function (motor) {

motor.addEventListener("destroyed", motorDestroyed);
motors.push(motor);
};

block.removeMotors = function (type) {

var i,
motorsToDestroy = [],
newMotorArr = [];

// Mark all motors to be destroyed. Don't destroy them yet because
// the motors array will change because an event is dispatched
// when the destroy method is called which alters the motor array
for (i = 0 ; i < motors.length; i += 1) {
if (type) {
if (motors[i].type === type) {
motorsToDestroy.push(motors[i]);
} else {
newMotorArr.push(motors[i]);
}
} else {
motorsToDestroy.push(motors[i]);
}
}

// Destroy all motors marked for destruction
for (i = 0 ; i < motorsToDestroy.length; i += 1) {
motorsToDestroy[i].destroy();
}

motors = newMotorArr;
};

block.destroy = function (options) {

var i;

if (block) {
block.removeMotors();

for (i = 0; i < slicesArr.length; i += 1) {
slicesArr[i].destroy(options);
}
slicesArr = null;
slicesObj = null;
curSlice = null;

block.dispatchEvent("destroyed", block);
block = null;
}
};

(function () {
var i,

createPublicProperty = function (propertyName) {

Object.defineProperty(block, propertyName, {
get: function () {
if (curSlice) {
return curSlice[propertyName];
}
},
set: function (value) {
if (curSlice) {
curSlice[propertyName] = value;
}
}
});
},

createPublicMethod = function (methodName) {

block[methodName] = function (parameter) {

return curSlice[methodName](parameter);
};
};

for (i = 0; i < properties.length; i += 1) {
createPublicProperty(properties[i]);
}

for (i = 0; i < methods.length; i += 1) {
createPublicMethod(methods[i]);
}

// If slices defined in the options
if (options.slices) {
for (i = 0; i < options.slices.length; i += 1) {
block.addSlice(options.slices[i]);
}
}
}());

return block;
};

0 comments on commit ad8f351

Please sign in to comment.