Merge branch 'unstable' of https://github.com/jsmaniac/2011-m1s2-ter into unstable

This commit is contained in:
Yoann 2011-04-28 18:15:27 +02:00
commit cc5b862248
36 changed files with 56 additions and 36 deletions

View File

@ -52,6 +52,8 @@ body {
<script src="ressources/pticlic.js"></script>
</head>
<body>
<div class="screen" id="logo">
</div>
<div class="screen" id="game">
<div id="mc-caption-block"></div>
<div id="mn-caption-block"></div>
@ -64,19 +66,19 @@ body {
<span id="title">PtiClic</span>
<div class="frontpage-button game">
<div><img class="icon" alt="" src="ressources/img/mode_normal.png" /></div>
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
<div class="text">Jouer</div>
</div>
<div class="frontpage-button prefs">
<div><img class="icon" alt="" src="ressources/img/config.png" /></div>
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
<div class="text">Configuration</div>
</div>
<div class="frontpage-button connection">
<div><img class="icon" alt="" src="ressources/img/config.png" /></div>
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
<div class="text">Connexion</div>
</div>
<div class="frontpage-button about">
<div><img class="icon" alt="" src="ressources/img/rel/default.png" /></div>
<div><img class="icon" alt="" src="ressources/img/72/default.png" /></div>
<div class="text">A Propos</div>
</div>
</div>
@ -87,7 +89,7 @@ body {
</div>
<div id="templates" style="display: none;">
<div class="relationBox">
<div class="relation"><img class="icon" alt="" src="ressources/img/rel/default.png" /><span class="text"></span></div>
<div class="relation"><img class="icon" alt="" src="ressources/img/72/default.png" /><span class="text"></span></div>
<div class="clearboth"></div>
</div>
<div class="scoreLine">

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

Before

Width:  |  Height:  |  Size: 7.4 KiB

After

Width:  |  Height:  |  Size: 7.4 KiB

View File

Before

Width:  |  Height:  |  Size: 5.9 KiB

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

Before

Width:  |  Height:  |  Size: 7.6 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 7.7 KiB

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -4,7 +4,7 @@ Number.prototype.clip = function(min, max, floor) {
} catch(e) {alert("Error Number.prototype.clip");alert(e);}
};
function dichotomy(start, isBigger) {
function dichotomy(start, isBigger, foo) {
try {
var i = 0, min = 0, max, half;
@ -57,7 +57,7 @@ $.fn.fitFont = function(w, h, minFont, maxFont) {
fubar = wrappers;
return (wrappers.maxHeight() > h || wrappers.maxWidth() > w);
} catch(e) {alert("Error anonymous in $.fn.fitFont");alert(e);}
}).clip(minFont || 0, maxFont || Infinity));
},this).clip(minFont || 0, maxFont || Infinity));
// Restore stuff
this.css("position", oldpos);

View File

@ -5,10 +5,12 @@ function State(init) {
if (!this.screen) this.screen = 'frontpage';
} catch(e) {alert("Error State");alert(e);}
};
var futureHashChange = null;
State.prototype.commit = function() {
try {
location.hash="#"+encodeURI($.JSON.encode(this));
return this;
futureHashChange = "#"+encodeURI($.JSON.encode(this));
location.hash = futureHashChange;
return this;
} catch(e) {alert("Error State.prototype.commit");alert(e);}
};
State.prototype.get = function(key) {
@ -41,37 +43,47 @@ var oldScreen = '';
var ui = {};
function hashchange() {
try {
var stateJSON = decodeURI(location.hash.substring(location.hash.indexOf("#") + 1));
state = new State($.parseJSON(stateJSON)).validate();
if (futureHashChange === location.hash) {
futureHashChange = null;
} else {
var stateJSON = decodeURI(location.hash.substring(location.hash.indexOf("#") + 1));
state = new State($.parseJSON(stateJSON)).validate();
}
} catch(e) {alert("Error hashchange");alert(e);}
}
// ==== JavaScript Style général
function jss() {
try {
var w = $(window).width();
var h = $(window).height();
var iconSize;
if (h > 600) iconSize = 72;
else if(h > 500) iconSize = 48;
else iconSize = 36;
$(".screen")
.wh(w, h)
.northWest({top:0,left:0});
$("body, html")
.css({
padding: 0,
margin: 0,
overflow: "hidden",
textAlign: "left"
var w = $(window).width();
var h = $(window).height();
var iconSize;
if (h > 600) iconSize = 72;
else if(h > 500) iconSize = 48;
else iconSize = 36;
$(".screen")
.wh(w, h)
.northWest({top:0,left:0});
$("body, html")
.css({
padding: 0,
margin: 0,
overflow: "hidden",
textAlign: "left"
});
$(".screen").hide();
$("#"+state.screen+".screen").show();
if (window[state.screen] && window[state.screen].jss) window[state.screen].jss(w, h, iconSize);
$("img.icon").each(function(i,e) {
e=$(e);
if (typeof(e.data('image')) != 'undefined')
e.attr("src", "ressources/img/"+iconSize+"/"+e.data('image')+".png");
});
$(".screen").hide();
$("#"+state.screen+".screen").show();
if (window[state.screen] && window[state.screen].jss) window[state.screen].jss(w, h, iconSize);
} catch(e) {alert("Error jss");alert(e);}
}
// ==== Interface Android
@ -87,7 +99,7 @@ function UI () {
show: function(title, text) {},
dismiss: function() {},
exit: function() {},
log: function() {},
log: function(msg) { window.console && console.log(msg); },
setScreen: function() {}
};
}
@ -141,8 +153,15 @@ frontpage.jss = function(w, h, iconSize) {
$fp(".text")
.fitFont(buttonWidth, labelHeight, 10);
$fp(".icon")
.wh(iconSize);
$fp(".game .icon").data('image', 'mode_normal');
$fp(".prefs .icon").data('image', 'config');
$fp(".connection .icon").data('image', 'config');
$fp(".about .icon").data('image', 'aide');
$fp(".frontpage-button")
.css('text-align', 'center')
.width(buttonWidth);
@ -266,7 +285,6 @@ game.enter = function () {
} else {
game.buildUi();
}
jss();
} catch(e) {alert("Error game.enter");alert(e);}
};
@ -290,7 +308,7 @@ game.buildUi = function () {
.html(relation.name.replace(/%(m[cn])/g, '<span class="$1"/>'))
.end()
.find(".icon")
.attr("src", "ressources/img/rel/"+relation.id+".png")
.data("image",relation.id)
.end()
.click(function(e) {
game.nextWord({left:e.pageX, top:e.pageY}, this);