Permalink
Browse files

* Ready for 0.4.3

  • Loading branch information...
1 parent bafbd73 commit bcb8e2e9e5cd3c3dc63eab9e7ecc80e6b0b5fd9a @louisstow louisstow committed Jun 19, 2011
Showing with 471 additions and 482 deletions.
  1. +8 −34 builder/assets/buttons.js
  2. +0 −121 builder/assets/compiler.js
  3. +1 −2 builder/assets/editor.js
  4. +1 −1 builder/index.html
  5. +13 −0 changelog.txt
  6. +3 −3 crafty-min.js
  7. +294 −184 crafty.js
  8. +11 −11 src/2D.js
  9. +12 −17 src/DOM.js
  10. +1 −0 src/animate.js
  11. +10 −9 src/animation.js
  12. +3 −3 src/canvas.js
  13. +1 −1 src/collision.js
  14. +62 −61 src/controls.js
  15. +6 −6 src/core.js
  16. +9 −9 src/drawing.js
  17. +24 −15 src/extensions.js
  18. +1 −1 src/license.txt
  19. +1 −1 src/particles.js
  20. +3 −3 src/text.js
  21. +7 −0 tests/playground.html
@@ -32,14 +32,10 @@ $b.newent.click(function() {
$instance.val("");
} else {
comps = typeof comps === "object" ? comps.join(", ") : "";
- block = new EntBlock("var "+inst+" = Crafty.e('"+comps+"');","",inst);
- block.comps = comps;
-
CENTS[inst] = Crafty.e("_GUI").comps(comps);
//append the entity in the selected scene
- CURRENT_SCENE.append(block);
- ENTS[inst] = block;
+ ENTS[inst] = {comps: comps};
Editor.update();
$instance.val("");
@@ -55,8 +51,7 @@ $b.newscene.click(function() {
Cancel: function() { $(this).dialog("close"); },
Create: function() {
var name = $scname.val();
- SCENES[name] = new Block("Crafty.scene(\""+ name + "\", function() {", "});", name);
- CODE.append(SCENES[name]);
+ SCENES[name] = {};
Editor.update();
$(this).dialog("close");
@@ -72,7 +67,6 @@ $b.addasset.click(function() {
Add: function() {
var url = $asname.val();
- LOADER.assets.push(url);
ASSETS[url] = {
type: Editor.media(url)
};
@@ -106,14 +100,13 @@ $b.load.click(function() {
});
function openScene(e) {
- console.log(this);
var href = $(this).attr("href");
href = href.substr(1); //grab the scene ID
- CURRENT_SCENE = SCENES[href]; //make it current
+ CURRENT_SCENE = href; //make it current
$("#scenes ul a").css("background", "transparent");
$(this).css("background", "#FFE4D9"); //change the selected color
- $currentscene.text(CURRENT_SCENE.name);
+ $currentscene.text(CURRENT_SCENE);
}
//when clicking on a scene, select it
@@ -146,47 +139,28 @@ $("#entities ul a").live("dblclick", function() {
var href = $(this).attr("href");
href = href.substr(1);
- CURRENT_ENTITY = ENTS[href];
-
- Editor.setCode();
+ CURRENT_ENTITY = href;
}).contextMenu("entsMenu", {
click: function() {
var href = $(this).attr("href"), selected = $workbench.tabs("option", "selected");
href = href.substr(1);
-
- //if an entity is selected, save the code
- if(selected === 1) {
- CURRENT_ENTITY.actions = CM.getCode();
- }
-
- CURRENT_ENTITY = ENTS[href];
-
- if(selected === 1) {
- Editor.setCode();
- }
+
+ CURRENT_ENTITY = href;
$("#entities ul a").css("background", "transparent");
$(this).css("background", "#FFE4D9");
},
- actions: function() {
- Editor.setCode();
- },
-
properties: function() {
$prdialog.dialog({modal: true, maxHeight:600, width:400,
buttons: {
Done: function() {
- //when done is clicked, update the .attr
- $prdialog.find("input").each(function() {
-
- });
$(this).dialog("close");
}
}
});
- var ent = CENTS[CURRENT_ENTITY.name], key, html = "";
+ var ent = CENTS[CURRENT_ENTITY], key, html = "";
for(key in ent) {
//no functions, private properties or properties starting with an int
if(typeof ent[key] === "function" || key === "length" ||
@@ -1,125 +1,4 @@
/**
-* Block of Crafty code
-*
-* @param open String of code before children
-* @param close String of code after children
-* @param name Name of the block (instance name, scene name, asset name, component name)
-* @param action Snippet of code related to the block. [this] is replaced with object in question
-*/
-function Block(open, close, name) {
- this.open = open || "";
- this.close = close || "";
- this.name = name || "";
- this.children = [];
-}
-
-Block.prototype = {
- parent: null,
-
- append: function(block) {
- block.parent = this;
- this.children.push(block);
-
- return block;
- },
-
- remove: function(block) {
- var i = 0, l = this.children.length;
- for(;i<l;++i) {
- if(this.children[i] === block) {
- this.children.splice(i,1);
- return;
- }
- }
- },
-
- move: function(block, to) {
- this.remove(block);
- to.append(block);
- },
-
- isRoot: function() {
- return this.parent === null;
- },
-
- hasChildren: function() {
- return this.children.length > 0;
- },
-
- toString: function() {
- var output = "", i = 0, l = this.children.length,
- current;
-
- output += this.open;
- for(;i<l;++i) {
- current = this.children[i];
- output += current.toString();
- }
- output += this.close;
-
- return output;
- }
-};
-
-function EntBlock(open, close, name) {
- this.open = open || "";
- this.close = close || "";
- this.name = name || "";
- this.children = [];
-}
-
-EntBlock.prototype = new Block;
-EntBlock.prototype.actions = "";
-EntBlock.prototype.comps = "";
-EntBlock.prototype.props = "";
-EntBlock.prototype.toString = function() {
- var output = "", i = 0, l = this.children.length,
- current;
-
- output += this.open;
- for(;i<l;++i) {
- current = this.children[i];
- output += current.toString();
- }
- output += this.close + "\n(function() { this.attr(" + this.props + ");\n" + this.actions + " }).call(" + this.name + ");\n";
-
- return output;
-};
-
-function LoaderBlock(open, close) {
- this.open = open || "";
- this.close = close || "";
-}
-
-LoaderBlock.prototype = new Block;
-LoaderBlock.prototype.assets = [];
-LoaderBlock.prototype.oncomplete = "";
-LoaderBlock.prototype.onprogress = "";
-LoaderBlock.prototype.onerror = "";
-LoaderBlock.prototype.toString = function() {
- var output = "";
-
- output += this.open;
-
- if(this.assets.length) output += '["' + this.assets.join('","') + '"]';
- else output += '[]';
-
- if(this.oncomplete) output += ',' + this.oncomplete;
- if(this.onprogress) output += ',' + this.onprogress;
- if(this.onerror) output += ',' + this.onerror;
- output += this.close;
-
- return output;
-};
-
-var CODE = new Block("window.onload = function() {", "};"),
- HEAD = CODE.append(new Block("Crafty.init(550,440);")),
- MAIN = CODE.append(new Block("Crafty.scene(\"main\", function() {", "});", "main")),
- LOADER = CODE.append(new LoaderBlock("Crafty.load(", ");"));
-
-CURRENT_SCENE = MAIN;
-
-/**
* TODO
*
* //wysiwyg
@@ -93,7 +93,7 @@ $(function() {
$workbench.tabs({
show: function(e,ui) {
calculate();
- console.log("LOAD", ui.index, CURRENT_ENTITY);
+
//when the code tab has been selected
if(ui.index === 1) {
//if nothing has been selected, don't change views
@@ -138,7 +138,6 @@ $(function() {
initButtons();
- SCENES.main = MAIN;
COMPS = Crafty.components();
Editor.update();
View
@@ -155,7 +155,7 @@
<label>Asset Location: <input type="text" id="asname" value="assets/logo.png" /></label><br />
</div>
-<div id="load-dialog" title="Add Asset" class="dialog">
+<div id="load-dialog" title="Load Game" class="dialog">
<label>Game Root: <input type="text" id="groot" value="../../demos/fruitassassin/" /></label><br />
<label>Main File: <input type="text" id="sloc" value="assassin.js" /></label><br />
</div>
View
@@ -94,6 +94,19 @@ v0.4.2
* Bugs in Draggable component fixed
* Fixed Full screen mode resize bug
+v0.4.3
+
+* CSS 3D transforms
+* .attach() takes multiple objects
+* Fixed bug with getClientBoundingRect in FireFox
+* DOM elements get components added as classes
+* Fixed Canvas redraw bugs
+* Animate renamed to SpriteAnimation
+* Added basic mobile support
+* Fixed mousedown triggering twice
+* Draggable bugs fixed
+* Sprite takes a tile height if not square
+
v1.0 or 0.5
* Mobile support
View
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit bcb8e2e

Please sign in to comment.