Permalink
Browse files

Added an uncompleted version of AkibaKa, a resource editor. Work enou…

…gh so have fun!
  • Loading branch information...
1 parent eb747cc commit 0ff1176d83c03a88a725473f3fcfbdac83182ad2 @kesiev committed Jan 6, 2011
View
@@ -11,12 +11,18 @@ Notes for developers
* For making sure that your sub-scripts are loaded, try to add an "alert" at the end. Opera for Wii silently fail when there are syntax errors like the one explained before.
* Opera Wii wants that canvas have to be blitted at least once before being used - or fails with a browser crash! The built-in gbox.createCanvas was already fixed. Is a good thing to use that method for spawning canvas.
+AkibaKa
+-------
+
+Thought as a flexible and simple Akihabara resource editor, AkibaKa has been committed partially uncompleted due to lack of time. Iit should be functional enough but I hope that I'll start working on it again or (better) that someone will pick up the code and give it a spin! :)
+
Todo
----
-* Akihabara needs to be documented! (Darren and Darius are wrapping up tutorials and docs! - some scripts for generating docs form sources are needed)
+* Some way for updating the JSDoc automatically. (Darren and Darius wrapped up tutorials and docs! - BTW some scripts for generating docs form sources are needed)
* Better embeddability keeping playability on mobile
* Solve randomly blinking sprites on Wii (?)
+* ON AkibaKa: add addImage and addTiles only when used!
Improvement
-----------
@@ -25,4 +31,4 @@ Improvement
Nice to have
----
-* Networking
+* Networking
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@@ -0,0 +1,44 @@
+extras.push({
+ id:"gridgenerator",
+ label:"Grid generator",
+ action:function() {
+ var dia="Cell size: <input id='cel-w' value='20'> X <input id='cel-h' value='20'> pixels<br>";
+ dia+="Grid size: <input id='grd-w' value='10'> X <input id='grd-h' value='10'> cells<br>";
+ dia+="Colors: <select id='grd-c'>";
+ dia+="<option value=''>Black and white</option>";
+ dia+="<option value='bluered'>Blue and red</option>";
+ dia+="<option value='whitemagenta'>White and magenta</option>";
+ dia+="</select>";
+ dia+="<br><br><input type=button onclick='getextra(\"gridgenerator\").make()' value='Make grid'> <input type=button onclick='detailhide()' value='Cancel'>";
+ dia+="<br><hr><i>Right click and save. You can use as background for making sprites.<br><br><canvas id='grd-canvas'></canvas>";
+ detailshow(dia);
+ },
+ make:function() {
+ var c=document.getElementById('grd-canvas');
+ var ctx=c.getContext("2d");
+ var cw=document.getElementById('cel-w').value*1;
+ var ch=document.getElementById('cel-h').value*1;
+ var gw=document.getElementById('grd-w').value*1;
+ var gh=document.getElementById('grd-h').value*1;
+ var cl=["#000000","#ffffff"];
+ switch (getcombovalue('grd-c')) {
+ case "bluered": { cl=["#ff0000","#0000ff"]; break; }
+ case "whitemagenta": { cl=["#ffffff","#ff00ff"]; break; }
+ default: { cl=["#000000","#ffffff"]; break; }
+ }
+ c.width=cw*gw;
+ c.height=ch*gh;
+
+ ctx.save();
+ var curc;
+ for (var y=0;y<gh;y++) {
+ curc=y%cl.length;
+ for (var x=0;x<gw;x++) {
+ ctx.fillStyle = cl[curc];
+ ctx.fillRect(x*cw,y*ch,cw,ch);
+ curc=(curc+1)%cl.length;
+ }
+ }
+ ctx.restore();
+ }
+});
Oops, something went wrong.

0 comments on commit 0ff1176

Please sign in to comment.