Skip to content

Commit c2e75a2

Browse files
committed
Rename Color4B to Color32
1 parent af4e62e commit c2e75a2

File tree

131 files changed

+638
-637
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

131 files changed

+638
-637
lines changed

cmake/Modules/AXBuildSet.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ endif()
3232

3333
# import minimal axslcc.cmake for shader compiler support
3434
# the function: ax_target_compile_shaders avaiable from it
35-
set(AXSLCC_FIND_PROG_ROOT "${_AX_ROOT}/tools/external/axslcc" "$ENV{AX_ROOT}/tools/external/axslcc")
35+
set(AXSLCC_FIND_PROG_ROOT "${_AX_ROOT}/tools/external/axslcc")
3636
include(AXSLCC)
3737

3838
# include helper functions

core/2d/FastTMXLayer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ void FastTMXLayer::updateTotalQuads()
499499
_tileToQuadIndex.resize(int(_layerSize.width * _layerSize.height), -1);
500500
_indicesVertexZOffsets.clear();
501501

502-
auto color = Color4B::WHITE;
502+
auto color = Color32::WHITE;
503503
color.a = getDisplayedOpacity();
504504

505505
if (_texture->hasPremultipliedAlpha())

core/2d/Label.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ void Label::reset()
618618
_vAlignment = TextVAlignment::TOP;
619619

620620
_effectColor = Color::BLACK;
621-
_textColor = Color4B::WHITE;
621+
_textColor = Color32::WHITE;
622622
_textColorF = Color::WHITE;
623623
setColor(Color3B::WHITE);
624624

@@ -1343,7 +1343,7 @@ void Label::scaleFontSize(float fontSize)
13431343
}
13441344
}
13451345

1346-
void Label::enableGlow(const Color4B& glowColor)
1346+
void Label::enableGlow(const Color32& glowColor)
13471347
{
13481348
if (_currentLabelType == LabelType::TTF)
13491349
{
@@ -1364,7 +1364,7 @@ void Label::enableGlow(const Color4B& glowColor)
13641364
}
13651365
}
13661366

1367-
void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 */)
1367+
void Label::enableOutline(const Color32& outlineColor, int outlineSize /* = -1 */)
13681368
{
13691369
AXASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF,
13701370
"Only supported system font and TTF!");
@@ -1406,7 +1406,7 @@ void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 *
14061406
}
14071407
}
14081408

1409-
void Label::enableShadow(const Color4B& shadowColor /* = Color4B::BLACK */,
1409+
void Label::enableShadow(const Color32& shadowColor /* = Color32::BLACK */,
14101410
const Vec2& offset /* = Vec2(2 ,-2)*/,
14111411
int /* blurRadius = 0 */)
14121412
{
@@ -1465,7 +1465,7 @@ void Label::enableBold()
14651465
if (!_boldEnabled)
14661466
{
14671467
// bold is implemented with outline
1468-
enableShadow(Color4B::WHITE, Vec2(0.9f, 0), 0);
1468+
enableShadow(Color32::WHITE, Vec2(0.9f, 0), 0);
14691469
// add one to kerning
14701470
setAdditionalKerning(_additionalKerning + 1);
14711471
_boldEnabled = true;
@@ -1805,7 +1805,7 @@ void Label::updateContent()
18051805
_debugDrawNode->clear();
18061806
Vec2 vertices[4] = {Vec2::ZERO, Vec2(_contentSize.width, 0.0f), Vec2(_contentSize.width, _contentSize.height),
18071807
Vec2(0.0f, _contentSize.height)};
1808-
_debugDrawNode->drawPoly(vertices, 4, true, Color4B::WHITE);
1808+
_debugDrawNode->drawPoly(vertices, 4, true, Color32::WHITE);
18091809
#endif
18101810
}
18111811

@@ -2423,7 +2423,7 @@ void Label::updateDisplayedOpacity(uint8_t parentOpacity)
24232423
// FIXME: it is not clear what is the difference between setTextColor() and setColor()
24242424
// if setTextColor() only changes the text and nothing but the text (no glow, no outline, not underline)
24252425
// that's fine but it should be documented
2426-
void Label::setTextColor(const Color4B& color)
2426+
void Label::setTextColor(const Color32& color)
24272427
{
24282428
if (_textColor != color)
24292429
{

core/2d/Label.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -396,31 +396,31 @@ class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol
396396
*
397397
* @warning Limiting use to only when the Label created with true type font or system font.
398398
*/
399-
virtual void setTextColor(const Color4B& color);
399+
virtual void setTextColor(const Color32& color);
400400

401401
/** Returns the text color of the Label.*/
402-
const Color4B& getTextColor() const { return _textColor; }
402+
const Color32& getTextColor() const { return _textColor; }
403403

404404
/**
405405
* Enable shadow effect to Label.
406406
*
407407
* @todo Support blur for shadow effect.
408408
*/
409-
virtual void enableShadow(const Color4B& shadowColor = Color4B::BLACK,
409+
virtual void enableShadow(const Color32& shadowColor = Color32::BLACK,
410410
const Vec2& offset = Vec2(2, -2),
411411
int blurRadius = 0);
412412

413413
/**
414414
* Enable outline effect to Label.
415415
* @warning Limiting use to only when the Label created with true type font or system font.
416416
*/
417-
virtual void enableOutline(const Color4B& outlineColor, int outlineSize = -1);
417+
virtual void enableOutline(const Color32& outlineColor, int outlineSize = -1);
418418

419419
/**
420420
* Enable glow effect to Label.
421421
* @warning Limiting use to only when the Label created with true type font.
422422
*/
423-
virtual void enableGlow(const Color4B& glowColor);
423+
virtual void enableGlow(const Color32& glowColor);
424424

425425
/**
426426
* Enable italics rendering
@@ -856,7 +856,7 @@ class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol
856856

857857
Overflow _overflow;
858858
float _originalFontSize;
859-
Color4B _textColor;
859+
Color32 _textColor;
860860

861861
BlendFunc _blendFunc;
862862

core/2d/LabelAtlas.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ void LabelAtlas::updateAtlasValues()
203203
quads[i].tr.position.x = (float)(i * _itemWidth + _itemWidth);
204204
quads[i].tr.position.y = (float)(_itemHeight);
205205
quads[i].tr.position.z = 0.0f;
206-
Color4B c(_displayedColor, _displayedOpacity);
206+
Color32 c(_displayedColor, _displayedOpacity);
207207
quads[i].tl.color = c;
208208
quads[i].tr.color = c;
209209
quads[i].bl.color = c;
@@ -277,7 +277,7 @@ void LabelAtlas::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
277277
_debugDrawNode->clear();
278278
auto size = getContentSize();
279279
Vec2 vertices[4] = {Vec2::ZERO, Vec2(size.width, 0), Vec2(size.width, size.height), Vec2(0.0f, size.height)};
280-
_debugDrawNode->drawPoly(vertices, 4, true, Color4B::WHITE);
280+
_debugDrawNode->drawPoly(vertices, 4, true, Color32::WHITE);
281281
}
282282
#endif
283283

core/2d/Layer.cpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ LayerColor* LayerColor::create()
7474
return ret;
7575
}
7676

77-
LayerColor* LayerColor::create(const Color4B& color, float width, float height)
77+
LayerColor* LayerColor::create(const Color32& color, float width, float height)
7878
{
7979
LayerColor* layer = new LayerColor();
8080
if (layer->initWithColor(color, width, height))
@@ -86,7 +86,7 @@ LayerColor* LayerColor::create(const Color4B& color, float width, float height)
8686
return nullptr;
8787
}
8888

89-
LayerColor* LayerColor::create(const Color4B& color)
89+
LayerColor* LayerColor::create(const Color32& color)
9090
{
9191
LayerColor* layer = new LayerColor();
9292
if (layer->initWithColor(color))
@@ -101,10 +101,10 @@ LayerColor* LayerColor::create(const Color4B& color)
101101
bool LayerColor::init()
102102
{
103103
Size s = _director->getWinSize();
104-
return initWithColor(Color4B(0, 0, 0, 0), s.width, s.height);
104+
return initWithColor(Color32(0, 0, 0, 0), s.width, s.height);
105105
}
106106

107-
bool LayerColor::initWithColor(const Color4B& color, float w, float h)
107+
bool LayerColor::initWithColor(const Color32& color, float w, float h)
108108
{
109109
if (Sprite::init())
110110
{
@@ -123,7 +123,7 @@ bool LayerColor::initWithColor(const Color4B& color, float w, float h)
123123
return false;
124124
}
125125

126-
bool LayerColor::initWithColor(const Color4B& color)
126+
bool LayerColor::initWithColor(const Color32& color)
127127
{
128128
Size s = _director->getWinSize();
129129
return initWithColor(color, s.width, s.height);
@@ -151,7 +151,7 @@ LayerGradient::LayerGradient() {}
151151

152152
LayerGradient::~LayerGradient() {}
153153

154-
LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end)
154+
LayerGradient* LayerGradient::create(const Color32& start, const Color32& end)
155155
{
156156
LayerGradient* layer = new LayerGradient();
157157
if (layer->initWithColor(start, end))
@@ -163,7 +163,7 @@ LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end)
163163
return nullptr;
164164
}
165165

166-
LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end, const Vec2& v)
166+
LayerGradient* LayerGradient::create(const Color32& start, const Color32& end, const Vec2& v)
167167
{
168168
LayerGradient* layer = new LayerGradient();
169169
if (layer->initWithColor(start, end, v))
@@ -191,15 +191,15 @@ LayerGradient* LayerGradient::create()
191191

192192
bool LayerGradient::init()
193193
{
194-
return initWithColor(Color4B(0, 0, 0, 255), Color4B(0, 0, 0, 255));
194+
return initWithColor(Color32(0, 0, 0, 255), Color32(0, 0, 0, 255));
195195
}
196196

197-
bool LayerGradient::initWithColor(const Color4B& start, const Color4B& end)
197+
bool LayerGradient::initWithColor(const Color32& start, const Color32& end)
198198
{
199199
return initWithColor(start, end, Vec2(0, -1));
200200
}
201201

202-
bool LayerGradient::initWithColor(const Color4B& start, const Color4B& end, const Vec2& v)
202+
bool LayerGradient::initWithColor(const Color32& start, const Color32& end, const Vec2& v)
203203
{
204204
_endColor.r = end.r;
205205
_endColor.g = end.g;
@@ -211,7 +211,7 @@ bool LayerGradient::initWithColor(const Color4B& start, const Color4B& end, cons
211211

212212
_compressedInterpolation = true;
213213

214-
return LayerColor::initWithColor(Color4B(start.r, start.g, start.b, 255));
214+
return LayerColor::initWithColor(Color32(start.r, start.g, start.b, 255));
215215
}
216216

217217
void LayerGradient::updateColor()
@@ -343,8 +343,8 @@ std::string LayerGradient::getDescription() const
343343
/**
344344
* LayerRadialGradient
345345
*/
346-
LayerRadialGradient* LayerRadialGradient::create(const Color4B& startColor,
347-
const Color4B& endColor,
346+
LayerRadialGradient* LayerRadialGradient::create(const Color32& startColor,
347+
const Color32& endColor,
348348
float radius,
349349
const Vec2& center,
350350
float expand)
@@ -363,7 +363,7 @@ LayerRadialGradient* LayerRadialGradient::create(const Color4B& startColor,
363363
LayerRadialGradient* LayerRadialGradient::create()
364364
{
365365
auto layerGradient = new LayerRadialGradient();
366-
if (layerGradient && layerGradient->initWithColor(Color4B::BLACK, Color4B::BLACK, 0, Vec2(0, 0), 0))
366+
if (layerGradient && layerGradient->initWithColor(Color32::BLACK, Color32::BLACK, 0, Vec2(0, 0), 0))
367367
{
368368
layerGradient->autorelease();
369369
return layerGradient;
@@ -397,8 +397,8 @@ LayerRadialGradient::~LayerRadialGradient()
397397
AX_SAFE_RELEASE_NULL(_customCommand.getPipelineDescriptor().programState);
398398
}
399399

400-
bool LayerRadialGradient::initWithColor(const ax::Color4B& startColor,
401-
const ax::Color4B& endColor,
400+
bool LayerRadialGradient::initWithColor(const ax::Color32& startColor,
401+
const ax::Color32& endColor,
402402
float radius,
403403
const Vec2& center,
404404
float expand)
@@ -508,16 +508,16 @@ float LayerRadialGradient::getExpand() const
508508

509509
void LayerRadialGradient::setStartColor(const Color3B& color)
510510
{
511-
setStartColor(Color4B(color));
511+
setStartColor(Color32(color));
512512
}
513513

514-
void LayerRadialGradient::setStartColor(const ax::Color4B& color)
514+
void LayerRadialGradient::setStartColor(const ax::Color32& color)
515515
{
516516
_startColor = color;
517517
_startColorRend = static_cast<ax::Color>(color);
518518
}
519519

520-
Color4B LayerRadialGradient::getStartColor() const
520+
Color32 LayerRadialGradient::getStartColor() const
521521
{
522522
return _startColor;
523523
}
@@ -529,16 +529,16 @@ Color3B LayerRadialGradient::getStartColor3B() const
529529

530530
void LayerRadialGradient::setEndColor(const Color3B& color)
531531
{
532-
setEndColor(Color4B(color));
532+
setEndColor(Color32(color));
533533
}
534534

535-
void LayerRadialGradient::setEndColor(const ax::Color4B& color)
535+
void LayerRadialGradient::setEndColor(const ax::Color32& color)
536536
{
537537
_endColor = color;
538538
_endColorRend = static_cast<ax::Color>(color);
539539
}
540540

541-
Color4B LayerRadialGradient::getEndColor() const
541+
Color32 LayerRadialGradient::getEndColor() const
542542
{
543543
return _endColor;
544544
}

0 commit comments

Comments
 (0)