DrawNode calls: replacing Color4F with Color4B (without the 'test' folder!) (#2192)

* drawNode calls: replace Color4F with Color4B

* replace Color4F

* removed unused includes
This commit is contained in:
aismann 2024-10-01 13:10:07 +02:00 committed by GitHub
parent 4644b2b428
commit 2e70bfc98a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 78 additions and 91 deletions

View File

@ -1758,7 +1758,7 @@ void Label::updateContent()
_debugDrawNode->clear(); _debugDrawNode->clear();
Vec2 vertices[4] = {Vec2::ZERO, Vec2(_contentSize.width, 0.0f), Vec2(_contentSize.width, _contentSize.height), Vec2 vertices[4] = {Vec2::ZERO, Vec2(_contentSize.width, 0.0f), Vec2(_contentSize.width, _contentSize.height),
Vec2(0.0f, _contentSize.height)}; Vec2(0.0f, _contentSize.height)};
_debugDrawNode->drawPoly(vertices, 4, true, Color4F::WHITE); _debugDrawNode->drawPoly(vertices, 4, true, Color4B::WHITE);
#endif #endif
} }

View File

@ -29,7 +29,6 @@ THE SOFTWARE.
#include "renderer/TextureAtlas.h" #include "renderer/TextureAtlas.h"
#include "platform/FileUtils.h" #include "platform/FileUtils.h"
#include "base/Director.h" #include "base/Director.h"
#include "base/UTF8.h"
#include "renderer/TextureCache.h" #include "renderer/TextureCache.h"
#if AX_LABELATLAS_DEBUG_DRAW #if AX_LABELATLAS_DEBUG_DRAW
@ -278,7 +277,7 @@ void LabelAtlas::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
_debugDrawNode->clear(); _debugDrawNode->clear();
auto size = getContentSize(); auto size = getContentSize();
Vec2 vertices[4] = {Vec2::ZERO, Vec2(size.width, 0), Vec2(size.width, size.height), Vec2(0.0f, size.height)}; Vec2 vertices[4] = {Vec2::ZERO, Vec2(size.width, 0), Vec2(size.width, size.height), Vec2(0.0f, size.height)};
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0)); _debugDrawNode->drawPoly(vertices, 4, true, Color4B::WHITE);
} }
#endif #endif

View File

@ -1101,15 +1101,15 @@ void Sprite::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
// draw 3 lines // draw 3 lines
Vec3 from = verts[indices[i * 3]].vertices; Vec3 from = verts[indices[i * 3]].vertices;
Vec3 to = verts[indices[i * 3 + 1]].vertices; Vec3 to = verts[indices[i * 3 + 1]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4F::WHITE); _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4B::WHITE);
from = verts[indices[i * 3 + 1]].vertices; from = verts[indices[i * 3 + 1]].vertices;
to = verts[indices[i * 3 + 2]].vertices; to = verts[indices[i * 3 + 2]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4F::WHITE); _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4B::WHITE);
from = verts[indices[i * 3 + 2]].vertices; from = verts[indices[i * 3 + 2]].vertices;
to = verts[indices[i * 3]].vertices; to = verts[indices[i * 3]].vertices;
_debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4F::WHITE); _debugDrawNode->drawLine(Vec2(from.x, from.y), Vec2(to.x, to.y), Color4B::WHITE);
} }
#endif // AX_SPRITE_DEBUG_DRAW #endif // AX_SPRITE_DEBUG_DRAW
} }

View File

