mirror of
https://github.com/gwenhael-le-moine/c-urs_-toil-s.git
synced 2025-01-14 08:01:19 +01:00
OMG with colors and ungodly slowliness
This commit is contained in:
parent
ff42619fcd
commit
1153e88fd6
2 changed files with 40 additions and 2 deletions
|
@ -27,7 +27,18 @@
|
|||
</header>
|
||||
|
||||
<div id="main" role="main">
|
||||
<pre id="blackboard"></pre>
|
||||
<style>
|
||||
#blackboard{background:#333}
|
||||
.starcell{width:1em;height:1em;display:block;float:left}
|
||||
.selected{font-weight:bold}
|
||||
.wall{color:#000}
|
||||
.ball{color:#99f}
|
||||
.cube{color:red}
|
||||
.gift{color:yellow}
|
||||
.void{}
|
||||
.selected{background:#555}
|
||||
</style>
|
||||
<p id="blackboard"></p>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
|
|
|
@ -91,7 +91,34 @@ function won_or_not( state ) {
|
|||
function format_level( state ) {
|
||||
dl = "";
|
||||
for ( i = 0 ; i < LEVEL_HEIGHT ; i++ ) {
|
||||
dl = dl + (state.board).substr( i*LEVEL_WIDTH, LEVEL_WIDTH ) + "\n";
|
||||
for ( j = 0 ; j < LEVEL_WIDTH ; j++ ) {
|
||||
c = get_cell( state, j, i );
|
||||
classes = "starcell";
|
||||
if ( state.moving == c) {
|
||||
classes = classes + " selected";
|
||||
}
|
||||
switch( c ) {
|
||||
case cell.BALL:
|
||||
classes = classes + " ball";
|
||||
break;
|
||||
case cell.CUBE:
|
||||
classes = classes + " cube";
|
||||
break;
|
||||
case cell.WALL:
|
||||
classes = classes + " wall";
|
||||
break;
|
||||
case cell.VOID:
|
||||
classes = classes + " void";
|
||||
break;
|
||||
case cell.GIFT:
|
||||
classes = classes + " gift";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
dl = dl + "<span class=\"" + classes + "\">" + c + "</span>"
|
||||
}
|
||||
dl = dl + "<br />"
|
||||
}
|
||||
return dl;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue