thread safe(lol :)) light ui

This commit is contained in:
garrettdreyfus 2014-05-24 12:48:46 -04:00
parent 154eea7a1b
commit 7c8830472a
2 changed files with 10 additions and 9 deletions

View file

@ -15,7 +15,7 @@
body { body {
color: #ecf0f1; color: #ecf0f1;
font-family: 'Roboto', sans-serif; font-family: 'Roboto', sans-serif;
background-color:#2c3e50; background-color:#ecf0f1;
} }
#clickToExit { #clickToExit {
@ -27,13 +27,14 @@
left: calc(50% - 80vmin / 2); left: calc(50% - 80vmin / 2);
height: 80vmin; height: 80vmin;
width: 80vmin; width: 80vmin;
background: -webkit-radial-gradient(#2980b9 35%, rgba(44,62,80,50) 68%); background-color:#ecf0f1;
z-index:3; z-index:3;
} }
#title { #title {
z-index:99999; z-index:99999;
margin-top:20px; margin-top:20px;
color:#2c3e50;
} }
</style> </style>
</head> </head>
@ -58,4 +59,4 @@
<script type = 'text/javascript' src="js/main.js"></script> <script type = 'text/javascript' src="js/main.js"></script>
<script type = 'text/javascript' src="js/analytics.js"></script> <script type = 'text/javascript' src="js/analytics.js"></script>
</body> </body>
</html> </html>

View file

@ -1,4 +1,3 @@
var deleting;
function search(twoD,oneD){ function search(twoD,oneD){
for(var i=0;i<twoD.length;i++){ for(var i=0;i<twoD.length;i++){
if(twoD[i][0] == oneD[0] && twoD[i][1] == oneD[1]) { if(twoD[i][0] == oneD[0] && twoD[i][1] == oneD[1]) {
@ -7,9 +6,9 @@ function search(twoD,oneD){
} }
return false; return false;
} }
function floodFill(clock,side,index) { function floodFill(clock,side,index,deleting) {
if(clock.blocks[side] === undefined || clock.blocks[side][index] === undefined){return;} if(clock.blocks[side] === undefined || clock.blocks[side][index] === undefined){return;}
var color = clock.blocks[side][index].color; var color = clock.blocks[side][index].color;
for(var x =-1;x<2;x++){ for(var x =-1;x<2;x++){
for(var y =-1;y<2;y++){ for(var y =-1;y<2;y++){
if(Math.abs(x)==Math.abs(y)){continue;} if(Math.abs(x)==Math.abs(y)){continue;}
@ -17,7 +16,7 @@ function floodFill(clock,side,index) {
if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y] !== undefined){ if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y] !== undefined){
if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y].color == color && search(deleting,[(side+x+clock.sides)%clock.sides,index+y]) === false) { if(clock.blocks[(side+x+clock.sides)%clock.sides][index+y].color == color && search(deleting,[(side+x+clock.sides)%clock.sides,index+y]) === false) {
deleting.push([(side+x+clock.sides)%clock.sides,index+y]); deleting.push([(side+x+clock.sides)%clock.sides,index+y]);
floodFill(clock,(side+x+clock.sides)%clock.sides,index+y); floodFill(clock,(side+x+clock.sides)%clock.sides,index+y,deleting);
} }
} }
} }
@ -25,9 +24,10 @@ function floodFill(clock,side,index) {
} }
function consolidateBlocks(clock,side,index){ function consolidateBlocks(clock,side,index){
var sidesChanged =[]; var sidesChanged =[];
deleting=[]; var deleting=[];
deleting.push([side,index]); deleting.push([side,index]);
floodFill(clock,side,index);
floodFill(clock,side,index,deleting);
var deleteList= deleting; var deleteList= deleting;
if(deleteList.length<3){return;} if(deleteList.length<3){return;}
var i; var i;