GithubHelp home page GithubHelp logo

garvinpanda / cocoscreator-multi-resolution-adapter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zhitaocai/cocoscreator-multi-resolution-adapter

0.0 1.0 0.0 42.71 MB

Cocos Creator 多分辨率适配方案

Home Page: https://www.jianshu.com/p/c34577e37dd5

License: MIT License

TypeScript 100.00%

cocoscreator-multi-resolution-adapter's Introduction

Cocos Creator 多分辨率完美适配演示项目

效果预览

使用说明

场景如下:

  1. Canvas 开启 SHOW ALL 模式,并设置你的设计分辨率,如:这里例子为 720 x 1280

  2. Background 背景节点实现 SHOW ALL 模式下 缩放适配 ,操作如下:

    1. Background 背景节点保持和设计分辨率一致的宽高(不能用 Widget 组件)
    2. Background 背景节点挂入 BackgroundAdapter.ts 组件

    操作后结果如下:

  3. Content 内容节点实现 SHOW ALL 模式下 尺寸适配(实质为宽高重置),操作如下:

    1. Content 内容节点保持和设计分辨率一致的宽高(不能用 Widget 组件)
    2. Content 节点挂入 ContentAdapter.ts 组件
    3. 需要实现尺寸适配的节点,直接挂在本节点下就可以,同时子节点可以正常开发使用,比如:直接用 Widget 组件实现撑满父节点范围也是支持的

    操作后结果如下:

更多

本系列教程指引:

  1. Cocos Creator 多分辨率完美适配系列-1(现状与最终效果)
  2. Cocos Creator 多分辨率完美适配系列-2(部署验证设置)
  3. Cocos Creator 多分辨率完美适配系列-3(背景适配实现)
  4. Cocos Creator 多分辨率完美适配系列-4(内容适配实现)
  5. Cocos Creator 多分辨率完美适配系列-5(贴边栏动画实现)
  6. Cocos Creator 多分辨率完美适配系列-6(刘海屏适配)
  7. Cocos Creator 多分辨率完美适配系列-7(封装库使用)

微信小游戏全面屏适配

  1. 全屏适配参考上面章节
  2. 下面为全屏屏顶部适配效果图,具体实现参考 WXGameTopBarUIAdapter.ts

支持一下作者吧

LICENSE

MIT License

Copyright (c) 2019 Zhitao Cai

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

cocoscreator-multi-resolution-adapter's People

Contributors

zhitaocai avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.