Fix connard_enoncant.png #1

This commit is contained in:
JosephK 2017-02-08 07:26:53 +01:00
parent 3aafbcc92a
commit 670f4e06a0
3 changed files with 48 additions and 113 deletions

View file

@ -15,7 +15,7 @@ scene.update();
var lib = $('#lib'); var lib = $('#lib');
var miniUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13_mini.png", "toon01_mini.png", "toon02_mini.png", "toon04_mini.png", "toon05_mini.png", "toon07_mini.png", "toon08_mini.png", "toon11_mini.png", "toon09_mini.png", "toon15_mini.png", "toon06_mini.png", "toon10_mini.png", "toon03_mini.png", "toon12_mini.png", "toon14_mini.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1_mini.png", "ballon2_mini.png", "ballon3_mini.png", "ballon4_mini.png", "ballon5_mini.png","ballon6_mini.png","affirmatif_mini.png","agace_mini.png","blagueur_bras_croises_mini.png","blagueur_bras_ecartes_mini.png","blagueur_doigt_leve_mini.png","blagueuse_mini.png","blase_mini.png","boude_mini.png","boudeur_mini.png","chasseur_mini.png","choque_mini.png","connard_mini.png","connard_avide_mini.png","connard_enoncant_mini.png","connard_menacant_mini.png","connard_pupitre_mini.png","depite_mini.png","desapointe_mini.png","desapointee_mini.png","effraye_mini.png","etonne_mini.png","facepalm_mini.png","facepalm2_mini.png","fache_mini.png","fbi_mini.png","festif_mini.png","guitare_mini.png","harpon_mini.png","heureux_mini.png","indigne_mini.png","inebranlable_mini.png","inebranlable2_mini.png","ironique_mini.png","journal_mini.png","journaliste_surpris_mini.png","joyeux_mini.png","lisant_mini.png","lisant_a_haute_voix_mini.png","la_mort_mini.png","marchant_mini.png","montre_du_doigt_mini.png","moqueur_mini.png","nauseeux_mini.png","negatif1_mini.png","negatif2_mini.png","negatif3_mini.png","negatif4_mini.png","negatif5_mini.png","non_mais_mini.png","paon_mini.png","pedant_mini.png","pensif_mini.png","pensive_mini.png","positif1_mini.png","positif2_mini.png","positif3_mini.png","positif4_mini.png","positif5_mini.png","psst_mini.png","sabre_laser_mini.png","scandalise_mini.png","se_cache_les_yeux_mini.png","souriante_mini.png","surarme_mini.png","surpris_mini.png","transpirant_mini.png","tsss_mini.png","vador_mini.png","vieille_dame_mini.png","voiture_mini.png"]; var miniUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13_mini.png", "toon01_mini.png", "toon02_mini.png", "toon04_mini.png", "toon05_mini.png", "toon07_mini.png", "toon08_mini.png", "toon11_mini.png", "toon09_mini.png", "toon15_mini.png", "toon06_mini.png", "toon10_mini.png", "toon03_mini.png", "toon12_mini.png", "toon14_mini.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1_mini.png", "ballon2_mini.png", "ballon3_mini.png", "ballon4_mini.png", "ballon5_mini.png","ballon6_mini.png","affirmatif_mini.png","agace_mini.png","blagueur_bras_croises_mini.png","blagueur_bras_ecartes_mini.png","blagueur_doigt_leve_mini.png","blagueuse_mini.png","blase_mini.png","boude_mini.png","boudeur_mini.png","chasseur_mini.png","choque_mini.png","connard_mini.png","connard_avide_mini.png","connard_enoncant_mini.png","connard_menacant_mini.png","connard_pupitre_mini.png","depite_mini.png","desapointe_mini.png","desapointee_mini.png","effraye_mini.png","etonne_mini.png","facepalm_mini.png","facepalm2_mini.png","fache_mini.png","fbi_mini.png","festif_mini.png","guitare_mini.png","harpon_mini.png","heureux_mini.png","indigne_mini.png","inebranlable_mini.png","inebranlable2_mini.png","ironique_mini.png","journal_mini.png","journaliste_surpris_mini.png","joyeux_mini.png","lisant_mini.png","lisant_a_haute_voix_mini.png","la_mort_mini.png","marchant_mini.png","montre_du_doigt_mini.png","moqueur_mini.png","nauseeux_mini.png","negatif1_mini.png","negatif2_mini.png","negatif3_mini.png","negatif4_mini.png","negatif5_mini.png","non_mais_mini.png","paon_mini.png","pedant_mini.png","pensif_mini.png","pensive_mini.png","positif1_mini.png","positif2_mini.png","positif3_mini.png","positif4_mini.png","positif5_mini.png","psst_mini.png","sabre_laser_mini.png","scandalise_mini.png","se_cache_les_yeux_mini.png","souriante_mini.png","surarme_mini.png","surpris_mini.png","transpirant_mini.png","tsss_mini.png","vador_mini.png","vieille_dame_mini.png","voiture_mini.png"];
var toonUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13.png", "toon01.png", "toon02.png", "toon04.png", "toon05.png", "toon07.png", "toon08.png", "toon11.png", "toon09.png", "toon15.png", "toon06.png", "toon10.png", "toon03.png", "toon12.png", "toon14.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1.png", "ballon2.png", "ballon3.png", "ballon4.png", "ballon5.png", "ballon6.png", "affirmatif.png","agace.png","blagueur_bras_croises.png","blagueur_bras_ecartes.png","blagueur_doigt_leve.png","blagueuse.png","blase.png","boude.png","boudeur.png","chasseur.png","choque.png","connard.png","connard_avide.png","connard_ennoncant.png","connard_menacant.png","connard_pupitre.png","depite.png","desapointe.png","desapointee.png","effraye.png","etonne.png","facepalm.png","facepalm2.png","fache.png","fbi.png","festif.png","guitare.png","harpon.png","heureux.png","indigne.png","inebranlable.png","inebranlable2.png","ironique.png","journal.png","journaliste_surpris.png","joyeux.png","lisant.png","lisant_a_haute_voix.png","la_mort.png","marchant.png","montre_du_doigt.png","moqueur.png","nauseeux.png","negatif1.png","negatif2.png","negatif3.png","negatif4.png","negatif5.png","non_mais.png","paon.png","pedant.png","pensif.png","pensive.png","positif1.png","positif2.png","positif3.png","positif4.png","positif5.png","psst.png","sabre_laser.png","scandalise.png","se_cache_les_yeux.png","souriante.png","surarme.png","surpris.png","transpirant.png","tsss.png","vador.png","vieille_dame.png","voiture.png"]; var toonUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13.png", "toon01.png", "toon02.png", "toon04.png", "toon05.png", "toon07.png", "toon08.png", "toon11.png", "toon09.png", "toon15.png", "toon06.png", "toon10.png", "toon03.png", "toon12.png", "toon14.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1.png", "ballon2.png", "ballon3.png", "ballon4.png", "ballon5.png", "ballon6.png", "affirmatif.png","agace.png","blagueur_bras_croises.png","blagueur_bras_ecartes.png","blagueur_doigt_leve.png","blagueuse.png","blase.png","boude.png","boudeur.png","chasseur.png","choque.png","connard.png","connard_avide.png","connard_enoncant.png","connard_menacant.png","connard_pupitre.png","depite.png","desapointe.png","desapointee.png","effraye.png","etonne.png","facepalm.png","facepalm2.png","fache.png","fbi.png","festif.png","guitare.png","harpon.png","heureux.png","indigne.png","inebranlable.png","inebranlable2.png","ironique.png","journal.png","journaliste_surpris.png","joyeux.png","lisant.png","lisant_a_haute_voix.png","la_mort.png","marchant.png","montre_du_doigt.png","moqueur.png","nauseeux.png","negatif1.png","negatif2.png","negatif3.png","negatif4.png","negatif5.png","non_mais.png","paon.png","pedant.png","pensif.png","pensive.png","positif1.png","positif2.png","positif3.png","positif4.png","positif5.png","psst.png","sabre_laser.png","scandalise.png","se_cache_les_yeux.png","souriante.png","surarme.png","surpris.png","transpirant.png","tsss.png","vador.png","vieille_dame.png","voiture.png"];
cg.clearScreen = function(){ cg.clearScreen = function(){
ctx = c.getContext('2d'); ctx = c.getContext('2d');
@ -40,20 +40,20 @@ $(d).keyup(function(e){
RB.destroyCanvas( currentObj.getCanvas().id ); RB.destroyCanvas( currentObj.getCanvas().id );
currentObj = null; currentObj = null;
} }
if( currentObj && (key==37 || key==39) ){ if( currentObj && (key==37 || key==39) ){
cg.hFlip(currentObj); cg.hFlip(currentObj);
} }
}); });
$(d).keydown(function(event){ $(d).keydown(function(event){
var key = event.keyCode || event.which; var key = event.keyCode || event.which;
if(key == 38 && currentObj){ if(key == 38 && currentObj){
cg.zoomIn(currentObj); cg.zoomIn(currentObj);
} }
if(key == 40 && currentObj){ if(key == 40 && currentObj){
cg.zoomOut(currentObj); cg.zoomOut(currentObj);
} }
@ -71,14 +71,14 @@ cg.buildMinis = function(){
var buffer = ''; var buffer = '';
var imgString = "<img src='toons/IMG_URL' class='rc mini' alt='toons'></img>"; var imgString = "<img src='toons/IMG_URL' class='rc mini' alt='toons'></img>";
var link = "<a href=\"javascript:cg.createImage('toons/IMG_URL')\">"; var link = "<a href=\"javascript:cg.createImage('toons/IMG_URL')\">";
for(var i=0; i < miniUrls.length; i++){ for(var i=0; i < miniUrls.length; i++){
buffer += link.replace(/IMG_URL/, toonUrls[i]); buffer += link.replace(/IMG_URL/, toonUrls[i]);
buffer += imgString.replace(/IMG_URL/, miniUrls[i]) + '</a>'; buffer += imgString.replace(/IMG_URL/, miniUrls[i]) + '</a>';
} }
lib.append(buffer); lib.append(buffer);
//lib.append( $('#textTool').clone() ); //lib.append( $('#textTool').clone() );
$('#menuContainer').append( $('#instructs').clone() ); $('#menuContainer').append( $('#instructs').clone() );
} }
@ -89,13 +89,13 @@ cg.createImage = function(url){
scene.image(url, function(obj){ scene.image(url, function(obj){
obj.draggable = true; obj.draggable = true;
obj.setXY(30, 30); obj.setXY(30, 30);
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
scene.add(obj); scene.add(obj);
currentObj = obj; currentObj = obj;
scene.update(); scene.update();
@ -105,19 +105,19 @@ cg.createImage = function(url){
cg.createText = function(){ cg.createText = function(){
var txt = prompt("Adicione um texto:"); var txt = prompt("Adicione um texto:");
if(txt){ if(txt){
var obj = scene.text(txt, fontFamily, 26, 'black'); var obj = scene.text(txt, fontFamily, 26, 'black');
obj.setXY(40, 40); obj.setXY(40, 40);
obj.draggable = true; obj.draggable = true;
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
currentObj = obj; currentObj = obj;
scene.add(obj); scene.add(obj);
scene.update(); scene.update();
pop.play(); pop.play();
@ -128,19 +128,19 @@ cg.createTextFromInput = function(e){
var key = e.keyCode || e.which; var key = e.keyCode || e.which;
var txt = $('#newText').val(); var txt = $('#newText').val();
if(key == 13){ if(key == 13){
var obj = scene.text(txt, fontFamily, 26, 'black'); var obj = scene.text(txt, fontFamily, 26, 'black');
obj.setXY(40, 40); obj.setXY(40, 40);
obj.draggable = true; obj.draggable = true;
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
currentObj = obj; currentObj = obj;
scene.add(obj); scene.add(obj);
scene.update(); scene.update();
$('#newText').val(''); $('#newText').val('');
@ -164,10 +164,10 @@ cg.zoomOut = function(obj){
if(obj.w - w > 0 && obj.h - h > 0){ if(obj.w - w > 0 && obj.h - h > 0){
obj.w -= w; obj.w -= w;
obj.h -= h; obj.h -= h;
obj.x += (w/2); obj.x += (w/2);
obj.y += (h/2); obj.y += (h/2);
scene.update(); scene.update();
} }
} }
@ -175,13 +175,13 @@ cg.zoomOut = function(obj){
cg.zoomIn = function(obj){ cg.zoomIn = function(obj){
var w = obj.w * 0.05; var w = obj.w * 0.05;
var h = obj.h * 0.05; var h = obj.h * 0.05;
obj.w += w; obj.w += w;
obj.h += h; obj.h += h;
obj.x -= (w/2); obj.x -= (w/2);
obj.y -= (h/2); obj.y -= (h/2);
scene.update(); scene.update();
} }
@ -191,20 +191,20 @@ cg.hFlip = function(obj){
var tmpCtx = tmpCanvas.getContext('2d'); var tmpCtx = tmpCanvas.getContext('2d');
var w = tmpCanvas.width; var w = tmpCanvas.width;
var h = tmpCanvas.height; var h = tmpCanvas.height;
//save current size and position //save current size and position
var cW = obj.w, cH = obj.h, cX = obj.x, cY = obj.y; var cW = obj.w, cH = obj.h, cX = obj.x, cY = obj.y;
tmpCtx.translate(w/2, h/2); tmpCtx.translate(w/2, h/2);
tmpCtx.scale(-1, 1); tmpCtx.scale(-1, 1);
tmpCtx.drawImage(img, (-1*w/2), (-1*h/2)); tmpCtx.drawImage(img, (-1*w/2), (-1*h/2));
tmpCanvas.id = obj.getCanvas().id; tmpCanvas.id = obj.getCanvas().id;
obj.getCanvas().id = 'killme'; obj.getCanvas().id = 'killme';
RB.destroyCanvas('killme'); RB.destroyCanvas('killme');
d.body.appendChild(tmpCanvas); d.body.appendChild(tmpCanvas);
obj.setCanvas(tmpCanvas); obj.setCanvas(tmpCanvas);
obj.x=cX; obj.y=cY; obj.h=cH; obj.w=cW; obj.x=cX; obj.y=cY; obj.h=cH; obj.w=cW;
scene.update(); scene.update();
} }

View file

@ -1,65 +0,0 @@
<!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<EFBFBD>che bas&nbsp;:</b> r<>tr<74>cir</li>
<li><b>Fl<EFBFBD>che haut&nbsp;:</b> agrandir </li>
<li><b>Gauche/droite&nbsp;:</b> retournement horizontal</li>
<li><b>Del&nbsp;:</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>

View file

@ -15,7 +15,7 @@ scene.update();
var lib = $('#lib'); var lib = $('#lib');
var miniUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13_mini.png", "toon01_mini.png", "toon02_mini.png", "toon04_mini.png", "toon05_mini.png", "toon07_mini.png", "toon08_mini.png", "toon11_mini.png", "toon09_mini.png", "toon15_mini.png", "toon06_mini.png", "toon10_mini.png", "toon03_mini.png", "toon12_mini.png", "toon14_mini.png","affirmatif_mini.png","agace_mini.png","blagueur_bras_croises_mini.png","blagueur_bras_ecartes_mini.png","blagueur_doigt_leve_mini.png","blagueuse_mini.png","blase_mini.png","boude_mini.png","boudeur_mini.png","chasseur_mini.png","choque_mini.png","connard_mini.png","connard_avide_mini.png","connard_enoncant_mini.png","connard_menacant_mini.png","connard_pupitre_mini.png","depite_mini.png","desapointe_mini.png","desapointee_mini.png","effraye_mini.png","etonne_mini.png","facepalm_mini.png","facepalm2_mini.png","fache_mini.png","fbi_mini.png","festif_mini.png","guitare_mini.png","harpon_mini.png","heureux_mini.png","indigne_mini.png","inebranlable_mini.png","inebranlable2_mini.png","ironique_mini.png","journal_mini.png","journaliste_surpris_mini.png","joyeux_mini.png","lisant_mini.png","lisant_a_haute_voix_mini.png","la_mort_mini.png","marchant_mini.png","montre_du_doigt_mini.png","moqueur_mini.png","nauseeux_mini.png","negatif1_mini.png","negatif2_mini.png","negatif3_mini.png","negatif4_mini.png","negatif5_mini.png","non_mais_mini.png","paon_mini.png","pedant_mini.png","pensif_mini.png","pensive_mini.png","positif1_mini.png","positif2_mini.png","positif3_mini.png","positif4_mini.png","positif5_mini.png","psst_mini.png","sabre_laser_mini.png","scandalise_mini.png","se_cache_les_yeux_mini.png","souriante_mini.png","surarme_mini.png","surpris_mini.png","transpirant_mini.png","tsss_mini.png","vador_mini.png","vieille_dame_mini.png","voiture_mini.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1_mini.png", "ballon2_mini.png", "ballon3_mini.png", "ballon4_mini.png", "ballon5_mini.png","ballon6_mini.png"]; var miniUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13_mini.png", "toon01_mini.png", "toon02_mini.png", "toon04_mini.png", "toon05_mini.png", "toon07_mini.png", "toon08_mini.png", "toon11_mini.png", "toon09_mini.png", "toon15_mini.png", "toon06_mini.png", "toon10_mini.png", "toon03_mini.png", "toon12_mini.png", "toon14_mini.png","affirmatif_mini.png","agace_mini.png","blagueur_bras_croises_mini.png","blagueur_bras_ecartes_mini.png","blagueur_doigt_leve_mini.png","blagueuse_mini.png","blase_mini.png","boude_mini.png","boudeur_mini.png","chasseur_mini.png","choque_mini.png","connard_mini.png","connard_avide_mini.png","connard_enoncant_mini.png","connard_menacant_mini.png","connard_pupitre_mini.png","depite_mini.png","desapointe_mini.png","desapointee_mini.png","effraye_mini.png","etonne_mini.png","facepalm_mini.png","facepalm2_mini.png","fache_mini.png","fbi_mini.png","festif_mini.png","guitare_mini.png","harpon_mini.png","heureux_mini.png","indigne_mini.png","inebranlable_mini.png","inebranlable2_mini.png","ironique_mini.png","journal_mini.png","journaliste_surpris_mini.png","joyeux_mini.png","lisant_mini.png","lisant_a_haute_voix_mini.png","la_mort_mini.png","marchant_mini.png","montre_du_doigt_mini.png","moqueur_mini.png","nauseeux_mini.png","negatif1_mini.png","negatif2_mini.png","negatif3_mini.png","negatif4_mini.png","negatif5_mini.png","non_mais_mini.png","paon_mini.png","pedant_mini.png","pensif_mini.png","pensive_mini.png","positif1_mini.png","positif2_mini.png","positif3_mini.png","positif4_mini.png","positif5_mini.png","psst_mini.png","sabre_laser_mini.png","scandalise_mini.png","se_cache_les_yeux_mini.png","souriante_mini.png","surarme_mini.png","surpris_mini.png","transpirant_mini.png","tsss_mini.png","vador_mini.png","vieille_dame_mini.png","voiture_mini.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1_mini.png", "ballon2_mini.png", "ballon3_mini.png", "ballon4_mini.png", "ballon5_mini.png","ballon6_mini.png"];
var toonUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13.png", "toon01.png", "toon02.png", "toon04.png", "toon05.png", "toon07.png", "toon08.png", "toon11.png", "toon09.png", "toon15.png", "toon06.png", "toon10.png", "toon03.png", "toon12.png", "toon14.png", "affirmatif.png","agace.png","blagueur_bras_croises.png","blagueur_bras_ecartes.png","blagueur_doigt_leve.png","blagueuse.png","blase.png","boude.png","boudeur.png","chasseur.png","choque.png","connard.png","connard_avide.png","connard_ennoncant.png","connard_menacant.png","connard_pupitre.png","depite.png","desapointe.png","desapointee.png","effraye.png","etonne.png","facepalm.png","facepalm2.png","fache.png","fbi.png","festif.png","guitare.png","harpon.png","heureux.png","indigne.png","inebranlable.png","inebranlable2.png","ironique.png","journal.png","journaliste_surpris.png","joyeux.png","lisant.png","lisant_a_haute_voix.png","la_mort.png","marchant.png","montre_du_doigt.png","moqueur.png","nauseeux.png","negatif1.png","negatif2.png","negatif3.png","negatif4.png","negatif5.png","non_mais.png","paon.png","pedant.png","pensif.png","pensive.png","positif1.png","positif2.png","positif3.png","positif4.png","positif5.png","psst.png","sabre_laser.png","scandalise.png","se_cache_les_yeux.png","souriante.png","surarme.png","surpris.png","transpirant.png","tsss.png","vador.png","vieille_dame.png","voiture.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1.png", "ballon2.png", "ballon3.png", "ballon4.png", "ballon5.png", "ballon6.png"]; var toonUrls = ["fond1.png", "fond2.png", "fond3.png", "fond4.png", "toon13.png", "toon01.png", "toon02.png", "toon04.png", "toon05.png", "toon07.png", "toon08.png", "toon11.png", "toon09.png", "toon15.png", "toon06.png", "toon10.png", "toon03.png", "toon12.png", "toon14.png", "affirmatif.png","agace.png","blagueur_bras_croises.png","blagueur_bras_ecartes.png","blagueur_doigt_leve.png","blagueuse.png","blase.png","boude.png","boudeur.png","chasseur.png","choque.png","connard.png","connard_avide.png","connard_enoncant.png","connard_menacant.png","connard_pupitre.png","depite.png","desapointe.png","desapointee.png","effraye.png","etonne.png","facepalm.png","facepalm2.png","fache.png","fbi.png","festif.png","guitare.png","harpon.png","heureux.png","indigne.png","inebranlable.png","inebranlable2.png","ironique.png","journal.png","journaliste_surpris.png","joyeux.png","lisant.png","lisant_a_haute_voix.png","la_mort.png","marchant.png","montre_du_doigt.png","moqueur.png","nauseeux.png","negatif1.png","negatif2.png","negatif3.png","negatif4.png","negatif5.png","non_mais.png","paon.png","pedant.png","pensif.png","pensive.png","positif1.png","positif2.png","positif3.png","positif4.png","positif5.png","psst.png","sabre_laser.png","scandalise.png","se_cache_les_yeux.png","souriante.png","surarme.png","surpris.png","transpirant.png","tsss.png","vador.png","vieille_dame.png","voiture.png", "smiley01.png", "smiley02.png", "smiley03.png", "ballon1.png", "ballon2.png", "ballon3.png", "ballon4.png", "ballon5.png", "ballon6.png"];
cg.clearScreen = function(){ cg.clearScreen = function(){
ctx = c.getContext('2d'); ctx = c.getContext('2d');
@ -40,20 +40,20 @@ $(d).keyup(function(e){
RB.destroyCanvas( currentObj.getCanvas().id ); RB.destroyCanvas( currentObj.getCanvas().id );
currentObj = null; currentObj = null;
} }
if( currentObj && (key==37 || key==39) ){ if( currentObj && (key==37 || key==39) ){
cg.hFlip(currentObj); cg.hFlip(currentObj);
} }
}); });
$(d).keydown(function(event){ $(d).keydown(function(event){
var key = event.keyCode || event.which; var key = event.keyCode || event.which;
if(key == 38 && currentObj){ if(key == 38 && currentObj){
cg.zoomIn(currentObj); cg.zoomIn(currentObj);
} }
if(key == 40 && currentObj){ if(key == 40 && currentObj){
cg.zoomOut(currentObj); cg.zoomOut(currentObj);
} }
@ -71,14 +71,14 @@ cg.buildMinis = function(){
var buffer = ''; var buffer = '';
var imgString = "<img src='toons/IMG_URL' class='rc mini' alt='toons'></img>"; var imgString = "<img src='toons/IMG_URL' class='rc mini' alt='toons'></img>";
var link = "<a href=\"javascript:cg.createImage('toons/IMG_URL')\">"; var link = "<a href=\"javascript:cg.createImage('toons/IMG_URL')\">";
for(var i=0; i < miniUrls.length; i++){ for(var i=0; i < miniUrls.length; i++){
buffer += link.replace(/IMG_URL/, toonUrls[i]); buffer += link.replace(/IMG_URL/, toonUrls[i]);
buffer += imgString.replace(/IMG_URL/, miniUrls[i]) + '</a>'; buffer += imgString.replace(/IMG_URL/, miniUrls[i]) + '</a>';
} }
lib.append(buffer); lib.append(buffer);
//lib.append( $('#textTool').clone() ); //lib.append( $('#textTool').clone() );
$('#menuContainer').append( $('#instructs').clone() ); $('#menuContainer').append( $('#instructs').clone() );
} }
@ -89,13 +89,13 @@ cg.createImage = function(url){
scene.image(url, function(obj){ scene.image(url, function(obj){
obj.draggable = true; obj.draggable = true;
obj.setXY(30, 30); obj.setXY(30, 30);
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
scene.add(obj); scene.add(obj);
currentObj = obj; currentObj = obj;
scene.update(); scene.update();
@ -105,19 +105,19 @@ cg.createImage = function(url){
cg.createText = function(){ cg.createText = function(){
var txt = prompt("Adicione um texto:"); var txt = prompt("Adicione um texto:");
if(txt){ if(txt){
var obj = scene.text(txt, fontFamily, 26, 'black'); var obj = scene.text(txt, fontFamily, 26, 'black');
obj.setXY(40, 40); obj.setXY(40, 40);
obj.draggable = true; obj.draggable = true;
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
currentObj = obj; currentObj = obj;
scene.add(obj); scene.add(obj);
scene.update(); scene.update();
pop.play(); pop.play();
@ -128,19 +128,19 @@ cg.createTextFromInput = function(e){
var key = e.keyCode || e.which; var key = e.keyCode || e.which;
var txt = $('#newText').val(); var txt = $('#newText').val();
if(key == 13){ if(key == 13){
var obj = scene.text(txt, fontFamily, 26, 'black'); var obj = scene.text(txt, fontFamily, 26, 'black');
obj.setXY(40, 40); obj.setXY(40, 40);
obj.draggable = true; obj.draggable = true;
obj.onmousedown = function(e){ obj.onmousedown = function(e){
currentObj = obj; currentObj = obj;
scene.zIndex(obj, 1); scene.zIndex(obj, 1);
scene.update(); scene.update();
} }
currentObj = obj; currentObj = obj;
scene.add(obj); scene.add(obj);
scene.update(); scene.update();
$('#newText').val(''); $('#newText').val('');
@ -164,10 +164,10 @@ cg.zoomOut = function(obj){
if(obj.w - w > 0 && obj.h - h > 0){ if(obj.w - w > 0 && obj.h - h > 0){
obj.w -= w; obj.w -= w;
obj.h -= h; obj.h -= h;
obj.x += (w/2); obj.x += (w/2);
obj.y += (h/2); obj.y += (h/2);
scene.update(); scene.update();
} }
} }
@ -175,13 +175,13 @@ cg.zoomOut = function(obj){
cg.zoomIn = function(obj){ cg.zoomIn = function(obj){
var w = obj.w * 0.05; var w = obj.w * 0.05;
var h = obj.h * 0.05; var h = obj.h * 0.05;
obj.w += w; obj.w += w;
obj.h += h; obj.h += h;
obj.x -= (w/2); obj.x -= (w/2);
obj.y -= (h/2); obj.y -= (h/2);
scene.update(); scene.update();
} }
@ -191,20 +191,20 @@ cg.hFlip = function(obj){
var tmpCtx = tmpCanvas.getContext('2d'); var tmpCtx = tmpCanvas.getContext('2d');
var w = tmpCanvas.width; var w = tmpCanvas.width;
var h = tmpCanvas.height; var h = tmpCanvas.height;
//save current size and position //save current size and position
var cW = obj.w, cH = obj.h, cX = obj.x, cY = obj.y; var cW = obj.w, cH = obj.h, cX = obj.x, cY = obj.y;
tmpCtx.translate(w/2, h/2); tmpCtx.translate(w/2, h/2);
tmpCtx.scale(-1, 1); tmpCtx.scale(-1, 1);
tmpCtx.drawImage(img, (-1*w/2), (-1*h/2)); tmpCtx.drawImage(img, (-1*w/2), (-1*h/2));
tmpCanvas.id = obj.getCanvas().id; tmpCanvas.id = obj.getCanvas().id;
obj.getCanvas().id = 'killme'; obj.getCanvas().id = 'killme';
RB.destroyCanvas('killme'); RB.destroyCanvas('killme');
d.body.appendChild(tmpCanvas); d.body.appendChild(tmpCanvas);
obj.setCanvas(tmpCanvas); obj.setCanvas(tmpCanvas);
obj.x=cX; obj.y=cY; obj.h=cH; obj.w=cW; obj.x=cX; obj.y=cY; obj.h=cH; obj.w=cW;
scene.update(); scene.update();
} }