@ -225,8 +225,8 @@ static void DrawCircle(cpVect p,
cpSpaceDebugColor fill, cpSpaceDebugColor fill,
cpDataPointer data) cpDataPointer data)
{ {
const Color4F fillColor(fill.r, fill.g, fill.b, fill.a); const Color4B fillColor(fill.r, fill.g, fill.b, fill.a);
const Color4F outlineColor(outline.r, outline.g, outline.b, outline.a); const Color4B outlineColor(outline.r, outline.g, outline.b, outline.a);
DrawNode* drawNode = static_cast<DrawNode*>(data); DrawNode* drawNode = static_cast<DrawNode*>(data);
float radius = PhysicsHelper::cpfloat2float(r); float radius = PhysicsHelper::cpfloat2float(r);
Vec2 centre = PhysicsHelper::cpv2vec2(p); Vec2 centre = PhysicsHelper::cpv2vec2(p);
@ -250,7 +250,7 @@ static void DrawFatSegment(cpVect a,
cpSpaceDebugColor /*fill*/, cpSpaceDebugColor /*fill*/,
cpDataPointer data) cpDataPointer data)
{ {
const Color4F outlineColor(outline.r, outline.g, outline.b, outline.a); const Color4B outlineColor(outline.r, outline.g, outline.b, outline.a);
DrawNode* drawNode = static_cast<DrawNode*>(data); DrawNode* drawNode = static_cast<DrawNode*>(data);
drawNode->drawSegment(PhysicsHelper::cpv2vec2(a), PhysicsHelper::cpv2vec2(b), drawNode->drawSegment(PhysicsHelper::cpv2vec2(a), PhysicsHelper::cpv2vec2(b),
PhysicsHelper::cpfloat2float(r == 0 ? _debugDrawThickness : r), outlineColor); PhysicsHelper::cpfloat2float(r == 0 ? _debugDrawThickness : r), outlineColor);
@ -268,8 +268,8 @@ static void DrawPolygon(int count,
cpSpaceDebugColor fill, cpSpaceDebugColor fill,
cpDataPointer data) cpDataPointer data)
{ {
const Color4F fillColor(fill.r, fill.g, fill.b, fill.a); const Color4B fillColor(fill.r, fill.g, fill.b, fill.a);
const Color4F outlineColor(outline.r, outline.g, outline.b, outline.a); const Color4B outlineColor(outline.r, outline.g, outline.b, outline.a);
DrawNode* drawNode = static_cast<DrawNode*>(data); DrawNode* drawNode = static_cast<DrawNode*>(data);
int num = count; int num = count;
Vec2* seg = new Vec2[num]; Vec2* seg = new Vec2[num];
@ -283,7 +283,7 @@ static void DrawPolygon(int count,
static void DrawDot(cpFloat /*size*/, cpVect pos, cpSpaceDebugColor color, cpDataPointer data) static void DrawDot(cpFloat /*size*/, cpVect pos, cpSpaceDebugColor color, cpDataPointer data)
{ {
const Color4F dotColor(color.r, color.g, color.b, color.a); const Color4B dotColor(color.r, color.g, color.b, color.a);
DrawNode* drawNode = static_cast<DrawNode*>(data); DrawNode* drawNode = static_cast<DrawNode*>(data);
drawNode->drawDot(PhysicsHelper::cpv2vec2(pos), _debugDrawThickness, dotColor); drawNode->drawDot(PhysicsHelper::cpv2vec2(pos), _debugDrawThickness, dotColor);
} }

View File

@ -449,7 +449,7 @@ void Layout::setStencilClippingSize(const Vec2& /*size*/)
if (_clippingEnabled && _clippingType == ClippingType::STENCIL) if (_clippingEnabled && _clippingType == ClippingType::STENCIL)
{ {
_clippingStencil->clear(); _clippingStencil->clear();
_clippingStencil->drawSolidRect(Vec2::ZERO, _contentSize, Color4F::GREEN); // Fix issue #1546 _clippingStencil->drawSolidRect(Vec2::ZERO, _contentSize, Color4B::GREEN); // Fix issue #1546
} }
} }

View File

@ -220,7 +220,7 @@ void createMediaControlTexture()
auto DrawStop = [&](const Vec2& middle) -> void { auto DrawStop = [&](const Vec2& middle) -> void {
auto s = Vec2(middle.x - iconW / 2.f, middle.y + iconH / 2.f); auto s = Vec2(middle.x - iconW / 2.f, middle.y + iconH / 2.f);
drawNode->drawSolidRect(s, s + Vec2(iconW, -iconH), Color4F::WHITE); drawNode->drawSolidRect(s, s + Vec2(iconW, -iconH), Color4B::WHITE);
}; };
auto DrawPlay = [&](const Vec2& middle) -> void { auto DrawPlay = [&](const Vec2& middle) -> void {
@ -1142,7 +1142,7 @@ void MediaPlayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flags
_debugDrawNode->clear(); _debugDrawNode->clear();
auto size = getContentSize(); auto size = getContentSize();
Point vertices[4] = {Point::ZERO, Point(size.width, 0), Point(size.width, size.height), Point(0, size.height)}; Point vertices[4] = {Point::ZERO, Point(size.width, 0), Point(size.width, size.height), Point(0, size.height)};
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0)); _debugDrawNode->drawPoly(vertices, 4, true, Color4B::WHITE);
# endif # endif
} }

View File

@ -26,17 +26,8 @@
#include "ui/UIScale9Sprite.h" #include "ui/UIScale9Sprite.h"
#include "2d/Sprite.h" #include "2d/Sprite.h"
#include "2d/SpriteFrameCache.h"
#include "base/Vector.h" #include "base/Vector.h"
#include "base/Director.h" #include "base/Director.h"
#include "base/UTF8.h"
#include "renderer/Shaders.h"
#include "platform/Image.h"
#include "base/NinePatchImageParser.h"
#include "2d/DrawNode.h"
#include "2d/Camera.h"
#include "renderer/Renderer.h"
#include "renderer/backend/ProgramStateRegistry.h"
using namespace ax::ui; using namespace ax::ui;

View File

@ -29,10 +29,7 @@
#include "2d/Sprite.h" #include "2d/Sprite.h"
#include "2d/SpriteFrame.h" #include "2d/SpriteFrame.h"
#include "2d/SpriteBatchNode.h"
#include "platform/PlatformMacros.h"
#include "ui/GUIExport.h" #include "ui/GUIExport.h"
#include "renderer/TrianglesCommand.h"
/** /**
* @addtogroup ui * @addtogroup ui

View File

@ -210,15 +210,15 @@ void DBCCSprite::draw(ax::Renderer* renderer, const ax::Mat4& transform, uint32_
// draw 3 lines // draw 3 lines
auto from = verts[indices[i * 3]].vertices; auto from = verts[indices[i * 3]].vertices;
auto to = verts[indices[i * 3 + 1]].vertices; auto to = verts[indices[i * 3 + 1]].vertices;
_debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4F::WHITE); _debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4B::WHITE);
from = verts[indices[i * 3 + 1]].vertices; from = verts[indices[i * 3 + 1]].vertices;
to = verts[indices[i * 3 + 2]].vertices; to = verts[indices[i * 3 + 2]].vertices;
_debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4F::WHITE); _debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4B::WHITE);
from = verts[indices[i * 3 + 2]].vertices; from = verts[indices[i * 3 + 2]].vertices;
to = verts[indices[i * 3]].vertices; to = verts[indices[i * 3]].vertices;
_debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4F::WHITE); _debugDrawNode->drawLine(ax::Vec2(from.x, from.y), ax::Vec2(to.x, to.y), ax::Color4B::WHITE);
} }
#endif // AX_SPRITE_DEBUG_DRAW #endif // AX_SPRITE_DEBUG_DRAW
} }

View File

@ -5,7 +5,7 @@
NS_FGUI_BEGIN NS_FGUI_BEGIN
using namespace ax; using namespace ax;
static void drawVertRect(ax::DrawNode* shape, float x, float y, float width, float height, const ax::Color4F& color) static void drawVertRect(ax::DrawNode* shape, float x, float y, float width, float height, const ax::Color4B& color)
{ {
float mx = x + width; float mx = x + width;
float my = y + height; float my = y + height;
@ -16,8 +16,8 @@ static void drawVertRect(ax::DrawNode* shape, float x, float y, float width, flo
GGraph::GGraph() : _shape(nullptr), GGraph::GGraph() : _shape(nullptr),
_type(0), _type(0),
_lineSize(1), _lineSize(1),
_lineColor(Color4F::BLACK), _lineColor(Color4B::BLACK),
_fillColor(Color4F::WHITE), _fillColor(Color4B::WHITE),
_cornerRadius(nullptr), _cornerRadius(nullptr),
_polygonPoints(nullptr), _polygonPoints(nullptr),
_distances(nullptr) _distances(nullptr)
@ -40,7 +40,7 @@ void GGraph::handleInit()
_displayObject = _shape; _displayObject = _shape;
} }
void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor) void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor)
{ {
_type = 0; //avoid updateshape call in handleSizeChange _type = 0; //avoid updateshape call in handleSizeChange
setSize(aWidth, aHeight); setSize(aWidth, aHeight);
@ -51,7 +51,7 @@ void GGraph::drawRect(float aWidth, float aHeight, int lineSize, const ax::Color
updateShape(); updateShape();
} }
void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor) void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor)
{ {
_type = 0; //avoid updateshape call in handleSizeChange _type = 0; //avoid updateshape call in handleSizeChange
setSize(aWidth, aHeight); setSize(aWidth, aHeight);
@ -62,7 +62,7 @@ void GGraph::drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Co
updateShape(); updateShape();
} }
void GGraph::drawPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, const ax::Vec2* points, int count) void GGraph::drawPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, const ax::Vec2* points, int count)
{ {
_type = 3; _type = 3;
_lineSize = lineSize; _lineSize = lineSize;
@ -83,7 +83,7 @@ void GGraph::drawPolygon(int lineSize, const ax::Color4F& lineColor, const ax::C
updateShape(); updateShape();
} }
void GGraph::drawRegularPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, void GGraph::drawRegularPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor,
int sides, float startAngle, const float* distances, int count) int sides, float startAngle, const float* distances, int count)
{ {
_type = 4; _type = 4;
@ -189,7 +189,7 @@ ax::Color3B GGraph::getColor() const
void GGraph::setColor(const ax::Color3B& value) void GGraph::setColor(const ax::Color3B& value)
{ {
_fillColor = Color4F(value, _fillColor.a); _fillColor = Color4B(value, _fillColor.a);
updateShape(); updateShape();
} }
@ -247,8 +247,8 @@ void GGraph::setup_beforeAdd(ByteBuffer* buffer, int beginPos)
if (_type != 0) if (_type != 0)
{ {
_lineSize = buffer->readInt(); _lineSize = buffer->readInt();
_lineColor = (Color4F)buffer->readColor(); _lineColor = (Color4B)buffer->readColor();
_fillColor = (Color4F)buffer->readColor(); _fillColor = (Color4B)buffer->readColor();
if (buffer->readBool()) if (buffer->readBool())
{ {
_cornerRadius = new float[4]; _cornerRadius = new float[4];

View File

@ -15,10 +15,10 @@ public:
CREATE_FUNC(GGraph); CREATE_FUNC(GGraph);
void drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor); void drawRect(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor);
void drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor); void drawEllipse(float aWidth, float aHeight, int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor);
void drawPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, const ax::Vec2* points, int count); void drawPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, const ax::Vec2* points, int count);
void drawRegularPolygon(int lineSize, const ax::Color4F& lineColor, const ax::Color4F& fillColor, int sides, float startAngle = 0, const float* distances = nullptr, int distanceCount = 0); void drawRegularPolygon(int lineSize, const ax::Color4B& lineColor, const ax::Color4B& fillColor, int sides, float startAngle = 0, const float* distances = nullptr, int distanceCount = 0);
bool isEmpty() const { return _type == 0; } bool isEmpty() const { return _type == 0; }
ax::Color3B getColor() const; ax::Color3B getColor() const;
@ -36,8 +36,8 @@ private:
void updateShape(); void updateShape();
int _type; int _type;
ax::Color4F _lineColor; ax::Color4B _lineColor;
ax::Color4F _fillColor; ax::Color4B _fillColor;
int _lineSize; int _lineSize;
float* _cornerRadius; float* _cornerRadius;
std::vector<ax::Vec2>* _polygonPoints; std::vector<ax::Vec2>* _polygonPoints;

View File

@ -249,4 +249,4 @@ void PhysicsDebugNode::setSpace(cpSpace* space)
_spacePtr = space; _spacePtr = space;
} }
NS_AX_EXT_END NS_AX_EXT_END

View File

@ -54,19 +54,19 @@ static const cpVect spring_verts[] = {
}; };
static const int spring_count = sizeof(spring_verts) / sizeof(cpVect); static const int spring_count = sizeof(spring_verts) / sizeof(cpVect);
static Color4F ColorForBody(cpBody* body) static Color4B ColorForBody(cpBody* body)
{ {
if (CP_BODY_TYPE_STATIC == cpBodyGetType(body) || cpBodyIsSleeping(body)) if (CP_BODY_TYPE_STATIC == cpBodyGetType(body) || cpBodyIsSleeping(body))
{ {
return Color4F(0.5f, 0.5f, 0.5f, 0.5f); return Color4B(127, 127, 127, 127);
} }
else if (body->sleeping.idleTime > cpBodyGetSpace(body)->sleepTimeThreshold) else if (body->sleeping.idleTime > cpBodyGetSpace(body)->sleepTimeThreshold)
{ {
return Color4F(0.33f, 0.33f, 0.33f, 0.5f); return Color4B(85, 85, 85, 127);
} }
else else
{ {
return Color4F(1.0f, 0.0f, 0.0f, 0.5f); return Color4B(255, 0, 0, 127);
} }
} }
@ -78,7 +78,7 @@ static Vec2 cpVert2Point(const cpVect& vert)
static void DrawShape(cpShape* shape, DrawNode* renderer) static void DrawShape(cpShape* shape, DrawNode* renderer)
{ {
cpBody* body = cpShapeGetBody(shape); cpBody* body = cpShapeGetBody(shape);
Color4F color = ColorForBody(body); Color4B color = ColorForBody(body);
switch (shape->klass->type) switch (shape->klass->type)
{ {
@ -101,7 +101,7 @@ static void DrawShape(cpShape* shape, DrawNode* renderer)
case CP_POLY_SHAPE: case CP_POLY_SHAPE:
{ {
cpPolyShape* poly = (cpPolyShape*)shape; cpPolyShape* poly = (cpPolyShape*)shape;
Color4F line = color; Color4B line = color;
line.a = cpflerp(color.a, 1.0, 0.5); line.a = cpflerp(color.a, 1.0, 0.5);
int num = poly->count; int num = poly->count;
Vec2* pPoints = new Vec2[num]; Vec2* pPoints = new Vec2[num];
@ -109,7 +109,7 @@ static void DrawShape(cpShape* shape, DrawNode* renderer)
pPoints[i] = cpVert2Point(poly->planes[i].v0); pPoints[i] = cpVert2Point(poly->planes[i].v0);
if (cpfmax(poly->r, 1.0) > 1.0) if (cpfmax(poly->r, 1.0) > 1.0)
{ {
renderer->drawPolygon(pPoints, num, Color4F(0.5f, 0.5f, 0.5f, 0.0f), poly->r, color); renderer->drawPolygon(pPoints, num, Color4B(127, 127, 127,0), poly->r, color);
} }
else else
{ {
@ -124,7 +124,7 @@ static void DrawShape(cpShape* shape, DrawNode* renderer)
} }
} }
static Color4F CONSTRAINT_COLOR(0, 1, 0, 0.5); static Color4B CONSTRAINT_COLOR(0, 255, 0, 127);
static void DrawConstraint(cpConstraint* constraint, DrawNode* renderer) static void DrawConstraint(cpConstraint* constraint, DrawNode* renderer)
{ {
@ -251,4 +251,4 @@ void PhysicsDebugNodeChipmunk2D::setSpace(cpSpace* space)
_spacePtr = space; _spacePtr = space;
} }
NS_AX_EXT_END NS_AX_EXT_END

View File

@ -10668,8 +10668,8 @@ int lua_ax_fairygui_GGraph_drawRect(lua_State* tolua_S)
double arg0; double arg0;
double arg1; double arg1;
int arg2; int arg2;
ax::Color4F arg3; ax::Color4B arg3;
ax::Color4F arg4; ax::Color4B arg4;
ok &= luaval_to_number(tolua_S, 2,&arg0, "fgui.GGraph:drawRect"); ok &= luaval_to_number(tolua_S, 2,&arg0, "fgui.GGraph:drawRect");
@ -10677,9 +10677,9 @@ int lua_ax_fairygui_GGraph_drawRect(lua_State* tolua_S)
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "fgui.GGraph:drawRect"); ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "fgui.GGraph:drawRect");
ok &=luaval_to_color4f(tolua_S, 5, &arg3, "fgui.GGraph:drawRect"); ok &=luaval_to_color4b(tolua_S, 5, &arg3, "fgui.GGraph:drawRect");
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "fgui.GGraph:drawRect"); ok &=luaval_to_color4b(tolua_S, 6, &arg4, "fgui.GGraph:drawRect");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_ax_fairygui_GGraph_drawRect'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_ax_fairygui_GGraph_drawRect'", nullptr);
@ -10730,8 +10730,8 @@ int lua_ax_fairygui_GGraph_drawEllipse(lua_State* tolua_S)
double arg0; double arg0;
double arg1; double arg1;
int arg2; int arg2;
ax::Color4F arg3; ax::Color4B arg3;
ax::Color4F arg4; ax::Color4B arg4;
ok &= luaval_to_number(tolua_S, 2,&arg0, "fgui.GGraph:drawEllipse"); ok &= luaval_to_number(tolua_S, 2,&arg0, "fgui.GGraph:drawEllipse");
@ -10739,9 +10739,9 @@ int lua_ax_fairygui_GGraph_drawEllipse(lua_State* tolua_S)
ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "fgui.GGraph:drawEllipse"); ok &= luaval_to_int32(tolua_S, 4,(int *)&arg2, "fgui.GGraph:drawEllipse");
ok &=luaval_to_color4f(tolua_S, 5, &arg3, "fgui.GGraph:drawEllipse"); ok &=luaval_to_color4b(tolua_S, 5, &arg3, "fgui.GGraph:drawEllipse");
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "fgui.GGraph:drawEllipse"); ok &=luaval_to_color4b(tolua_S, 6, &arg4, "fgui.GGraph:drawEllipse");
if(!ok) if(!ok)
{ {
tolua_error(tolua_S,"invalid arguments in function 'lua_ax_fairygui_GGraph_drawEllipse'", nullptr); tolua_error(tolua_S,"invalid arguments in function 'lua_ax_fairygui_GGraph_drawEllipse'", nullptr);
@ -10790,16 +10790,16 @@ int lua_ax_fairygui_GGraph_drawPolygon(lua_State* tolua_S)
if (argc == 5) if (argc == 5)
{ {
int arg0; int arg0;
ax::Color4F arg1; ax::Color4B arg1;
ax::Color4F arg2; ax::Color4B arg2;
const ax::Vec2* arg3; const ax::Vec2* arg3;
int arg4; int arg4;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawPolygon"); ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawPolygon");
ok &=luaval_to_color4f(tolua_S, 3, &arg1, "fgui.GGraph:drawPolygon"); ok &=luaval_to_color4b(tolua_S, 3, &arg1, "fgui.GGraph:drawPolygon");
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "fgui.GGraph:drawPolygon"); ok &=luaval_to_color4b(tolua_S, 4, &arg2, "fgui.GGraph:drawPolygon");
ok &= luaval_to_object<const ax::Vec2>(tolua_S, 5, "ax.Vec2",&arg3, "fgui.GGraph:drawPolygon"); ok &= luaval_to_object<const ax::Vec2>(tolua_S, 5, "ax.Vec2",&arg3, "fgui.GGraph:drawPolygon");
@ -10852,15 +10852,15 @@ int lua_ax_fairygui_GGraph_drawRegularPolygon(lua_State* tolua_S)
if (argc == 4) if (argc == 4)
{ {
int arg0; int arg0;
ax::Color4F arg1; ax::Color4B arg1;
ax::Color4F arg2; ax::Color4B arg2;
int arg3; int arg3;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon");
ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon");
if(!ok) if(!ok)
@ -10875,16 +10875,16 @@ int lua_ax_fairygui_GGraph_drawRegularPolygon(lua_State* tolua_S)
if (argc == 5) if (argc == 5)
{ {
int arg0; int arg0;
ax::Color4F arg1; ax::Color4B arg1;
ax::Color4F arg2; ax::Color4B arg2;
int arg3; int arg3;
double arg4; double arg4;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon");
ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon");
@ -10901,17 +10901,17 @@ int lua_ax_fairygui_GGraph_drawRegularPolygon(lua_State* tolua_S)
if (argc == 6) if (argc == 6)
{ {
int arg0; int arg0;
ax::Color4F arg1; ax::Color4B arg1;
ax::Color4F arg2; ax::Color4B arg2;
int arg3; int arg3;
double arg4; double arg4;
const float* arg5; const float* arg5;
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon");
ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon");
@ -10931,8 +10931,8 @@ int lua_ax_fairygui_GGraph_drawRegularPolygon(lua_State* tolua_S)
if (argc == 7) if (argc == 7)
{ {
int arg0; int arg0;
ax::Color4F arg1; ax::Color4B arg1;
ax::Color4F arg2; ax::Color4B arg2;
int arg3; int arg3;
double arg4; double arg4;
const float* arg5; const float* arg5;
@ -10940,9 +10940,9 @@ int lua_ax_fairygui_GGraph_drawRegularPolygon(lua_State* tolua_S)
ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 3, &arg1, "fgui.GGraph:drawRegularPolygon");
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon"); ok &=luaval_to_color4b(tolua_S, 4, &arg2, "fgui.GGraph:drawRegularPolygon");
ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon"); ok &= luaval_to_int32(tolua_S, 5,(int *)&arg3, "fgui.GGraph:drawRegularPolygon");

View File

@ -539,7 +539,7 @@ namespace spine {
{brect.origin.x + brect.size.width, brect.origin.y}, {brect.origin.x + brect.size.width, brect.origin.y},
{brect.origin.x + brect.size.width, brect.origin.y + brect.size.height}, {brect.origin.x + brect.size.width, brect.origin.y + brect.size.height},
{brect.origin.x, brect.origin.y + brect.size.height}}; {brect.origin.x, brect.origin.y + brect.size.height}};
drawNode->drawPoly(points, 4, true, Color4F::GREEN, 2.0f); drawNode->drawPoly(points, 4, true, Color4B::GREEN, 2.0f);
} }
if (_debugSlots) { if (_debugSlots) {
@ -565,7 +565,7 @@ namespace spine {
{worldVertices[2], worldVertices[3]}, {worldVertices[2], worldVertices[3]},
{worldVertices[4], worldVertices[5]}, {worldVertices[4], worldVertices[5]},
{worldVertices[6], worldVertices[7]}}; {worldVertices[6], worldVertices[7]}};
drawNode->drawPoly(points, 4, true, Color4F::BLUE, 2.0f); drawNode->drawPoly(points, 4, true, Color4B::BLUE, 2.0f);
} }
} }
@ -576,15 +576,15 @@ namespace spine {
if (!bone->isActive()) continue; if (!bone->isActive()) continue;
float x = bone->getData().getLength() * bone->getA() + bone->getWorldX(); float x = bone->getData().getLength() * bone->getA() + bone->getWorldX();
float y = bone->getData().getLength() * bone->getC() + bone->getWorldY(); float y = bone->getData().getLength() * bone->getC() + bone->getWorldY();
drawNode->drawLine(Vec2(bone->getWorldX(), bone->getWorldY()), Vec2(x, y), Color4F::RED, 2.0f); drawNode->drawLine(Vec2(bone->getWorldX(), bone->getWorldY()), Vec2(x, y), Color4B::RED, 2.0f);
} }
// Bone origins. // Bone origins.
auto color = Color4F::BLUE;// Root bone is blue. auto color = Color4B::BLUE;// Root bone is blue.
for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) { for (int i = 0, n = (int)_skeleton->getBones().size(); i < n; i++) {
Bone *bone = _skeleton->getBones()[i]; Bone *bone = _skeleton->getBones()[i];
if (!bone->isActive()) continue; if (!bone->isActive()) continue;
drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color); drawNode->drawPoint(Vec2(bone->getWorldX(), bone->getWorldY()), 4, color);
if (i == 0) color = Color4F::GREEN; if (i == 0) color = Color4B::GREEN;
} }
} }
@ -607,7 +607,7 @@ namespace spine {
worldCoord + (idx0 * 2), worldCoord + (idx0 * 2),
worldCoord + (idx1 * 2), worldCoord + (idx1 * 2),
worldCoord + (idx2 * 2)}; worldCoord + (idx2 * 2)};
drawNode->drawPoly(v, 3, true, Color4F::YELLOW, 2.0f); drawNode->drawPoly(v, 3, true, Color4B::YELLOW, 2.0f);
} }
VLA_FREE(worldCoord); VLA_FREE(worldCoord);
} }

View File

@ -133,7 +133,7 @@ bool MainScene::init()
drawNode->setPosition(Vec2(0, 0)); drawNode->setPosition(Vec2(0, 0));
addChild(drawNode); addChild(drawNode);
drawNode->drawRect(safeArea.origin + Vec2(1, 1), safeArea.origin + safeArea.size, Color4F::BLUE); drawNode->drawRect(safeArea.origin + Vec2(1, 1), safeArea.origin + safeArea.size, Color4B::BLUE);
} }
// scheduleUpdate() is required to ensure update(float) is called on every loop // scheduleUpdate() is required to ensure update(float) is called on every loop