mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-21 20:46:14 -04:00
Styles refactor
This commit is contained in:
parent
2e3ab3011f
commit
7e3750c915
9 changed files with 419 additions and 416 deletions
|
@ -1,15 +1,5 @@
|
|||
import {RawLevel} from "./types";
|
||||
|
||||
export function hashCode(string: string) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
let code = string.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + code;
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
||||
import _backgrounds from "./backgrounds.json";
|
||||
const backgrounds = _backgrounds as string[];
|
||||
|
||||
|
@ -21,4 +11,15 @@ export function getLevelBackground(level:RawLevel){
|
|||
svg = backgrounds[hashCode(level.name) % backgrounds.length];
|
||||
}
|
||||
return svg
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
export function hashCode(string: string) {
|
||||
let hash = 0;
|
||||
for (let i = 0; i < string.length; i++) {
|
||||
let code = string.charCodeAt(i);
|
||||
hash = (hash << 5) - hash + code;
|
||||
hash = hash & hash; // Convert to 32bit integer
|
||||
}
|
||||
return Math.abs(hash);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue