Affichage du splash au démarrage de l'application.

This commit is contained in:
Georges Dupéron 2011-04-28 23:07:01 +02:00
parent cf7054935b
commit 2f814043db
3 changed files with 52 additions and 8 deletions

View File

@ -9,10 +9,15 @@ body {
}
.screen {
background-color : #FFFFE0;
background-color: #FFFFE0;
display: none;
}
#splash.screen {
background-color: #000;
display: block;
}
#mc-caption {
color: #8b4;
}
@ -52,7 +57,8 @@ body {
<script src="ressources/pticlic.js"></script>
</head>
<body>
<div class="screen" id="logo">
<div class="screen" id="splash">
<img src="ressources/img/splash.png" />
</div>
<div class="screen" id="game">
<div id="mc-caption-block"></div>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 95 KiB

View File

@ -2,7 +2,7 @@
function State(init) {
try {
$.extend(this, init || {});
if (!this.screen) this.screen = 'frontpage';
if (!this.screen) this.screen = 'splash';
} catch(e) {alert("Error State");alert(e);}
};
var futureHashChange = null;
@ -88,6 +88,7 @@ function jss() {
});
} catch(e) {alert("Error jss");alert(e);}
}
// ==== Interface Android
function UI () {
try {
@ -127,6 +128,40 @@ function ajaxError(x) {
} catch(e) {alert("Error ajaxError");alert(e);}
}
// ==== Code métier pour le splash
splash = {};
splash.jss = function(w,h,iconSize) {
try {
var splashW = 320;
var splashH = 480;
var ratio = Math.min(w / splashW, h / splashH);
$('#splash.screen img')
.wh(splashW * ratio, splashH * ratio)
.center($('#splash.screen').center());
} catch(e) {alert("Error splash.jss");alert(e);}
}
splash.enter = function() {
// Si l'application est déjà chargée, on zappe directement jusqu'à la frontpage.
if (runstate.skipSplash) {
splash.click.goFrontpage();
} else {
runstate.skipSplash = true;
jss();
$('#splash.screen').clickOnce(splash.click.goFrontpage);
}
}
splash.click = {};
splash.click.goFrontpage = function() {
try {
UI().show("PtiClic", "Chargement…");
state.set('screen', 'frontpage').validate();
} catch(e) {alert("Error splash.click.goFrontpage");alert(e);}
};
// ==== Code métier pour la frontpage
frontpage = {};
@ -458,12 +493,15 @@ score.ui = function () {
.appendTo("#score .scores");
} catch(e) {alert("Error anonymous 1 in score.ui");alert(e);}
});
$("#score #jaivu").clickOnce(function() {
try {
state = new State().validate();
} catch(e) {alert("Error anonymous 2 in score.ui");alert(e);}
});
$("#score #jaivu").clickOnce(score.click.jaivu);
jss();
UI().dismiss();
} catch(e) {alert("Error score.ui");alert(e);}
}
score.click = {};
score.click.jaivu = function() {
try {
state = new State().validate();
} catch(e) {alert("Error score.click.jaivu");alert(e);}
};