Comments (5)
Thank you.
Fixed. Please try it again. Have fun.
from phaser-catch-the-cat.
其实可以手动设置 canvas 的宽度和高度,这个 js 只是一个游戏的 js,具体怎么调整 canvas,可以自己使用额外的代码
from phaser-catch-the-cat.
phaser-catch-the-cat/public/index.html
Line 28 in 7619feb
你可以看到,游戏是这样初始化的。
from phaser-catch-the-cat.
@Coxxs 你有什么代码方面的建议吗?或者提交一个 Pull Request ?
from phaser-catch-the-cat.
我找到篇相关资料:https://supernapie.com/blog/support-retina-with-phaser-3 ,因为这个游戏用的都是 svg 素材,可能只需要稍微修改 Phaser 3 的初始化代码即可。
let config = {
...
width: window.innerWidth * window.devicePixelRatio, // set game width by multiplying window width with devicePixelRatio
height: window.innerHeight * window.devicePixelRatio, // set game height by multiplying window height with devicePixelRatio
...
zoom: 1 / window.devicePixelRatio, // Set the zoom to the inverse of the devicePixelRatio
...
};
另外为了兼容旧版浏览器,建议这样使用 window.devicePixelRatio:
window.devicePixelRatio || 1
文章里还有些其他建议,可以参考下。
from phaser-catch-the-cat.
Related Issues (10)
- 滿有趣的 nice
- how to change circle color HOT 3
- how can vin? HOT 1
- catch-the-cat.js能提供源吗? HOT 2
- 哪里来的声音对象啊??? HOT 1
- 之前看过一个版本猫移动的时候是有一个爬过去的动作的请问怎么实现 HOT 2
- 如何自适应画布 HOT 3
- 询问本项目的licence HOT 1
- Configure difficulty HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phaser-catch-the-cat.