Giter VIP home page Giter VIP logo

spritewithhue's Introduction

SpriteWithHue


这个类主要实现的功能是对cocos2d::Sprite色调的修改,从而达到一套纹理可以重复利用的目的,特别对于一些只需在颜色上换装的游戏来说,真是大大的福利。

这是我从CCSpriteWithHue Github扒过来,从Cocos2d-iphone移植到Cocos2d-x,并进行了适当的修改。

感谢原作者Alex314

实现的效果如图:

支持Sprite以及Animtion。使用的引擎版本是Cocos2d-x v3.5 Final

测试例如图:

SpriteWithHue

SpriteWithHueAnimation

使用方式很简单,和cocos2d::Sprite一样,只是多了一个 setHue(float hue)接口用于设置色调,范围处于0~2π。

示例代码:

	auto alien = SpriteWithHue::create("alien.png");
	alien->setPosition(Vec2(100, 100));
	alien->setHue(M_PI);
	this->addChild(alien);

实现以及测试例在https://github.com/fusijie/SpriteWithHue

spritewithhue's People

Contributors

bryant1410 avatar fusijie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spritewithhue's Issues

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.