Advertisement
Guest User

Untitled

a guest
Dec 10th, 2019
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $diff ~/test/phaser3-optimal-resolution/src/game.js src/game.js
  2. 5c5,7
  3. < const DPR = window.devicePixelRatio
  4. ---
  5. > const graphicsSettings = { best: 1, medium: 0.75, low: 0.5 };
  6. > const DPR = window.devicePixelRatio * graphicsSettings.best;
  7. >
  8. 8c10,11
  9. < // base resolution is 360x640 @4
  10. ---
  11. >
  12. > // base resolution is 640x480 @4
  13. 13c16
  14. < export const assetsDPR = roundHalf(Math.min(Math.max(HEIGHT / 360, 1), 4))
  15. ---
  16. > export const assetsDPR = roundHalf(Math.min(Math.max(HEIGHT / 480, 1), 4))
  17.  
  18.  
  19.  
  20.  
  21. $ diff ~/test/phaser3-optimal-resolution/src/mainScene.js src
  22. 10c10
  23. <     this.load.atlas('atlas', `src/atlas/atlas-@${assetsDPR}.png`, `src/atlas/atlas-@${assetsDPR}.json`)
  24. ---
  25. >     this.load.multiatlas("bigBackground", `src/atlas/pdw1A@${assetsDPR}.json`, "src/atlas");
  26. 19,21c19,22
  27. <     const zombie = new Sprite(this, width / 3, height, 'atlas', 'zombie').setOrigin(0.5, 1)
  28. <     const robot = new Sprite(this, width / 3, height, 'atlas', 'robot').setOrigin(0.5, 1)
  29. <     robot.setX(width - 100)
  30. ---
  31. >     //const zombie = new Sprite(this, width / 3, height, 'atlas', 'zombie').setOrigin(0.5, 1)
  32. >     //const robot = new Sprite(this, width / 3, height, 'atlas', 'robot').setOrigin(0.5, 1)
  33. >     //robot.setX(width - 100)
  34. >         this.background  = new Sprite(this, 0,0, "bigBackground", "road2test").setOrigin(0,0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement