Racing conditions at loading time fixed

This commit is contained in:
Mal 2023-09-17 14:29:42 +02:00
parent 593d323aff
commit 349792f916
2 changed files with 9 additions and 9 deletions

View File

@ -18,7 +18,7 @@
</style> </style>
<link rel="shortcut icon" type="image/png" href="favicon.png"> <link rel="shortcut icon" type="image/png" href="favicon.png">
<link rel="stylesheet" type="text/css" href="tilorswift/style.css"> <link rel="stylesheet" type="text/css" href="tilorswift/style.css">
<script type="module" src="js/module.js"></script> <script type="module" src="js/module.js" defer></script>
</head> </head>
<body> <body>
<canvas id="canvas"></canvas> <canvas id="canvas"></canvas>

View File

@ -56,13 +56,6 @@ class Game
this.loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png'); this.loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-left.png');
new FrameRateMeasurer(); new FrameRateMeasurer();
window.addEventListener(
'imagesloaded',
() => {
this.init();
}
);
} }
render(timestamp) render(timestamp)
@ -293,4 +286,11 @@ const level = Level.createFromFile(
); );
let game = new Game(level); let game = new Game(level);
window.addEventListener(
'imagesloaded',
() => {
game.init(mainLoop); game.init(mainLoop);
}
);