Advertisement
Redomine

Untitled

Aug 30th, 2020
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. async function draw(data){
  2. if (render_mode === "map") {
  3. for (i in data.star_systems) {
  4. img.star = new Image();
  5. img.star.src = '/img' + '/stars' + data.star_systems[i][2];
  6. star_size = data.star_systems[i][5];
  7. star_x = data.star_systems[i][3];
  8. star_y = data.star_systems[i][4];
  9. star_name = data.star_systems[i][1];
  10. let promise = new Promise ((resolve, reject) => {
  11. buffer_ctx.drawImage(img.star,star_x - star_size,star_y - star_size, star_size, star_size);
  12. buffer_ctx.fillText(star_name, star_x - star_size,star_y+30 - star_size);
  13. })
  14. console.log(1);
  15. await promise
  16. console.log(2);
  17. }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement