flackr / dungeon

A D&D based multiplayer role playing game.
13 stars 4 forks source link

Game does not draw correctly after loading textures. #9

Closed flackr closed 12 years ago

flackr commented 12 years ago

Summary.

There is a race in the game in that images are loaded asynchronously. The result is that before the images have been loaded they draw black and you have to scroll the map to see them. We should be updating after the images have loaded.

Implementation

In dungeon-client.js whenever we construct a new Image we should have an onload handler. We can either detect when all loading images have loaded, or we can redraw after each image has loaded. This will eliminate the occasional black screens that you can see.

flackr commented 12 years ago

Resolved by making sure that multiple calls to update would only cause one redraw and binding update to the onload of texture images.