Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PIXI 扫盲 #34

Open
XJIANBIN opened this issue Jan 16, 2020 · 0 comments
Open

PIXI 扫盲 #34

XJIANBIN opened this issue Jan 16, 2020 · 0 comments

Comments

@XJIANBIN
Copy link
Owner

XJIANBIN commented Jan 16, 2020

  • app.stage 舞台,一个容器对象
  • 精灵,放在舞台里面
  • PIXI用webgl和GPU渲染图像,而GPU处理的图像叫做纹理,PIXI同时设计了纹理缓存来提升效率
  • 如何转换成纹理
PIXI.loader
  .add("images/anyImage.png")
  .load(setup); // setup是回调
  • Loader对象用来加载图像
  • PIXI.loader.resources["images/anyImage.png"].texture 返回图像资源
  • 从雪碧图加载精灵(通过矩形块去截取雪碧图来创建精灵的纹理,texture.frame = rectangle)
  • 使用一个纹理贴图集来加载精灵
  • 使用Pixi的ticker。这被称为 游戏循环 。任何在游戏循环里的代码都会1秒更新60次
  • Pixi有一个对象叫 Container,可以用来给精灵分组
  • Pixi有一个额外的,高性能的方式去分组精灵的方法称作:ParticleContainer(PIXI.ParticleContainer)。任何在ParticleContainer 里的精灵都会比在一个普通的Container的渲染速度快2到5倍。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant