Add first files for the Geektionnerd generator
41
comicgen.appcache
Normal file
|
@ -0,0 +1,41 @@
|
|||
CACHE MANIFEST
|
||||
# v5
|
||||
comicgen.js
|
||||
estilo.css
|
||||
jquery-1.5.2.min.js
|
||||
pop.mp3
|
||||
pop.ogg
|
||||
ragaboom.min.js
|
||||
toons/balao.png
|
||||
toons/sm01_mini.png
|
||||
toons/sm01.png
|
||||
toons/sm02_mini.png
|
||||
toons/sm02.png
|
||||
toons/sm03_mini.png
|
||||
toons/sm03.png
|
||||
toons/sushi_mini.png
|
||||
toons/sushi.png
|
||||
toons/toon01_mini.png
|
||||
toons/toon01.png
|
||||
toons/toon02_mini.png
|
||||
toons/toon02.png
|
||||
toons/toon03_mini.png
|
||||
toons/toon03.png
|
||||
toons/toon04_mini.png
|
||||
toons/toon04.png
|
||||
toons/toon05_mini.png
|
||||
toons/toon05.png
|
||||
toons/toon06_mini.png
|
||||
toons/toon06.png
|
||||
toons/z01_mini.png
|
||||
toons/z01.png
|
||||
toons/z02_mini.png
|
||||
toons/z02.png
|
||||
toons/z03_mini.png
|
||||
toons/z03.png
|
||||
toons/z04_mini.png
|
||||
toons/z04.png
|
||||
|
||||
NETWORK:
|
||||
|
||||
FALLBACK:
|
222
comicgen.js
Normal file
|
@ -0,0 +1,222 @@
|
|||
var d = document;
|
||||
var cg = {};
|
||||
var c = $('#c')[0];
|
||||
var ctx = c.getContext('2d');
|
||||
var scene = new RB.Scene(c);
|
||||
var w = c.width;
|
||||
var h = c.height;
|
||||
var fontFamily = "Domestic_Manners, Arial, helvetica";
|
||||
var pop = new Audio('pop.ogg');
|
||||
var currentObj = null;
|
||||
|
||||
scene.add( scene.rect(w, h, 'white') );
|
||||
scene.update();
|
||||
|
||||
var lib = $('#lib');
|
||||
|
||||
var miniUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon01_mini.png", "toon02_mini.png", "toon03_mini.png", "toon04_mini.png", "toon05_mini.png", "toon06_mini.png", "toon07_mini.png", "toon08_mini.png", "toon09_mini.png", "toon10_mini.png", "toon11_mini.png", "ballon1_mini.png", "ballon2_mini.png", "ballon3_mini.png", "ballon4_mini.png", "ballon5_mini.png",];
|
||||
var toonUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon01.png", "toon02.png", "toon03.png", "toon04.png", "toon05.png", "toon06.png", "toon07.png", "toon08.png", "toon09.png", "toon10.png", "toon11.png", "ballon1.png", "ballon2.png", "ballon3.png", "ballon4.png", "ballon5.png",];
|
||||
|
||||
cg.clearScreen = function(){
|
||||
ctx = c.getContext('2d');
|
||||
scene = new RB.Scene(c);
|
||||
w = c.width;
|
||||
h = c.height;
|
||||
fontFamily = "Domestic_Manners, Arial, helvetica";
|
||||
pop = new Audio('pop.ogg');
|
||||
currentObj = null;
|
||||
|
||||
scene.add( scene.rect(w, h, 'white') );
|
||||
scene.update();
|
||||
}
|
||||
|
||||
$(d).keyup(function(e){
|
||||
|
||||
var key = e.keyCode || e.which;
|
||||
|
||||
if(key == 46 && currentObj){
|
||||
scene.remove(currentObj);
|
||||
scene.update();
|
||||
RB.destroyCanvas( currentObj.getCanvas().id );
|
||||
currentObj = null;
|
||||
}
|
||||
|
||||
if( currentObj && (key==37 || key==39) ){
|
||||
cg.hFlip(currentObj);
|
||||
}
|
||||
});
|
||||
|
||||
$(d).keydown(function(event){
|
||||
|
||||
var key = event.keyCode || event.which;
|
||||
|
||||
if(key == 38 && currentObj){
|
||||
cg.zoomIn(currentObj);
|
||||
}
|
||||
|
||||
if(key == 40 && currentObj){
|
||||
cg.zoomOut(currentObj);
|
||||
}
|
||||
});
|
||||
|
||||
d.onmousewheel = function(mw){
|
||||
if(currentObj && mw.wheelDelta > 0){
|
||||
cg.zoomIn(currentObj);
|
||||
} else if (currentObj && mw.wheelDelta < 0){
|
||||
cg.zoomOut(currentObj);
|
||||
}
|
||||
};
|
||||
|
||||
cg.buildMinis = function(){
|
||||
var buffer = '';
|
||||
var imgString = "<img src='toons/IMG_URL' class='rc mini'></img>";
|
||||
var link = "<a href=\"javascript:cg.createImage('toons/IMG_URL')\">";
|
||||
|
||||
for(var i=0; i < miniUrls.length; i++){
|
||||
buffer += link.replace(/IMG_URL/, toonUrls[i]);
|
||||
buffer += imgString.replace(/IMG_URL/, miniUrls[i]) + '</a>';
|
||||
}
|
||||
|
||||
lib.append(buffer);
|
||||
|
||||
//lib.append( $('#textTool').clone() );
|
||||
$('#menuContainer').append( $('#instructs').clone() );
|
||||
}
|
||||
|
||||
cg.buildMinis();
|
||||
|
||||
cg.createImage = function(url){
|
||||
scene.image(url, function(obj){
|
||||
obj.draggable = true;
|
||||
obj.setXY(30, 30);
|
||||
|
||||
obj.onmousedown = function(e){
|
||||
currentObj = obj;
|
||||
scene.zIndex(obj, 1);
|
||||
scene.update();
|
||||
}
|
||||
|
||||
scene.add(obj);
|
||||
currentObj = obj;
|
||||
scene.update();
|
||||
pop.play();
|
||||
});
|
||||
}
|
||||
|
||||
cg.createText = function(){
|
||||
var txt = prompt("Adicione um texto:");
|
||||
|
||||
if(txt){
|
||||
var obj = scene.text(txt, fontFamily, 26, 'black');
|
||||
obj.setXY(40, 40);
|
||||
obj.draggable = true;
|
||||
|
||||
obj.onmousedown = function(e){
|
||||
currentObj = obj;
|
||||
scene.zIndex(obj, 1);
|
||||
scene.update();
|
||||
}
|
||||
currentObj = obj;
|
||||
|
||||
scene.add(obj);
|
||||
scene.update();
|
||||
pop.play();
|
||||
}
|
||||
}
|
||||
|
||||
cg.createTextFromInput = function(e){
|
||||
|
||||
var key = e.keyCode || e.which;
|
||||
var txt = $('#newText').val();
|
||||
|
||||
if(key == 13){
|
||||
var obj = scene.text(txt, fontFamily, 26, 'black');
|
||||
obj.setXY(40, 40);
|
||||
obj.draggable = true;
|
||||
|
||||
obj.onmousedown = function(e){
|
||||
currentObj = obj;
|
||||
scene.zIndex(obj, 1);
|
||||
scene.update();
|
||||
}
|
||||
currentObj = obj;
|
||||
|
||||
scene.add(obj);
|
||||
scene.update();
|
||||
$('#newText').val('');
|
||||
pop.play();
|
||||
}
|
||||
}
|
||||
|
||||
cg.saveImage = function(){
|
||||
var data = c.toDataURL('png');
|
||||
var win = window.open();
|
||||
var b = win.document.body;
|
||||
var img = new Image();
|
||||
img.src = data;
|
||||
b.appendChild(img);
|
||||
}
|
||||
|
||||
cg.zoomOut = function(obj){
|
||||
var w = obj.w * 0.05;
|
||||
var h = obj.h * 0.05;
|
||||
|
||||
if(obj.w - w > 0 && obj.h - h > 0){
|
||||
obj.w -= w;
|
||||
obj.h -= h;
|
||||
|
||||
obj.x += (w/2);
|
||||
obj.y += (h/2);
|
||||
|
||||
scene.update();
|
||||
}
|
||||
}
|
||||
|
||||
cg.zoomIn = function(obj){
|
||||
var w = obj.w * 0.05;
|
||||
var h = obj.h * 0.05;
|
||||
|
||||
obj.w += w;
|
||||
obj.h += h;
|
||||
|
||||
obj.x -= (w/2);
|
||||
obj.y -= (h/2);
|
||||
|
||||
scene.update();
|
||||
}
|
||||
|
||||
cg.hFlip = function(obj){
|
||||
var tmpCanvas = $(obj.getCanvas()).clone()[0];
|
||||
var img = obj.getCanvas();
|
||||
var tmpCtx = tmpCanvas.getContext('2d');
|
||||
var w = tmpCanvas.width;
|
||||
var h = tmpCanvas.height;
|
||||
|
||||
//save current size and position
|
||||
var cW = obj.w, cH = obj.h, cX = obj.x, cY = obj.y;
|
||||
|
||||
tmpCtx.translate(w/2, h/2);
|
||||
tmpCtx.scale(-1, 1);
|
||||
tmpCtx.drawImage(img, (-1*w/2), (-1*h/2));
|
||||
tmpCanvas.id = obj.getCanvas().id;
|
||||
obj.getCanvas().id = 'killme';
|
||||
|
||||
RB.destroyCanvas('killme');
|
||||
d.body.appendChild(tmpCanvas);
|
||||
obj.setCanvas(tmpCanvas);
|
||||
obj.x=cX; obj.y=cY; obj.h=cH; obj.w=cW;
|
||||
scene.update();
|
||||
}
|
||||
|
||||
cg.setScreen = function(w, h){
|
||||
if(w && h && !isNaN(w) && !isNaN(h)){
|
||||
//var ok = confirm('All your work will be lost. Continue?');
|
||||
ok=true;
|
||||
if(ok){
|
||||
c.width = w;
|
||||
c.height = h;
|
||||
scene.update();
|
||||
//cg.clearScreen();
|
||||
}
|
||||
}
|
||||
}
|
110
estilo.css
Normal file
|
@ -0,0 +1,110 @@
|
|||
|
||||
body {
|
||||
background: url("images/bg.png") repeat fixed 0 0 #D5B578;
|
||||
color: #D5B578;
|
||||
font-family: arial,helvetica;
|
||||
font-size: 12px;
|
||||
margin: 0;
|
||||
text-shadow: 1px 1px 0 #222222;
|
||||
}
|
||||
a {
|
||||
color: #222222;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
#container {
|
||||
height: 650px;
|
||||
margin-left: 100px;
|
||||
overflow: hidden;
|
||||
text-align: center;
|
||||
width: 1050px;
|
||||
}
|
||||
#menuContainer {
|
||||
float: left;
|
||||
height: 520px;
|
||||
width: 220px;
|
||||
}
|
||||
#lib {
|
||||
background-color: #D5B578;
|
||||
height: 380px;
|
||||
overflow: auto;
|
||||
padding-left: 5px;
|
||||
padding-top: 5px;
|
||||
width: 210px;
|
||||
}
|
||||
#cscreen {
|
||||
float: left;
|
||||
height: 490px;
|
||||
text-align: center;
|
||||
width: 590px;
|
||||
}
|
||||
#cscreen canvas {
|
||||
border: 7px solid #D5B578;
|
||||
box-shadow: 3px 3px 10px #222222;
|
||||
margin-left: 2px;
|
||||
}
|
||||
.mini {
|
||||
background-color: white;
|
||||
border: 2px solid #D5B578;
|
||||
float: left;
|
||||
height: 50px;
|
||||
margin: 2px;
|
||||
overflow: hidden;
|
||||
padding: 2px;
|
||||
width: 50px;
|
||||
}
|
||||
.mini:hover {
|
||||
background-color: orange;
|
||||
cursor: pointer;
|
||||
}
|
||||
.rc {
|
||||
border-radius: 4px 4px 4px 4px;
|
||||
}
|
||||
.rcBottom {
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
#hiddenObjs {
|
||||
display: none;
|
||||
}
|
||||
.textTool {
|
||||
color: #222222;
|
||||
font-family: 'times new roman',times;
|
||||
font-size: 40px;
|
||||
text-align: center;
|
||||
}
|
||||
.instructions {
|
||||
background-color: #D5B578;
|
||||
color: #222222;
|
||||
height: 100px;
|
||||
margin: 6px 2px 2px;
|
||||
padding: 6px;
|
||||
text-align: left;
|
||||
text-shadow: 1px 1px 0 silver;
|
||||
width: 202px;
|
||||
}
|
||||
.instructions ul {
|
||||
list-style: none outside none;
|
||||
padding-left: 5px;
|
||||
}
|
||||
#logo {
|
||||
color: #222222;
|
||||
font-size: 29px;
|
||||
font-weight: bold;
|
||||
padding: 4px;
|
||||
text-align: left;
|
||||
text-shadow: 0 0 8px #D5B578;
|
||||
}
|
||||
|
||||
|
||||
#newText {
|
||||
width: 180px;
|
||||
}
|
||||
|
||||
#toolbar {
|
||||
background-color: #D5B578;
|
||||
height: 50px;
|
||||
margin-bottom: 10px;
|
||||
padding: 3px;
|
||||
text-align: left;
|
||||
width: 950px;
|
||||
}
|
BIN
font/Domestic_Manners.ttf
Normal file
BIN
font/Purisa.ttf
Normal file
BIN
images/bg.png
Normal file
After Width: | Height: | Size: 77 KiB |
65
index.html
Normal file
|
@ -0,0 +1,65 @@
|
|||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html manifest="comicgen.appcache">
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<link href="estilo.css" type="text/css" rel="stylesheet"/>
|
||||
<title>Geektionnerd creator</title>
|
||||
|
||||
<style type="text/css">
|
||||
@font-face {
|
||||
font-family: 'Domestic_Manners';
|
||||
src: url('./font/Domestic_Manners.ttf');
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<center>
|
||||
<div id="toolbar" class="rcBottom">
|
||||
<div>BARRE D'OUTILS</div>
|
||||
<a href="javascript:cg.saveImage();">Enregistrer l'image</a> |
|
||||
<a href="javascript:cg.setScreen(800, 600)">800x600</a> |
|
||||
<a href="javascript:cg.setScreen(640, 480)">640x480</a> |
|
||||
<a href="javascript:cg.setScreen(320, 240)">320x240</a>
|
||||
</div>
|
||||
</center>
|
||||
|
||||
<div id="container">
|
||||
<div id="menuContainer">
|
||||
<div id="logo">Geektionnerd creator</div>
|
||||
<div id="lib" class="rc">
|
||||
<div><input type="text" id="newText" onkeypress="cg.createTextFromInput(event)"/></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="cscreen">
|
||||
<canvas class="rc" id="c" width="800" height="600">
|
||||
Votre navigateur ne supporte pas HTML5. Utiliez un navigateur plus récent SVP.
|
||||
</canvas>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="hiddenObjs">
|
||||
<div id="textTool" class="rc mini textTool" title="Adicionar texto" onclick="cg.createText();">T</div>
|
||||
|
||||
<div id="instructs" class="rc instructions">
|
||||
<b>Instructions</b>
|
||||
<ul>
|
||||
<li><b>Flêche bas:</b> rétrécir</li>
|
||||
<li><b>Flêche haut:</b> agrandir </li>
|
||||
<li><b>Gauche/droite:</b> retournement horizontal</li>
|
||||
<li><b>Del:</b> effacer l'objet</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="jquery-1.5.2.min.js"></script>
|
||||
<script type="text/javascript" src="ragaboom.min.js"></script>
|
||||
<script type="text/javascript" src="comicgen.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
16
jquery-1.5.2.min.js
vendored
Normal file
BIN
pop.mp3
Normal file
BIN
pop.ogg
Normal file
20
ragaboom.min.js
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
var RB={};
|
||||
RB.Scene=function(b,k){if(!b)throw"RB.Scene(canvasObject): You must specify a canvas object";k||(k=24);this.timeInterval=k;var n=document;this.ctx=b.getContext("2d");var d=[],m=null,u=!1,z=!1,s=!1,p=!1,v=!1,t=null,A=0,l=0,q=[],r=[],w=!1,x=0,a=0,y=0;this.genID=function(){return"RB_OBJECT"+y++};this.add=function(c){if(!c)throw"RB.Scene.add(o): the object you are trying to add to the scene doesn't exist.";d.push(c);c.collidable&&q.push(c);c.draggable&&r.push(c);return c};this.addLots=function(c){for(var i=0;i<
|
||||
c.length;i++)this.add(c[i])};this.remove=function(c){for(var c=c.getId(),i=d.length,a=r.length,h=q.length,e=0;e<i;e++)if(c==d[e].getId()){d.splice(e,1);break}for(e=0;e<h;e++)if(c==q[e].getId()){q.splice(e,1);break}for(e=0;e<a;e++)if(c==r[e].getId()){r.splice(e,1);break}};this.removeLots=function(c){for(var i=0;i<c.length;i++)this.remove(c[i])};this.removeAll=function(){var c=r.length,i=q.length;d.splice(0,d.length);q.splice(0,i);r.splice(0,c)};this.zIndex=function(c,i){var a=d.length,h=getIdByObject(c),
|
||||
e=h+i;e<0&&(e=0);e>=a&&(e=a-1);a=d[h];d[h]=d[e];d[e]=a};getObjectById=function(c){for(var a=d.length,f=0;f<a;f++)if(d[f].getId()==c)return o;return null};getIdByObject=function(c){for(var a=d.length,f=0;f<a;f++)if(d[f].getId()==c.getId())return f;return null};this.setMovableObject=function(c){m=typeof c=="object"?c.getId():c};this.getMovableObject=function(){return getObjectById(m)};var B=function(c,a){switch(c.keyCode){case 37:u=a;break;case 38:s=a;break;case 39:z=a;break;case 40:p=a}};this.onmousemove=
|
||||
function(){};this.onmousedown=function(){};this.onmouseup=function(){};this.onkeydown=function(){};this.onkeyup=function(){};var j=this;b.onmousemove=function(c){if(v&&t)t.x=RB.xPos(c)-A,t.y=RB.yPos(c)-l,w||j.update();j.onmousemove(c)};b.onmousedown=function(c){for(var a=r.length-1;a>=0;a--){var f=r[a];if(f.checkRange(RB.xPos(c),RB.yPos(c))){f.onmousedown(c);t=f;currentObjectIndex=a;A=RB.xPos(c)-t.x;l=RB.yPos(c)-t.y;v=!0;break}}j.onmousedown(c)};b.onmouseup=function(c){v=!1;j.onmouseup(c)};n.onkeydown=
|
||||
function(c){B(c,!0);j.onkeydown(c)};n.onkeyup=function(c){B(c,!1);j.onkeyup(c)};this.getObjectSize=function(){return d.length};this.getObj=function(c){return d[c]};this.rect=function(c,a,f,h,e){var h=h||this.genID(),h=RB.createCanvas(c,a,h),g=h.getContext("2d");if(f)g.fillStyle=RB.getFS(f,g,a),g.fillRect(0,0,c,a);if(e)f=e.lineWidth||1,g.lineWidth=e.lineWidth,g.strokeStyle=e.strokeStyle,g.rect(0+f,0+f,c-f-f,a-f-f),g.stroke();return rectObj=new RB.Obj(h,this.ctx)};this.image=function(c,i,f){var h=new Image,
|
||||
e=this,g=null;h.onload=function(){f=f||e.genID();g=RB.createCanvas(h.width,h.height,f);g.getContext("2d").drawImage(this,0,0);a++;var c=new RB.Obj(g,e.ctx);i(c)};h.src=c;x++};this.loadImage=function(c,i,f){var h=new Image,e=this,g=null;h.onload=function(){i=i||e.genID();g=RB.createCanvas(h.width,h.height,i);g.getContext("2d").drawImage(this,0,0);a++;f(g)};h.src=c;x++};this.imagePattern=function(c,i,f,h,e){var g=new Image,b=this;g.onload=function(){e=e||b.genID();var c=RB.createCanvas(i,f,e).getContext("2d"),
|
||||
d=c.createPattern(g,h);c.fillStyle=d;c.fillRect(0,0,i,f);a++;a==x&&b.doAfterLoad()};g.src=c;x++};this.roundRect=function(c,a,f,h,e,g){var e=e||this.genID(),e=RB.createCanvas(c,a,e),b=e.getContext("2d");b.beginPath();b.moveTo(0+f,0);b.lineTo(c+0-f,0);b.quadraticCurveTo(c+0,0,c+0,0+f);b.lineTo(c+0,a+0-f);b.quadraticCurveTo(c+0,0+a,c+0-f,0+a);b.lineTo(0+f,0+a);b.quadraticCurveTo(0,0+a,0,0+a-f);b.lineTo(0,0+f);b.quadraticCurveTo(0,0,0+f,0);b.closePath();if(h)b.fillStyle=RB.getFS(h,b,a),b.fill();if(g)b.lineWidth=
|
||||
g.lineWidth,b.strokeStyle=g.strokeStyle,b.stroke();return new RB.Obj(e,this.ctx)};this.text=function(a,b,f,h,e){var g=RB.getTextBuffer(),e=e||this.genID();g.innerHTML=a;g.style.fontFamily=b;g.style.fontSize=f+"px";var d=RB.el(e);d?(e=d.getContext("2d"),d.width=g.offsetWidth,d.height=g.offsetHeight+15,e.clearRect(0,0,g.offsetWidth,g.offsetHeight+15)):(d=RB.createCanvas(g.offsetWidth,g.offsetHeight+15,e),e=d.getContext("2d"));e.fillStyle=RB.getFS(h,e,g.offsetHeight+25);e.font="normal "+f+"px "+b;e.fillText(a,
|
||||
0,g.offsetHeight+5);return new RB.Obj(d,this.ctx)};this.start=function(){w=!0;this.animate()};this.stop=function(){w=!1};this.toggleStart=function(){w?this.stop():this.start()};this.onLoop=function(){};this.runOnce=function(){this.ctx.restore();for(var a=d.length,b=q.length,f=0;f<a;f++){var h=d[f];if(h.visible){h.run();if(h.collidable&&!h.obstacle)for(var e=0;e<b;e++){var g=q[e];if(h.getId()!=g.getId())if(g=h.checkCollision(g,!0),g.top||g.bottom||g.left||g.right){h.colliding=!0;h.collidingCoords=
|
||||
g;break}else h.colliding=!1,h.collidingCoords=null}e=u||z||p||s;if(h.getId()==m&&e){var B=g=e=!1,j=!1,y=h.collidingCoords;if(y)e=y.left,g=y.right,B=y.top,j=y.bottom;u&&!e&&h.left();z&&!g&&h.right();s&&!B&&h.up();p&&!j&&h.down()}}}this.ctx.save()};this.animate=function(){this.runOnce();this.onLoop();if(w){var a=this;setTimeout(function(){a.animate()},this.timeInterval)}};this.update=function(){for(var a=d.length,b=0;b<a;b++)d[b].run()};this.doAfterLoad=function(){}};
|
||||
RB.Obj=function(b,k,n,d){if(!k)throw"RB.Obj(c, sceneContext, _x, _y): You must specify a scene context";var m=Math.random(),u=k,z=null,s=null;this.h=this.w=this.y=this.x=0;if(n)this.x=n;if(d)this.y=d;this.w=b.width;this.h=b.height;this.onmousedown=function(){};this.visible=!0;this.colliding=this.obstacle=this.collidable=!1;var p=this.collidingCoords=null;this.draggable=!1;this.speedY=this.speedX=1;var v=null;this.spriteChangeInterval=1;var t=0,A=0;this.setCanvas=function(a){s=typeof a=="object"?a:
|
||||
RB.el(a);this.w=s.width;this.h=s.height};this.setCoords=function(a,b){this.x=a;this.y=b};this.setDimension=function(a,b){this.w=a;this.h=b};this.setCanvas(b);this.getCanvas=function(){return s};this.getId=function(){return m};this.setSCtx=function(a){u=a};this.getSCtx=function(){return u};this.setCtx=function(a){z=a};this.getCtx=function(){return z};this.setXY=function(a,b){this.x=a;this.y=b};this.setSpeed=function(a){this.speedY=this.speedX=a};this.getX2=function(){return this.x+this.w};this.getY2=
|
||||
function(){return this.y+this.h};this.fn=function(){this.draw()};this.run=function(){this.fn()};this.clone=function(){var a=new RB.Obj(b,u);a.x=this.x;a.y=this.y;a.w=this.w;a.h=this.h;a.collidable=this.collidable;a.obstacle=this.obstacle;a.fn=this.fn;a.speedX=this.speedX;a.speedY=this.speedY;a.setSprites(v,this.spriteChangeInterval);a.draggable=this.draggable;a.visible=this.visible;return a};this.draw=function(a,b){try{a&&b?u.drawImage(s,this.x,this.y,a,b):u.drawImage(s,this.x,this.y,this.w,this.h)}catch(d){throw d;
|
||||
}};this.up=function(a){this.y-=a||this.speedY;p="up"};this.down=function(a){this.y+=a||this.speedY;p="down"};this.left=function(a){this.x-=a||this.speedX;p="left"};this.right=function(a){this.x+=a||this.speedX;p="right"};this.setSprites=function(a,b){v=a;spriteChangeInterval=b};this.animateSprite=function(){t==spriteChangeInterval?(s=v[++A]?v[A]:v[A=0],t=0):t++};this.checkCollision=function(a,b){var d=a.x,j=a.y,c=a.getX2(),i=a.getY2();b&&(d-=this.speedX,j-=this.speedY,c+=this.speedX,i+=this.speedY);
|
||||
var f={top:!1,bottom:!1,left:!1,right:!1};if(p=="up")f.top=w(d,j,c,i),f.left=q(d,j,c,i),f.right=r(d,j,c,i);if(p=="down")f.bottom=x(d,j,c,i),f.left=q(d,j,c,i),f.right=r(d,j,c,i);if(p=="right")f.right=r(d,j,c,i),f.top=w(d,j,c,i),f.bottom=x(d,j,c,i);if(p=="left")f.left=q(d,j,c,i),f.top=w(d,j,c,i),f.bottom=x(d,j,c,i);return f};var l=this,q=function(a,b,d,j){a=l.y<j&&l.getY2()>b;d=l.x<d&&l.getX2()>d;return a&&d},r=function(a,b,d,j){b=l.y<j&&l.getY2()>b;a=l.getX2()>a&&l.getX2()<d;return b&&a},w=function(a,
|
||||
b,d,j){b=l.y<j&&l.getY2()>j;a=l.x<d&&l.getX2()>a;return b&&a},x=function(a,b,d,j){b=l.getY2()>b&&l.getY2()<j;a=l.x<d&&l.getX2()>a;return b&&a};this.checkRange=function(a,b){var d=a>=this.x&&a<=this.getX2(),j=b>=this.y&&b<=this.getY2();return d&&j}};RB.createTextBuffer=function(){var b=document,k=b.createElement("div");k.id="txtBuffer";k.style.position="absolute";k.style.width="auto";k.style.height="auto";k.style.padding="0px";k.style.visibility="hidden";b.body.appendChild(k)};
|
||||
RB.getTextBuffer=function(){RB.el("txtBuffer")||RB.createTextBuffer();return RB.el("txtBuffer")};RB.createCanvasLocation=null;RB.createCanvas=function(b,k,n){var d=document,m=d.createElement("canvas");m.width=b;m.height=k;m.id=n;m.style.display="none";RB.createCanvasLocation?RB.createCanvasLocation.appendChild(m):d.body.appendChild(m);return m};RB.destroyCanvas=function(b){var k=document,b=k.getElementById(b);k.body.removeChild(b)};RB.el=function(b){return document.getElementById(b)};
|
||||
RB.linearGradient=function(b,k){var n=k.createLinearGradient(0,5,0,b.h);csLen=b.colors.length;for(var d=0;d<csLen;d++){var m=b.colors[d];n.addColorStop(m.stopPoint,m.name)}return n};RB.getFS=function(b,k,n){if(typeof b=="object")return b.h=n,RB.linearGradient(b,k);return b};RB.rtImage=function(b,k,n){var d=new Image;d.onload=function(){var b=RB.createCanvas(d.width,d.height,k);b.getContext("2d").drawImage(this,0,0);n&&n(b)};d.src=b};
|
||||
RB.canvasSupport=function(b){if(b)try{return b.getContext("2d"),!0}catch(k){return!1}else return!1};RB.xPos=function(b){return b.pageX-b.target.offsetLeft};RB.yPos=function(b){return b.pageY-b.target.offsetTop};
|
BIN
toons/ballon1.png
Executable file
After Width: | Height: | Size: 4 KiB |
BIN
toons/ballon1_mini.png
Executable file
After Width: | Height: | Size: 571 B |
BIN
toons/ballon2.png
Executable file
After Width: | Height: | Size: 4.9 KiB |
BIN
toons/ballon2_mini.png
Executable file
After Width: | Height: | Size: 568 B |
BIN
toons/ballon3.png
Executable file
After Width: | Height: | Size: 5.4 KiB |
BIN
toons/ballon3_mini.png
Executable file
After Width: | Height: | Size: 447 B |
BIN
toons/ballon4.png
Executable file
After Width: | Height: | Size: 6.1 KiB |
BIN
toons/ballon4_mini.png
Executable file
After Width: | Height: | Size: 838 B |
BIN
toons/ballon5.png
Executable file
After Width: | Height: | Size: 4.9 KiB |
BIN
toons/ballon5_mini.png
Executable file
After Width: | Height: | Size: 740 B |
BIN
toons/fond1.png
Executable file
After Width: | Height: | Size: 156 KiB |
BIN
toons/fond2.png
Executable file
After Width: | Height: | Size: 192 KiB |
BIN
toons/fond3.png
Executable file
After Width: | Height: | Size: 164 KiB |
BIN
toons/fond4.png
Executable file
After Width: | Height: | Size: 146 KiB |
BIN
toons/toon01.png
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
toons/toon01_mini.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
toons/toon02.png
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
toons/toon02_mini.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
toons/toon03.png
Executable file
After Width: | Height: | Size: 17 KiB |
BIN
toons/toon03_mini.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
toons/toon04.png
Executable file
After Width: | Height: | Size: 13 KiB |
BIN
toons/toon04_mini.png
Normal file
After Width: | Height: | Size: 1.3 KiB |
BIN
toons/toon05.png
Executable file
After Width: | Height: | Size: 19 KiB |
BIN
toons/toon05_mini.png
Executable file
After Width: | Height: | Size: 1.7 KiB |
BIN
toons/toon06.png
Executable file
After Width: | Height: | Size: 16 KiB |
BIN
toons/toon06_mini.png
Executable file
After Width: | Height: | Size: 1.5 KiB |
BIN
toons/toon07.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
toons/toon07_mini.png
Executable file
After Width: | Height: | Size: 1.3 KiB |
BIN
toons/toon08.png
Executable file
After Width: | Height: | Size: 15 KiB |
BIN
toons/toon08_mini.png
Executable file
After Width: | Height: | Size: 1.4 KiB |
BIN
toons/toon09.png
Executable file
After Width: | Height: | Size: 21 KiB |
BIN
toons/toon09_mini.png
Executable file
After Width: | Height: | Size: 1.8 KiB |
BIN
toons/toon10.png
Executable file
After Width: | Height: | Size: 18 KiB |
BIN
toons/toon10_mini.png
Executable file
After Width: | Height: | Size: 1.6 KiB |
BIN
toons/toon11.png
Executable file
After Width: | Height: | Size: 14 KiB |
BIN
toons/toon11_mini.png
Executable file
After Width: | Height: | Size: 1.4 KiB |