mirror of https://github.com/axmolengine/axmol.git
commit
f59c3e02cd
|
@ -1,6 +1,7 @@
|
||||||
cocos2d-x-3.3?? ??
|
cocos2d-x-3.3?? ??
|
||||||
[NEW] ActionManager: added removeAllActionsByTag()
|
[NEW] ActionManager: added removeAllActionsByTag()
|
||||||
[NEW] Audio: added new audio system for iOS and Android
|
[NEW] Audio: added new audio system for iOS and Android
|
||||||
|
[FIX] DrawNode: has any many functions as `DrawPrimitive`
|
||||||
[NEW] GLViewProtocol: added getAllTouches()
|
[NEW] GLViewProtocol: added getAllTouches()
|
||||||
[NEW] Node: added stopAllActionsByTag()
|
[NEW] Node: added stopAllActionsByTag()
|
||||||
[NEW] PhysicsWorld: add setSubsteps() and getSubsteps()
|
[NEW] PhysicsWorld: add setSubsteps() and getSubsteps()
|
||||||
|
@ -11,11 +12,15 @@ cocos2d-x-3.3?? ??
|
||||||
[FIX] C++: Reorganized cocos2d/platform folder. Easier to add new platforms
|
[FIX] C++: Reorganized cocos2d/platform folder. Easier to add new platforms
|
||||||
[FIX] EditBox: moved to ui:EditBox
|
[FIX] EditBox: moved to ui:EditBox
|
||||||
[FIX] HttpClient: condition variable sleep on unrelated mutex
|
[FIX] HttpClient: condition variable sleep on unrelated mutex
|
||||||
|
[FIX] Label: outline effect may be wrong if outline width is big and font size is big too
|
||||||
|
[FIX] MeshCommand: generate wrong meterial id which will cause problem that only first mesh is drawn
|
||||||
[FIX] Node: create unneeded temple `Vec2` object in `setPosition(int, int)`, `setPositionX()` and `setPositionY()`
|
[FIX] Node: create unneeded temple `Vec2` object in `setPosition(int, int)`, `setPositionX()` and `setPositionY()`
|
||||||
[FIX] Node: skew effect is wrong
|
[FIX] Node: skew effect is wrong
|
||||||
[FIX] Node: setNormalizedPosition can not take effect if parent position is not changed
|
[FIX] Node: setNormalizedPosition can not take effect if parent position is not changed
|
||||||
[FIX] External: ScrollView: scroll view hidden picks up the touch events
|
[FIX] External: ScrollView: scroll view hidden picks up the touch events
|
||||||
[FIX] TextureAtlas: may crash if only drawing part of it
|
[FIX] TextureAtlas: may crash if only drawing part of it
|
||||||
|
[FIX] UI: Button: a button can not be touched if it only contains title
|
||||||
|
[FIX] UI: Button: title can not be scaled if a button is scaled
|
||||||
|
|
||||||
cocos2d-x-3.3alpha0 Aug.28 2014
|
cocos2d-x-3.3alpha0 Aug.28 2014
|
||||||
[NEW] 3D: Added Camera, AABB, OBB and Ray
|
[NEW] 3D: Added Camera, AABB, OBB and Ray
|
||||||
|
|
|
@ -1,12 +1,10 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio 2013
|
# Visual Studio 2013
|
||||||
VisualStudioVersion = 12.0.30324.0
|
VisualStudioVersion = 12.0.21005.1
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cocos2dShaderCompiler", "Cocos2dShaderCompiler.vcxproj", "{4F6DEF20-AC4C-487F-85B8-5993519E3911}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Cocos2dShaderCompiler", "Cocos2dShaderCompiler.vcxproj", "{4F6DEF20-AC4C-487F-85B8-5993519E3911}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "..\..\..\external\chipmunk\proj.winrt\chipmunk.vcxproj", "{8B143765-5C1B-4076-9384-3E0EC3650B1A}"
|
|
||||||
EndProject
|
|
||||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\..\cocos\2d\cocos2d_winrt.vcxproj", "{2330EDF4-5596-4B53-8BA5-158DDDE713D9}"
|
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\..\..\cocos\2d\cocos2d_winrt.vcxproj", "{2330EDF4-5596-4B53-8BA5-158DDDE713D9}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
|
@ -37,18 +35,6 @@ Global
|
||||||
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.ActiveCfg = Release|x64
|
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.ActiveCfg = Release|x64
|
||||||
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.Build.0 = Release|x64
|
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.Build.0 = Release|x64
|
||||||
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.Deploy.0 = Release|x64
|
{4F6DEF20-AC4C-487F-85B8-5993519E3911}.Release|x64.Deploy.0 = Release|x64
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|ARM.ActiveCfg = Debug|ARM
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|ARM.Build.0 = Debug|ARM
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|Win32.ActiveCfg = Debug|Win32
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|Win32.Build.0 = Debug|Win32
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|x64.ActiveCfg = Debug|x64
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Debug|x64.Build.0 = Debug|x64
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|ARM.ActiveCfg = Release|ARM
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|ARM.Build.0 = Release|ARM
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|Win32.ActiveCfg = Release|Win32
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|Win32.Build.0 = Release|Win32
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|x64.ActiveCfg = Release|x64
|
|
||||||
{8B143765-5C1B-4076-9384-3E0EC3650B1A}.Release|x64.Build.0 = Release|x64
|
|
||||||
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|ARM.ActiveCfg = Debug|ARM
|
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|ARM.ActiveCfg = Debug|ARM
|
||||||
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|ARM.Build.0 = Debug|ARM
|
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|ARM.Build.0 = Debug|ARM
|
||||||
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|Win32.ActiveCfg = Debug|Win32
|
{2330EDF4-5596-4B53-8BA5-158DDDE713D9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||||
|
|
|
@ -249,9 +249,6 @@
|
||||||
<ProjectReference Include="..\..\..\cocos\2d\cocos2d_winrt.vcxproj">
|
<ProjectReference Include="..\..\..\cocos\2d\cocos2d_winrt.vcxproj">
|
||||||
<Project>{2330edf4-5596-4b53-8ba5-158ddde713d9}</Project>
|
<Project>{2330edf4-5596-4b53-8ba5-158ddde713d9}</Project>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\..\..\external\chipmunk\proj.winrt\chipmunk.vcxproj">
|
|
||||||
<Project>{8b143765-5c1b-4076-9384-3e0ec3650b1a}</Project>
|
|
||||||
</ProjectReference>
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
#include "2d/CCClippingNode.h"
|
#include "2d/CCClippingNode.h"
|
||||||
#include "2d/CCDrawingPrimitives.h"
|
#include "2d/CCDrawingPrimitives.h"
|
||||||
#include "renderer/CCGLProgramCache.h"
|
#include "renderer/CCGLProgramCache.h"
|
||||||
|
#include "renderer/ccGLStateCache.h"
|
||||||
#include "renderer/CCRenderer.h"
|
#include "renderer/CCRenderer.h"
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
|
|
||||||
|
@ -200,12 +201,40 @@ void ClippingNode::drawFullScreenQuadClearStencil()
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
|
|
||||||
|
Vec2 vertices[] = {
|
||||||
|
Vec2(-1, -1),
|
||||||
|
Vec2(1, -1),
|
||||||
|
Vec2(1, 1),
|
||||||
|
Vec2(-1, 1)
|
||||||
|
};
|
||||||
|
|
||||||
DrawPrimitives::drawSolidRect(Vec2(-1,-1), Vec2(1,1), Color4F(1, 1, 1, 1));
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->retain();
|
||||||
|
|
||||||
|
int colorLocation = glProgram->getUniformLocation("u_color");
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
|
Color4F color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins();
|
||||||
|
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||||
|
|
||||||
|
GLuint vbo;
|
||||||
|
glGenBuffers(1, &vbo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
void ClippingNode::visit(Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
|
||||||
|
|
|
@ -27,9 +27,11 @@
|
||||||
#include "renderer/CCRenderer.h"
|
#include "renderer/CCRenderer.h"
|
||||||
#include "renderer/ccGLStateCache.h"
|
#include "renderer/ccGLStateCache.h"
|
||||||
#include "renderer/CCGLProgramState.h"
|
#include "renderer/CCGLProgramState.h"
|
||||||
|
#include "renderer/CCGLProgramCache.h"
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
#include "base/CCEventListenerCustom.h"
|
#include "base/CCEventListenerCustom.h"
|
||||||
#include "base/CCEventDispatcher.h"
|
#include "base/CCEventDispatcher.h"
|
||||||
|
#include "2d/CCActionCatmullRom.h"
|
||||||
#include "platform/CCGL.h"
|
#include "platform/CCGL.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -108,6 +110,20 @@ DrawNode::DrawNode()
|
||||||
, _bufferCount(0)
|
, _bufferCount(0)
|
||||||
, _buffer(nullptr)
|
, _buffer(nullptr)
|
||||||
, _dirty(false)
|
, _dirty(false)
|
||||||
|
, _vaoGLPoint(0)
|
||||||
|
, _vboGLPoint(0)
|
||||||
|
, _bufferCapacityGLPoint(0)
|
||||||
|
, _bufferCountGLPoint(0)
|
||||||
|
, _bufferGLPoint(nullptr)
|
||||||
|
, _pointColor(1,1,1,1)
|
||||||
|
, _pointSize(1)
|
||||||
|
, _dirtyGLPoint(false)
|
||||||
|
, _vaoGLLine(0)
|
||||||
|
, _vboGLLine(0)
|
||||||
|
, _bufferCapacityGLLine(0)
|
||||||
|
, _bufferCountGLLine(0)
|
||||||
|
, _bufferGLLine(nullptr)
|
||||||
|
, _dirtyGLLine(false)
|
||||||
{
|
{
|
||||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||||
}
|
}
|
||||||
|
@ -116,9 +132,17 @@ DrawNode::~DrawNode()
|
||||||
{
|
{
|
||||||
free(_buffer);
|
free(_buffer);
|
||||||
_buffer = nullptr;
|
_buffer = nullptr;
|
||||||
|
free(_bufferGLPoint);
|
||||||
|
_bufferGLPoint = nullptr;
|
||||||
|
free(_bufferGLLine);
|
||||||
|
_bufferGLLine = nullptr;
|
||||||
|
|
||||||
glDeleteBuffers(1, &_vbo);
|
glDeleteBuffers(1, &_vbo);
|
||||||
|
glDeleteBuffers(1, &_vboGLLine);
|
||||||
|
glDeleteBuffers(1, &_vboGLPoint);
|
||||||
_vbo = 0;
|
_vbo = 0;
|
||||||
|
_vboGLPoint = 0;
|
||||||
|
_vboGLLine = 0;
|
||||||
|
|
||||||
if (Configuration::getInstance()->supportsShareableVAO())
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
{
|
{
|
||||||
|
@ -154,6 +178,28 @@ void DrawNode::ensureCapacity(int count)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawNode::ensureCapacityGLPoint(int count)
|
||||||
|
{
|
||||||
|
CCASSERT(count>=0, "capacity must be >= 0");
|
||||||
|
|
||||||
|
if(_bufferCountGLPoint + count > _bufferCapacityGLPoint)
|
||||||
|
{
|
||||||
|
_bufferCapacityGLPoint += MAX(_bufferCapacityGLPoint, count);
|
||||||
|
_bufferGLPoint = (V2F_C4B_T2F*)realloc(_bufferGLPoint, _bufferCapacityGLPoint*sizeof(V2F_C4B_T2F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::ensureCapacityGLLine(int count)
|
||||||
|
{
|
||||||
|
CCASSERT(count>=0, "capacity must be >= 0");
|
||||||
|
|
||||||
|
if(_bufferCountGLLine + count > _bufferCapacityGLLine)
|
||||||
|
{
|
||||||
|
_bufferCapacityGLLine += MAX(_bufferCapacityGLLine, count);
|
||||||
|
_bufferGLLine = (V2F_C4B_T2F*)realloc(_bufferGLLine, _bufferCapacityGLLine*sizeof(V2F_C4B_T2F));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool DrawNode::init()
|
bool DrawNode::init()
|
||||||
{
|
{
|
||||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||||
|
@ -161,27 +207,63 @@ bool DrawNode::init()
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR));
|
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR));
|
||||||
|
|
||||||
ensureCapacity(512);
|
ensureCapacity(512);
|
||||||
|
ensureCapacityGLPoint(64);
|
||||||
|
ensureCapacityGLLine(256);
|
||||||
|
|
||||||
if (Configuration::getInstance()->supportsShareableVAO())
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
{
|
{
|
||||||
glGenVertexArrays(1, &_vao);
|
glGenVertexArrays(1, &_vao);
|
||||||
GL::bindVAO(_vao);
|
GL::bindVAO(_vao);
|
||||||
}
|
}
|
||||||
|
|
||||||
glGenBuffers(1, &_vbo);
|
glGenBuffers(1, &_vbo);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)* _bufferCapacity, _buffer, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)* _bufferCapacity, _buffer, GL_STREAM_DRAW);
|
||||||
|
// vertex
|
||||||
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
// color
|
||||||
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
// texcood
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||||
|
|
||||||
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
|
{
|
||||||
|
glGenVertexArrays(1, &_vaoGLLine);
|
||||||
|
GL::bindVAO(_vaoGLLine);
|
||||||
|
}
|
||||||
|
glGenBuffers(1, &_vboGLLine);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLLine, _bufferGLLine, GL_STREAM_DRAW);
|
||||||
|
// vertex
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
// color
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
// texcood
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||||
|
|
||||||
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
|
{
|
||||||
|
glGenVertexArrays(1, &_vaoGLPoint);
|
||||||
|
GL::bindVAO(_vaoGLPoint);
|
||||||
|
}
|
||||||
|
glGenBuffers(1, &_vboGLPoint);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW);
|
||||||
|
// vertex
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_POSITION);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
// color
|
||||||
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_COLOR);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
// texcood
|
||||||
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
glEnableVertexAttribArray(GLProgram::VERTEX_ATTRIB_TEX_COORD);
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
|
||||||
|
|
||||||
if (Configuration::getInstance()->supportsShareableVAO())
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
{
|
{
|
||||||
|
@ -191,6 +273,8 @@ bool DrawNode::init()
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
_dirtyGLLine = true;
|
||||||
|
_dirtyGLPoint = true;
|
||||||
|
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
// Need to listen the event only when not use batchnode, because it will use VBO
|
// Need to listen the event only when not use batchnode, because it will use VBO
|
||||||
|
@ -207,9 +291,26 @@ bool DrawNode::init()
|
||||||
|
|
||||||
void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void DrawNode::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
_customCommand.init(_globalZOrder);
|
if(_bufferCount)
|
||||||
_customCommand.func = CC_CALLBACK_0(DrawNode::onDraw, this, transform, flags);
|
{
|
||||||
renderer->addCommand(&_customCommand);
|
_customCommand.init(_globalZOrder);
|
||||||
|
_customCommand.func = CC_CALLBACK_0(DrawNode::onDraw, this, transform, flags);
|
||||||
|
renderer->addCommand(&_customCommand);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_bufferCountGLPoint)
|
||||||
|
{
|
||||||
|
_customCommandGLPoint.init(_globalZOrder);
|
||||||
|
_customCommandGLPoint.func = CC_CALLBACK_0(DrawNode::onDrawGLPoint, this, transform, flags);
|
||||||
|
renderer->addCommand(&_customCommandGLPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(_bufferCountGLLine)
|
||||||
|
{
|
||||||
|
_customCommandGLLine.init(_globalZOrder);
|
||||||
|
_customCommandGLLine.func = CC_CALLBACK_0(DrawNode::onDrawGLLine, this, transform, flags);
|
||||||
|
renderer->addCommand(&_customCommandGLLine);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
|
@ -224,6 +325,7 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacity, _buffer, GL_STREAM_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacity, _buffer, GL_STREAM_DRAW);
|
||||||
|
|
||||||
_dirty = false;
|
_dirty = false;
|
||||||
}
|
}
|
||||||
if (Configuration::getInstance()->supportsShareableVAO())
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
|
@ -237,21 +339,287 @@ void DrawNode::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||||
// vertex
|
// vertex
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
|
||||||
// color
|
// color
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
|
||||||
// texcood
|
// texcood
|
||||||
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||||
}
|
}
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||||
glDrawArrays(GL_TRIANGLES, 0, _bufferCount);
|
glDrawArrays(GL_TRIANGLES, 0, _bufferCount);
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCount);
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, _bufferCount);
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawNode::onDrawGLLine(const Mat4 &transform, uint32_t flags)
|
||||||
|
{
|
||||||
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_LENGTH_TEXTURE_COLOR);
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins(transform);
|
||||||
|
|
||||||
|
if (_dirtyGLLine)
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLLine, _bufferGLLine, GL_STREAM_DRAW);
|
||||||
|
_dirtyGLLine = false;
|
||||||
|
}
|
||||||
|
if (Configuration::getInstance()->supportsShareableVAO())
|
||||||
|
{
|
||||||
|
GL::bindVAO(_vaoGLLine);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine);
|
||||||
|
GL::enableVertexAttribs(GL::VERTEX_ATTRIB_FLAG_POS_COLOR_TEX);
|
||||||
|
// vertex
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
// color
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
// texcood
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_TEX_COORD, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, texCoords));
|
||||||
|
}
|
||||||
|
glLineWidth(2);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLLine);
|
||||||
|
glDrawArrays(GL_LINES, 0, _bufferCountGLLine);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLLine);
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::onDrawGLPoint(const Mat4 &transform, uint32_t flags)
|
||||||
|
{
|
||||||
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins(transform);
|
||||||
|
|
||||||
|
glProgram->setUniformLocationWith4fv(glProgram->getUniformLocation("u_color"), (GLfloat*) &_pointColor.r, 1);
|
||||||
|
glProgram->setUniformLocationWith1f(glProgram->getUniformLocation("u_pointSize"), _pointSize);
|
||||||
|
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, _vboGLPoint);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(V2F_C4B_T2F)*_bufferCapacityGLPoint, _bufferGLPoint, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION | GL::VERTEX_ATTRIB_FLAG_COLOR);
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, vertices));
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_COLOR, 4, GL_UNSIGNED_BYTE, GL_TRUE, sizeof(V2F_C4B_T2F), (GLvoid *)offsetof(V2F_C4B_T2F, colors));
|
||||||
|
|
||||||
|
glDrawArrays(GL_POINTS, 0, _bufferCountGLPoint);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1,_bufferCountGLPoint);
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawPoint(const Vec2& position, const float pointSize, const Color4F &color)
|
||||||
|
{
|
||||||
|
V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLPoint + _bufferCountGLPoint);
|
||||||
|
V2F_C4B_T2F a = {position, Color4B(color), Tex2F(0.0, 0.0) };
|
||||||
|
*point = a;
|
||||||
|
|
||||||
|
_pointSize = pointSize;
|
||||||
|
_pointColor = color;
|
||||||
|
|
||||||
|
_bufferCountGLPoint += 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawPoints(const Vec2 *position, unsigned int numberOfPoints, const Color4F &color)
|
||||||
|
{
|
||||||
|
ensureCapacityGLPoint(numberOfPoints);
|
||||||
|
|
||||||
|
V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLPoint + _bufferCountGLPoint);
|
||||||
|
|
||||||
|
for(int i=0; i<numberOfPoints; i++,point++)
|
||||||
|
{
|
||||||
|
V2F_C4B_T2F a = {position[i], Color4B(color), Tex2F(0.0, 0.0) };
|
||||||
|
*point = a;
|
||||||
|
}
|
||||||
|
|
||||||
|
_pointColor = color;
|
||||||
|
|
||||||
|
_bufferCountGLPoint += numberOfPoints;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawLine(const Vec2 &origin, const Vec2 &destination, const Color4F &color)
|
||||||
|
{
|
||||||
|
ensureCapacityGLLine(2);
|
||||||
|
|
||||||
|
V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLLine + _bufferCountGLLine);
|
||||||
|
|
||||||
|
V2F_C4B_T2F a = {origin, Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
V2F_C4B_T2F b = {destination, Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
|
||||||
|
*point = a;
|
||||||
|
*(point+1) = b;
|
||||||
|
|
||||||
|
_bufferCountGLLine += 2;
|
||||||
|
_dirtyGLLine = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color)
|
||||||
|
{
|
||||||
|
drawLine(Vec2(origin.x, origin.y), Vec2(destination.x, origin.y), color);
|
||||||
|
drawLine(Vec2(destination.x, origin.y), Vec2(destination.x, destination.y), color);
|
||||||
|
drawLine(Vec2(destination.x, destination.y), Vec2(origin.x, destination.y), color);
|
||||||
|
drawLine(Vec2(origin.x, destination.y), Vec2(origin.x, origin.y), color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawPoly(const Vec2 *poli, unsigned int numberOfPoints, bool closePolygon, const Color4F &color)
|
||||||
|
{
|
||||||
|
unsigned int vertext_count;
|
||||||
|
if(closePolygon)
|
||||||
|
{
|
||||||
|
vertext_count = 2 * numberOfPoints;
|
||||||
|
ensureCapacityGLLine(vertext_count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
vertext_count = 2 * (numberOfPoints - 1);
|
||||||
|
ensureCapacityGLLine(vertext_count);
|
||||||
|
}
|
||||||
|
|
||||||
|
V2F_C4B_T2F *point = (V2F_C4B_T2F*)(_bufferGLLine + _bufferCountGLLine);
|
||||||
|
|
||||||
|
int i;
|
||||||
|
for(i=0; i<numberOfPoints-1; i++)
|
||||||
|
{
|
||||||
|
V2F_C4B_T2F a = {poli[i], Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
V2F_C4B_T2F b = {poli[i+1], Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
|
||||||
|
*point = a;
|
||||||
|
*(point+1) = b;
|
||||||
|
point += 2;
|
||||||
|
}
|
||||||
|
if(closePolygon)
|
||||||
|
{
|
||||||
|
V2F_C4B_T2F a = {poli[i], Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
V2F_C4B_T2F b = {poli[0], Color4B(color), Tex2F(0.0, 0.0)};
|
||||||
|
*point = a;
|
||||||
|
*(point+1) = b;
|
||||||
|
}
|
||||||
|
|
||||||
|
_bufferCountGLLine += vertext_count;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY, const Color4F &color)
|
||||||
|
{
|
||||||
|
const float coef = 2.0f * (float)M_PI/segments;
|
||||||
|
|
||||||
|
Vec2 *vertices = new (std::nothrow) Vec2[segments+2];
|
||||||
|
if( ! vertices )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(unsigned int i = 0;i <= segments; i++) {
|
||||||
|
float rads = i*coef;
|
||||||
|
GLfloat j = radius * cosf(rads + angle) * scaleX + center.x;
|
||||||
|
GLfloat k = radius * sinf(rads + angle) * scaleY + center.y;
|
||||||
|
|
||||||
|
vertices[i].x = j;
|
||||||
|
vertices[i].y = k;
|
||||||
|
}
|
||||||
|
if(drawLineToCenter)
|
||||||
|
{
|
||||||
|
vertices[segments+1].x = center.x;
|
||||||
|
vertices[segments+1].y = center.y;
|
||||||
|
drawPoly(vertices, segments+2, true, color);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
drawPoly(vertices, segments+1, true, color);
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawCircle(const Vec2 ¢er, float radius, float angle, unsigned int segments, bool drawLineToCenter, const Color4F &color)
|
||||||
|
{
|
||||||
|
drawCircle(center, radius, angle, segments, drawLineToCenter, 1.0f, 1.0f, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawQuadBezier(const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments, const Color4F &color)
|
||||||
|
{
|
||||||
|
Vec2* vertices = new (std::nothrow) Vec2[segments + 1];
|
||||||
|
if( ! vertices )
|
||||||
|
return;
|
||||||
|
|
||||||
|
float t = 0.0f;
|
||||||
|
for(unsigned int i = 0; i < segments; i++)
|
||||||
|
{
|
||||||
|
vertices[i].x = powf(1 - t, 2) * origin.x + 2.0f * (1 - t) * t * control.x + t * t * destination.x;
|
||||||
|
vertices[i].y = powf(1 - t, 2) * origin.y + 2.0f * (1 - t) * t * control.y + t * t * destination.y;
|
||||||
|
t += 1.0f / segments;
|
||||||
|
}
|
||||||
|
vertices[segments].x = destination.x;
|
||||||
|
vertices[segments].y = destination.y;
|
||||||
|
|
||||||
|
drawPoly(vertices, segments+1, false, color);
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawCubicBezier(const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments, const Color4F &color)
|
||||||
|
{
|
||||||
|
Vec2* vertices = new (std::nothrow) Vec2[segments + 1];
|
||||||
|
if( ! vertices )
|
||||||
|
return;
|
||||||
|
|
||||||
|
float t = 0;
|
||||||
|
for (unsigned int i = 0; i < segments; i++)
|
||||||
|
{
|
||||||
|
vertices[i].x = powf(1 - t, 3) * origin.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * destination.x;
|
||||||
|
vertices[i].y = powf(1 - t, 3) * origin.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * destination.y;
|
||||||
|
t += 1.0f / segments;
|
||||||
|
}
|
||||||
|
vertices[segments].x = destination.x;
|
||||||
|
vertices[segments].y = destination.y;
|
||||||
|
|
||||||
|
drawPoly(vertices, segments+1, false, color);
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawCardinalSpline(PointArray *config, float tension, unsigned int segments, const Color4F &color)
|
||||||
|
{
|
||||||
|
Vec2* vertices = new (std::nothrow) Vec2[segments + 1];
|
||||||
|
if( ! vertices )
|
||||||
|
return;
|
||||||
|
|
||||||
|
ssize_t p;
|
||||||
|
float lt;
|
||||||
|
float deltaT = 1.0f / config->count();
|
||||||
|
|
||||||
|
for( unsigned int i=0; i < segments+1;i++) {
|
||||||
|
|
||||||
|
float dt = (float)i / segments;
|
||||||
|
|
||||||
|
// border
|
||||||
|
if( dt == 1 ) {
|
||||||
|
p = config->count() - 1;
|
||||||
|
lt = 1;
|
||||||
|
} else {
|
||||||
|
p = dt / deltaT;
|
||||||
|
lt = (dt - deltaT * (float)p) / deltaT;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Interpolate
|
||||||
|
Vec2 pp0 = config->getControlPointAtIndex(p-1);
|
||||||
|
Vec2 pp1 = config->getControlPointAtIndex(p+0);
|
||||||
|
Vec2 pp2 = config->getControlPointAtIndex(p+1);
|
||||||
|
Vec2 pp3 = config->getControlPointAtIndex(p+2);
|
||||||
|
|
||||||
|
Vec2 newPos = ccCardinalSplineAt( pp0, pp1, pp2, pp3, tension, lt);
|
||||||
|
vertices[i].x = newPos.x;
|
||||||
|
vertices[i].y = newPos.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawPoly(vertices, segments+1, false, color);
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawCatmullRom(PointArray *points, unsigned int segments, const Color4F &color)
|
||||||
|
{
|
||||||
|
drawCardinalSpline( points, 0.5f, segments, color);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawNode::drawDot(const Vec2 &pos, float radius, const Color4F &color)
|
void DrawNode::drawDot(const Vec2 &pos, float radius, const Color4F &color)
|
||||||
{
|
{
|
||||||
unsigned int vertex_count = 2*3;
|
unsigned int vertex_count = 2*3;
|
||||||
|
@ -273,6 +641,27 @@ void DrawNode::drawDot(const Vec2 &pos, float radius, const Color4F &color)
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawRect(const Vec2 &lb, const Vec2 <, const Vec2 &rt, const Vec2& rb, const Color4F &color)
|
||||||
|
{
|
||||||
|
unsigned int vertex_count = 2*3;
|
||||||
|
ensureCapacity(vertex_count);
|
||||||
|
|
||||||
|
V2F_C4B_T2F a = {lb, Color4B(color), Tex2F(-1.0, -1.0) };
|
||||||
|
V2F_C4B_T2F b = {lt, Color4B(color), Tex2F(-1.0, 1.0) };
|
||||||
|
V2F_C4B_T2F c = {rt, Color4B(color), Tex2F( 1.0, 1.0) };
|
||||||
|
V2F_C4B_T2F d = {rb, Color4B(color), Tex2F( 1.0, -1.0) };
|
||||||
|
|
||||||
|
V2F_C4B_T2F_Triangle *triangles = (V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount);
|
||||||
|
V2F_C4B_T2F_Triangle triangle0 = {a, b, c};
|
||||||
|
V2F_C4B_T2F_Triangle triangle1 = {a, c, d};
|
||||||
|
triangles[0] = triangle0;
|
||||||
|
triangles[1] = triangle1;
|
||||||
|
|
||||||
|
_bufferCount += vertex_count;
|
||||||
|
|
||||||
|
_dirty = true;
|
||||||
|
}
|
||||||
|
|
||||||
void DrawNode::drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color)
|
void DrawNode::drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color)
|
||||||
{
|
{
|
||||||
unsigned int vertex_count = 6*3;
|
unsigned int vertex_count = 6*3;
|
||||||
|
@ -346,7 +735,7 @@ void DrawNode::drawSegment(const Vec2 &from, const Vec2 &to, float radius, const
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::drawPolygon(Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor)
|
void DrawNode::drawPolygon(const Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor)
|
||||||
{
|
{
|
||||||
CCASSERT(count >= 0, "invalid count value");
|
CCASSERT(count >= 0, "invalid count value");
|
||||||
|
|
||||||
|
@ -454,9 +843,54 @@ void DrawNode::drawPolygon(Vec2 *verts, int count, const Color4F &fillColor, flo
|
||||||
free(extrude);
|
free(extrude);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color)
|
||||||
|
{
|
||||||
|
Vec2 vertices[] = {
|
||||||
|
origin,
|
||||||
|
Vec2(destination.x, origin.y),
|
||||||
|
destination,
|
||||||
|
Vec2(origin.x, destination.y)
|
||||||
|
};
|
||||||
|
|
||||||
|
drawSolidPoly(vertices, 4, color );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, const Color4F &color)
|
||||||
|
{
|
||||||
|
drawPolygon(poli, numberOfPoints, color, 0.0, Color4F(0.0, 0.0, 0.0, 0.0));
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color)
|
||||||
|
{
|
||||||
|
const float coef = 2.0f * (float)M_PI/segments;
|
||||||
|
|
||||||
|
Vec2 *vertices = new (std::nothrow) Vec2[segments];
|
||||||
|
if( ! vertices )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for(unsigned int i = 0;i < segments; i++)
|
||||||
|
{
|
||||||
|
float rads = i*coef;
|
||||||
|
GLfloat j = radius * cosf(rads + angle) * scaleX + center.x;
|
||||||
|
GLfloat k = radius * sinf(rads + angle) * scaleY + center.y;
|
||||||
|
|
||||||
|
vertices[i].x = j;
|
||||||
|
vertices[i].y = k;
|
||||||
|
}
|
||||||
|
|
||||||
|
drawSolidPoly(vertices, segments, color);
|
||||||
|
|
||||||
|
CC_SAFE_DELETE_ARRAY(vertices);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawNode::drawSolidCircle( const Vec2& center, float radius, float angle, unsigned int segments, const Color4F& color)
|
||||||
|
{
|
||||||
|
drawSolidCircle(center, radius, angle, segments, 1.0f, 1.0f, color);
|
||||||
|
}
|
||||||
|
|
||||||
void DrawNode::drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Color4F &color)
|
void DrawNode::drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Color4F &color)
|
||||||
{
|
{
|
||||||
unsigned int vertex_count = 2*3;
|
unsigned int vertex_count = 3;
|
||||||
ensureCapacity(vertex_count);
|
ensureCapacity(vertex_count);
|
||||||
|
|
||||||
Color4B col = Color4B(color);
|
Color4B col = Color4B(color);
|
||||||
|
@ -472,72 +906,19 @@ void DrawNode::drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, cons
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::drawCubicBezier(const Vec2& from, const Vec2& control1, const Vec2& control2, const Vec2& to, unsigned int segments, const Color4F &color)
|
|
||||||
{
|
|
||||||
unsigned int vertex_count = (segments + 1) * 3;
|
|
||||||
ensureCapacity(vertex_count);
|
|
||||||
|
|
||||||
Tex2F texCoord = Tex2F(0.0, 0.0);
|
|
||||||
Color4B col = Color4B(color);
|
|
||||||
Vec2 vertex;
|
|
||||||
Vec2 firstVertex = Vec2(from.x, from.y);
|
|
||||||
Vec2 lastVertex = Vec2(to.x, to.y);
|
|
||||||
|
|
||||||
float t = 0;
|
|
||||||
for(unsigned int i = segments + 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
float x = powf(1 - t, 3) * from.x + 3.0f * powf(1 - t, 2) * t * control1.x + 3.0f * (1 - t) * t * t * control2.x + t * t * t * to.x;
|
|
||||||
float y = powf(1 - t, 3) * from.y + 3.0f * powf(1 - t, 2) * t * control1.y + 3.0f * (1 - t) * t * t * control2.y + t * t * t * to.y;
|
|
||||||
vertex = Vec2(x, y);
|
|
||||||
|
|
||||||
V2F_C4B_T2F a = {firstVertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F b = {lastVertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F c = {vertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F_Triangle triangle = {a, b, c};
|
|
||||||
((V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount))[0] = triangle;
|
|
||||||
|
|
||||||
lastVertex = vertex;
|
|
||||||
t += 1.0f / segments;
|
|
||||||
_bufferCount += 3;
|
|
||||||
}
|
|
||||||
_dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DrawNode::drawQuadraticBezier(const Vec2& from, const Vec2& control, const Vec2& to, unsigned int segments, const Color4F &color)
|
void DrawNode::drawQuadraticBezier(const Vec2& from, const Vec2& control, const Vec2& to, unsigned int segments, const Color4F &color)
|
||||||
{
|
{
|
||||||
unsigned int vertex_count = (segments + 1) * 3;
|
drawQuadBezier(from, control, to, segments, color);
|
||||||
ensureCapacity(vertex_count);
|
|
||||||
|
|
||||||
Tex2F texCoord = Tex2F(0.0, 0.0);
|
|
||||||
Color4B col = Color4B(color);
|
|
||||||
Vec2 vertex;
|
|
||||||
Vec2 firstVertex = Vec2(from.x, from.y);
|
|
||||||
Vec2 lastVertex = Vec2(to.x, to.y);
|
|
||||||
|
|
||||||
float t = 0;
|
|
||||||
for(unsigned int i = segments + 1; i > 0; i--)
|
|
||||||
{
|
|
||||||
float x = powf(1 - t, 2) * from.x + 2.0f * (1 - t) * t * control.x + t * t * to.x;
|
|
||||||
float y = powf(1 - t, 2) * from.y + 2.0f * (1 - t) * t * control.y + t * t * to.y;
|
|
||||||
vertex = Vec2(x, y);
|
|
||||||
|
|
||||||
V2F_C4B_T2F a = {firstVertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F b = {lastVertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F c = {vertex, col, texCoord };
|
|
||||||
V2F_C4B_T2F_Triangle triangle = {a, b, c};
|
|
||||||
((V2F_C4B_T2F_Triangle *)(_buffer + _bufferCount))[0] = triangle;
|
|
||||||
|
|
||||||
lastVertex = vertex;
|
|
||||||
t += 1.0f / segments;
|
|
||||||
_bufferCount += 3;
|
|
||||||
}
|
|
||||||
_dirty = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::clear()
|
void DrawNode::clear()
|
||||||
{
|
{
|
||||||
_bufferCount = 0;
|
_bufferCount = 0;
|
||||||
_dirty = true;
|
_dirty = true;
|
||||||
|
_bufferCountGLLine = 0;
|
||||||
|
_dirtyGLLine = true;
|
||||||
|
_bufferCountGLPoint = 0;
|
||||||
|
_dirtyGLPoint = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const BlendFunc& DrawNode::getBlendFunc() const
|
const BlendFunc& DrawNode::getBlendFunc() const
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "2d/CCNode.h"
|
#include "2d/CCNode.h"
|
||||||
#include "base/ccTypes.h"
|
#include "base/ccTypes.h"
|
||||||
#include "renderer/CCCustomCommand.h"
|
#include "renderer/CCCustomCommand.h"
|
||||||
|
#include "math/CCMath.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -43,15 +44,51 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
@since v2.1
|
@since v2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class PointArray;
|
||||||
|
|
||||||
class CC_DLL DrawNode : public Node
|
class CC_DLL DrawNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates and initialize a DrawNode node */
|
/** creates and initialize a DrawNode node */
|
||||||
static DrawNode* create();
|
static DrawNode* create();
|
||||||
|
|
||||||
|
void drawPoint(const Vec2& point, const float pointSize, const Color4F &color);
|
||||||
|
|
||||||
|
void drawPoints(const Vec2 *position, unsigned int numberOfPoints, const Color4F &color);
|
||||||
|
|
||||||
|
void drawLine(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||||
|
|
||||||
|
void drawRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||||
|
|
||||||
|
void drawPoly(const Vec2 *poli, unsigned int numberOfPoints, bool closePolygon, const Color4F &color);
|
||||||
|
|
||||||
|
void drawCircle( const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY, const Color4F &color);
|
||||||
|
|
||||||
|
void drawCircle(const Vec2 ¢er, float radius, float angle, unsigned int segments, bool drawLineToCenter, const Color4F &color);
|
||||||
|
|
||||||
|
void drawQuadBezier(const Vec2 &origin, const Vec2 &control, const Vec2 &destination, unsigned int segments, const Color4F &color);
|
||||||
|
|
||||||
|
/** draw a cubic bezier curve with color and number of segments */
|
||||||
|
void drawCubicBezier(const Vec2 &origin, const Vec2 &control1, const Vec2 &control2, const Vec2 &destination, unsigned int segments, const Color4F &color);
|
||||||
|
|
||||||
|
void drawCardinalSpline(PointArray *config, float tension, unsigned int segments, const Color4F &color);
|
||||||
|
|
||||||
|
void drawCatmullRom(PointArray *points, unsigned int segments, const Color4F &color);
|
||||||
|
|
||||||
/** draw a dot at a position, with a given radius and color */
|
/** draw a dot at a position, with a given radius and color */
|
||||||
void drawDot(const Vec2 &pos, float radius, const Color4F &color);
|
void drawDot(const Vec2 &pos, float radius, const Color4F &color);
|
||||||
|
|
||||||
|
void drawRect(const Vec2 &lb, const Vec2 <, const Vec2 &rt, const Vec2& rb, const Color4F &color);
|
||||||
|
|
||||||
|
void drawSolidRect(const Vec2 &origin, const Vec2 &destination, const Color4F &color);
|
||||||
|
|
||||||
|
void drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, const Color4F &color);
|
||||||
|
|
||||||
|
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY, const Color4F &color);
|
||||||
|
|
||||||
|
void drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, const Color4F& color);
|
||||||
|
|
||||||
/** draw a segment with a radius and color */
|
/** draw a segment with a radius and color */
|
||||||
void drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color);
|
void drawSegment(const Vec2 &from, const Vec2 &to, float radius, const Color4F &color);
|
||||||
|
|
||||||
|
@ -62,16 +99,13 @@ public:
|
||||||
* In lua:local drawPolygon(local pointTable,local tableCount,local fillColor,local width,local borderColor)
|
* In lua:local drawPolygon(local pointTable,local tableCount,local fillColor,local width,local borderColor)
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
void drawPolygon(Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
|
void drawPolygon(const Vec2 *verts, int count, const Color4F &fillColor, float borderWidth, const Color4F &borderColor);
|
||||||
|
|
||||||
/** draw a triangle with color */
|
/** draw a triangle with color */
|
||||||
void drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Color4F &color);
|
void drawTriangle(const Vec2 &p1, const Vec2 &p2, const Vec2 &p3, const Color4F &color);
|
||||||
|
|
||||||
/** draw a cubic bezier curve with color and number of segments */
|
/** draw a quadratic bezier curve with color and number of segments, use drawQuadBezier instead*/
|
||||||
void drawCubicBezier(const Vec2& from, const Vec2& control1, const Vec2& control2, const Vec2& to, unsigned int segments, const Color4F &color);
|
CC_DEPRECATED_ATTRIBUTE void drawQuadraticBezier(const Vec2& from, const Vec2& control, const Vec2& to, unsigned int segments, const Color4F &color);
|
||||||
|
|
||||||
/** draw a quadratic bezier curve with color and number of segments */
|
|
||||||
void drawQuadraticBezier(const Vec2& from, const Vec2& control, const Vec2& to, unsigned int segments, const Color4F &color);
|
|
||||||
|
|
||||||
/** Clear the geometry in the node's buffer. */
|
/** Clear the geometry in the node's buffer. */
|
||||||
void clear();
|
void clear();
|
||||||
|
@ -90,6 +124,8 @@ public:
|
||||||
void setBlendFunc(const BlendFunc &blendFunc);
|
void setBlendFunc(const BlendFunc &blendFunc);
|
||||||
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
void onDraw(const Mat4 &transform, uint32_t flags);
|
||||||
|
void onDrawGLLine(const Mat4 &transform, uint32_t flags);
|
||||||
|
void onDrawGLPoint(const Mat4 &transform, uint32_t flags);
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||||
|
@ -101,18 +137,38 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void ensureCapacity(int count);
|
void ensureCapacity(int count);
|
||||||
|
void ensureCapacityGLPoint(int count);
|
||||||
|
void ensureCapacityGLLine(int count);
|
||||||
|
|
||||||
GLuint _vao;
|
GLuint _vao;
|
||||||
GLuint _vbo;
|
GLuint _vbo;
|
||||||
|
GLuint _vaoGLPoint;
|
||||||
|
GLuint _vboGLPoint;
|
||||||
|
GLuint _vaoGLLine;
|
||||||
|
GLuint _vboGLLine;
|
||||||
|
|
||||||
int _bufferCapacity;
|
int _bufferCapacity;
|
||||||
GLsizei _bufferCount;
|
GLsizei _bufferCount;
|
||||||
V2F_C4B_T2F *_buffer;
|
V2F_C4B_T2F *_buffer;
|
||||||
|
|
||||||
|
int _bufferCapacityGLPoint;
|
||||||
|
GLsizei _bufferCountGLPoint;
|
||||||
|
V2F_C4B_T2F *_bufferGLPoint;
|
||||||
|
Color4F _pointColor;
|
||||||
|
int _pointSize;
|
||||||
|
|
||||||
|
int _bufferCapacityGLLine;
|
||||||
|
GLsizei _bufferCountGLLine;
|
||||||
|
V2F_C4B_T2F *_bufferGLLine;
|
||||||
|
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
CustomCommand _customCommand;
|
CustomCommand _customCommand;
|
||||||
|
CustomCommand _customCommandGLPoint;
|
||||||
|
CustomCommand _customCommandGLLine;
|
||||||
|
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
|
bool _dirtyGLPoint;
|
||||||
|
bool _dirtyGLLine;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||||
|
|
|
@ -79,85 +79,85 @@ class PointArray;
|
||||||
namespace DrawPrimitives
|
namespace DrawPrimitives
|
||||||
{
|
{
|
||||||
/** Initializes the drawing primitives */
|
/** Initializes the drawing primitives */
|
||||||
void CC_DLL init();
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL init();
|
||||||
|
|
||||||
/** Frees allocated resources by the drawing primitives */
|
/** Frees allocated resources by the drawing primitives */
|
||||||
void CC_DLL free();
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL free();
|
||||||
|
|
||||||
/** draws a point given x and y coordinate measured in points */
|
/** draws a point given x and y coordinate measured in points */
|
||||||
void CC_DLL drawPoint(const Vec2& point);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawPoint(const Vec2& point);
|
||||||
|
|
||||||
/** draws an array of points.
|
/** draws an array of points.
|
||||||
@since v0.7.2
|
@since v0.7.2
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawPoints(const Vec2 *points, unsigned int numberOfPoints);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawPoints(const Vec2 *points, unsigned int numberOfPoints);
|
||||||
|
|
||||||
/** draws a line given the origin and destination point measured in points */
|
/** draws a line given the origin and destination point measured in points */
|
||||||
void CC_DLL drawLine(const Vec2& origin, const Vec2& destination);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawLine(const Vec2& origin, const Vec2& destination);
|
||||||
|
|
||||||
/** draws a rectangle given the origin and destination point measured in points. */
|
/** draws a rectangle given the origin and destination point measured in points. */
|
||||||
void CC_DLL drawRect(Vec2 origin, Vec2 destination);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawRect(Vec2 origin, Vec2 destination);
|
||||||
|
|
||||||
/** draws a solid rectangle given the origin and destination point measured in points.
|
/** draws a solid rectangle given the origin and destination point measured in points.
|
||||||
@since 1.1
|
@since 1.1
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawSolidRect(Vec2 origin, Vec2 destination, Color4F color);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidRect(Vec2 origin, Vec2 destination, Color4F color);
|
||||||
|
|
||||||
/** draws a polygon given a pointer to point coordinates and the number of vertices measured in points.
|
/** draws a polygon given a pointer to point coordinates and the number of vertices measured in points.
|
||||||
The polygon can be closed or open
|
The polygon can be closed or open
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawPoly(const Vec2 *vertices, unsigned int numOfVertices, bool closePolygon);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawPoly(const Vec2 *vertices, unsigned int numOfVertices, bool closePolygon);
|
||||||
|
|
||||||
/** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
|
/** draws a solid polygon given a pointer to CGPoint coordinates, the number of vertices measured in points, and a color.
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, Color4F color);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidPoly(const Vec2 *poli, unsigned int numberOfPoints, Color4F color);
|
||||||
|
|
||||||
/** draws a circle given the center, radius and number of segments. */
|
/** draws a circle given the center, radius and number of segments. */
|
||||||
void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter, float scaleX, float scaleY);
|
||||||
void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawCircle(const Vec2& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
|
||||||
|
|
||||||
/** draws a solid circle given the center, radius and number of segments. */
|
/** draws a solid circle given the center, radius and number of segments. */
|
||||||
void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments, float scaleX, float scaleY);
|
||||||
void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawSolidCircle(const Vec2& center, float radius, float angle, unsigned int segments);
|
||||||
|
|
||||||
/** draws a quad bezier path
|
/** draws a quad bezier path
|
||||||
@warning This function could be pretty slow. Use it only for debugging purposes.
|
@warning This function could be pretty slow. Use it only for debugging purposes.
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawQuadBezier(const Vec2& origin, const Vec2& control, const Vec2& destination, unsigned int segments);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawQuadBezier(const Vec2& origin, const Vec2& control, const Vec2& destination, unsigned int segments);
|
||||||
|
|
||||||
/** draws a cubic bezier path
|
/** draws a cubic bezier path
|
||||||
@warning This function could be pretty slow. Use it only for debugging purposes.
|
@warning This function could be pretty slow. Use it only for debugging purposes.
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawCubicBezier(const Vec2& origin, const Vec2& control1, const Vec2& control2, const Vec2& destination, unsigned int segments);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawCubicBezier(const Vec2& origin, const Vec2& control1, const Vec2& control2, const Vec2& destination, unsigned int segments);
|
||||||
|
|
||||||
/** draws a Catmull Rom path.
|
/** draws a Catmull Rom path.
|
||||||
@warning This function could be pretty slow. Use it only for debugging purposes.
|
@warning This function could be pretty slow. Use it only for debugging purposes.
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawCatmullRom(PointArray *arrayOfControlPoints, unsigned int segments);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawCatmullRom(PointArray *arrayOfControlPoints, unsigned int segments);
|
||||||
|
|
||||||
/** draws a Cardinal Spline path.
|
/** draws a Cardinal Spline path.
|
||||||
@warning This function could be pretty slow. Use it only for debugging purposes.
|
@warning This function could be pretty slow. Use it only for debugging purposes.
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
void CC_DLL drawCardinalSpline(PointArray *config, float tension, unsigned int segments);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL drawCardinalSpline(PointArray *config, float tension, unsigned int segments);
|
||||||
|
|
||||||
/** set the drawing color with 4 unsigned bytes
|
/** set the drawing color with 4 unsigned bytes
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
void CC_DLL setDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL setDrawColor4B(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
|
||||||
|
|
||||||
/** set the drawing color with 4 floats
|
/** set the drawing color with 4 floats
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
void CC_DLL setDrawColor4F(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL setDrawColor4F(GLfloat r, GLfloat g, GLfloat b, GLfloat a);
|
||||||
|
|
||||||
/** set the point size in points. Default 1.
|
/** set the point size in points. Default 1.
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
void CC_DLL setPointSize(GLfloat pointSize);
|
CC_DEPRECATED_ATTRIBUTE void CC_DLL setPointSize(GLfloat pointSize);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -64,15 +64,17 @@ FontAtlas::FontAtlas(Font &theFont)
|
||||||
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
|
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
|
||||||
}
|
}
|
||||||
_currentPageDataSize = CacheTextureWidth * CacheTextureHeight;
|
_currentPageDataSize = CacheTextureWidth * CacheTextureHeight;
|
||||||
if(fontTTf->getOutlineSize() > 0)
|
auto outlineSize = fontTTf->getOutlineSize();
|
||||||
|
if(outlineSize > 0)
|
||||||
{
|
{
|
||||||
|
_commonLineHeight += 2 * outlineSize * CC_CONTENT_SCALE_FACTOR();
|
||||||
_currentPageDataSize *= 2;
|
_currentPageDataSize *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentPageData = new unsigned char[_currentPageDataSize];
|
_currentPageData = new unsigned char[_currentPageDataSize];
|
||||||
memset(_currentPageData, 0, _currentPageDataSize);
|
memset(_currentPageData, 0, _currentPageDataSize);
|
||||||
|
|
||||||
auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8;
|
auto pixelFormat = outlineSize > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8;
|
||||||
texture->initWithData(_currentPageData, _currentPageDataSize,
|
texture->initWithData(_currentPageData, _currentPageDataSize,
|
||||||
pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) );
|
pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) );
|
||||||
|
|
||||||
|
|
|
@ -252,19 +252,8 @@ void LabelAtlas::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
AtlasNode::draw(renderer, transform, transformUpdated);
|
AtlasNode::draw(renderer, transform, transformUpdated);
|
||||||
|
|
||||||
_customDebugDrawCommand.init(_globalZOrder);
|
_debugDrawNode->clear();
|
||||||
_customDebugDrawCommand.func = CC_CALLBACK_0(LabelAtlas::drawDebugData, this,transform,transformUpdated);
|
|
||||||
renderer->addCommand(&_customDebugDrawCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelAtlas::drawDebugData(const Mat4& transform, bool transformUpdated)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto size = getContentSize();
|
auto size = getContentSize();
|
||||||
|
|
||||||
Vec2 vertices[4]=
|
Vec2 vertices[4]=
|
||||||
{
|
{
|
||||||
Vec2::ZERO,
|
Vec2::ZERO,
|
||||||
|
@ -272,10 +261,7 @@ void LabelAtlas::drawDebugData(const Mat4& transform, bool transformUpdated)
|
||||||
Vec2(size.width, size.height),
|
Vec2(size.width, size.height),
|
||||||
Vec2(0, size.height)
|
Vec2(0, size.height)
|
||||||
};
|
};
|
||||||
|
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,12 @@ public:
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
LabelAtlas()
|
LabelAtlas()
|
||||||
:_string("")
|
:_string("")
|
||||||
{}
|
{
|
||||||
|
#if CC_LABELATLAS_DEBUG_DRAW
|
||||||
|
_debugDrawNode = DrawNode::create();
|
||||||
|
addChild(_debugDrawNode);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
virtual ~LabelAtlas()
|
virtual ~LabelAtlas()
|
||||||
{
|
{
|
||||||
|
@ -101,8 +106,7 @@ protected:
|
||||||
virtual void updateColor() override;
|
virtual void updateColor() override;
|
||||||
|
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if CC_LABELATLAS_DEBUG_DRAW
|
||||||
CustomCommand _customDebugDrawCommand;
|
DrawNode *_debugDrawNode;
|
||||||
void drawDebugData(const Mat4& transform, bool transformUpdated);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// string to render
|
// string to render
|
||||||
|
|
|
@ -98,6 +98,11 @@ LabelBMFont::LabelBMFont()
|
||||||
this->addChild(_label);
|
this->addChild(_label);
|
||||||
this->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
this->setAnchorPoint(Vec2::ANCHOR_MIDDLE);
|
||||||
_cascadeOpacityEnabled = true;
|
_cascadeOpacityEnabled = true;
|
||||||
|
|
||||||
|
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||||
|
_debugDrawNode = DrawNode::create();
|
||||||
|
addChild(_debugDrawNode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelBMFont::~LabelBMFont()
|
LabelBMFont::~LabelBMFont()
|
||||||
|
@ -210,19 +215,8 @@ void LabelBMFont::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags
|
||||||
{
|
{
|
||||||
Node::draw(renderer, transform, transformUpdated);
|
Node::draw(renderer, transform, transformUpdated);
|
||||||
|
|
||||||
_customDebugDrawCommand.init(_globalZOrder);
|
_debugDrawNode->clear();
|
||||||
_customDebugDrawCommand.func = CC_CALLBACK_0(LabelBMFont::drawDebugData, this,transform,transformUpdated);
|
|
||||||
renderer->addCommand(&_customDebugDrawCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelBMFont::drawDebugData(const Mat4& transform, bool transformUpdated)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto size = getContentSize();
|
auto size = getContentSize();
|
||||||
|
|
||||||
Vec2 vertices[4]=
|
Vec2 vertices[4]=
|
||||||
{
|
{
|
||||||
Vec2::ZERO,
|
Vec2::ZERO,
|
||||||
|
@ -230,10 +224,7 @@ void LabelBMFont::drawDebugData(const Mat4& transform, bool transformUpdated)
|
||||||
Vec2(size.width, size.height),
|
Vec2(size.width, size.height),
|
||||||
Vec2(0, size.height)
|
Vec2(0, size.height)
|
||||||
};
|
};
|
||||||
|
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -129,8 +129,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||||
CustomCommand _customDebugDrawCommand;
|
DrawNode *_debugDrawNode;
|
||||||
void drawDebugData(const Mat4& transform, bool transformUpdated);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// name of fntFile
|
// name of fntFile
|
||||||
|
|
|
@ -263,6 +263,10 @@ Sprite::Sprite(void)
|
||||||
, _texture(nullptr)
|
, _texture(nullptr)
|
||||||
, _insideBounds(true)
|
, _insideBounds(true)
|
||||||
{
|
{
|
||||||
|
#if CC_SPRITE_DEBUG_DRAW
|
||||||
|
_debugDrawNode = DrawNode::create();
|
||||||
|
addChild(_debugDrawNode);
|
||||||
|
#endif //CC_SPRITE_DEBUG_DRAW
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite::~Sprite(void)
|
Sprite::~Sprite(void)
|
||||||
|
@ -585,32 +589,17 @@ void Sprite::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
_quadCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, transform);
|
_quadCommand.init(_globalZOrder, _texture->getName(), getGLProgramState(), _blendFunc, &_quad, 1, transform);
|
||||||
renderer->addCommand(&_quadCommand);
|
renderer->addCommand(&_quadCommand);
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
#if CC_SPRITE_DEBUG_DRAW
|
||||||
_customDebugDrawCommand.init(_globalZOrder);
|
_debugDrawNode->clear();
|
||||||
_customDebugDrawCommand.func = CC_CALLBACK_0(Sprite::drawDebugData, this);
|
Vec2 vertices[4] = {
|
||||||
renderer->addCommand(&_customDebugDrawCommand);
|
Vec2( _quad.bl.vertices.x, _quad.bl.vertices.y ),
|
||||||
|
Vec2( _quad.br.vertices.x, _quad.br.vertices.y ),
|
||||||
|
Vec2( _quad.tr.vertices.x, _quad.tr.vertices.y ),
|
||||||
|
Vec2( _quad.tl.vertices.x, _quad.tl.vertices.y ),
|
||||||
|
};
|
||||||
|
_debugDrawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
#endif //CC_SPRITE_DEBUG_DRAW
|
#endif //CC_SPRITE_DEBUG_DRAW
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
|
||||||
void Sprite::drawDebugData()
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
Mat4 oldModelView;
|
|
||||||
oldModelView = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
|
||||||
// draw bounding box
|
|
||||||
Vec2 vertices[4] = {
|
|
||||||
Vec2( _quad.bl.vertices.x, _quad.bl.vertices.y ),
|
|
||||||
Vec2( _quad.br.vertices.x, _quad.br.vertices.y ),
|
|
||||||
Vec2( _quad.tr.vertices.x, _quad.tr.vertices.y ),
|
|
||||||
Vec2( _quad.tl.vertices.x, _quad.tl.vertices.y ),
|
|
||||||
};
|
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldModelView);
|
|
||||||
}
|
|
||||||
#endif //CC_SPRITE_DEBUG_DRAW
|
|
||||||
|
|
||||||
// MARK: visit, draw, transform
|
// MARK: visit, draw, transform
|
||||||
|
|
||||||
|
|
|
@ -540,8 +540,7 @@ protected:
|
||||||
Texture2D* _texture; /// Texture2D object that is used to render the sprite
|
Texture2D* _texture; /// Texture2D object that is used to render the sprite
|
||||||
QuadCommand _quadCommand; /// quad command
|
QuadCommand _quadCommand; /// quad command
|
||||||
#if CC_SPRITE_DEBUG_DRAW
|
#if CC_SPRITE_DEBUG_DRAW
|
||||||
CustomCommand _customDebugDrawCommand;
|
DrawNode *_debugDrawNode;
|
||||||
void drawDebugData();
|
|
||||||
#endif //CC_SPRITE_DEBUG_DRAW
|
#endif //CC_SPRITE_DEBUG_DRAW
|
||||||
//
|
//
|
||||||
// Shared data
|
// Shared data
|
||||||
|
|
|
@ -143,6 +143,7 @@
|
||||||
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WINRT;_DEBUG;_LIB;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4267;4251;4244;4996;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||||
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
|
||||||
|
<AdditionalOptions>-Zm110 %(AdditionalOptions)</AdditionalOptions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Console</SubSystem>
|
<SubSystem>Console</SubSystem>
|
||||||
|
@ -151,8 +152,8 @@
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
<Lib>
|
||||||
<AdditionalOptions>/IGNORE:4264 %(AdditionalOptions)</AdditionalOptions>
|
<AdditionalOptions>/IGNORE:4264 %(AdditionalOptions)</AdditionalOptions>
|
||||||
<AdditionalDependencies>zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>zlib.lib;libpng.lib;libjpeg.lib;libtiff.lib;freetype.lib;libchipmunk.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
<AdditionalLibraryDirectories>$(ProjectDir)..\..\external\winrt-specific\zlib\prebuilt\$(Platform);$(ProjectDir)..\..\external\png\prebuilt\winrt\$(Platform);$(ProjectDir)..\..\external\jpeg\prebuilt\winrt\$(Platform);$(ProjectDir)..\..\external\tiff\prebuilt\winrt\$(Platform);$(ProjectDir)..\..\external\freetype2\prebuilt\winrt\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(ProjectDir)..\..\external\winrt-specific\zlib\prebuilt\$(Platform);$(ProjectDir)..\..\external\png\prebuilt\winrt\$(Platform);$(ProjectDir)..\..\external\jpeg\prebuilt\winrt\$(Platform);$(ProjectDir)..\..\external\tiff\prebuilt\winrt\$(Platform);$(EngineRoot)external\chipmunk\prebuilt\wp8\$(Platform);$(ProjectDir)..\..\external\freetype2\prebuilt\winrt\$(Platform);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||||
</Lib>
|
</Lib>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
@ -346,9 +347,9 @@
|
||||||
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
|
<CompileAs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">CompileAsCpp</CompileAs>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
<ClCompile Include="..\base\CCIMEDispatcher.cpp" />
|
||||||
<ClCompile Include="..\base\CCModuleManager.cpp" />
|
|
||||||
<ClCompile Include="..\base\CCNS.cpp" />
|
<ClCompile Include="..\base\CCNS.cpp" />
|
||||||
<ClCompile Include="..\base\CCProfiling.cpp" />
|
<ClCompile Include="..\base\CCProfiling.cpp" />
|
||||||
|
<ClCompile Include="..\base\ccRandom.cpp" />
|
||||||
<ClCompile Include="..\base\CCRef.cpp" />
|
<ClCompile Include="..\base\CCRef.cpp" />
|
||||||
<ClCompile Include="..\base\CCScheduler.cpp" />
|
<ClCompile Include="..\base\CCScheduler.cpp" />
|
||||||
<ClCompile Include="..\base\CCScriptSupport.cpp" />
|
<ClCompile Include="..\base\CCScriptSupport.cpp" />
|
||||||
|
@ -434,6 +435,7 @@
|
||||||
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
|
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
|
||||||
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
|
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
|
||||||
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
|
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
|
||||||
|
<ClCompile Include="..\renderer\CCTrianglesCommand.cpp" />
|
||||||
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp" />
|
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp" />
|
||||||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
|
||||||
<ClCompile Include="CCAction.cpp" />
|
<ClCompile Include="CCAction.cpp" />
|
||||||
|
@ -542,12 +544,12 @@
|
||||||
<ClInclude Include="..\base\CCIMEDispatcher.h" />
|
<ClInclude Include="..\base\CCIMEDispatcher.h" />
|
||||||
<ClInclude Include="..\base\ccMacros.h" />
|
<ClInclude Include="..\base\ccMacros.h" />
|
||||||
<ClInclude Include="..\base\CCMap.h" />
|
<ClInclude Include="..\base\CCMap.h" />
|
||||||
<ClInclude Include="..\base\CCModuleManager.h" />
|
|
||||||
<ClInclude Include="..\base\CCNS.h" />
|
<ClInclude Include="..\base\CCNS.h" />
|
||||||
<ClInclude Include="..\base\CCPlatformConfig.h" />
|
<ClInclude Include="..\base\CCPlatformConfig.h" />
|
||||||
<ClInclude Include="..\base\CCPlatformMacros.h" />
|
<ClInclude Include="..\base\CCPlatformMacros.h" />
|
||||||
<ClInclude Include="..\base\CCProfiling.h" />
|
<ClInclude Include="..\base\CCProfiling.h" />
|
||||||
<ClInclude Include="..\base\CCProtocols.h" />
|
<ClInclude Include="..\base\CCProtocols.h" />
|
||||||
|
<ClInclude Include="..\base\ccRandom.h" />
|
||||||
<ClInclude Include="..\base\CCRef.h" />
|
<ClInclude Include="..\base\CCRef.h" />
|
||||||
<ClInclude Include="..\base\CCRefPtr.h" />
|
<ClInclude Include="..\base\CCRefPtr.h" />
|
||||||
<ClInclude Include="..\base\CCScheduler.h" />
|
<ClInclude Include="..\base\CCScheduler.h" />
|
||||||
|
@ -605,9 +607,14 @@
|
||||||
<ClInclude Include="..\platform\CCCommon.h" />
|
<ClInclude Include="..\platform\CCCommon.h" />
|
||||||
<ClInclude Include="..\platform\CCDevice.h" />
|
<ClInclude Include="..\platform\CCDevice.h" />
|
||||||
<ClInclude Include="..\platform\CCFileUtils.h" />
|
<ClInclude Include="..\platform\CCFileUtils.h" />
|
||||||
|
<ClInclude Include="..\platform\CCGL.h" />
|
||||||
<ClInclude Include="..\platform\CCGLView.h" />
|
<ClInclude Include="..\platform\CCGLView.h" />
|
||||||
<ClInclude Include="..\platform\CCImage.h" />
|
<ClInclude Include="..\platform\CCImage.h" />
|
||||||
|
<ClInclude Include="..\platform\CCPlatformConfig.h" />
|
||||||
|
<ClInclude Include="..\platform\CCPlatformDefine.h" />
|
||||||
|
<ClInclude Include="..\platform\CCPlatformMacros.h" />
|
||||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||||
|
<ClInclude Include="..\platform\CCStdC.h" />
|
||||||
<ClInclude Include="..\platform\CCThread.h" />
|
<ClInclude Include="..\platform\CCThread.h" />
|
||||||
<ClInclude Include="..\platform\winrt\CCApplication.h" />
|
<ClInclude Include="..\platform\winrt\CCApplication.h" />
|
||||||
<ClInclude Include="..\platform\winrt\CCFileUtilsWinRT.h" />
|
<ClInclude Include="..\platform\winrt\CCFileUtilsWinRT.h" />
|
||||||
|
@ -645,6 +652,7 @@
|
||||||
<ClInclude Include="..\renderer\CCTexture2D.h" />
|
<ClInclude Include="..\renderer\CCTexture2D.h" />
|
||||||
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
|
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
|
||||||
<ClInclude Include="..\renderer\CCTextureCache.h" />
|
<ClInclude Include="..\renderer\CCTextureCache.h" />
|
||||||
|
<ClInclude Include="..\renderer\CCTrianglesCommand.h" />
|
||||||
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h" />
|
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h" />
|
||||||
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
|
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
|
||||||
<ClInclude Include="CCAction.h" />
|
<ClInclude Include="CCAction.h" />
|
||||||
|
|
|
@ -584,9 +584,6 @@
|
||||||
<ClCompile Include="..\base\CCCamera.cpp">
|
<ClCompile Include="..\base\CCCamera.cpp">
|
||||||
<Filter>base</Filter>
|
<Filter>base</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\base\CCModuleManager.cpp">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp">
|
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -599,6 +596,12 @@
|
||||||
<ClCompile Include="..\renderer\CCVertexIndexData.cpp">
|
<ClCompile Include="..\renderer\CCVertexIndexData.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\renderer\CCTrianglesCommand.cpp">
|
||||||
|
<Filter>renderer</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\base\ccRandom.cpp">
|
||||||
|
<Filter>base</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\cocos2d.h" />
|
<ClInclude Include="..\cocos2d.h" />
|
||||||
|
@ -1209,9 +1212,6 @@
|
||||||
<ClInclude Include="..\base\CCCamera.h">
|
<ClInclude Include="..\base\CCCamera.h">
|
||||||
<Filter>base</Filter>
|
<Filter>base</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\base\CCModuleManager.h">
|
|
||||||
<Filter>base</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\renderer\CCPrimitiveCommand.h">
|
<ClInclude Include="..\renderer\CCPrimitiveCommand.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1224,6 +1224,27 @@
|
||||||
<ClInclude Include="..\renderer\CCVertexIndexData.h">
|
<ClInclude Include="..\renderer\CCVertexIndexData.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCPlatformConfig.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCPlatformDefine.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCPlatformMacros.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCGL.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\platform\CCStdC.h">
|
||||||
|
<Filter>platform</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\renderer\CCTrianglesCommand.h">
|
||||||
|
<Filter>renderer</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\base\ccRandom.h">
|
||||||
|
<Filter>base</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\base\CCUserDefault.mm">
|
<None Include="..\base\CCUserDefault.mm">
|
||||||
|
|
|
@ -226,6 +226,7 @@
|
||||||
<ClCompile Include="..\3d\CCAnimate3D.cpp" />
|
<ClCompile Include="..\3d\CCAnimate3D.cpp" />
|
||||||
<ClCompile Include="..\3d\CCAnimation3D.cpp" />
|
<ClCompile Include="..\3d\CCAnimation3D.cpp" />
|
||||||
<ClCompile Include="..\3d\CCAttachNode.cpp" />
|
<ClCompile Include="..\3d\CCAttachNode.cpp" />
|
||||||
|
<ClCompile Include="..\3d\CCBillBoard.cpp" />
|
||||||
<ClCompile Include="..\3d\CCBundle3D.cpp" />
|
<ClCompile Include="..\3d\CCBundle3D.cpp" />
|
||||||
<ClCompile Include="..\3d\CCBundleReader.cpp" />
|
<ClCompile Include="..\3d\CCBundleReader.cpp" />
|
||||||
<ClCompile Include="..\3d\CCMesh.cpp" />
|
<ClCompile Include="..\3d\CCMesh.cpp" />
|
||||||
|
@ -450,6 +451,7 @@
|
||||||
<ClInclude Include="..\3d\CCAnimation3D.h" />
|
<ClInclude Include="..\3d\CCAnimation3D.h" />
|
||||||
<ClInclude Include="..\3d\CCAnimationCurve.h" />
|
<ClInclude Include="..\3d\CCAnimationCurve.h" />
|
||||||
<ClInclude Include="..\3d\CCAttachNode.h" />
|
<ClInclude Include="..\3d\CCAttachNode.h" />
|
||||||
|
<ClInclude Include="..\3d\CCBillBoard.h" />
|
||||||
<ClInclude Include="..\3d\CCBundle3D.h" />
|
<ClInclude Include="..\3d\CCBundle3D.h" />
|
||||||
<ClInclude Include="..\3d\CCBundle3DData.h" />
|
<ClInclude Include="..\3d\CCBundle3DData.h" />
|
||||||
<ClInclude Include="..\3d\CCBundleReader.h" />
|
<ClInclude Include="..\3d\CCBundleReader.h" />
|
||||||
|
|
|
@ -659,6 +659,9 @@
|
||||||
<ClCompile Include="..\platform\wp8\CCGLViewImpl-wp8.cpp">
|
<ClCompile Include="..\platform\wp8\CCGLViewImpl-wp8.cpp">
|
||||||
<Filter>platform\wp8</Filter>
|
<Filter>platform\wp8</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\3d\CCBillBoard.cpp">
|
||||||
|
<Filter>3d</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||||
|
@ -1358,6 +1361,9 @@
|
||||||
<ClInclude Include="..\platform\wp8\CCGLViewImpl-wp8.h">
|
<ClInclude Include="..\platform\wp8\CCGLViewImpl-wp8.h">
|
||||||
<Filter>platform\wp8</Filter>
|
<Filter>platform\wp8</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\3d\CCBillBoard.h">
|
||||||
|
<Filter>3d</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\math\Mat4.inl">
|
<None Include="..\math\Mat4.inl">
|
||||||
|
|
|
@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||||
#include "platform/android/CCGL-android.h"
|
#include "platform/android/CCGL-android.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||||
#include "platform/win32/CCGL-win32.h"
|
#include "platform/win32/CCGL-win32.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
||||||
#include "platform/winrt/CCGL.h"
|
#include "platform/winrt/CCGL.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||||
#include "platform/linux/CCGL-linux.h"
|
#include "platform/linux/CCGL-linux.h"
|
||||||
|
|
|
@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||||
#include "platform/android/CCPlatformDefine-android.h"
|
#include "platform/android/CCPlatformDefine-android.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||||
#include "platform/win32/CCPlatformDefine-win32.h"
|
#include "platform/win32/CCPlatformDefine-win32.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
||||||
#include "platform/winrt/CCPlatformDefine.h"
|
#include "platform/winrt/CCPlatformDefine.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||||
#include "platform/linux/CCPlatformDefine-linux.h"
|
#include "platform/linux/CCPlatformDefine-linux.h"
|
||||||
|
|
|
@ -36,7 +36,7 @@ THE SOFTWARE.
|
||||||
#include "platform/android/CCStdC-android.h"
|
#include "platform/android/CCStdC-android.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WIN32
|
||||||
#include "platform/win32/CCStdC-win32.h"
|
#include "platform/win32/CCStdC-win32.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_WP8 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT
|
||||||
#include "platform/winrt/CCStdC.h"
|
#include "platform/winrt/CCStdC.h"
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
#elif CC_TARGET_PLATFORM == CC_PLATFORM_LINUX
|
||||||
#include "platform/linux/CCStdC-linux.h"
|
#include "platform/linux/CCStdC-linux.h"
|
||||||
|
|
|
@ -173,14 +173,13 @@ void MeshCommand::restoreRenderState()
|
||||||
|
|
||||||
void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, GLuint vertexBuffer, GLuint indexBuffer, const BlendFunc& blend)
|
void MeshCommand::genMaterialID(GLuint texID, void* glProgramState, GLuint vertexBuffer, GLuint indexBuffer, const BlendFunc& blend)
|
||||||
{
|
{
|
||||||
int* intstate = static_cast<int*>(glProgramState);
|
int intArray[7] = {0};
|
||||||
|
intArray[0] = (int)texID;
|
||||||
int statekey[] = {intstate[0], 0};
|
*(int**)&intArray[1] = (int*) glProgramState;
|
||||||
if (sizeof(void*) > sizeof(int))
|
intArray[3] = (int) vertexBuffer;
|
||||||
{
|
intArray[4] = (int) indexBuffer;
|
||||||
statekey[1] = intstate[1];
|
intArray[5] = (int) blend.src;
|
||||||
}
|
intArray[6] = (int) blend.dst;
|
||||||
int intArray[] = {(int)texID, statekey[0], statekey[1], (int)vertexBuffer, (int)indexBuffer, (int)blend.src, (int)blend.dst};
|
|
||||||
_materialID = XXH32((const void*)intArray, sizeof(intArray), 0);
|
_materialID = XXH32((const void*)intArray, sizeof(intArray), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,13 +5,59 @@
|
||||||
-- @parent_module cc
|
-- @parent_module cc
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- draw a quadratic bezier curve with color and number of segments
|
--
|
||||||
-- @function [parent=#DrawNode] drawQuadraticBezier
|
-- @function [parent=#DrawNode] drawLine
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table origin
|
||||||
|
-- @param #vec2_table destination
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @overload self, vec2_table, vec2_table, vec2_table, vec2_table, color4f_table
|
||||||
|
-- @overload self, vec2_table, vec2_table, color4f_table
|
||||||
|
-- @function [parent=#DrawNode] drawRect
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table lb
|
||||||
|
-- @param #vec2_table lt
|
||||||
|
-- @param #vec2_table rt
|
||||||
|
-- @param #vec2_table rb
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- @overload self, vec2_table, float, float, unsigned int, color4f_table
|
||||||
|
-- @overload self, vec2_table, float, float, unsigned int, float, float, color4f_table
|
||||||
|
-- @function [parent=#DrawNode] drawSolidCircle
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table center
|
||||||
|
-- @param #float radius
|
||||||
|
-- @param #float angle
|
||||||
|
-- @param #unsigned int segments
|
||||||
|
-- @param #float scaleX
|
||||||
|
-- @param #float scaleY
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
--
|
||||||
|
-- @function [parent=#DrawNode] onDrawGLPoint
|
||||||
|
-- @param self
|
||||||
|
-- @param #mat4_table transform
|
||||||
|
-- @param #unsigned int flags
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- draw a dot at a position, with a given radius and color
|
||||||
|
-- @function [parent=#DrawNode] drawDot
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table pos
|
||||||
|
-- @param #float radius
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
-- draw a segment with a radius and color
|
||||||
|
-- @function [parent=#DrawNode] drawSegment
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #vec2_table from
|
-- @param #vec2_table from
|
||||||
-- @param #vec2_table control
|
|
||||||
-- @param #vec2_table to
|
-- @param #vec2_table to
|
||||||
-- @param #unsigned int segments
|
-- @param #float radius
|
||||||
-- @param #color4f_table color
|
-- @param #color4f_table color
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
|
@ -22,9 +68,35 @@
|
||||||
-- @param #unsigned int flags
|
-- @param #unsigned int flags
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- Clear the geometry in the node's buffer.
|
-- @overload self, vec2_table, float, float, unsigned int, bool, color4f_table
|
||||||
-- @function [parent=#DrawNode] clear
|
-- @overload self, vec2_table, float, float, unsigned int, bool, float, float, color4f_table
|
||||||
|
-- @function [parent=#DrawNode] drawCircle
|
||||||
-- @param self
|
-- @param self
|
||||||
|
-- @param #vec2_table center
|
||||||
|
-- @param #float radius
|
||||||
|
-- @param #float angle
|
||||||
|
-- @param #unsigned int segments
|
||||||
|
-- @param #bool drawLineToCenter
|
||||||
|
-- @param #float scaleX
|
||||||
|
-- @param #float scaleY
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
--
|
||||||
|
-- @function [parent=#DrawNode] drawQuadBezier
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table origin
|
||||||
|
-- @param #vec2_table control
|
||||||
|
-- @param #vec2_table destination
|
||||||
|
-- @param #unsigned int segments
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
--
|
||||||
|
-- @function [parent=#DrawNode] onDrawGLLine
|
||||||
|
-- @param self
|
||||||
|
-- @param #mat4_table transform
|
||||||
|
-- @param #unsigned int flags
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- draw a triangle with color
|
-- draw a triangle with color
|
||||||
|
@ -36,33 +108,37 @@
|
||||||
-- @param #color4f_table color
|
-- @param #color4f_table color
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- draw a dot at a position, with a given radius and color
|
-- Clear the geometry in the node's buffer.
|
||||||
-- @function [parent=#DrawNode] drawDot
|
-- @function [parent=#DrawNode] clear
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #vec2_table pos
|
|
||||||
-- @param #float radius
|
--------------------------------
|
||||||
|
--
|
||||||
|
-- @function [parent=#DrawNode] drawSolidRect
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table origin
|
||||||
|
-- @param #vec2_table destination
|
||||||
|
-- @param #color4f_table color
|
||||||
|
|
||||||
|
--------------------------------
|
||||||
|
--
|
||||||
|
-- @function [parent=#DrawNode] drawPoint
|
||||||
|
-- @param self
|
||||||
|
-- @param #vec2_table point
|
||||||
|
-- @param #float pointSize
|
||||||
-- @param #color4f_table color
|
-- @param #color4f_table color
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- draw a cubic bezier curve with color and number of segments
|
-- draw a cubic bezier curve with color and number of segments
|
||||||
-- @function [parent=#DrawNode] drawCubicBezier
|
-- @function [parent=#DrawNode] drawCubicBezier
|
||||||
-- @param self
|
-- @param self
|
||||||
-- @param #vec2_table from
|
-- @param #vec2_table origin
|
||||||
-- @param #vec2_table control1
|
-- @param #vec2_table control1
|
||||||
-- @param #vec2_table control2
|
-- @param #vec2_table control2
|
||||||
-- @param #vec2_table to
|
-- @param #vec2_table destination
|
||||||
-- @param #unsigned int segments
|
-- @param #unsigned int segments
|
||||||
-- @param #color4f_table color
|
-- @param #color4f_table color
|
||||||
|
|
||||||
--------------------------------
|
|
||||||
-- draw a segment with a radius and color
|
|
||||||
-- @function [parent=#DrawNode] drawSegment
|
|
||||||
-- @param self
|
|
||||||
-- @param #vec2_table from
|
|
||||||
-- @param #vec2_table to
|
|
||||||
-- @param #float radius
|
|
||||||
-- @param #color4f_table color
|
|
||||||
|
|
||||||
--------------------------------
|
--------------------------------
|
||||||
-- creates and initialize a DrawNode node
|
-- creates and initialize a DrawNode node
|
||||||
-- @function [parent=#DrawNode] create
|
-- @function [parent=#DrawNode] create
|
||||||
|
|
|
@ -33971,7 +33971,7 @@ int lua_register_cocos2dx_AtlasNode(lua_State* tolua_S)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lua_cocos2dx_DrawNode_drawQuadraticBezier(lua_State* tolua_S)
|
int lua_cocos2dx_DrawNode_drawLine(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
cocos2d::DrawNode* cobj = nullptr;
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
@ -33991,40 +33991,360 @@ int lua_cocos2dx_DrawNode_drawQuadraticBezier(lua_State* tolua_S)
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
if (!cobj)
|
if (!cobj)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawQuadraticBezier'", nullptr);
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawLine'", nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
argc = lua_gettop(tolua_S)-1;
|
argc = lua_gettop(tolua_S)-1;
|
||||||
if (argc == 5)
|
if (argc == 3)
|
||||||
{
|
{
|
||||||
cocos2d::Vec2 arg0;
|
cocos2d::Vec2 arg0;
|
||||||
cocos2d::Vec2 arg1;
|
cocos2d::Vec2 arg1;
|
||||||
cocos2d::Vec2 arg2;
|
cocos2d::Color4F arg2;
|
||||||
unsigned int arg3;
|
|
||||||
cocos2d::Color4F arg4;
|
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawQuadraticBezier");
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawLine");
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawQuadraticBezier");
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawLine");
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 4, &arg2, "cc.DrawNode:drawQuadraticBezier");
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawLine");
|
||||||
|
|
||||||
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawQuadraticBezier");
|
|
||||||
|
|
||||||
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "cc.DrawNode:drawQuadraticBezier");
|
|
||||||
if(!ok)
|
if(!ok)
|
||||||
return 0;
|
return 0;
|
||||||
cobj->drawQuadraticBezier(arg0, arg1, arg2, arg3, arg4);
|
cobj->drawLine(arg0, arg1, arg2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawQuadraticBezier",argc, 5);
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawLine",argc, 3);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawQuadraticBezier'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawLine'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawRect(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawRect'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
do{
|
||||||
|
if (argc == 5) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Vec2 arg1;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Vec2 arg2;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 4, &arg2, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Vec2 arg3;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 5, &arg3, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg4;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawRect(arg0, arg1, arg2, arg3, arg4);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
do{
|
||||||
|
if (argc == 3) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Vec2 arg1;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawRect");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawRect(arg0, arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawRect",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawRect'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawSolidCircle(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawSolidCircle'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
do{
|
||||||
|
if (argc == 5) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg1;
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg2;
|
||||||
|
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
unsigned int arg3;
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg4;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
do{
|
||||||
|
if (argc == 7) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg1;
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg2;
|
||||||
|
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
unsigned int arg3;
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg4;
|
||||||
|
ok &= luaval_to_number(tolua_S, 6,&arg4, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg5;
|
||||||
|
ok &= luaval_to_number(tolua_S, 7,&arg5, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg6;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 8, &arg6, "cc.DrawNode:drawSolidCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawSolidCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawSolidCircle",argc, 7);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawSolidCircle'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_onDrawGLPoint(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_onDrawGLPoint'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 2)
|
||||||
|
{
|
||||||
|
cocos2d::Mat4 arg0;
|
||||||
|
unsigned int arg1;
|
||||||
|
|
||||||
|
ok &= luaval_to_mat4(tolua_S, 2, &arg0, "cc.DrawNode:onDrawGLPoint");
|
||||||
|
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 3,&arg1, "cc.DrawNode:onDrawGLPoint");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->onDrawGLPoint(arg0, arg1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:onDrawGLPoint",argc, 2);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_onDrawGLPoint'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawDot(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawDot'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
double arg1;
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawDot");
|
||||||
|
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawDot");
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawDot");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->drawDot(arg0, arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawDot",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawDot'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawSegment(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawSegment'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 4)
|
||||||
|
{
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
cocos2d::Vec2 arg1;
|
||||||
|
double arg2;
|
||||||
|
cocos2d::Color4F arg3;
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawSegment");
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawSegment");
|
||||||
|
|
||||||
|
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawSegment");
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 5, &arg3, "cc.DrawNode:drawSegment");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->drawSegment(arg0, arg1, arg2, arg3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawSegment",argc, 4);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawSegment'.",&tolua_err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34078,7 +34398,108 @@ int lua_cocos2dx_DrawNode_onDraw(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lua_cocos2dx_DrawNode_clear(lua_State* tolua_S)
|
int lua_cocos2dx_DrawNode_drawCircle(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawCircle'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
do{
|
||||||
|
if (argc == 6) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg1;
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg2;
|
||||||
|
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
unsigned int arg3;
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
bool arg4;
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 6,&arg4, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg5;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 7, &arg5, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
do{
|
||||||
|
if (argc == 8) {
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg1;
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg2;
|
||||||
|
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
unsigned int arg3;
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
bool arg4;
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 6,&arg4, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg5;
|
||||||
|
ok &= luaval_to_number(tolua_S, 7,&arg5, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
double arg6;
|
||||||
|
ok &= luaval_to_number(tolua_S, 8,&arg6, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cocos2d::Color4F arg7;
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 9, &arg7, "cc.DrawNode:drawCircle");
|
||||||
|
|
||||||
|
if (!ok) { break; }
|
||||||
|
cobj->drawCircle(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}while(0);
|
||||||
|
ok = true;
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawCircle",argc, 8);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawCircle'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawQuadBezier(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
cocos2d::DrawNode* cobj = nullptr;
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
@ -34098,25 +34519,89 @@ int lua_cocos2dx_DrawNode_clear(lua_State* tolua_S)
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
if (!cobj)
|
if (!cobj)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_clear'", nullptr);
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawQuadBezier'", nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
argc = lua_gettop(tolua_S)-1;
|
argc = lua_gettop(tolua_S)-1;
|
||||||
if (argc == 0)
|
if (argc == 5)
|
||||||
{
|
{
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
cocos2d::Vec2 arg1;
|
||||||
|
cocos2d::Vec2 arg2;
|
||||||
|
unsigned int arg3;
|
||||||
|
cocos2d::Color4F arg4;
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawQuadBezier");
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawQuadBezier");
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 4, &arg2, "cc.DrawNode:drawQuadBezier");
|
||||||
|
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 5,&arg3, "cc.DrawNode:drawQuadBezier");
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 6, &arg4, "cc.DrawNode:drawQuadBezier");
|
||||||
if(!ok)
|
if(!ok)
|
||||||
return 0;
|
return 0;
|
||||||
cobj->clear();
|
cobj->drawQuadBezier(arg0, arg1, arg2, arg3, arg4);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:clear",argc, 0);
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawQuadBezier",argc, 5);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_clear'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawQuadBezier'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_onDrawGLLine(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_onDrawGLLine'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 2)
|
||||||
|
{
|
||||||
|
cocos2d::Mat4 arg0;
|
||||||
|
unsigned int arg1;
|
||||||
|
|
||||||
|
ok &= luaval_to_mat4(tolua_S, 2, &arg0, "cc.DrawNode:onDrawGLLine");
|
||||||
|
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 3,&arg1, "cc.DrawNode:onDrawGLLine");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->onDrawGLLine(arg0, arg1);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:onDrawGLLine",argc, 2);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_onDrawGLLine'.",&tolua_err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34176,7 +34661,7 @@ int lua_cocos2dx_DrawNode_drawTriangle(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lua_cocos2dx_DrawNode_drawDot(lua_State* tolua_S)
|
int lua_cocos2dx_DrawNode_clear(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
cocos2d::DrawNode* cobj = nullptr;
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
@ -34196,7 +34681,102 @@ int lua_cocos2dx_DrawNode_drawDot(lua_State* tolua_S)
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
if (!cobj)
|
if (!cobj)
|
||||||
{
|
{
|
||||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawDot'", nullptr);
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_clear'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 0)
|
||||||
|
{
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->clear();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:clear",argc, 0);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_clear'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawSolidRect(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawSolidRect'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
cocos2d::Vec2 arg0;
|
||||||
|
cocos2d::Vec2 arg1;
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawSolidRect");
|
||||||
|
|
||||||
|
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawSolidRect");
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawSolidRect");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
cobj->drawSolidRect(arg0, arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawSolidRect",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawSolidRect'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
int lua_cocos2dx_DrawNode_drawPoint(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* cobj = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!cobj)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawPoint'", nullptr);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -34208,22 +34788,22 @@ int lua_cocos2dx_DrawNode_drawDot(lua_State* tolua_S)
|
||||||
double arg1;
|
double arg1;
|
||||||
cocos2d::Color4F arg2;
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawDot");
|
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawPoint");
|
||||||
|
|
||||||
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawDot");
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawPoint");
|
||||||
|
|
||||||
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawDot");
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawPoint");
|
||||||
if(!ok)
|
if(!ok)
|
||||||
return 0;
|
return 0;
|
||||||
cobj->drawDot(arg0, arg1, arg2);
|
cobj->drawPoint(arg0, arg1, arg2);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawDot",argc, 3);
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawPoint",argc, 3);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
#if COCOS2D_DEBUG >= 1
|
||||||
tolua_lerror:
|
tolua_lerror:
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawDot'.",&tolua_err);
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawPoint'.",&tolua_err);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34289,61 +34869,6 @@ int lua_cocos2dx_DrawNode_drawCubicBezier(lua_State* tolua_S)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
int lua_cocos2dx_DrawNode_drawSegment(lua_State* tolua_S)
|
|
||||||
{
|
|
||||||
int argc = 0;
|
|
||||||
cocos2d::DrawNode* cobj = nullptr;
|
|
||||||
bool ok = true;
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
tolua_Error tolua_err;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
cobj = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
if (!cobj)
|
|
||||||
{
|
|
||||||
tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_DrawNode_drawSegment'", nullptr);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
argc = lua_gettop(tolua_S)-1;
|
|
||||||
if (argc == 4)
|
|
||||||
{
|
|
||||||
cocos2d::Vec2 arg0;
|
|
||||||
cocos2d::Vec2 arg1;
|
|
||||||
double arg2;
|
|
||||||
cocos2d::Color4F arg3;
|
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 2, &arg0, "cc.DrawNode:drawSegment");
|
|
||||||
|
|
||||||
ok &= luaval_to_vec2(tolua_S, 3, &arg1, "cc.DrawNode:drawSegment");
|
|
||||||
|
|
||||||
ok &= luaval_to_number(tolua_S, 4,&arg2, "cc.DrawNode:drawSegment");
|
|
||||||
|
|
||||||
ok &=luaval_to_color4f(tolua_S, 5, &arg3, "cc.DrawNode:drawSegment");
|
|
||||||
if(!ok)
|
|
||||||
return 0;
|
|
||||||
cobj->drawSegment(arg0, arg1, arg2, arg3);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawSegment",argc, 4);
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
#if COCOS2D_DEBUG >= 1
|
|
||||||
tolua_lerror:
|
|
||||||
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawSegment'.",&tolua_err);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
int lua_cocos2dx_DrawNode_create(lua_State* tolua_S)
|
int lua_cocos2dx_DrawNode_create(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
int argc = 0;
|
int argc = 0;
|
||||||
|
@ -34387,13 +34912,21 @@ int lua_register_cocos2dx_DrawNode(lua_State* tolua_S)
|
||||||
tolua_cclass(tolua_S,"DrawNode","cc.DrawNode","cc.Node",nullptr);
|
tolua_cclass(tolua_S,"DrawNode","cc.DrawNode","cc.Node",nullptr);
|
||||||
|
|
||||||
tolua_beginmodule(tolua_S,"DrawNode");
|
tolua_beginmodule(tolua_S,"DrawNode");
|
||||||
tolua_function(tolua_S,"drawQuadraticBezier",lua_cocos2dx_DrawNode_drawQuadraticBezier);
|
tolua_function(tolua_S,"drawLine",lua_cocos2dx_DrawNode_drawLine);
|
||||||
tolua_function(tolua_S,"onDraw",lua_cocos2dx_DrawNode_onDraw);
|
tolua_function(tolua_S,"drawRect",lua_cocos2dx_DrawNode_drawRect);
|
||||||
tolua_function(tolua_S,"clear",lua_cocos2dx_DrawNode_clear);
|
tolua_function(tolua_S,"drawSolidCircle",lua_cocos2dx_DrawNode_drawSolidCircle);
|
||||||
tolua_function(tolua_S,"drawTriangle",lua_cocos2dx_DrawNode_drawTriangle);
|
tolua_function(tolua_S,"onDrawGLPoint",lua_cocos2dx_DrawNode_onDrawGLPoint);
|
||||||
tolua_function(tolua_S,"drawDot",lua_cocos2dx_DrawNode_drawDot);
|
tolua_function(tolua_S,"drawDot",lua_cocos2dx_DrawNode_drawDot);
|
||||||
tolua_function(tolua_S,"drawCubicBezier",lua_cocos2dx_DrawNode_drawCubicBezier);
|
|
||||||
tolua_function(tolua_S,"drawSegment",lua_cocos2dx_DrawNode_drawSegment);
|
tolua_function(tolua_S,"drawSegment",lua_cocos2dx_DrawNode_drawSegment);
|
||||||
|
tolua_function(tolua_S,"onDraw",lua_cocos2dx_DrawNode_onDraw);
|
||||||
|
tolua_function(tolua_S,"drawCircle",lua_cocos2dx_DrawNode_drawCircle);
|
||||||
|
tolua_function(tolua_S,"drawQuadBezier",lua_cocos2dx_DrawNode_drawQuadBezier);
|
||||||
|
tolua_function(tolua_S,"onDrawGLLine",lua_cocos2dx_DrawNode_onDrawGLLine);
|
||||||
|
tolua_function(tolua_S,"drawTriangle",lua_cocos2dx_DrawNode_drawTriangle);
|
||||||
|
tolua_function(tolua_S,"clear",lua_cocos2dx_DrawNode_clear);
|
||||||
|
tolua_function(tolua_S,"drawSolidRect",lua_cocos2dx_DrawNode_drawSolidRect);
|
||||||
|
tolua_function(tolua_S,"drawPoint",lua_cocos2dx_DrawNode_drawPoint);
|
||||||
|
tolua_function(tolua_S,"drawCubicBezier",lua_cocos2dx_DrawNode_drawCubicBezier);
|
||||||
tolua_function(tolua_S,"create", lua_cocos2dx_DrawNode_create);
|
tolua_function(tolua_S,"create", lua_cocos2dx_DrawNode_create);
|
||||||
tolua_endmodule(tolua_S);
|
tolua_endmodule(tolua_S);
|
||||||
std::string typeName = typeid(cocos2d::DrawNode).name();
|
std::string typeName = typeid(cocos2d::DrawNode).name();
|
||||||
|
|
|
@ -1553,6 +1553,14 @@ int register_all_cocos2dx(lua_State* tolua_S);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1429,7 +1429,7 @@ int lua_cocos2dx_ui_Widget_getVirtualRendererSize(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
if(!ok)
|
if(!ok)
|
||||||
return 0;
|
return 0;
|
||||||
const cocos2d::Size& ret = cobj->getVirtualRendererSize();
|
cocos2d::Size ret = cobj->getVirtualRendererSize();
|
||||||
size_to_luaval(tolua_S, ret);
|
size_to_luaval(tolua_S, ret);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -4417,7 +4417,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: DrawPoint in the DrawPrimitives namespace */
|
/* function: DrawPoint in the DrawPrimitives namespace */
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_ccDrawPoint00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_ccDrawPoint00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawPoint00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawPoint00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4445,7 +4445,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawPoints in the DrawPrimitives namespace*/
|
/* function: drawPoints in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_DrawPoints00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_DrawPoints00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawPoints00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawPoints00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4499,7 +4499,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawLine in the DrawPrimitives namespace*/
|
/* function: drawLine in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawLine00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawLine00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawLine00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawLine00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4532,7 +4532,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawRect in the DrawPrimitives namespace*/
|
/* function: drawRect in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawRect00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawRect00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawRect00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawRect00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4565,7 +4565,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawSolidRect in the DrawPrimitives namespace*/
|
/* function: drawSolidRect in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_Cocos2d_DrawPrimitives_drawSolidRect00
|
#ifndef TOLUA_DISABLE_tolua_Cocos2d_DrawPrimitives_drawSolidRect00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawSolidRect00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawSolidRect00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4605,7 +4605,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawPoly in the DrawPrimitives namespace*/
|
/* function: drawPoly in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawPoly00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawPoly00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawPoly00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawPoly00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4661,7 +4661,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawSolidPoly in the DrawPrimitives namespace*/
|
/* function: drawSolidPoly in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawSolidPoly00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawSolidPoly00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawSolidPoly00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawSolidPoly00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4723,7 +4723,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawCircle in the DrawPrimitives namespace*/
|
/* function: drawCircle in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCircle00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCircle00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawCircle00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawCircle00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4765,7 +4765,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawSolidCircle in the DrawPrimitives namespace*/
|
/* function: drawSolidCircle in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawSolidCircle00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawSolidCircle00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawSolidCircle00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawSolidCircle00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4804,7 +4804,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawQuadBezier in the DrawPrimitives namespace*/
|
/* function: drawQuadBezier in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawQuadBezier00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawQuadBezier00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawQuadBezier00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawQuadBezier00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4845,7 +4845,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawCubicBezier in the DrawPrimitives namespace*/
|
/* function: drawCubicBezier in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCubicBezier00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCubicBezier00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawCubicBezier00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawCubicBezier00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4892,7 +4892,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawCatmullRom in the DrawPrimitives namespace*/
|
/* function: drawCatmullRom in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCatmullRom00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCatmullRom00
|
||||||
int tolua_cocos2d_DrawPrimitives_drawCatmullRom00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE int tolua_cocos2d_DrawPrimitives_drawCatmullRom00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4938,7 +4938,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawCardinalSpline in the DrawPrimitives namespace*/
|
/* function: drawCardinalSpline in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCardinalSpline00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawCardinalSpline00
|
||||||
int tolua_cocos2d_DrawPrimitives_drawCardinalSpline00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE int tolua_cocos2d_DrawPrimitives_drawCardinalSpline00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -4984,7 +4984,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawColor4B in the DrawPrimitives namespace*/
|
/* function: drawColor4B in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawColor4B00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawColor4B00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawColor4B00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawColor4B00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -5016,7 +5016,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: drawColor4F in the DrawPrimitives namespace*/
|
/* function: drawColor4F in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawColor4F00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_drawColor4F00
|
||||||
static int tolua_cocos2d_DrawPrimitives_drawColor4F00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_drawColor4F00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
@ -5048,7 +5048,7 @@ tolua_lerror:
|
||||||
|
|
||||||
/* function: setPointSize in the DrawPrimitives namespace*/
|
/* function: setPointSize in the DrawPrimitives namespace*/
|
||||||
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_setPointSize00
|
#ifndef TOLUA_DISABLE_tolua_cocos2d_DrawPrimitives_setPointSize00
|
||||||
static int tolua_cocos2d_DrawPrimitives_setPointSize00(lua_State* tolua_S)
|
CC_DEPRECATED_ATTRIBUTE static int tolua_cocos2d_DrawPrimitives_setPointSize00(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
#ifndef TOLUA_RELEASE
|
#ifndef TOLUA_RELEASE
|
||||||
tolua_Error tolua_err;
|
tolua_Error tolua_err;
|
||||||
|
|
|
@ -2653,7 +2653,7 @@ tolua_lerror:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static int tolua_cocos2d_DrawNode_drawPolygon(lua_State* tolua_S)
|
static int tolua_cocos2dx_DrawNode_drawPolygon(lua_State* tolua_S)
|
||||||
{
|
{
|
||||||
if (NULL == tolua_S)
|
if (NULL == tolua_S)
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -2748,6 +2748,370 @@ tolua_lerror:
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int tolua_cocos2dx_DrawNode_drawSolidPoly(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* self = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!self)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_DrawNode_drawSolidPoly'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
luaval_to_uint32(tolua_S, 3, &size, "cc.DrawNode:drawSolidPoly");
|
||||||
|
if ( size > 0 )
|
||||||
|
{
|
||||||
|
cocos2d::Vec2* points = new cocos2d::Vec2[size];
|
||||||
|
if (NULL == points)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
lua_pushnumber(tolua_S,i + 1);
|
||||||
|
lua_gettable(tolua_S,2);
|
||||||
|
if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.DrawNode:drawSolidPoly"))
|
||||||
|
{
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawSolidPoly");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
self->drawSolidPoly(points, size, arg2);
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawSolidPoly",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawSolidPoly'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolua_cocos2dx_DrawNode_drawPoly(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
if (NULL == tolua_S)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int argc = 0;
|
||||||
|
DrawNode* self = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = static_cast<cocos2d::DrawNode*>(tolua_tousertype(tolua_S,1,0));
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!self)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_DrawNode_drawPoly'", NULL);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 4)
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
luaval_to_uint32(tolua_S, 3, &size, "cc.DrawNode:drawPoly");
|
||||||
|
if ( size > 0 )
|
||||||
|
{
|
||||||
|
cocos2d::Vec2* points = new cocos2d::Vec2[size];
|
||||||
|
if (NULL == points)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
lua_pushnumber(tolua_S,i + 1);
|
||||||
|
lua_gettable(tolua_S,2);
|
||||||
|
if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.DrawNode:drawPoly"))
|
||||||
|
{
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool arg2;
|
||||||
|
cocos2d::Color4F arg3;
|
||||||
|
|
||||||
|
ok &= luaval_to_boolean(tolua_S, 4,&arg2, "cc.DrawNode:drawPoly");
|
||||||
|
|
||||||
|
ok &= luaval_to_color4f(tolua_S, 5, &arg3, "cc.DrawNode:drawPoly");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
self->drawPoly(points, size, arg2, arg3);
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawPoly",argc, 4);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawPoly'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolua_cocos2dx_DrawNode_drawCardinalSpline(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* self = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!self)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_DrawNode_drawCardinalSpline'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 4)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
cocos2d::Vec2 *arr = NULL;
|
||||||
|
if (!luaval_to_array_of_vec2(tolua_S, 2, &arr, &num, "cc.DrawNode:drawCardinalSpline"))
|
||||||
|
return 0;
|
||||||
|
PointArray* config = PointArray::create(num);
|
||||||
|
if (NULL == config)
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE_ARRAY(arr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < num; i++) {
|
||||||
|
config->addControlPoint(arr[i]);
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE_ARRAY(arr);
|
||||||
|
|
||||||
|
double arg1;
|
||||||
|
unsigned int arg2;
|
||||||
|
cocos2d::Color4F arg3;
|
||||||
|
|
||||||
|
ok &= luaval_to_number(tolua_S, 3,&arg1, "cc.DrawNode:drawCardinalSpline");
|
||||||
|
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 4,&arg2, "cc.DrawNode:drawCardinalSpline");
|
||||||
|
|
||||||
|
ok &= luaval_to_color4f(tolua_S, 5, &arg3, "cc.DrawNode:drawCardinalSpline");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
self->drawCardinalSpline(config, arg1, arg2, arg3);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawCardinalSpline",argc, 4);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawCardinalSpline'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolua_cocos2dx_DrawNode_drawCatmullRom(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* self = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!self)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_DrawNode_drawCatmullRom'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
int num = 0;
|
||||||
|
cocos2d::Vec2 *arr = NULL;
|
||||||
|
if (!luaval_to_array_of_vec2(tolua_S, 2, &arr, &num, "cc.DrawNode:drawCatmullRom"))
|
||||||
|
return 0;
|
||||||
|
PointArray* config = PointArray::create(num);
|
||||||
|
if (NULL == config)
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE_ARRAY(arr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for( int i = 0; i < num; i++) {
|
||||||
|
config->addControlPoint(arr[i]);
|
||||||
|
}
|
||||||
|
CC_SAFE_DELETE_ARRAY(arr);
|
||||||
|
|
||||||
|
unsigned int arg1;
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
|
ok &= luaval_to_uint32(tolua_S, 3,&arg1, "cc.DrawNode:drawCatmullRom");
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawCatmullRom");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
self->drawCatmullRom(config, arg1, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawCatmullRom",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawCatmullRom'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int tolua_cocos2dx_DrawNode_drawPoints(lua_State* tolua_S)
|
||||||
|
{
|
||||||
|
int argc = 0;
|
||||||
|
cocos2d::DrawNode* self = nullptr;
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
tolua_Error tolua_err;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!tolua_isusertype(tolua_S,1,"cc.DrawNode",0,&tolua_err)) goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
self = (cocos2d::DrawNode*)tolua_tousertype(tolua_S,1,0);
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
if (!self)
|
||||||
|
{
|
||||||
|
tolua_error(tolua_S,"invalid 'self' in function 'lua_cocos2dx_DrawNode_drawPoints'", nullptr);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
argc = lua_gettop(tolua_S)-1;
|
||||||
|
if (argc == 3)
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
luaval_to_uint32(tolua_S, 3, &size, "cc.DrawNode:drawPoints");
|
||||||
|
if ( size > 0 )
|
||||||
|
{
|
||||||
|
cocos2d::Vec2* points = new cocos2d::Vec2[size];
|
||||||
|
if (NULL == points)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (int i = 0; i < size; i++)
|
||||||
|
{
|
||||||
|
lua_pushnumber(tolua_S,i + 1);
|
||||||
|
lua_gettable(tolua_S,2);
|
||||||
|
if (!tolua_istable(tolua_S,-1, 0, &tolua_err))
|
||||||
|
{
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
goto tolua_lerror;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!luaval_to_vec2(tolua_S, lua_gettop(tolua_S), &points[i], "cc.DrawNode:drawPoints"))
|
||||||
|
{
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
CC_SAFE_DELETE_ARRAY(points);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
lua_pop(tolua_S, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
cocos2d::Color4F arg2;
|
||||||
|
|
||||||
|
ok &=luaval_to_color4f(tolua_S, 4, &arg2, "cc.DrawNode:drawPoints");
|
||||||
|
if(!ok)
|
||||||
|
return 0;
|
||||||
|
self->drawPoints(points, size, arg2);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "cc.DrawNode:drawPoints",argc, 3);
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
#if COCOS2D_DEBUG >= 1
|
||||||
|
tolua_lerror:
|
||||||
|
tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_DrawNode_drawPoints'.",&tolua_err);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// setBlendFunc
|
// setBlendFunc
|
||||||
template<class T>
|
template<class T>
|
||||||
static int tolua_cocos2dx_setBlendFunc(lua_State* tolua_S,const char* className)
|
static int tolua_cocos2dx_setBlendFunc(lua_State* tolua_S,const char* className)
|
||||||
|
@ -4154,7 +4518,27 @@ static void extendDrawNode(lua_State* tolua_S)
|
||||||
if (lua_istable(tolua_S,-1))
|
if (lua_istable(tolua_S,-1))
|
||||||
{
|
{
|
||||||
lua_pushstring(tolua_S,"drawPolygon");
|
lua_pushstring(tolua_S,"drawPolygon");
|
||||||
lua_pushcfunction(tolua_S,tolua_cocos2d_DrawNode_drawPolygon);
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawPolygon);
|
||||||
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
|
lua_pushstring(tolua_S,"drawSolidPoly");
|
||||||
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawSolidPoly);
|
||||||
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
|
lua_pushstring(tolua_S,"drawPoly");
|
||||||
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawPoly);
|
||||||
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
|
lua_pushstring(tolua_S,"drawCardinalSpline");
|
||||||
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawCardinalSpline);
|
||||||
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
|
lua_pushstring(tolua_S,"drawCatmullRom");
|
||||||
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawCatmullRom);
|
||||||
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
|
lua_pushstring(tolua_S,"drawPoints");
|
||||||
|
lua_pushcfunction(tolua_S,tolua_cocos2dx_DrawNode_drawPoints);
|
||||||
lua_rawset(tolua_S,-3);
|
lua_rawset(tolua_S,-3);
|
||||||
|
|
||||||
lua_pushstring(tolua_S,"setBlendFunc");
|
lua_pushstring(tolua_S,"setBlendFunc");
|
||||||
|
|
|
@ -37,6 +37,7 @@ static const int NORMAL_RENDERER_Z = (-2);
|
||||||
static const int PRESSED_RENDERER_Z = (-2);
|
static const int PRESSED_RENDERER_Z = (-2);
|
||||||
static const int DISABLED_RENDERER_Z = (-2);
|
static const int DISABLED_RENDERER_Z = (-2);
|
||||||
static const int TITLE_RENDERER_Z = (-1);
|
static const int TITLE_RENDERER_Z = (-1);
|
||||||
|
static const float ZOOM_ACTION_TIME_STEP = 0.05;
|
||||||
|
|
||||||
IMPLEMENT_CLASS_GUI_INFO(Button)
|
IMPLEMENT_CLASS_GUI_INFO(Button)
|
||||||
|
|
||||||
|
@ -361,17 +362,15 @@ void Button::onPressStateChangedToNormal()
|
||||||
{
|
{
|
||||||
if (_pressedActionEnabled)
|
if (_pressedActionEnabled)
|
||||||
{
|
{
|
||||||
_buttonNormalRenderer->stopAllActions();
|
this->stopAllActions();
|
||||||
_buttonClickedRenderer->stopAllActions();
|
Action *zoomAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1.0, 1.0);
|
||||||
Action *zoomAction = ScaleTo::create(0.05f, _normalTextureScaleXInSize, _normalTextureScaleYInSize);
|
this->runAction(zoomAction);
|
||||||
_buttonNormalRenderer->runAction(zoomAction);
|
|
||||||
_buttonClickedRenderer->setScale(_pressedTextureScaleXInSize, _pressedTextureScaleYInSize);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_buttonNormalRenderer->stopAllActions();
|
this->stopAllActions();
|
||||||
_buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize);
|
this->setScale(1.0, 1.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,11 +384,9 @@ void Button::onPressStateChangedToPressed()
|
||||||
|
|
||||||
if (_pressedActionEnabled)
|
if (_pressedActionEnabled)
|
||||||
{
|
{
|
||||||
_buttonNormalRenderer->stopAllActions();
|
this->stopAllActions();
|
||||||
_buttonClickedRenderer->stopAllActions();
|
Action *zoomAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1.0 + _zoomScale, 1.0 + _zoomScale);
|
||||||
Action *zoomAction = ScaleTo::create(0.05f, _pressedTextureScaleXInSize + _zoomScale, _pressedTextureScaleYInSize + _zoomScale);
|
this->runAction(zoomAction);
|
||||||
_buttonClickedRenderer->runAction(zoomAction);
|
|
||||||
_buttonNormalRenderer->setScale(_pressedTextureScaleXInSize + _zoomScale, _pressedTextureScaleYInSize + _zoomScale);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -403,8 +400,8 @@ void Button::onPressStateChangedToPressed()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_buttonNormalRenderer->stopAllActions();
|
this->stopAllActions();
|
||||||
_buttonNormalRenderer->setScale(_normalTextureScaleXInSize +_zoomScale, _normalTextureScaleYInSize + _zoomScale);
|
this->setScale(1.0 +_zoomScale, 1.0 + _zoomScale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -414,8 +411,6 @@ void Button::onPressStateChangedToDisabled()
|
||||||
_buttonNormalRenderer->setVisible(false);
|
_buttonNormalRenderer->setVisible(false);
|
||||||
_buttonClickedRenderer->setVisible(false);
|
_buttonClickedRenderer->setVisible(false);
|
||||||
_buttonDisableRenderer->setVisible(true);
|
_buttonDisableRenderer->setVisible(true);
|
||||||
_buttonNormalRenderer->setScale(_normalTextureScaleXInSize, _normalTextureScaleYInSize);
|
|
||||||
_buttonClickedRenderer->setScale(_pressedTextureScaleXInSize, _pressedTextureScaleYInSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Button::updateFlippedX()
|
void Button::updateFlippedX()
|
||||||
|
@ -470,8 +465,12 @@ void Button::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& Button::getVirtualRendererSize() const
|
Size Button::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
|
Size titleSize = _titleRenderer->getContentSize();
|
||||||
|
if (!_normalTextureLoaded && _titleRenderer->getString().size() > 0) {
|
||||||
|
return titleSize;
|
||||||
|
}
|
||||||
return _normalTextureSize;
|
return _normalTextureSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -170,7 +170,7 @@ public:
|
||||||
virtual void ignoreContentAdaptWithSize(bool ignore) override;
|
virtual void ignoreContentAdaptWithSize(bool ignore) override;
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -450,7 +450,7 @@ void CheckBox::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& CheckBox::getVirtualRendererSize() const
|
Size CheckBox::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _backGroundBoxRenderer->getContentSize();
|
return _backGroundBoxRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ public:
|
||||||
|
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -238,7 +238,7 @@ void ImageView::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& ImageView::getVirtualRendererSize() const
|
Size ImageView::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _imageTextureSize;
|
return _imageTextureSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
||||||
CC_CONSTRUCTOR_ACCESS:
|
CC_CONSTRUCTOR_ACCESS:
|
||||||
|
|
|
@ -27,6 +27,7 @@ THE SOFTWARE.
|
||||||
#include "ui/UIScale9Sprite.h"
|
#include "ui/UIScale9Sprite.h"
|
||||||
#include "renderer/CCGLProgram.h"
|
#include "renderer/CCGLProgram.h"
|
||||||
#include "renderer/CCGLProgramCache.h"
|
#include "renderer/CCGLProgramCache.h"
|
||||||
|
#include "renderer/ccGLStateCache.h"
|
||||||
#include "base/CCDirector.h"
|
#include "base/CCDirector.h"
|
||||||
#include "2d/CCDrawingPrimitives.h"
|
#include "2d/CCDrawingPrimitives.h"
|
||||||
#include "renderer/CCRenderer.h"
|
#include "renderer/CCRenderer.h"
|
||||||
|
@ -352,13 +353,43 @@ void Layout::drawFullScreenQuadClearStencil()
|
||||||
Director* director = Director::getInstance();
|
Director* director = Director::getInstance();
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
||||||
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
|
||||||
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
|
||||||
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
|
|
||||||
DrawPrimitives::drawSolidRect(Vec2(-1,-1), Vec2(1,1), Color4F(1, 1, 1, 1));
|
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
|
director->loadIdentityMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
|
|
||||||
|
Vec2 vertices[] = {
|
||||||
|
Vec2(-1, -1),
|
||||||
|
Vec2(1, -1),
|
||||||
|
Vec2(1, 1),
|
||||||
|
Vec2(-1, 1)
|
||||||
|
};
|
||||||
|
|
||||||
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->retain();
|
||||||
|
|
||||||
|
int colorLocation = glProgram->getUniformLocation("u_color");
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
|
Color4F color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins();
|
||||||
|
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||||
|
|
||||||
|
GLuint vbo;
|
||||||
|
glGenBuffers(1, &vbo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
|
|
|
@ -265,7 +265,7 @@ void LoadingBar::ignoreContentAdaptWithSize(bool ignore)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& LoadingBar::getVirtualRendererSize() const
|
Size LoadingBar::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _barRendererTextureSize;
|
return _barRendererTextureSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,7 +130,7 @@ public:
|
||||||
virtual void ignoreContentAdaptWithSize(bool ignore) override;
|
virtual void ignoreContentAdaptWithSize(bool ignore) override;
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -451,7 +451,7 @@ void RichText::setAnchorPoint(const Vec2 &pt)
|
||||||
_elementRenderersContainer->setAnchorPoint(pt);
|
_elementRenderersContainer->setAnchorPoint(pt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& RichText::getVirtualRendererSize() const
|
Size RichText::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _elementRenderersContainer->getContentSize();
|
return _elementRenderersContainer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ public:
|
||||||
|
|
||||||
void setVerticalSpace(float space);
|
void setVerticalSpace(float space);
|
||||||
virtual void setAnchorPoint(const Vec2 &pt);
|
virtual void setAnchorPoint(const Vec2 &pt);
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
void formatText();
|
void formatText();
|
||||||
virtual void ignoreContentAdaptWithSize(bool ignore);
|
virtual void ignoreContentAdaptWithSize(bool ignore);
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
|
@ -449,7 +449,7 @@ void Slider::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& Slider::getVirtualRendererSize() const
|
Size Slider::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _barRenderer->getContentSize();
|
return _barRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -194,7 +194,7 @@ public:
|
||||||
virtual void onTouchCancelled(Touch *touch, Event *unusedEvent) override;
|
virtual void onTouchCancelled(Touch *touch, Event *unusedEvent) override;
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -292,7 +292,7 @@ void Text::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& Text::getVirtualRendererSize() const
|
Size Text::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _labelRenderer->getContentSize();
|
return _labelRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,7 +139,7 @@ public:
|
||||||
bool isTouchScaleChangeEnabled()const;
|
bool isTouchScaleChangeEnabled()const;
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -135,7 +135,7 @@ void TextAtlas::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& TextAtlas::getVirtualRendererSize() const
|
Size TextAtlas::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _labelAtlasRenderer->getContentSize();
|
return _labelAtlasRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,7 +93,7 @@ public:
|
||||||
ssize_t getStringLength()const;
|
ssize_t getStringLength()const;
|
||||||
|
|
||||||
//override "getVirtualRendererSize" method of widget.
|
//override "getVirtualRendererSize" method of widget.
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
|
|
||||||
//override "getVirtualRenderer" method of widget.
|
//override "getVirtualRenderer" method of widget.
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
|
|
|
@ -129,7 +129,7 @@ void TextBMFont::adaptRenderers()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& TextBMFont::getVirtualRendererSize() const
|
Size TextBMFont::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _labelBMFontRenderer->getContentSize();
|
return _labelBMFontRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ public:
|
||||||
*/
|
*/
|
||||||
ssize_t getStringLength()const;
|
ssize_t getStringLength()const;
|
||||||
|
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
/**
|
/**
|
||||||
* Returns the "class name" of widget.
|
* Returns the "class name" of widget.
|
||||||
|
|
|
@ -737,7 +737,7 @@ void TextField::textfieldRendererScaleChangedWithSize()
|
||||||
_textFieldRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
_textFieldRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& TextField::getVirtualRendererSize() const
|
Size TextField::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _textFieldRenderer->getContentSize();
|
return _textFieldRenderer->getContentSize();
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual Size getVirtualRendererSize() const override;
|
||||||
virtual Node* getVirtualRenderer() override;
|
virtual Node* getVirtualRenderer() override;
|
||||||
void attachWithIME();
|
void attachWithIME();
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
|
@ -178,6 +178,11 @@ VideoPlayer::VideoPlayer()
|
||||||
{
|
{
|
||||||
_videoPlayerIndex = createVideoWidgetJNI();
|
_videoPlayerIndex = createVideoWidgetJNI();
|
||||||
s_allVideoPlayers[_videoPlayerIndex] = this;
|
s_allVideoPlayers[_videoPlayerIndex] = this;
|
||||||
|
|
||||||
|
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||||
|
_debugDrawNode = DrawNode::create();
|
||||||
|
addchild(_debugDrawNode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoPlayer::~VideoPlayer()
|
VideoPlayer::~VideoPlayer()
|
||||||
|
@ -224,9 +229,16 @@ void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||||
_customDebugDrawCommand.init(_globalZOrder);
|
_debugDrawNode->clear();
|
||||||
_customDebugDrawCommand.func = CC_CALLBACK_0(VideoPlayer::drawDebugData, this);
|
auto size = getContentSize();
|
||||||
renderer->addCommand(&_customDebugDrawCommand);
|
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));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -275,6 +275,11 @@ VideoPlayer::VideoPlayer()
|
||||||
, _isPlaying(false)
|
, _isPlaying(false)
|
||||||
{
|
{
|
||||||
_videoView = [[UIVideoViewWrapperIos alloc] init:this];
|
_videoView = [[UIVideoViewWrapperIos alloc] init:this];
|
||||||
|
|
||||||
|
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||||
|
_debugDrawNode = DrawNode::create();
|
||||||
|
addchild(_debugDrawNode);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoPlayer::~VideoPlayer()
|
VideoPlayer::~VideoPlayer()
|
||||||
|
@ -324,9 +329,16 @@ void VideoPlayer::draw(Renderer* renderer, const Mat4 &transform, uint32_t flags
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||||
_customDebugDrawCommand.init(_globalZOrder);
|
_debugDrawNode->clear();
|
||||||
_customDebugDrawCommand.func = CC_CALLBACK_0(VideoPlayer::drawDebugData, this);
|
auto size = getContentSize();
|
||||||
renderer->addCommand(&_customDebugDrawCommand);
|
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));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,31 +361,6 @@ void VideoPlayer::setKeepAspectRatioEnabled(bool enable)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
|
||||||
void VideoPlayer::drawDebugData()
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
|
||||||
|
|
||||||
auto size = getContentSize();
|
|
||||||
|
|
||||||
Point vertices[4]=
|
|
||||||
{
|
|
||||||
Point::ZERO,
|
|
||||||
Point(size.width, 0),
|
|
||||||
Point(size.width, size.height),
|
|
||||||
Point(0, size.height)
|
|
||||||
};
|
|
||||||
|
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void VideoPlayer::play()
|
void VideoPlayer::play()
|
||||||
{
|
{
|
||||||
if (! _videoURL.empty())
|
if (! _videoURL.empty())
|
||||||
|
|
|
@ -84,8 +84,7 @@ namespace experimental{
|
||||||
virtual ~VideoPlayer();
|
virtual ~VideoPlayer();
|
||||||
|
|
||||||
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
#if CC_VIDEOPLAYER_DEBUG_DRAW
|
||||||
CustomCommand _customDebugDrawCommand;
|
DrawNode *_debugDrawNode;
|
||||||
void VideoPlayer::drawDebugData();
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
enum class Source
|
enum class Source
|
||||||
|
|
|
@ -468,7 +468,7 @@ void Widget::onSizeChanged()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const Size& Widget::getVirtualRendererSize() const
|
Size Widget::getVirtualRendererSize() const
|
||||||
{
|
{
|
||||||
return _contentSize;
|
return _contentSize;
|
||||||
}
|
}
|
||||||
|
|
|
@ -489,7 +489,7 @@ public:
|
||||||
virtual Node* getVirtualRenderer();
|
virtual Node* getVirtualRenderer();
|
||||||
|
|
||||||
|
|
||||||
virtual const Size& getVirtualRendererSize() const;
|
virtual Size getVirtualRendererSize() const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#import "AppController.h"
|
#import "AppController.h"
|
||||||
#import "CCEAGLView.h"
|
#import "platform/ios/CCEAGLView-ios.h"
|
||||||
#import "cocos2d.h"
|
#import "cocos2d.h"
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import "RootViewController.h"
|
#import "RootViewController.h"
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#import "RootViewController.h"
|
#import "RootViewController.h"
|
||||||
#import "cocos2d.h"
|
#import "cocos2d.h"
|
||||||
#import "CCEAGLView.h"
|
#import "platform/ios/CCEAGLView-ios.h"
|
||||||
|
|
||||||
@implementation RootViewController
|
@implementation RootViewController
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#import "AppController.h"
|
#import "AppController.h"
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import "RootViewController.h"
|
#import "RootViewController.h"
|
||||||
#import "CCEAGLView.h"
|
#import "platform/ios/CCEAGLView-ios.h"
|
||||||
|
|
||||||
@implementation AppController
|
@implementation AppController
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
#import "RootViewController.h"
|
#import "RootViewController.h"
|
||||||
#import "cocos2d.h"
|
#import "cocos2d.h"
|
||||||
#import "CCEAGLView.h"
|
#import "platform/ios/CCEAGLView-ios.h"
|
||||||
|
|
||||||
@implementation RootViewController
|
@implementation RootViewController
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
#import "AppController.h"
|
#import "AppController.h"
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import "RootViewController.h"
|
#import "RootViewController.h"
|
||||||
#import "CCEAGLView.h"
|
#import "platform/ios/CCEAGLView-ios.h"
|
||||||
#include "ConfigParser.h"
|
#include "ConfigParser.h"
|
||||||
|
|
||||||
@implementation AppController
|
@implementation AppController
|
||||||
|
|
|
@ -1339,6 +1339,15 @@ void ActionFollow::onEnter()
|
||||||
centerSprites(1);
|
centerSprites(1);
|
||||||
auto s = Director::getInstance()->getWinSize();
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
DrawNode* drawNode = DrawNode::create();
|
||||||
|
float x = s.width*2 - 100;
|
||||||
|
float y = s.height;
|
||||||
|
|
||||||
|
Vec2 vertices[] = { Vec2(5,5), Vec2(x-5,5), Vec2(x-5,y-5), Vec2(5,y-5) };
|
||||||
|
drawNode->drawPoly(vertices, 4, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
this->addChild(drawNode);
|
||||||
|
|
||||||
_grossini->setPosition(-200, s.height / 2);
|
_grossini->setPosition(-200, s.height / 2);
|
||||||
auto move = MoveBy::create(2, Vec2(s.width * 3, 0));
|
auto move = MoveBy::create(2, Vec2(s.width * 3, 0));
|
||||||
auto move_back = move->reverse();
|
auto move_back = move->reverse();
|
||||||
|
@ -1350,32 +1359,6 @@ void ActionFollow::onEnter()
|
||||||
this->runAction(Follow::create(_grossini, Rect(0, 0, s.width * 2 - 100, s.height)));
|
this->runAction(Follow::create(_grossini, Rect(0, 0, s.width * 2 - 100, s.height)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionFollow::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(ActionFollow::onDraw, this, transform, flags);
|
|
||||||
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionFollow::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto winSize = Director::getInstance()->getWinSize();
|
|
||||||
|
|
||||||
float x = winSize.width*2 - 100;
|
|
||||||
float y = winSize.height;
|
|
||||||
|
|
||||||
Vec2 vertices[] = { Vec2(5,5), Vec2(x-5,5), Vec2(x-5,y-5), Vec2(5,y-5) };
|
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string ActionFollow::subtitle() const
|
std::string ActionFollow::subtitle() const
|
||||||
{
|
{
|
||||||
return "Follow action";
|
return "Follow action";
|
||||||
|
@ -1623,6 +1606,11 @@ void ActionCatmullRomStacked::onEnter()
|
||||||
MoveBy::create(0.05f, Vec2(-10,0)),
|
MoveBy::create(0.05f, Vec2(-10,0)),
|
||||||
nullptr)));
|
nullptr)));
|
||||||
|
|
||||||
|
auto drawNode1 = DrawNode::create();
|
||||||
|
drawNode1->setPosition(Vec2(50,50));
|
||||||
|
drawNode1->drawCatmullRom(array, 50, Color4F(1.0, 1.0, 0.0, 0.5));
|
||||||
|
this->addChild(drawNode1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// sprite 2 (To)
|
// sprite 2 (To)
|
||||||
//
|
//
|
||||||
|
@ -1652,54 +1640,13 @@ void ActionCatmullRomStacked::onEnter()
|
||||||
MoveBy::create(0.05f, Vec2(-10,0)),
|
MoveBy::create(0.05f, Vec2(-10,0)),
|
||||||
nullptr)));
|
nullptr)));
|
||||||
|
|
||||||
array->retain();
|
auto drawNode2 = DrawNode::create();
|
||||||
_array1 = array;
|
drawNode2->drawCatmullRom(array2, 50, Color4F(1.0, 0.0, 0.0, 0.5));
|
||||||
array2->retain();
|
this->addChild(drawNode2);
|
||||||
_array2 = array2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionCatmullRomStacked::~ActionCatmullRomStacked()
|
ActionCatmullRomStacked::~ActionCatmullRomStacked()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_array1);
|
|
||||||
CC_SAFE_RELEASE(_array2);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCatmullRomStacked::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
ActionsDemo::draw(renderer, transform, flags);
|
|
||||||
|
|
||||||
// move to 50,50 since the "by" path will start at 50,50
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
Mat4 translation;
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(50, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
|
|
||||||
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(ActionCatmullRomStacked::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCatmullRomStacked::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
|
|
||||||
Mat4 oldMat;
|
|
||||||
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
|
|
||||||
DrawPrimitives::drawCatmullRom(_array1,50);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV2);
|
|
||||||
DrawPrimitives::drawCatmullRom(_array2,50);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ActionCatmullRomStacked::title() const
|
std::string ActionCatmullRomStacked::title() const
|
||||||
|
@ -1753,6 +1700,11 @@ void ActionCardinalSplineStacked::onEnter()
|
||||||
MoveBy::create(0.05f, Vec2(-10,0)),
|
MoveBy::create(0.05f, Vec2(-10,0)),
|
||||||
nullptr)));
|
nullptr)));
|
||||||
|
|
||||||
|
auto drawNode1 = DrawNode::create();
|
||||||
|
drawNode1->setPosition(Vec2(50,50));
|
||||||
|
drawNode1->drawCardinalSpline(array, 0, 100, Color4F(1.0, 0.0, 1.0, 1.0));
|
||||||
|
this->addChild(drawNode1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// sprite 2 (By)
|
// sprite 2 (By)
|
||||||
//
|
//
|
||||||
|
@ -1775,61 +1727,14 @@ void ActionCardinalSplineStacked::onEnter()
|
||||||
MoveBy::create(0.05f, Vec2(-10,0)),
|
MoveBy::create(0.05f, Vec2(-10,0)),
|
||||||
nullptr)));
|
nullptr)));
|
||||||
|
|
||||||
array->retain();
|
auto drawNode2 = DrawNode::create();
|
||||||
_array = array;
|
drawNode2->setPosition(Vec2(s.width/2,50));
|
||||||
|
drawNode2->drawCardinalSpline(array, 1, 100, Color4F(0.0, 0.0, 1.0, 1.0));
|
||||||
|
this->addChild(drawNode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionCardinalSplineStacked::~ActionCardinalSplineStacked()
|
ActionCardinalSplineStacked::~ActionCardinalSplineStacked()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCardinalSplineStacked::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
ActionsDemo::draw(renderer, transform, flags);
|
|
||||||
|
|
||||||
// move to 50,50 since the "by" path will start at 50,50
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
Mat4 translation;
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(50, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
|
|
||||||
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(s.width/2, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
|
|
||||||
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(ActionCardinalSplineStacked::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCardinalSplineStacked::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
|
|
||||||
Mat4 oldMat;
|
|
||||||
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
|
|
||||||
DrawPrimitives::drawCardinalSpline(_array, 0, 100);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV2);
|
|
||||||
DrawPrimitives::drawCardinalSpline(_array, 1, 100);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ActionCardinalSplineStacked::title() const
|
std::string ActionCardinalSplineStacked::title() const
|
||||||
|
@ -2163,6 +2068,10 @@ void ActionCatmullRom::onEnter()
|
||||||
|
|
||||||
_tamara->runAction(seq);
|
_tamara->runAction(seq);
|
||||||
|
|
||||||
|
auto drawNode1 = DrawNode::create();
|
||||||
|
drawNode1->setPosition(Vec2(50,50));
|
||||||
|
drawNode1->drawCatmullRom(array, 50, Color4F(1.0, 0.0, 1.0, 1.0));
|
||||||
|
this->addChild(drawNode1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// sprite 2 (To)
|
// sprite 2 (To)
|
||||||
|
@ -2186,58 +2095,15 @@ void ActionCatmullRom::onEnter()
|
||||||
|
|
||||||
_kathia->runAction(seq2);
|
_kathia->runAction(seq2);
|
||||||
|
|
||||||
_array1 = array;
|
auto drawNode2 = DrawNode::create();
|
||||||
_array1->retain();
|
drawNode2->drawCatmullRom(array2, 50, Color4F(0.0, 1.0, 1.0, 1.0));
|
||||||
_array2 = array2;
|
this->addChild(drawNode2);
|
||||||
_array2->retain();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionCatmullRom::~ActionCatmullRom()
|
ActionCatmullRom::~ActionCatmullRom()
|
||||||
{
|
{
|
||||||
_array1->release();
|
|
||||||
_array2->release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionCatmullRom::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
ActionsDemo::draw(renderer, transform, flags);
|
|
||||||
|
|
||||||
// move to 50,50 since the "by" path will start at 50,50
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
Mat4 translation;
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(50, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(ActionCatmullRom::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void ActionCatmullRom::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
|
|
||||||
Mat4 oldMat;
|
|
||||||
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
|
|
||||||
DrawPrimitives::drawCatmullRom(_array1, 50);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV2);
|
|
||||||
DrawPrimitives::drawCatmullRom(_array2,50);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMat);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
std::string ActionCatmullRom::title() const
|
std::string ActionCatmullRom::title() const
|
||||||
{
|
{
|
||||||
return "CatmullRomBy / CatmullRomTo";
|
return "CatmullRomBy / CatmullRomTo";
|
||||||
|
@ -2280,6 +2146,11 @@ void ActionCardinalSpline::onEnter()
|
||||||
_tamara->setPosition(50, 50);
|
_tamara->setPosition(50, 50);
|
||||||
_tamara->runAction(seq);
|
_tamara->runAction(seq);
|
||||||
|
|
||||||
|
auto drawNode1 = DrawNode::create();
|
||||||
|
drawNode1->setPosition(Vec2(50,50));
|
||||||
|
drawNode1->drawCardinalSpline(array, 0, 100, Color4F(1.0, 0.0, 1.0, 1.0));
|
||||||
|
this->addChild(drawNode1);
|
||||||
|
|
||||||
//
|
//
|
||||||
// sprite 2 (By)
|
// sprite 2 (By)
|
||||||
//
|
//
|
||||||
|
@ -2294,59 +2165,14 @@ void ActionCardinalSpline::onEnter()
|
||||||
_kathia->setPosition(s.width/2, 50);
|
_kathia->setPosition(s.width/2, 50);
|
||||||
_kathia->runAction(seq2);
|
_kathia->runAction(seq2);
|
||||||
|
|
||||||
_array = array;
|
auto drawNode2 = DrawNode::create();
|
||||||
array->retain();
|
drawNode2->setPosition(Vec2(s.width/2, 50));
|
||||||
|
drawNode2->drawCardinalSpline(array, 1, 100, Color4F(1.0, 0.0, 1.0, 1.0));
|
||||||
|
this->addChild(drawNode2);
|
||||||
}
|
}
|
||||||
|
|
||||||
ActionCardinalSpline::~ActionCardinalSpline()
|
ActionCardinalSpline::~ActionCardinalSpline()
|
||||||
{
|
{
|
||||||
_array->release();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCardinalSpline::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
ActionsDemo::draw(renderer, transform, flags);
|
|
||||||
|
|
||||||
// move to 50,50 since the "by" path will start at 50,50
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
Mat4 translation;
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(50, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
_modelViewMV1 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
//Create a rotation matrix using the axis and the angle
|
|
||||||
Mat4::createTranslation(s.width/2, 50, 0, &translation);
|
|
||||||
director->multiplyMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, translation);
|
|
||||||
_modelViewMV2 = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(ActionCardinalSpline::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ActionCardinalSpline::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
|
|
||||||
Mat4 oldMat;
|
|
||||||
oldMat = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV1);
|
|
||||||
DrawPrimitives::drawCardinalSpline(_array, 0, 100);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewMV2);
|
|
||||||
DrawPrimitives::drawCardinalSpline(_array, 1, 100);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, oldMat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ActionCardinalSpline::title() const
|
std::string ActionCardinalSpline::title() const
|
||||||
|
|
|
@ -379,13 +379,7 @@ public:
|
||||||
CREATE_FUNC(ActionFollow);
|
CREATE_FUNC(ActionFollow);
|
||||||
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionTargeted : public ActionsDemo
|
class ActionTargeted : public ActionsDemo
|
||||||
|
@ -454,20 +448,9 @@ public:
|
||||||
CREATE_FUNC(ActionCatmullRomStacked);
|
CREATE_FUNC(ActionCatmullRomStacked);
|
||||||
|
|
||||||
virtual ~ActionCatmullRomStacked();
|
virtual ~ActionCatmullRomStacked();
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
//cached data and callback
|
|
||||||
Mat4 _modelViewMV1;
|
|
||||||
Mat4 _modelViewMV2;
|
|
||||||
PointArray* _array1;
|
|
||||||
PointArray* _array2;
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionCardinalSplineStacked : public ActionsDemo
|
class ActionCardinalSplineStacked : public ActionsDemo
|
||||||
|
@ -476,18 +459,9 @@ public:
|
||||||
CREATE_FUNC(ActionCardinalSplineStacked);
|
CREATE_FUNC(ActionCardinalSplineStacked);
|
||||||
|
|
||||||
virtual ~ActionCardinalSplineStacked();
|
virtual ~ActionCardinalSplineStacked();
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags);
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
Mat4 _modelViewMV1;
|
|
||||||
Mat4 _modelViewMV2;
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
PointArray* _array;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Issue1305 : public ActionsDemo
|
class Issue1305 : public ActionsDemo
|
||||||
|
@ -584,18 +558,8 @@ public:
|
||||||
~ActionCatmullRom();
|
~ActionCatmullRom();
|
||||||
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
Mat4 _modelViewMV1;
|
|
||||||
Mat4 _modelViewMV2;
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
PointArray *_array1;
|
|
||||||
PointArray *_array2;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionCardinalSpline : public ActionsDemo
|
class ActionCardinalSpline : public ActionsDemo
|
||||||
|
@ -606,17 +570,8 @@ public:
|
||||||
~ActionCardinalSpline();
|
~ActionCardinalSpline();
|
||||||
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
PointArray *_array;
|
|
||||||
Mat4 _modelViewMV1;
|
|
||||||
Mat4 _modelViewMV2;
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PauseResumeActions : public ActionsDemo
|
class PauseResumeActions : public ActionsDemo
|
||||||
|
|
|
@ -677,7 +677,38 @@ void RawStencilBufferTest::onBeforeDrawClip(int planeIndex, const Vec2& pt)
|
||||||
{
|
{
|
||||||
this->setupStencilForClippingOnPlane(planeIndex);
|
this->setupStencilForClippingOnPlane(planeIndex);
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
DrawPrimitives::drawSolidRect(Vec2::ZERO, pt, Color4F(1, 1, 1, 1));
|
|
||||||
|
Vec2 vertices[] = {
|
||||||
|
Vec2::ZERO,
|
||||||
|
Vec2(pt.x, 0),
|
||||||
|
pt,
|
||||||
|
Vec2(0, pt.y)
|
||||||
|
};
|
||||||
|
|
||||||
|
auto glProgram= GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->retain();
|
||||||
|
|
||||||
|
int colorLocation = glProgram->getUniformLocation("u_color");
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
|
Color4F color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins();
|
||||||
|
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||||
|
|
||||||
|
GLuint vbo;
|
||||||
|
glGenBuffers(1, &vbo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
|
void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
|
||||||
|
@ -685,7 +716,36 @@ void RawStencilBufferTest::onBeforeDrawSprite(int planeIndex, const Vec2& pt)
|
||||||
this->setupStencilForDrawingOnPlane(planeIndex);
|
this->setupStencilForDrawingOnPlane(planeIndex);
|
||||||
CHECK_GL_ERROR_DEBUG();
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
DrawPrimitives::drawSolidRect(Vec2::ZERO, pt, _planeColor[planeIndex]);
|
Vec2 vertices[] = {
|
||||||
|
Vec2::ZERO,
|
||||||
|
Vec2(pt.x, 0),
|
||||||
|
pt,
|
||||||
|
Vec2(0, pt.y)
|
||||||
|
};
|
||||||
|
|
||||||
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->retain();
|
||||||
|
|
||||||
|
int colorLocation = glProgram->getUniformLocation("u_color");
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
|
Color4F color = _planeColor[planeIndex];
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins();
|
||||||
|
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||||
|
|
||||||
|
GLuint vbo;
|
||||||
|
glGenBuffers(1, &vbo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RawStencilBufferTest::setupStencilForClippingOnPlane(GLint plane)
|
void RawStencilBufferTest::setupStencilForClippingOnPlane(GLint plane)
|
||||||
|
@ -861,7 +921,40 @@ void RawStencilBufferTest6::setupStencilForClippingOnPlane(GLint plane)
|
||||||
glStencilMask(planeMask);
|
glStencilMask(planeMask);
|
||||||
glStencilFunc(GL_NEVER, 0, planeMask);
|
glStencilFunc(GL_NEVER, 0, planeMask);
|
||||||
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
||||||
DrawPrimitives::drawSolidRect(Vec2::ZERO, Vec2(Director::getInstance()->getWinSize()), Color4F(1, 1, 1, 1));
|
|
||||||
|
Vec2 pt = Director::getInstance()->getWinSize();
|
||||||
|
Vec2 vertices[] = {
|
||||||
|
Vec2::ZERO,
|
||||||
|
Vec2(pt.x, 0),
|
||||||
|
pt,
|
||||||
|
Vec2(0, pt.y)
|
||||||
|
};
|
||||||
|
|
||||||
|
auto glProgram = GLProgramCache::getInstance()->getGLProgram(GLProgram::SHADER_NAME_POSITION_U_COLOR);
|
||||||
|
glProgram->retain();
|
||||||
|
|
||||||
|
int colorLocation = glProgram->getUniformLocation("u_color");
|
||||||
|
CHECK_GL_ERROR_DEBUG();
|
||||||
|
|
||||||
|
Color4F color(1, 1, 1, 1);
|
||||||
|
|
||||||
|
glProgram->use();
|
||||||
|
glProgram->setUniformsForBuiltins();
|
||||||
|
glProgram->setUniformLocationWith4fv(colorLocation, (GLfloat*) &color.r, 1);
|
||||||
|
|
||||||
|
GL::enableVertexAttribs( GL::VERTEX_ATTRIB_FLAG_POSITION );
|
||||||
|
|
||||||
|
GLuint vbo;
|
||||||
|
glGenBuffers(1, &vbo);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, vbo);
|
||||||
|
glBufferData(GL_ARRAY_BUFFER, sizeof(Vec2)*4, vertices, GL_STREAM_DRAW);
|
||||||
|
|
||||||
|
glVertexAttribPointer(GLProgram::VERTEX_ATTRIB_POSITION, 2, GL_FLOAT, GL_FALSE, 0, 0);
|
||||||
|
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
|
||||||
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 4);
|
||||||
|
|
||||||
glStencilFunc(GL_NEVER, planeMask, planeMask);
|
glStencilFunc(GL_NEVER, planeMask, planeMask);
|
||||||
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
glStencilOp(GL_REPLACE, GL_KEEP, GL_KEEP);
|
||||||
glDisable(GL_DEPTH_TEST);
|
glDisable(GL_DEPTH_TEST);
|
||||||
|
|
|
@ -257,6 +257,60 @@ DrawNodeTest::DrawNodeTest()
|
||||||
auto draw = DrawNode::create();
|
auto draw = DrawNode::create();
|
||||||
addChild(draw, 10);
|
addChild(draw, 10);
|
||||||
|
|
||||||
|
draw->drawPoint(Vec2(s.width/2-120, s.height/2-120), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
draw->drawPoint(Vec2(s.width/2+120, s.height/2+120), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
// draw 4 small points
|
||||||
|
Vec2 position[] = { Vec2(60,60), Vec2(70,70), Vec2(60,70), Vec2(70,60) };
|
||||||
|
draw->drawPoints( position, 4, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
// draw a line
|
||||||
|
draw->drawLine(Vec2(0,0), Vec2(s.width, s.height), Color4F(1.0, 0.0, 0.0, 0.5));
|
||||||
|
|
||||||
|
// draw a rectangle
|
||||||
|
draw->drawRect(Vec2(23,23), Vec2(7,7), Color4F(1,1,0,1));
|
||||||
|
|
||||||
|
// draw a circle
|
||||||
|
draw->drawCircle(VisibleRect::center() + Vec2(140,0), 100, CC_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f, Color4F(1.0, 0.0, 0.0, 0.5));
|
||||||
|
|
||||||
|
draw->drawCircle(VisibleRect::center() - Vec2(140,0), 50, CC_DEGREES_TO_RADIANS(90), 30, false, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
// Draw some beziers
|
||||||
|
draw->drawQuadBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10), Vec2(s.width - 10, s.height - 10), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
draw->drawQuadBezier(Vec2(0, s.height), Vec2(s.width/2, s.height/2), Vec2(s.width, s.height), 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
draw->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x+30,VisibleRect::center().y+50), Vec2(VisibleRect::center().x+60,VisibleRect::center().y-50),VisibleRect::right(),100, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
draw->drawCubicBezier(Vec2(s.width - 250, 40), Vec2(s.width - 70, 100), Vec2(s.width - 30, 250), Vec2(s.width - 10, s.height - 50), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
auto array = PointArray::create(20);
|
||||||
|
array->addControlPoint(Vec2(0,0));
|
||||||
|
array->addControlPoint(Vec2(80,80));
|
||||||
|
array->addControlPoint(Vec2(s.width-80,80));
|
||||||
|
array->addControlPoint(Vec2(s.width-80,s.height-80));
|
||||||
|
array->addControlPoint(Vec2(80,s.height-80));
|
||||||
|
array->addControlPoint(Vec2(80,80));
|
||||||
|
array->addControlPoint(Vec2(s.width/2, s.height/2));
|
||||||
|
draw->drawCardinalSpline(array, 0.5, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
auto array2 = PointArray::create(20);
|
||||||
|
array2->addControlPoint(Vec2(s.width / 2, 30));
|
||||||
|
array2->addControlPoint(Vec2(s.width -80, 30));
|
||||||
|
array2->addControlPoint(Vec2(s.width - 80, s.height - 80));
|
||||||
|
array2->addControlPoint(Vec2(s.width / 2, s.height - 80));
|
||||||
|
array2->addControlPoint(Vec2(s.width / 2, 30));
|
||||||
|
draw->drawCatmullRom(array2, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
|
// open random color poly
|
||||||
|
Vec2 vertices[] = { Vec2(0,0), Vec2(50,50), Vec2(100,50), Vec2(100,100), Vec2(50,100) };
|
||||||
|
draw->drawPoly( vertices, 5, false, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
|
// closed random color poly
|
||||||
|
Vec2 vertices2[] = { Vec2(30,130), Vec2(30,230), Vec2(50,200) };
|
||||||
|
draw->drawPoly( vertices2, 3, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1));
|
||||||
|
|
||||||
// Draw 10 circles
|
// Draw 10 circles
|
||||||
for( int i=0; i < 10; i++)
|
for( int i=0; i < 10; i++)
|
||||||
{
|
{
|
||||||
|
@ -265,7 +319,7 @@ DrawNodeTest::DrawNodeTest()
|
||||||
|
|
||||||
// Draw polygons
|
// Draw polygons
|
||||||
Vec2 points[] = { Vec2(s.height/4,0), Vec2(s.width,s.height/5), Vec2(s.width/3*2,s.height) };
|
Vec2 points[] = { Vec2(s.height/4,0), Vec2(s.width,s.height/5), Vec2(s.width/3*2,s.height) };
|
||||||
draw->drawPolygon(points, sizeof(points)/sizeof(points[0]), Color4F(1,0,0,0.5), 4, Color4F(0,0,1,1));
|
draw->drawPolygon(points, sizeof(points)/sizeof(points[0]), Color4F(1,0,0,0.5), 4, Color4F(0,0,1,0.5));
|
||||||
|
|
||||||
// star poly (triggers buggs)
|
// star poly (triggers buggs)
|
||||||
{
|
{
|
||||||
|
@ -297,6 +351,15 @@ DrawNodeTest::DrawNodeTest()
|
||||||
draw->drawPolygon(star, sizeof(star)/sizeof(star[0]), Color4F(1,0,0,0.5), 1, Color4F(0,0,1,1));
|
draw->drawPolygon(star, sizeof(star)/sizeof(star[0]), Color4F(1,0,0,0.5), 1, Color4F(0,0,1,1));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//draw a solid polygon
|
||||||
|
Vec2 vertices3[] = {Vec2(60,160), Vec2(70,190), Vec2(100,190), Vec2(90,160)};
|
||||||
|
draw->drawSolidPoly( vertices3, 4, Color4F(1,1,0,1) );
|
||||||
|
|
||||||
|
//draw a solid rectangle
|
||||||
|
draw->drawSolidRect(Vec2(10,10), Vec2(20,20), Color4F(1,1,0,1));
|
||||||
|
|
||||||
|
//draw a solid circle
|
||||||
|
draw->drawSolidCircle( VisibleRect::center() + Vec2(140,0), 40, CC_DEGREES_TO_RADIANS(90), 50, 2.0f, 2.0f, Color4F(0.0, 1.0, 0.0, 1.0));
|
||||||
|
|
||||||
// Draw segment
|
// Draw segment
|
||||||
draw->drawSegment(Vec2(20,s.height), Vec2(20,s.height/2), 10, Color4F(0, 1, 0, 1));
|
draw->drawSegment(Vec2(20,s.height), Vec2(20,s.height/2), 10, Color4F(0, 1, 0, 1));
|
||||||
|
@ -305,11 +368,6 @@ DrawNodeTest::DrawNodeTest()
|
||||||
|
|
||||||
// Draw triangle
|
// Draw triangle
|
||||||
draw->drawTriangle(Vec2(10, 10), Vec2(70, 30), Vec2(100, 140), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
draw->drawTriangle(Vec2(10, 10), Vec2(70, 30), Vec2(100, 140), Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
||||||
|
|
||||||
// Draw some beziers
|
|
||||||
draw->drawQuadraticBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10), Vec2(s.width - 10, s.height - 10), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
|
||||||
|
|
||||||
draw->drawCubicBezier(Vec2(s.width - 250, 40), Vec2(s.width - 70, 100), Vec2(s.width - 30, 250), Vec2(s.width - 10, s.height - 50), 10, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string DrawNodeTest::title() const
|
string DrawNodeTest::title() const
|
||||||
|
|
|
@ -764,6 +764,10 @@ void TestColliderDetector::onEnter()
|
||||||
bullet = cocos2d::extension::PhysicsSprite::createWithSpriteFrameName("25.png");
|
bullet = cocos2d::extension::PhysicsSprite::createWithSpriteFrameName("25.png");
|
||||||
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
|
#elif ENABLE_PHYSICS_SAVE_CALCULATED_VERTEX
|
||||||
bullet = Sprite::createWithSpriteFrameName("25.png");
|
bullet = Sprite::createWithSpriteFrameName("25.png");
|
||||||
|
|
||||||
|
drawNode = DrawNode::create();
|
||||||
|
addChild(drawNode, -1);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
addChild(bullet);
|
addChild(bullet);
|
||||||
|
|
||||||
|
@ -1070,21 +1074,35 @@ void TestColliderDetector::update(float delta)
|
||||||
}
|
}
|
||||||
void TestColliderDetector::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void TestColliderDetector::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
_customCommand.init(_globalZOrder);
|
for(auto& element : armature2->getBoneDic())
|
||||||
_customCommand.func = CC_CALLBACK_0(TestColliderDetector::onDraw, this, transform, flags);
|
{
|
||||||
renderer->addCommand(&_customCommand);
|
Bone *bone = element.second;
|
||||||
}
|
ColliderDetector *detector = bone->getColliderDetector();
|
||||||
|
|
||||||
void TestColliderDetector::onDraw(const Mat4 &transform, uint32_t flags)
|
if (!detector)
|
||||||
{
|
continue;
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
armature2->drawContour();
|
const cocos2d::Vector<ColliderBody*>& bodyList = detector->getColliderBodyList();
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
for (auto& object : bodyList)
|
||||||
|
{
|
||||||
|
ColliderBody *body = static_cast<ColliderBody*>(object);
|
||||||
|
const std::vector<Vec2> &vertexList = body->getCalculatedVertexList();
|
||||||
|
|
||||||
|
unsigned long length = vertexList.size();
|
||||||
|
Vec2 *points = new Vec2[length];
|
||||||
|
for (unsigned long i = 0; i<length; i++)
|
||||||
|
{
|
||||||
|
Vec2 p = vertexList.at(i);
|
||||||
|
points[i].x = p.x;
|
||||||
|
points[i].y = p.y;
|
||||||
|
}
|
||||||
|
drawNode->clear();
|
||||||
|
drawNode->drawPoly(points, (unsigned int)length, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
|
|
||||||
|
delete []points;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1104,6 +1122,9 @@ void TestBoundingBox::onEnter()
|
||||||
|
|
||||||
Sprite *sprite = Sprite::create("Images/background3.png");
|
Sprite *sprite = Sprite::create("Images/background3.png");
|
||||||
armature->addChild(sprite);
|
armature->addChild(sprite);
|
||||||
|
|
||||||
|
_drawNode = DrawNode::create();
|
||||||
|
this->addChild(_drawNode);
|
||||||
}
|
}
|
||||||
std::string TestBoundingBox::title() const
|
std::string TestBoundingBox::title() const
|
||||||
{
|
{
|
||||||
|
@ -1111,21 +1132,9 @@ std::string TestBoundingBox::title() const
|
||||||
}
|
}
|
||||||
void TestBoundingBox::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
void TestBoundingBox::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(TestBoundingBox::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void TestBoundingBox::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
getGLProgram()->use();
|
|
||||||
getGLProgram()->setUniformsForBuiltins(transform);
|
|
||||||
|
|
||||||
rect = armature->getBoundingBox();
|
rect = armature->getBoundingBox();
|
||||||
|
_drawNode->clear();
|
||||||
DrawPrimitives::setDrawColor4B(100, 100, 100, 255);
|
_drawNode->drawRect(rect.origin, Vec2(rect.getMaxX(), rect.getMaxY()), Color4F(1.0, 0.5, 0.5, 1.0));
|
||||||
DrawPrimitives::drawRect(rect.origin, Vec2(rect.getMaxX(), rect.getMaxY()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TestAnchorPoint::onEnter()
|
void TestAnchorPoint::onEnter()
|
||||||
|
|
|
@ -272,7 +272,6 @@ public:
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual void update(float delta);
|
virtual void update(float delta);
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
|
void onFrameEvent(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
|
||||||
|
|
||||||
|
@ -280,7 +279,7 @@ public:
|
||||||
cocostudio::Armature *armature;
|
cocostudio::Armature *armature;
|
||||||
cocostudio::Armature *armature2;
|
cocostudio::Armature *armature2;
|
||||||
|
|
||||||
CustomCommand _customCommand; //new render needed this for drawing primitives
|
DrawNode *drawNode;
|
||||||
cocos2d::Sprite *bullet;
|
cocos2d::Sprite *bullet;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
@ -300,9 +299,7 @@ public:
|
||||||
Rect rect;
|
Rect rect;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
DrawNode* _drawNode;
|
||||||
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TestAnchorPoint : public ArmatureTestLayer
|
class TestAnchorPoint : public ArmatureTestLayer
|
||||||
|
|
|
@ -484,12 +484,17 @@ Atlas4::Atlas4()
|
||||||
{
|
{
|
||||||
_time = 0;
|
_time = 0;
|
||||||
|
|
||||||
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
auto drawNode = DrawNode::create();
|
||||||
|
drawNode->drawLine( Vec2(0, s.height/2), Vec2(s.width, s.height/2), Color4F(1.0, 1.0, 1.0, 1.0) );
|
||||||
|
drawNode->drawLine( Vec2(s.width/2, 0), Vec2(s.width/2, s.height), Color4F(1.0, 1.0, 1.0, 1.0) );
|
||||||
|
addChild(drawNode, -1);
|
||||||
|
|
||||||
// Upper Label
|
// Upper Label
|
||||||
auto label = LabelBMFont::create("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");
|
auto label = LabelBMFont::create("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
|
|
||||||
label->setPosition( Vec2(s.width/2, s.height/2) );
|
label->setPosition( Vec2(s.width/2, s.height/2) );
|
||||||
label->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
label->setAnchorPoint( Vec2::ANCHOR_MIDDLE );
|
||||||
|
|
||||||
|
@ -532,27 +537,6 @@ Atlas4::Atlas4()
|
||||||
schedule( schedule_selector(Atlas4::step), 0.1f);
|
schedule( schedule_selector(Atlas4::step), 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Atlas4::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(Atlas4::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Atlas4::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
DrawPrimitives::drawLine( Vec2(0, s.height/2), Vec2(s.width, s.height/2) );
|
|
||||||
DrawPrimitives::drawLine( Vec2(s.width/2, 0), Vec2(s.width/2, s.height) );
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Atlas4::step(float dt)
|
void Atlas4::step(float dt)
|
||||||
{
|
{
|
||||||
_time += dt;
|
_time += dt;
|
||||||
|
@ -1644,35 +1628,12 @@ LabelBMFontBounds::LabelBMFontBounds()
|
||||||
addChild(layer, -10);
|
addChild(layer, -10);
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
label1 = LabelBMFont::create("Testing Glyph Designer", "fonts/boundsTestFont.fnt");
|
auto label1 = LabelBMFont::create("Testing Glyph Designer", "fonts/boundsTestFont.fnt");
|
||||||
|
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setPosition(Vec2(s.width/2, s.height/2));
|
label1->setPosition(Vec2(s.width/2, s.height/2));
|
||||||
}
|
|
||||||
|
|
||||||
std::string LabelBMFontBounds::title() const
|
auto drawNode = DrawNode::create();
|
||||||
{
|
|
||||||
return "Testing LabelBMFont Bounds";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LabelBMFontBounds::subtitle() const
|
|
||||||
{
|
|
||||||
return "You should see string enclosed by a box";
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelBMFontBounds::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_customCommand.init(_globalZOrder);
|
|
||||||
_customCommand.func = CC_CALLBACK_0(LabelBMFontBounds::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_customCommand);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelBMFontBounds::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto labelSize = label1->getContentSize();
|
auto labelSize = label1->getContentSize();
|
||||||
auto origin = Director::getInstance()->getWinSize();
|
auto origin = Director::getInstance()->getWinSize();
|
||||||
|
@ -1687,9 +1648,18 @@ void LabelBMFontBounds::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
Vec2(origin.width, labelSize.height + origin.height)
|
Vec2(origin.width, labelSize.height + origin.height)
|
||||||
};
|
};
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
drawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
|
addChild(drawNode);
|
||||||
|
}
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
std::string LabelBMFontBounds::title() const
|
||||||
|
{
|
||||||
|
return "Testing LabelBMFont Bounds";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelBMFontBounds::subtitle() const
|
||||||
|
{
|
||||||
|
return "You should see string enclosed by a box";
|
||||||
}
|
}
|
||||||
|
|
||||||
// LabelBMFontCrashTest
|
// LabelBMFontCrashTest
|
||||||
|
|
|
@ -108,14 +108,9 @@ public:
|
||||||
|
|
||||||
Atlas4();
|
Atlas4();
|
||||||
virtual void step(float dt);
|
virtual void step(float dt);
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
protected:
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class Atlas5 : public AtlasDemo
|
class Atlas5 : public AtlasDemo
|
||||||
|
@ -383,14 +378,8 @@ public:
|
||||||
|
|
||||||
LabelBMFontBounds();
|
LabelBMFontBounds();
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
private:
|
|
||||||
LabelBMFont *label1;
|
|
||||||
CustomCommand _customCommand;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class NewLabelTTFUnicode : public AtlasDemo
|
class NewLabelTTFUnicode : public AtlasDemo
|
||||||
|
|
|
@ -264,11 +264,17 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
||||||
{
|
{
|
||||||
_time = 0;
|
_time = 0;
|
||||||
|
|
||||||
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
auto drawNode = DrawNode::create();
|
||||||
|
drawNode->drawLine( Vec2(0, s.height/2), Vec2(s.width, s.height/2), Color4F(1.0, 1.0, 1.0, 1.0) );
|
||||||
|
drawNode->drawLine( Vec2(s.width/2, 0), Vec2(s.width/2, s.height), Color4F(1.0, 1.0, 1.0, 1.0) );
|
||||||
|
addChild(drawNode, -1);
|
||||||
|
|
||||||
// Upper Label
|
// Upper Label
|
||||||
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas");
|
auto label = Label::createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas");
|
||||||
addChild(label);
|
addChild(label);
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
|
|
||||||
label->setPosition( Vec2(s.width/2, s.height/2) );
|
label->setPosition( Vec2(s.width/2, s.height/2) );
|
||||||
|
|
||||||
|
@ -310,28 +316,6 @@ LabelFNTSpriteActions::LabelFNTSpriteActions()
|
||||||
schedule( schedule_selector(LabelFNTSpriteActions::step), 0.1f);
|
schedule( schedule_selector(LabelFNTSpriteActions::step), 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelFNTSpriteActions::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(LabelFNTSpriteActions::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFNTSpriteActions::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto s = Director::getInstance()->getWinSize();
|
|
||||||
DrawPrimitives::drawLine( Vec2(0, s.height/2), Vec2(s.width, s.height/2) );
|
|
||||||
DrawPrimitives::drawLine( Vec2(s.width/2, 0), Vec2(s.width/2, s.height) );
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFNTSpriteActions::step(float dt)
|
void LabelFNTSpriteActions::step(float dt)
|
||||||
{
|
{
|
||||||
_time += dt;
|
_time += dt;
|
||||||
|
@ -894,35 +878,11 @@ LabelFNTBounds::LabelFNTBounds()
|
||||||
addChild(layer, -10);
|
addChild(layer, -10);
|
||||||
|
|
||||||
// LabelBMFont
|
// LabelBMFont
|
||||||
label1 = Label::createWithBMFont("fonts/boundsTestFont.fnt", "Testing Glyph Designer", TextHAlignment::CENTER,s.width);
|
auto label1 = Label::createWithBMFont("fonts/boundsTestFont.fnt", "Testing Glyph Designer", TextHAlignment::CENTER,s.width);
|
||||||
addChild(label1);
|
addChild(label1);
|
||||||
label1->setPosition(Vec2(s.width/2, s.height/2));
|
label1->setPosition(Vec2(s.width/2, s.height/2));
|
||||||
}
|
|
||||||
|
|
||||||
std::string LabelFNTBounds::title() const
|
|
||||||
{
|
|
||||||
return "New Label + .FNT + Bounds";
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string LabelFNTBounds::subtitle() const
|
|
||||||
{
|
|
||||||
return "You should see string enclosed by a box";
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFNTBounds::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(LabelFNTBounds::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void LabelFNTBounds::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
|
auto drawNode = DrawNode::create();
|
||||||
auto labelSize = label1->getContentSize();
|
auto labelSize = label1->getContentSize();
|
||||||
auto origin = Director::getInstance()->getWinSize();
|
auto origin = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
@ -936,9 +896,18 @@ void LabelFNTBounds::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
Vec2(origin.width, labelSize.height + origin.height)
|
Vec2(origin.width, labelSize.height + origin.height)
|
||||||
};
|
};
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
drawNode->drawPoly(vertices, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
|
addChild(drawNode);
|
||||||
|
}
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
std::string LabelFNTBounds::title() const
|
||||||
|
{
|
||||||
|
return "New Label + .FNT + Bounds";
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string LabelFNTBounds::subtitle() const
|
||||||
|
{
|
||||||
|
return "You should see string enclosed by a box";
|
||||||
}
|
}
|
||||||
|
|
||||||
LabelTTFLongLineWrapping::LabelTTFLongLineWrapping()
|
LabelTTFLongLineWrapping::LabelTTFLongLineWrapping()
|
||||||
|
@ -1508,16 +1477,8 @@ LabelTTFOldNew::LabelTTFOldNew()
|
||||||
auto label2 = Label::createWithTTF(ttfConfig, "Cocos2d-x Label Test");
|
auto label2 = Label::createWithTTF(ttfConfig, "Cocos2d-x Label Test");
|
||||||
addChild(label2, 0, kTagBitmapAtlas2);
|
addChild(label2, 0, kTagBitmapAtlas2);
|
||||||
label2->setPosition(Vec2(s.width/2, delta * 2));
|
label2->setPosition(Vec2(s.width/2, delta * 2));
|
||||||
}
|
|
||||||
|
|
||||||
void LabelTTFOldNew::onDraw(const Mat4 &transform, uint32_t flags)
|
auto drawNode = DrawNode::create();
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto label1 = (Label*)getChildByTag(kTagBitmapAtlas1);
|
|
||||||
auto labelSize = label1->getContentSize();
|
auto labelSize = label1->getContentSize();
|
||||||
auto origin = Director::getInstance()->getWinSize();
|
auto origin = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
@ -1531,10 +1492,8 @@ void LabelTTFOldNew::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
Vec2(origin.width, labelSize.height + origin.height)
|
Vec2(origin.width, labelSize.height + origin.height)
|
||||||
};
|
};
|
||||||
DrawPrimitives::setDrawColor4B(Color4B::RED.r,Color4B::RED.g,Color4B::RED.b,Color4B::RED.a);
|
drawNode->drawPoly(vertices, 4, true, Color4F(1.0, 0.0, 0.0, 1.0));
|
||||||
DrawPrimitives::drawPoly(vertices, 4, true);
|
|
||||||
|
|
||||||
auto label2 = (Label*)getChildByTag(kTagBitmapAtlas2);
|
|
||||||
labelSize = label2->getContentSize();
|
labelSize = label2->getContentSize();
|
||||||
origin = Director::getInstance()->getWinSize();
|
origin = Director::getInstance()->getWinSize();
|
||||||
|
|
||||||
|
@ -1548,17 +1507,9 @@ void LabelTTFOldNew::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
Vec2(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
Vec2(origin.width, labelSize.height + origin.height)
|
Vec2(origin.width, labelSize.height + origin.height)
|
||||||
};
|
};
|
||||||
DrawPrimitives::setDrawColor4B(Color4B::WHITE.r,Color4B::WHITE.g,Color4B::WHITE.b,Color4B::WHITE.a);
|
drawNode->drawPoly(vertices2, 4, true, Color4F(1.0, 1.0, 1.0, 1.0));
|
||||||
DrawPrimitives::drawPoly(vertices2, 4, true);
|
|
||||||
|
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
addChild(drawNode);
|
||||||
}
|
|
||||||
|
|
||||||
void LabelTTFOldNew::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(LabelTTFOldNew::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string LabelTTFOldNew::title() const
|
std::string LabelTTFOldNew::title() const
|
||||||
|
|
|
@ -58,14 +58,9 @@ public:
|
||||||
|
|
||||||
LabelFNTSpriteActions();
|
LabelFNTSpriteActions();
|
||||||
virtual void step(float dt);
|
virtual void step(float dt);
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LabelFNTPadding : public AtlasDemoNew
|
class LabelFNTPadding : public AtlasDemoNew
|
||||||
|
@ -224,14 +219,8 @@ public:
|
||||||
|
|
||||||
LabelFNTBounds();
|
LabelFNTBounds();
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
Label *label1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LabelTTFLongLineWrapping : public AtlasDemoNew
|
class LabelTTFLongLineWrapping : public AtlasDemoNew
|
||||||
|
@ -430,14 +419,8 @@ public:
|
||||||
|
|
||||||
LabelTTFOldNew();
|
LabelTTFOldNew();
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
|
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
|
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class LabelFontNameTest : public AtlasDemoNew
|
class LabelFontNameTest : public AtlasDemoNew
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#include "MutiTouchTest.h"
|
#include "MutiTouchTest.h"
|
||||||
|
|
||||||
|
|
||||||
static const Color3B* s_TouchColors[EventTouch::MAX_TOUCHES] = {
|
static const Color3B* s_TouchColors[5] = {
|
||||||
&Color3B::YELLOW,
|
&Color3B::YELLOW,
|
||||||
&Color3B::BLUE,
|
&Color3B::BLUE,
|
||||||
&Color3B::GREEN,
|
&Color3B::GREEN,
|
||||||
|
@ -12,44 +12,25 @@ static const Color3B* s_TouchColors[EventTouch::MAX_TOUCHES] = {
|
||||||
class TouchPoint : public Node
|
class TouchPoint : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TouchPoint()
|
TouchPoint(const Vec2 &touchPoint, const Color3B &touchColor)
|
||||||
{
|
{
|
||||||
setGLProgramState(GLProgramState::getOrCreateWithGLProgramName(GLProgram::SHADER_NAME_POSITION_TEXTURE_COLOR));
|
DrawNode* drawNode = DrawNode::create();
|
||||||
|
auto s = Director::getInstance()->getWinSize();
|
||||||
|
Color4F color(touchColor.r/255.0f, touchColor.g/255.0f, touchColor.b/255.0f, 1.0f);
|
||||||
|
drawNode->drawLine(Vec2(0, touchPoint.y), Vec2(s.width, touchPoint.y), color);
|
||||||
|
drawNode->drawLine(Vec2(touchPoint.x, 0), Vec2(touchPoint.x, s.height), color);
|
||||||
|
drawNode->drawDot(touchPoint, 3, color);
|
||||||
|
addChild(drawNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
static TouchPoint* touchPointWithParent(Node* pParent, const Vec2 &touchPoint, const Color3B &touchColor)
|
||||||
{
|
{
|
||||||
DrawPrimitives::setDrawColor4B(_touchColor.r, _touchColor.g, _touchColor.b, 255);
|
auto pRet = new (std::nothrow) TouchPoint(touchPoint, touchColor);
|
||||||
glLineWidth(10);
|
|
||||||
DrawPrimitives::drawLine( Vec2(0, _touchPoint.y), Vec2(getContentSize().width, _touchPoint.y) );
|
|
||||||
DrawPrimitives::drawLine( Vec2(_touchPoint.x, 0), Vec2(_touchPoint.x, getContentSize().height) );
|
|
||||||
glLineWidth(1);
|
|
||||||
DrawPrimitives::setPointSize(30);
|
|
||||||
DrawPrimitives::drawPoint(_touchPoint);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTouchPos(const Vec2& pt)
|
|
||||||
{
|
|
||||||
_touchPoint = pt;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setTouchColor(Color3B color)
|
|
||||||
{
|
|
||||||
_touchColor = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
static TouchPoint* touchPointWithParent(Node* pParent)
|
|
||||||
{
|
|
||||||
auto pRet = new (std::nothrow) TouchPoint();
|
|
||||||
pRet->setContentSize(pParent->getContentSize());
|
pRet->setContentSize(pParent->getContentSize());
|
||||||
pRet->setAnchorPoint(Vec2(0.0f, 0.0f));
|
pRet->setAnchorPoint(Vec2(0.0f, 0.0f));
|
||||||
pRet->autorelease();
|
pRet->autorelease();
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
|
||||||
Vec2 _touchPoint;
|
|
||||||
Color3B _touchColor;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
bool MutiTouchTestLayer::init()
|
bool MutiTouchTestLayer::init()
|
||||||
|
@ -78,11 +59,8 @@ void MutiTouchTestLayer::onTouchesBegan(const std::vector<Touch*>& touches, Even
|
||||||
for ( auto &item: touches )
|
for ( auto &item: touches )
|
||||||
{
|
{
|
||||||
auto touch = item;
|
auto touch = item;
|
||||||
auto touchPoint = TouchPoint::touchPointWithParent(this);
|
|
||||||
auto location = touch->getLocation();
|
auto location = touch->getLocation();
|
||||||
|
auto touchPoint = TouchPoint::touchPointWithParent(this, location, *s_TouchColors[touch->getID()%5]);
|
||||||
touchPoint->setTouchPos(location);
|
|
||||||
touchPoint->setTouchColor(*s_TouchColors[touch->getID()]);
|
|
||||||
|
|
||||||
addChild(touchPoint);
|
addChild(touchPoint);
|
||||||
s_map.insert(touch->getID(), touchPoint);
|
s_map.insert(touch->getID(), touchPoint);
|
||||||
|
@ -96,7 +74,13 @@ void MutiTouchTestLayer::onTouchesMoved(const std::vector<Touch*>& touches, Even
|
||||||
auto touch = item;
|
auto touch = item;
|
||||||
auto pTP = s_map.at(touch->getID());
|
auto pTP = s_map.at(touch->getID());
|
||||||
auto location = touch->getLocation();
|
auto location = touch->getLocation();
|
||||||
pTP->setTouchPos(location);
|
|
||||||
|
removeChild(pTP, true);
|
||||||
|
s_map.erase(touch->getID());
|
||||||
|
|
||||||
|
auto touchPointNew = TouchPoint::touchPointWithParent(this, location, *s_TouchColors[touch->getID()%5]);
|
||||||
|
addChild(touchPointNew);
|
||||||
|
s_map.insert(touch->getID(), touchPointNew);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -757,27 +757,8 @@ TMXOrthoObjectsTest::TMXOrthoObjectsTest()
|
||||||
|
|
||||||
Value objectsVal = Value(objects);
|
Value objectsVal = Value(objects);
|
||||||
CCLOG("%s", objectsVal.getDescription().c_str());
|
CCLOG("%s", objectsVal.getDescription().c_str());
|
||||||
}
|
|
||||||
|
|
||||||
void TMXOrthoObjectsTest::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
auto drawNode = DrawNode::create();
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXOrthoObjectsTest::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXOrthoObjectsTest::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = static_cast<TMXTiledMap*>( getChildByTag(kTagTileMap) );
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Group 1");
|
|
||||||
|
|
||||||
auto& objects = group->getObjects();
|
|
||||||
|
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
|
@ -788,17 +769,14 @@ void TMXOrthoObjectsTest::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x, y), pos + Vec2((x+width), y) );
|
drawNode->drawLine( Vec2(x, y), Vec2((x+width), y), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2((x+width), y), pos + Vec2((x+width), (y+height)) );
|
drawNode->drawLine( Vec2((x+width), y), Vec2((x+width), (y+height)), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2((x+width), (y+height)), pos + Vec2(x, (y+height)) );
|
drawNode->drawLine( Vec2((x+width), (y+height)), Vec2(x, (y+height)), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x, (y+height)), pos + Vec2(x, y) );
|
drawNode->drawLine( Vec2(x, (y+height)), Vec2(x, y), color );
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXOrthoObjectsTest::title() const
|
std::string TMXOrthoObjectsTest::title() const
|
||||||
|
@ -832,46 +810,26 @@ TMXIsoObjectsTest::TMXIsoObjectsTest()
|
||||||
|
|
||||||
Value objectsVal = Value(objects);
|
Value objectsVal = Value(objects);
|
||||||
CCLOG("%s", objectsVal.getDescription().c_str());
|
CCLOG("%s", objectsVal.getDescription().c_str());
|
||||||
}
|
|
||||||
|
|
||||||
void TMXIsoObjectsTest::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
auto drawNode = DrawNode::create();
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXIsoObjectsTest::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXIsoObjectsTest::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = (TMXTiledMap*) getChildByTag(kTagTileMap);
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Group 1");
|
|
||||||
|
|
||||||
auto& objects = group->getObjects();
|
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
ValueMap& dict = obj.asValueMap();
|
ValueMap& dict = obj.asValueMap();
|
||||||
|
|
||||||
float x = dict["x"].asFloat();
|
float x = dict["x"].asFloat();
|
||||||
float y = dict["y"].asFloat();
|
float y = dict["y"].asFloat();
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
|
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x,y), pos + Vec2(x+width,y) );
|
drawNode->drawLine( Vec2(x, y), Vec2((x+width), y), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x+width,y), pos + Vec2(x+width,y+height) );
|
drawNode->drawLine( Vec2((x+width), y), Vec2((x+width), (y+height)), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x+width,y+height), pos + Vec2(x,y+height) );
|
drawNode->drawLine( Vec2((x+width), (y+height)), Vec2(x, (y+height)), color );
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x,y+height), pos + Vec2(x,y) );
|
drawNode->drawLine( Vec2(x, (y+height)), Vec2(x, y), color );
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode, 10);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXIsoObjectsTest::title() const
|
std::string TMXIsoObjectsTest::title() const
|
||||||
|
@ -1519,28 +1477,10 @@ TMXGIDObjectsTest::TMXGIDObjectsTest()
|
||||||
CCLOG("Contentsize: %f, %f", s.width, s.height);
|
CCLOG("Contentsize: %f, %f", s.width, s.height);
|
||||||
|
|
||||||
CCLOG("----> Iterating over all the group objets");
|
CCLOG("----> Iterating over all the group objets");
|
||||||
//auto group = map->objectGroupNamed("Object Layer 1");
|
|
||||||
|
|
||||||
}
|
auto drawNode = DrawNode::create();
|
||||||
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
void TMXGIDObjectsTest::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXGIDObjectsTest::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXGIDObjectsTest::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = (TMXTiledMap*)getChildByTag(kTagTileMap);
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Layer 1");
|
auto group = map->getObjectGroup("Object Layer 1");
|
||||||
|
|
||||||
auto& objects = group->getObjects();
|
auto& objects = group->getObjects();
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
|
@ -1551,17 +1491,12 @@ void TMXGIDObjectsTest::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
|
||||||
|
drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x, y), pos + Vec2(x + width, y));
|
drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x + width, y), pos + Vec2(x + width, y + height));
|
drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x + width,y + height), pos + Vec2(x,y + height));
|
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x,y + height), pos + Vec2(x,y));
|
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXGIDObjectsTest::title() const
|
std::string TMXGIDObjectsTest::title() const
|
||||||
|
|
|
@ -134,11 +134,7 @@ public:
|
||||||
TMXOrthoObjectsTest(void);
|
TMXOrthoObjectsTest(void);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMXIsoObjectsTest : public TileDemo
|
class TMXIsoObjectsTest : public TileDemo
|
||||||
|
@ -147,11 +143,7 @@ public:
|
||||||
TMXIsoObjectsTest(void);
|
TMXIsoObjectsTest(void);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMXResizeTest : public TileDemo
|
class TMXResizeTest : public TileDemo
|
||||||
|
@ -292,12 +284,6 @@ public:
|
||||||
TMXGIDObjectsTest();
|
TMXGIDObjectsTest();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TileMapTestScene : public TestScene
|
class TileMapTestScene : public TestScene
|
||||||
|
|
|
@ -728,28 +728,9 @@ TMXOrthoObjectsTestNew::TMXOrthoObjectsTestNew()
|
||||||
|
|
||||||
Value objectsVal = Value(objects);
|
Value objectsVal = Value(objects);
|
||||||
CCLOG("%s", objectsVal.getDescription().c_str());
|
CCLOG("%s", objectsVal.getDescription().c_str());
|
||||||
}
|
|
||||||
|
|
||||||
void TMXOrthoObjectsTestNew::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXOrthoObjectsTestNew::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXOrthoObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = static_cast<cocos2d::experimental::TMXTiledMap*>( getChildByTag(kTagTileMap) );
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Group 1");
|
|
||||||
|
|
||||||
auto& objects = group->getObjects();
|
|
||||||
|
|
||||||
|
auto drawNode = DrawNode::create();
|
||||||
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
ValueMap& dict = obj.asValueMap();
|
ValueMap& dict = obj.asValueMap();
|
||||||
|
@ -759,17 +740,12 @@ void TMXOrthoObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
|
||||||
|
drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x, y), pos + Vec2((x+width), y) );
|
drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2((x+width), y), pos + Vec2((x+width), (y+height)) );
|
drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2((x+width), (y+height)), pos + Vec2(x, (y+height)) );
|
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x, (y+height)), pos + Vec2(x, y) );
|
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXOrthoObjectsTestNew::title() const
|
std::string TMXOrthoObjectsTestNew::title() const
|
||||||
|
@ -803,46 +779,24 @@ TMXIsoObjectsTestNew::TMXIsoObjectsTestNew()
|
||||||
|
|
||||||
Value objectsVal = Value(objects);
|
Value objectsVal = Value(objects);
|
||||||
CCLOG("%s", objectsVal.getDescription().c_str());
|
CCLOG("%s", objectsVal.getDescription().c_str());
|
||||||
}
|
|
||||||
|
|
||||||
void TMXIsoObjectsTestNew::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
auto drawNode = DrawNode::create();
|
||||||
{
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXIsoObjectsTestNew::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXIsoObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = (cocos2d::experimental::TMXTiledMap*) getChildByTag(kTagTileMap);
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Group 1");
|
|
||||||
|
|
||||||
auto& objects = group->getObjects();
|
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
ValueMap& dict = obj.asValueMap();
|
ValueMap& dict = obj.asValueMap();
|
||||||
|
|
||||||
float x = dict["x"].asFloat();
|
float x = dict["x"].asFloat();
|
||||||
float y = dict["y"].asFloat();
|
float y = dict["y"].asFloat();
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
|
||||||
|
drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x,y), pos + Vec2(x+width,y) );
|
drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x+width,y), pos + Vec2(x+width,y+height) );
|
drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x+width,y+height), pos + Vec2(x,y+height) );
|
|
||||||
DrawPrimitives::drawLine( pos + Vec2(x,y+height), pos + Vec2(x,y) );
|
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode, 10);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXIsoObjectsTestNew::title() const
|
std::string TMXIsoObjectsTestNew::title() const
|
||||||
|
@ -1460,29 +1414,11 @@ TMXGIDObjectsTestNew::TMXGIDObjectsTestNew()
|
||||||
CCLOG("Contentsize: %f, %f", s.width, s.height);
|
CCLOG("Contentsize: %f, %f", s.width, s.height);
|
||||||
|
|
||||||
CCLOG("----> Iterating over all the group objets");
|
CCLOG("----> Iterating over all the group objets");
|
||||||
//auto group = map->objectGroupNamed("Object Layer 1");
|
|
||||||
|
|
||||||
}
|
auto drawNode = DrawNode::create();
|
||||||
|
Color4F color(1.0, 1.0, 1.0, 1.0);
|
||||||
void TMXGIDObjectsTestNew::draw(Renderer *renderer, const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
_renderCmd.init(_globalZOrder);
|
|
||||||
_renderCmd.func = CC_CALLBACK_0(TMXGIDObjectsTestNew::onDraw, this, transform, flags);
|
|
||||||
renderer->addCommand(&_renderCmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TMXGIDObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
|
||||||
{
|
|
||||||
Director* director = Director::getInstance();
|
|
||||||
CCASSERT(nullptr != director, "Director is null when seting matrix stack");
|
|
||||||
director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, transform);
|
|
||||||
|
|
||||||
auto map = (cocos2d::experimental::TMXTiledMap*)getChildByTag(kTagTileMap);
|
|
||||||
auto pos = map->getPosition();
|
|
||||||
auto group = map->getObjectGroup("Object Layer 1");
|
auto group = map->getObjectGroup("Object Layer 1");
|
||||||
|
auto objects = group->getObjects();
|
||||||
auto& objects = group->getObjects();
|
|
||||||
for (auto& obj : objects)
|
for (auto& obj : objects)
|
||||||
{
|
{
|
||||||
ValueMap& dict = obj.asValueMap();
|
ValueMap& dict = obj.asValueMap();
|
||||||
|
@ -1492,17 +1428,12 @@ void TMXGIDObjectsTestNew::onDraw(const Mat4 &transform, uint32_t flags)
|
||||||
float width = dict["width"].asFloat();
|
float width = dict["width"].asFloat();
|
||||||
float height = dict["height"].asFloat();
|
float height = dict["height"].asFloat();
|
||||||
|
|
||||||
glLineWidth(3);
|
drawNode->drawLine(Vec2(x, y), Vec2(x + width, y), color);
|
||||||
|
drawNode->drawLine(Vec2(x + width, y), Vec2(x + width, y + height), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x, y), pos + Vec2(x + width, y));
|
drawNode->drawLine(Vec2(x + width,y + height), Vec2(x,y + height), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x + width, y), pos + Vec2(x + width, y + height));
|
drawNode->drawLine(Vec2(x,y + height), Vec2(x,y), color);
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x + width,y + height), pos + Vec2(x,y + height));
|
|
||||||
DrawPrimitives::drawLine(pos + Vec2(x,y + height), pos + Vec2(x,y));
|
|
||||||
|
|
||||||
glLineWidth(1);
|
|
||||||
}
|
}
|
||||||
|
map->addChild(drawNode, 10);
|
||||||
director->popMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TMXGIDObjectsTestNew::title() const
|
std::string TMXGIDObjectsTestNew::title() const
|
||||||
|
|
|
@ -134,11 +134,7 @@ public:
|
||||||
TMXOrthoObjectsTestNew(void);
|
TMXOrthoObjectsTestNew(void);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMXIsoObjectsTestNew : public TileDemoNew
|
class TMXIsoObjectsTestNew : public TileDemoNew
|
||||||
|
@ -147,11 +143,7 @@ public:
|
||||||
TMXIsoObjectsTestNew(void);
|
TMXIsoObjectsTestNew(void);
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
|
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMXResizeTestNew : public TileDemoNew
|
class TMXResizeTestNew : public TileDemoNew
|
||||||
|
@ -292,12 +284,6 @@ public:
|
||||||
TMXGIDObjectsTestNew();
|
TMXGIDObjectsTestNew();
|
||||||
virtual std::string title() const override;
|
virtual std::string title() const override;
|
||||||
virtual std::string subtitle() const override;
|
virtual std::string subtitle() const override;
|
||||||
virtual void draw(Renderer *renderer, const Mat4 &transform, uint32_t flags) override;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
CustomCommand _renderCmd;
|
|
||||||
void onDraw(const Mat4 &transform, uint32_t flags);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TileMapTestSceneNew : public TestScene
|
class TileMapTestSceneNew : public TestScene
|
||||||
|
|
|
@ -89,7 +89,7 @@ g_guisTests[] =
|
||||||
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
|
UISceneManager* sceneManager = UISceneManager::sharedUISceneManager();
|
||||||
sceneManager->setCurrentUISceneId(kUIButtonTest);
|
sceneManager->setCurrentUISceneId(kUIButtonTest);
|
||||||
sceneManager->setMinUISceneId(kUIButtonTest);
|
sceneManager->setMinUISceneId(kUIButtonTest);
|
||||||
sceneManager->setMaxUISceneId(kUIButtonTestZoomScale);
|
sceneManager->setMaxUISceneId(kUIButtonIgnoreContentSizeTest);
|
||||||
Scene* scene = sceneManager->currentUIScene();
|
Scene* scene = sceneManager->currentUIScene();
|
||||||
Director::getInstance()->replaceScene(scene);
|
Director::getInstance()->replaceScene(scene);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,12 @@ bool UIButtonTest::init()
|
||||||
_uiLayer->addChild(alert);
|
_uiLayer->addChild(alert);
|
||||||
|
|
||||||
// Create the button
|
// Create the button
|
||||||
Button* button = Button::create("cocosui/animationbuttonnormal.png",
|
Button* button = Button::create("cocosui/animationbuttonnormal.png");
|
||||||
"cocosui/animationbuttonpressed.png");
|
|
||||||
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
// button->addTouchEventListener(this, toucheventselector(UIButtonTest::touchEvent));
|
|
||||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest::touchEvent, this));
|
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest::touchEvent, this));
|
||||||
|
button->setZoomScale(0.4);
|
||||||
|
button->setPressedActionEnabled(true);
|
||||||
_uiLayer->addChild(button);
|
_uiLayer->addChild(button);
|
||||||
// button->setColor(Color3B::RED);
|
|
||||||
button->setOpacity(100);
|
button->setOpacity(100);
|
||||||
// Create the imageview
|
// Create the imageview
|
||||||
ImageView* imageView = ImageView::create();
|
ImageView* imageView = ImageView::create();
|
||||||
|
@ -133,6 +132,7 @@ bool UIButtonTest_Scale9::init()
|
||||||
button->setScale9Enabled(true);
|
button->setScale9Enabled(true);
|
||||||
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
button->setContentSize(Size(150, 70));
|
button->setContentSize(Size(150, 70));
|
||||||
|
button->setPressedActionEnabled(true);
|
||||||
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Scale9::touchEvent, this));
|
button->addTouchEventListener(CC_CALLBACK_2(UIButtonTest_Scale9::touchEvent, this));
|
||||||
_uiLayer->addChild(button);
|
_uiLayer->addChild(button);
|
||||||
|
|
||||||
|
@ -297,7 +297,7 @@ bool UIButtonTest_Title::init()
|
||||||
|
|
||||||
// Create the button with title
|
// Create the button with title
|
||||||
Button* button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
|
Button* button = Button::create("cocosui/backtotoppressed.png", "cocosui/backtotopnormal.png");
|
||||||
button->setTitleText("Title Button");
|
button->setTitleText("Title Button!");
|
||||||
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f));
|
||||||
button->setTitleColor(Color3B::YELLOW);
|
button->setTitleColor(Color3B::YELLOW);
|
||||||
CCASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColotr & getTitleColor not match!");
|
CCASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColotr & getTitleColor not match!");
|
||||||
|
@ -539,7 +539,7 @@ bool UIButtonTestZoomScale::init()
|
||||||
Size widgetSize = _widget->getContentSize();
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
// Add a label in which the button events will be displayed
|
// Add a label in which the button events will be displayed
|
||||||
_displayValueLabel = Text::create("Zoom Scale: 0.1", "fonts/Marker Felt.ttf",32);
|
_displayValueLabel = Text::create("Zoom Scale: -0.5", "fonts/Marker Felt.ttf",32);
|
||||||
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||||
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
|
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
|
||||||
_uiLayer->addChild(_displayValueLabel);
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
@ -592,3 +592,103 @@ void UIButtonTestZoomScale::sliderEvent(Ref *pSender, Slider::EventType type)
|
||||||
_displayValueLabel->setString(String::createWithFormat("Zoom Scale: %f", zoomScale)->getCString());
|
_displayValueLabel->setString(String::createWithFormat("Zoom Scale: %f", zoomScale)->getCString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// UIButtonTextOnly
|
||||||
|
UIButtonTextOnly::UIButtonTextOnly()
|
||||||
|
: _displayValueLabel(nullptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UIButtonTextOnly::~UIButtonTextOnly()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UIButtonTextOnly::init()
|
||||||
|
{
|
||||||
|
if (UIScene::init())
|
||||||
|
{
|
||||||
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
|
// Add a label in which the button events will be displayed
|
||||||
|
_displayValueLabel = Text::create("Text Only Button", "fonts/Marker Felt.ttf",32);
|
||||||
|
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||||
|
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
|
||||||
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
|
||||||
|
// Add the alert
|
||||||
|
Text* alert = Text::create("Button","fonts/Marker Felt.ttf",30);
|
||||||
|
alert->setColor(Color3B(159, 168, 176));
|
||||||
|
|
||||||
|
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||||
|
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
|
||||||
|
|
||||||
|
_uiLayer->addChild(alert);
|
||||||
|
|
||||||
|
// Create the button
|
||||||
|
auto button = Button::create();
|
||||||
|
button->setNormalizedPosition(Vec2(0.5, 0.5));
|
||||||
|
button->setTitleText("PLAY GAME");
|
||||||
|
button->setZoomScale(0.3);
|
||||||
|
button->setPressedActionEnabled(true);
|
||||||
|
button->addClickEventListener([this](Ref* sender) {
|
||||||
|
CCLOG("clicked!");
|
||||||
|
});
|
||||||
|
_uiLayer->addChild(button);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// UIButtonIgnoreContentSizeTest
|
||||||
|
UIButtonIgnoreContentSizeTest::UIButtonIgnoreContentSizeTest()
|
||||||
|
: _displayValueLabel(nullptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
UIButtonIgnoreContentSizeTest::~UIButtonIgnoreContentSizeTest()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool UIButtonIgnoreContentSizeTest::init()
|
||||||
|
{
|
||||||
|
if (UIScene::init())
|
||||||
|
{
|
||||||
|
Size widgetSize = _widget->getContentSize();
|
||||||
|
|
||||||
|
// Add a label in which the button events will be displayed
|
||||||
|
_displayValueLabel = Text::create("Button IgnoreContent Size Test", "fonts/Marker Felt.ttf",32);
|
||||||
|
_displayValueLabel->setAnchorPoint(Vec2(0.5f, -1.0f));
|
||||||
|
_displayValueLabel->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20));
|
||||||
|
_uiLayer->addChild(_displayValueLabel);
|
||||||
|
|
||||||
|
// Add the alert
|
||||||
|
Text* alert = Text::create("Button","fonts/Marker Felt.ttf",30);
|
||||||
|
alert->setColor(Color3B(159, 168, 176));
|
||||||
|
|
||||||
|
alert->setPosition(Vec2(widgetSize.width / 2.0f,
|
||||||
|
widgetSize.height / 2.0f - alert->getContentSize().height * 1.75f));
|
||||||
|
|
||||||
|
_uiLayer->addChild(alert);
|
||||||
|
|
||||||
|
// Create the button
|
||||||
|
auto button = Button::create("cocosui/animationbuttonnormal.png",
|
||||||
|
"cocosui/animationbuttonpressed.png");
|
||||||
|
button->ignoreContentAdaptWithSize(false);
|
||||||
|
button->setContentSize(Size(200,100));
|
||||||
|
button->setNormalizedPosition(Vec2(0.5, 0.5));
|
||||||
|
button->setTitleText("PLAY GAME");
|
||||||
|
button->setZoomScale(0.3);
|
||||||
|
button->setPressedActionEnabled(true);
|
||||||
|
button->addClickEventListener([this](Ref* sender) {
|
||||||
|
CCLOG("touched!");
|
||||||
|
});
|
||||||
|
_uiLayer->addChild(button);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,4 +118,27 @@ protected:
|
||||||
Text* _displayValueLabel;
|
Text* _displayValueLabel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class UIButtonTextOnly : public UIScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UIButtonTextOnly();
|
||||||
|
~UIButtonTextOnly();
|
||||||
|
bool init();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
UI_SCENE_CREATE_FUNC(UIButtonTextOnly)
|
||||||
|
Text* _displayValueLabel;
|
||||||
|
};
|
||||||
|
|
||||||
|
class UIButtonIgnoreContentSizeTest : public UIScene
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
UIButtonIgnoreContentSizeTest();
|
||||||
|
~UIButtonIgnoreContentSizeTest();
|
||||||
|
bool init();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
UI_SCENE_CREATE_FUNC(UIButtonIgnoreContentSizeTest)
|
||||||
|
Text* _displayValueLabel;
|
||||||
|
};
|
||||||
#endif /* defined(__TestCpp__UIButtonTest__) */
|
#endif /* defined(__TestCpp__UIButtonTest__) */
|
||||||
|
|
|
@ -39,6 +39,9 @@ static const char* s_testArray[] =
|
||||||
"UIButtonTest_RemoveSelf",
|
"UIButtonTest_RemoveSelf",
|
||||||
"UIButtonTestSwitchScale9",
|
"UIButtonTestSwitchScale9",
|
||||||
"UIButtonTestZoomScale",
|
"UIButtonTestZoomScale",
|
||||||
|
"UIButtonTextOnly",
|
||||||
|
"UIButtonIgnoreContentSizeTest",
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_TIZEN) || (CC_TARGET_PLATFORM == CC_PLATFORM_WP8)
|
||||||
"UIEditBoxTest",
|
"UIEditBoxTest",
|
||||||
#endif
|
#endif
|
||||||
|
@ -195,6 +198,11 @@ Scene *UISceneManager::currentUIScene()
|
||||||
return UIButtonTestSwitchScale9::sceneWithTitle(s_testArray[_currentUISceneId]);
|
return UIButtonTestSwitchScale9::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||||
case kUIButtonTestZoomScale:
|
case kUIButtonTestZoomScale:
|
||||||
return UIButtonTestZoomScale::sceneWithTitle(s_testArray[_currentUISceneId]);
|
return UIButtonTestZoomScale::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||||
|
case kUIButtonTextOnly:
|
||||||
|
return UIButtonTextOnly::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||||
|
case kUIButtonIgnoreContentSizeTest:
|
||||||
|
return UIButtonIgnoreContentSizeTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||||
|
|
||||||
case kUICheckBoxTest:
|
case kUICheckBoxTest:
|
||||||
return UICheckBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
return UICheckBoxTest::sceneWithTitle(s_testArray[_currentUISceneId]);
|
||||||
|
|
||||||
|
|
|
@ -38,6 +38,8 @@ enum
|
||||||
kUIButtonTest_RemoveSelf,
|
kUIButtonTest_RemoveSelf,
|
||||||
kUIButtonTestSwitchScale9,
|
kUIButtonTestSwitchScale9,
|
||||||
kUIButtonTestZoomScale,
|
kUIButtonTestZoomScale,
|
||||||
|
kUIButtonTextOnly,
|
||||||
|
kUIButtonIgnoreContentSizeTest,
|
||||||
kUIEditBoxTest,
|
kUIEditBoxTest,
|
||||||
kUICheckBoxTest,
|
kUICheckBoxTest,
|
||||||
kUISliderTest,
|
kUISliderTest,
|
||||||
|
|
|
@ -184,6 +184,7 @@
|
||||||
<ClCompile Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\DirectXBase.cpp" />
|
<ClCompile Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\DirectXBase.cpp" />
|
||||||
<ClCompile Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\EditBoxEvent.cpp" />
|
<ClCompile Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\EditBoxEvent.cpp" />
|
||||||
<ClCompile Include="..\..\Classes\BaseTest.cpp" />
|
<ClCompile Include="..\..\Classes\BaseTest.cpp" />
|
||||||
|
<ClCompile Include="..\..\Classes\BillBoardTest\BillBoardTest.cpp" />
|
||||||
<ClCompile Include="..\..\Classes\BugsTest\Bug-Child.cpp" />
|
<ClCompile Include="..\..\Classes\BugsTest\Bug-Child.cpp" />
|
||||||
<ClCompile Include="..\..\Classes\Camera3DTest\Camera3DTest.cpp" />
|
<ClCompile Include="..\..\Classes\Camera3DTest\Camera3DTest.cpp" />
|
||||||
<ClCompile Include="..\..\Classes\ChipmunkTest\ChipmunkTest.cpp" />
|
<ClCompile Include="..\..\Classes\ChipmunkTest\ChipmunkTest.cpp" />
|
||||||
|
@ -378,6 +379,7 @@
|
||||||
<ClInclude Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\DirectXHelper.h" />
|
<ClInclude Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\DirectXHelper.h" />
|
||||||
<ClInclude Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\EditBoxEvent.h" />
|
<ClInclude Include="..\..\..\..\cocos\platform\wp8-xaml\cpp\EditBoxEvent.h" />
|
||||||
<ClInclude Include="..\..\Classes\BaseTest.h" />
|
<ClInclude Include="..\..\Classes\BaseTest.h" />
|
||||||
|
<ClInclude Include="..\..\Classes\BillBoardTest\BillBoardTest.h" />
|
||||||
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\ConvexHull.h" />
|
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\ConvexHull.h" />
|
||||||
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\ConveyorBelt.h" />
|
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\ConveyorBelt.h" />
|
||||||
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\Mobile.h" />
|
<ClInclude Include="..\..\Classes\Box2DTestBed\Tests\Mobile.h" />
|
||||||
|
|
|
@ -322,6 +322,9 @@
|
||||||
<Filter Include="Classes\Camera3DTest">
|
<Filter Include="Classes\Camera3DTest">
|
||||||
<UniqueIdentifier>{d17dc00f-2b4d-46af-a1ff-c3f4d937d621}</UniqueIdentifier>
|
<UniqueIdentifier>{d17dc00f-2b4d-46af-a1ff-c3f4d937d621}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
<Filter Include="Classes\BillBoardTest">
|
||||||
|
<UniqueIdentifier>{4dadf399-3bf1-4d35-85d1-d8def766fe0f}</UniqueIdentifier>
|
||||||
|
</Filter>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\Classes\AppDelegate.cpp">
|
<ClCompile Include="..\..\Classes\AppDelegate.cpp">
|
||||||
|
@ -856,6 +859,9 @@
|
||||||
<Filter>Classes\Camera3DTest</Filter>
|
<Filter>Classes\Camera3DTest</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
<ClCompile Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.cpp" />
|
||||||
|
<ClCompile Include="..\..\Classes\BillBoardTest\BillBoardTest.cpp">
|
||||||
|
<Filter>Classes\BillBoardTest</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\Classes\AppDelegate.h">
|
<ClInclude Include="..\..\Classes\AppDelegate.h">
|
||||||
|
@ -1589,6 +1595,9 @@
|
||||||
<Filter>Classes\Camera3DTest</Filter>
|
<Filter>Classes\Camera3DTest</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.h" />
|
<ClInclude Include="..\..\Classes\UITest\CocoStudioGUITest\UIEditBoxTest.h" />
|
||||||
|
<ClInclude Include="..\..\Classes\BillBoardTest\BillBoardTest.h">
|
||||||
|
<Filter>Classes\BillBoardTest</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="..\..\..\..\external\curl\prebuilt\wp8\arm\libcurl.dll" />
|
<None Include="..\..\..\..\external\curl\prebuilt\wp8\arm\libcurl.dll" />
|
||||||
|
|
|
@ -311,27 +311,17 @@ local function ActionCardinalSpline()
|
||||||
|
|
||||||
kathia:setPosition(cc.p(size.width / 2, 50))
|
kathia:setPosition(cc.p(size.width / 2, 50))
|
||||||
kathia:runAction(seq2)
|
kathia:runAction(seq2)
|
||||||
--[[
|
|
||||||
local function drawCardinalSpline()
|
|
||||||
kmGLPushMatrix()
|
|
||||||
kmGLTranslatef(50, 50, 0)
|
|
||||||
cc.DrawPrimitives.drawCardinalSpline(array, 0, 100)
|
|
||||||
kmGLPopMatrix()
|
|
||||||
|
|
||||||
kmGLPushMatrix()
|
local drawNode1 = cc.DrawNode:create()
|
||||||
kmGLTranslatef(size.width / 2, 50, 0)
|
drawNode1:setPosition(50, 50)
|
||||||
cc.DrawPrimitives.drawCardinalSpline(array, 1, 100)
|
drawNode1:drawCardinalSpline(array, 0, 100, cc.c4f(0,0,1,1))
|
||||||
kmGLPopMatrix()
|
layer:addChild(drawNode1)
|
||||||
end
|
|
||||||
|
local drawNode2 = cc.DrawNode:create()
|
||||||
|
drawNode2:setPosition(size.width/2, 50)
|
||||||
|
drawNode2:drawCardinalSpline(array, 1, 100, cc.c4f(0,0,1,1))
|
||||||
|
layer:addChild(drawNode2)
|
||||||
|
|
||||||
array:retain()
|
|
||||||
local glNode = gl.glNodeCreate()
|
|
||||||
glNode:setContentSize(cc.size(size.width, size.height))
|
|
||||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
|
||||||
glNode:registerScriptDrawHandler(drawCardinalSpline)
|
|
||||||
layer:addChild(glNode,-10)
|
|
||||||
glNode:setPosition( size.width / 2, size.height / 2)
|
|
||||||
]]--
|
|
||||||
Helper.titleLabel:setString("CardinalSplineBy / CardinalSplineAt")
|
Helper.titleLabel:setString("CardinalSplineBy / CardinalSplineAt")
|
||||||
Helper.subtitleLabel:setString("Cardinal Spline paths.\nTesting different tensions for one array")
|
Helper.subtitleLabel:setString("Cardinal Spline paths.\nTesting different tensions for one array")
|
||||||
return layer
|
return layer
|
||||||
|
@ -374,25 +364,15 @@ local function ActionCatmullRom()
|
||||||
local reverse2 = action2:reverse()
|
local reverse2 = action2:reverse()
|
||||||
local seq2 = cc.Sequence:create(action2, reverse2)
|
local seq2 = cc.Sequence:create(action2, reverse2)
|
||||||
kathia:runAction(seq2)
|
kathia:runAction(seq2)
|
||||||
--[[
|
local drawNode1 = cc.DrawNode:create()
|
||||||
local function drawCatmullRom()
|
drawNode1:setPosition(50, 50)
|
||||||
kmGLPushMatrix()
|
drawNode1:drawCatmullRom(array, 50, cc.c4f(0,0,1,1))
|
||||||
kmGLTranslatef(50, 50, 0)
|
layer:addChild(drawNode1)
|
||||||
cc.DrawPrimitives.drawCatmullRom(array, 50)
|
|
||||||
kmGLPopMatrix()
|
|
||||||
|
|
||||||
cc.DrawPrimitives.drawCatmullRom(array2,50)
|
local drawNode2 = cc.DrawNode:create()
|
||||||
end
|
--drawNode2:setPosition(size.width/2, 50)
|
||||||
|
drawNode2:drawCatmullRom(array2, 50, cc.c4f(0,0,1,1))
|
||||||
array:retain()
|
layer:addChild(drawNode2)
|
||||||
array2:retain()
|
|
||||||
local glNode = gl.glNodeCreate()
|
|
||||||
glNode:setContentSize(cc.size(size.width, size.height))
|
|
||||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
|
||||||
glNode:registerScriptDrawHandler(drawCatmullRom)
|
|
||||||
layer:addChild(glNode,-10)
|
|
||||||
glNode:setPosition( size.width / 2, size.height / 2)
|
|
||||||
]]--
|
|
||||||
|
|
||||||
Helper.titleLabel:setString("CatmullRomBy / CatmullRomTo")
|
Helper.titleLabel:setString("CatmullRomBy / CatmullRomTo")
|
||||||
Helper.subtitleLabel:setString("Catmull Rom spline paths. Testing reverse too")
|
Helper.subtitleLabel:setString("Catmull Rom spline paths. Testing reverse too")
|
||||||
|
@ -966,20 +946,13 @@ local function ActionFollow()
|
||||||
|
|
||||||
layer:runAction(cc.Follow:create(grossini, cc.rect(0, 0, size.width * 2 - 100, size.height)))
|
layer:runAction(cc.Follow:create(grossini, cc.rect(0, 0, size.width * 2 - 100, size.height)))
|
||||||
|
|
||||||
local function draw()
|
local drawNode = cc.DrawNode:create()
|
||||||
local winSize = cc.Director:getInstance():getWinSize()
|
local winSize = cc.Director:getInstance():getWinSize()
|
||||||
local x = winSize.width * 2 - 100
|
local x = winSize.width * 2 - 100
|
||||||
local y = winSize.height
|
local y = winSize.height
|
||||||
local vertices = { cc.p(5, 5), cc.p(x - 5, 5), cc.p(x - 5,y - 5), cc.p(5,y - 5) }
|
local vertices = { cc.p(5, 5), cc.p(x - 5, 5), cc.p(x - 5,y - 5), cc.p(5,y - 5) }
|
||||||
cc.DrawPrimitives.drawPoly(vertices, 4, true)
|
drawNode:drawPoly(vertices, 4, true, cc.c4f(0,0,1,1))
|
||||||
end
|
layer:addChild(drawNode)
|
||||||
|
|
||||||
local glNode = gl.glNodeCreate()
|
|
||||||
glNode:setContentSize(cc.size(size.width, size.height))
|
|
||||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
|
||||||
glNode:registerScriptDrawHandler(draw)
|
|
||||||
layer:addChild(glNode,-10)
|
|
||||||
glNode:setPosition( size.width / 2, size.height / 2)
|
|
||||||
|
|
||||||
Helper.subtitleLabel:setString("Follow action")
|
Helper.subtitleLabel:setString("Follow action")
|
||||||
return layer
|
return layer
|
||||||
|
|
|
@ -175,9 +175,69 @@ local function drawPrimitivesMainLayer()
|
||||||
local draw = cc.DrawNode:create()
|
local draw = cc.DrawNode:create()
|
||||||
layer:addChild(draw, 10)
|
layer:addChild(draw, 10)
|
||||||
|
|
||||||
|
--draw 1 point
|
||||||
|
draw:drawPoint(cc.p(60,60), 4, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||||
|
|
||||||
|
--draw 4 small points
|
||||||
|
local fourpoints = { cc.p(60,60), cc.p(70,70), cc.p(60,70), cc.p(70,60) }
|
||||||
|
draw:drawPoints(fourpoints, 4, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||||
|
|
||||||
|
--draw a line
|
||||||
|
draw:drawLine(cc.p(0,0), cc.p(size.width, size.height), cc.c4f(0,1,0,1))
|
||||||
|
|
||||||
|
--draw a rectangle
|
||||||
|
draw:drawRect(cc.p(23,23), cc.p(7,7), cc.c4f(1,1,0,1))
|
||||||
|
|
||||||
|
--draw a solid polygon
|
||||||
|
local vertices3 = { cc.p(60,160), cc.p(70,190), cc.p(100,190), cc.p(90,160) }
|
||||||
|
draw:drawSolidPoly( vertices3, 4, cc.c4f(0,0,1,1) )
|
||||||
|
|
||||||
|
--draw a solid rectangle
|
||||||
|
draw:drawSolidRect(cc.p(10,10), cc.p(20,20), cc.c4f(1,1,0,1))
|
||||||
|
|
||||||
|
--draw a solid circle
|
||||||
|
draw:drawSolidCircle(cc.p(VisibleRect:center().x + 140 ,VisibleRect:center().y), 100, math.pi/2, 50, 1.0, 2.0, cc.c4f(1,0,0,0.2))
|
||||||
|
|
||||||
|
--draw open random color poly
|
||||||
|
local vertices = { cc.p(0,0), cc.p(50,50), cc.p(100,50), cc.p(100,100), cc.p(50,100) }
|
||||||
|
draw:drawPoly( vertices, 5, false, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||||
|
|
||||||
|
--draw closed random color poly
|
||||||
|
local vertices2 = { cc.p(30,130), cc.p(30,230), cc.p(50,200) }
|
||||||
|
draw:drawPoly( vertices2, 3, true, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||||
|
|
||||||
|
--draw two circle
|
||||||
|
draw:drawCircle(cc.p(VisibleRect:center().x + 140 ,VisibleRect:center().y), 110, math.pi/2, 50, true, 1.0, 2.0, cc.c4f(1.0, 0.0, 0.0, 0.5))
|
||||||
|
|
||||||
|
draw:drawCircle(cc.p(VisibleRect:center().x - 140 ,VisibleRect:center().y), 50, math.pi/2, 30, false, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||||
|
|
||||||
|
--draw some beziers
|
||||||
|
draw:drawQuadBezier(cc.p(size.width - 150, size.height - 150), cc.p(size.width - 70, size.height - 10), cc.p(size.width - 10, size.height - 10), 10, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
|
|
||||||
|
draw:drawQuadBezier(cc.p(0, size.height), cc.p(size.width/2, size.height/2), cc.p(size.width, size.height), 50, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
|
|
||||||
|
draw:drawCubicBezier(cc.p(VisibleRect:center()), cc.p(VisibleRect:center().x+30,VisibleRect:center().y+50), cc.p(VisibleRect:center().x+60,VisibleRect:center().y-50),VisibleRect:right(),100, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
|
|
||||||
|
--draw Cardinal spline and catmullrom
|
||||||
|
local array = {
|
||||||
|
cc.p(0, 0),
|
||||||
|
cc.p(size.width / 2 - 30, 0),
|
||||||
|
cc.p(size.width / 2 - 30, size.height - 80),
|
||||||
|
cc.p(0, size.height - 80),
|
||||||
|
cc.p(0, 0) }
|
||||||
|
draw:drawCardinalSpline(array, 0.5, 50, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
|
|
||||||
|
local array2 = {
|
||||||
|
cc.p(size.width / 2, 30),
|
||||||
|
cc.p(size.width - 80, 30),
|
||||||
|
cc.p(size.width - 80, size.height - 80),
|
||||||
|
cc.p(size.width / 2, size.height - 80),
|
||||||
|
cc.p(size.width / 2, 30) }
|
||||||
|
draw:drawCatmullRom(array2, 50, cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
|
|
||||||
--Draw 10 circles
|
--Draw 10 circles
|
||||||
for i=1, 10 do
|
for i=1, 10 do
|
||||||
draw:drawDot(cc.p(size.width/2, size.height/2), 10*(10-i), cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
draw:drawDot(cc.p(size.width/2, size.height/2), 10*(10-i), cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 0.5))
|
||||||
end
|
end
|
||||||
|
|
||||||
--Draw polygons
|
--Draw polygons
|
||||||
|
|
|
@ -543,6 +543,9 @@ local function TMXOrthoObjectsTest()
|
||||||
local s = map:getContentSize()
|
local s = map:getContentSize()
|
||||||
cclog("ContentSize: %f, %f", s.width,s.height)
|
cclog("ContentSize: %f, %f", s.width,s.height)
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
map:addChild(drawNode, 10)
|
||||||
|
|
||||||
--------cclog("---: Iterating over all the group objets")
|
--------cclog("---: Iterating over all the group objets")
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
local group = map:getObjectGroup("Object Group 1")
|
||||||
local objects = group:getObjects()
|
local objects = group:getObjects()
|
||||||
|
@ -558,29 +561,6 @@ local function TMXOrthoObjectsTest()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
--------cclog("object: %x", dict)
|
--------cclog("object: %x", dict)
|
||||||
end
|
|
||||||
|
|
||||||
--------cclog("---: Fetching 1 object by name")
|
|
||||||
-- local platform = group:objectNamed("platform")
|
|
||||||
--------cclog("platform: %x", platform)
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
local function draw()
|
|
||||||
|
|
||||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
|
||||||
|
|
||||||
local objects = group:getObjects()
|
|
||||||
local dict = nil
|
|
||||||
local i = 0
|
|
||||||
local len = table.getn(objects)
|
|
||||||
for i = 0, len-1, 1 do
|
|
||||||
dict = objects[i + 1]
|
|
||||||
|
|
||||||
if dict == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
local key = "x"
|
local key = "x"
|
||||||
local x = dict["x"]
|
local x = dict["x"]
|
||||||
|
@ -591,15 +571,20 @@ local function draw()
|
||||||
key = "height"
|
key = "height"
|
||||||
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||||
|
|
||||||
glLineWidth(3)
|
local color = cc.c4f(1,1,1,1)
|
||||||
|
drawNode:drawLine( cc.p(x, y), cc.p((x+width), y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x, y), cc.p((x+width), y) )
|
drawNode:drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)) )
|
drawNode:drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)) )
|
drawNode:drawLine( cc.p(x, (y+height)), cc.p(x, y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x, (y+height)), cc.p(x, y) )
|
|
||||||
|
|
||||||
glLineWidth(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------cclog("---: Fetching 1 object by name")
|
||||||
|
-- local platform = group:objectNamed("platform")
|
||||||
|
--------cclog("platform: %x", platform)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
@ -616,6 +601,9 @@ local function TMXIsoObjectsTest()
|
||||||
local s = map:getContentSize()
|
local s = map:getContentSize()
|
||||||
cclog("ContentSize: %f, %f", s.width,s.height)
|
cclog("ContentSize: %f, %f", s.width,s.height)
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
map:addChild(drawNode, 10)
|
||||||
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
local group = map:getObjectGroup("Object Group 1")
|
||||||
|
|
||||||
--UxMutableArray* objects = group:objects()
|
--UxMutableArray* objects = group:objects()
|
||||||
|
@ -624,51 +612,30 @@ local function TMXIsoObjectsTest()
|
||||||
local dict = nil
|
local dict = nil
|
||||||
local i = 0
|
local i = 0
|
||||||
local len = table.getn(objects)
|
local len = table.getn(objects)
|
||||||
for i = 0, len-1, 1 do
|
|
||||||
-- dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
|
||||||
|
|
||||||
-- if dict == nil then
|
|
||||||
-- break
|
|
||||||
-- end
|
|
||||||
--------cclog("object: %x", dict)
|
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
local function draw()
|
|
||||||
|
|
||||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
|
||||||
|
|
||||||
local objects = group:getObjects()
|
|
||||||
local dict = nil
|
|
||||||
local i = 0
|
|
||||||
local len = table.getn(objects)
|
|
||||||
for i = 0, len-1, 1 do
|
for i = 0, len-1, 1 do
|
||||||
dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
||||||
|
|
||||||
if dict == nil then
|
if dict == nil then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
|
--------cclog("object: %x", dict)
|
||||||
|
|
||||||
local key = "x"
|
local key = "x"
|
||||||
local x = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("x")):getNumber()
|
local x = dict["x"]
|
||||||
key = "y"
|
key = "y"
|
||||||
local y = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("y")):getNumber()
|
local y = dict["y"]--dynamic_cast<NSNumber*>(dict:objectForKey("y")):getNumber()
|
||||||
key = "width"
|
key = "width"
|
||||||
local width = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("width")):getNumber()
|
local width = dict["width"]--dynamic_cast<NSNumber*>(dict:objectForKey("width")):getNumber()
|
||||||
key = "height"
|
key = "height"
|
||||||
local height = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||||
|
|
||||||
glLineWidth(3)
|
local color = cc.c4f(1,1,1,1)
|
||||||
|
drawNode:drawLine( cc.p(x, y), cc.p((x+width), y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x,y), cc.p(x+width,y) )
|
drawNode:drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y), cc.p(x+width,y+height) )
|
drawNode:drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y+height), cc.p(x,y+height) )
|
drawNode:drawLine( cc.p(x, (y+height)), cc.p(x, y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x,y+height), cc.p(x,y) )
|
|
||||||
|
|
||||||
glLineWidth(1)
|
|
||||||
end
|
end
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
@ -264,12 +264,17 @@ function Atlas4.create()
|
||||||
Helper.initWithLayer(layer)
|
Helper.initWithLayer(layer)
|
||||||
Atlas4.layer = layer
|
Atlas4.layer = layer
|
||||||
|
|
||||||
|
local s = cc.Director:getInstance():getWinSize()
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
drawNode:drawLine( cc.p(0, s.height/2), cc.p(s.width, s.height/2), cc.c4f(1,1,1,1))
|
||||||
|
drawNode:drawLine( cc.p(s.width/2, 0), cc.p(s.width/2, s.height), cc.c4f(1,1,1,1))
|
||||||
|
layer:addChild(drawNode, -10)
|
||||||
|
|
||||||
-- Upper Label
|
-- Upper Label
|
||||||
local label = cc.LabelBMFont:create("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt")
|
local label = cc.LabelBMFont:create("Bitmap Font Atlas", "fonts/bitmapFontTest.fnt")
|
||||||
layer:addChild(label)
|
layer:addChild(label)
|
||||||
|
|
||||||
local s = cc.Director:getInstance():getWinSize()
|
|
||||||
|
|
||||||
label:setPosition( cc.p(s.width/2, s.height/2) )
|
label:setPosition( cc.p(s.width/2, s.height/2) )
|
||||||
label:setAnchorPoint( cc.p(0.5, 0.5) )
|
label:setAnchorPoint( cc.p(0.5, 0.5) )
|
||||||
|
|
||||||
|
@ -311,19 +316,11 @@ function Atlas4.create()
|
||||||
local lastChar = label2:getChildByTag(3)
|
local lastChar = label2:getChildByTag(3)
|
||||||
lastChar:runAction(rot_4ever:clone())
|
lastChar:runAction(rot_4ever:clone())
|
||||||
|
|
||||||
layer:registerScriptHandler(Atlas4.onNodeEvent)
|
|
||||||
|
|
||||||
Helper.titleLabel:setString("LabelBMFont")
|
Helper.titleLabel:setString("LabelBMFont")
|
||||||
Helper.subtitleLabel:setString( "Using fonts as cc.Sprite objects. Some characters should rotate.")
|
Helper.subtitleLabel:setString( "Using fonts as cc.Sprite objects. Some characters should rotate.")
|
||||||
return layer
|
return layer
|
||||||
end
|
end
|
||||||
|
|
||||||
function Atlas4.draw()
|
|
||||||
local s = cc.Director:getInstance():getWinSize()
|
|
||||||
cc.DrawPrimitives.drawLine( cc.p(0, s.height/2), cc.p(s.width, s.height/2) )
|
|
||||||
cc.DrawPrimitives.drawLine( cc.p(s.width/2, 0), cc.p(s.width/2, s.height) )
|
|
||||||
end
|
|
||||||
|
|
||||||
function Atlas4.step(dt)
|
function Atlas4.step(dt)
|
||||||
m_time = m_time + dt
|
m_time = m_time + dt
|
||||||
|
|
||||||
|
|
|
@ -120,11 +120,17 @@ function LabelFNTSpriteActions.create()
|
||||||
Helper.initWithLayer(layer)
|
Helper.initWithLayer(layer)
|
||||||
LabelFNTSpriteActions.layer = layer
|
LabelFNTSpriteActions.layer = layer
|
||||||
|
|
||||||
|
local s = cc.Director:getInstance():getWinSize()
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
drawNode:drawLine( cc.p(0, s.height/2), cc.p(s.width, s.height/2), cc.c4f(1,1,1,1))
|
||||||
|
drawNode:drawLine( cc.p(s.width/2, 0), cc.p(s.width/2, s.height), cc.c4f(1,1,1,1))
|
||||||
|
layer:addChild(drawNode, -10)
|
||||||
|
|
||||||
-- Upper Label
|
-- Upper Label
|
||||||
local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas")
|
local label = cc.Label:createWithBMFont("fonts/bitmapFontTest.fnt", "Bitmap Font Atlas")
|
||||||
layer:addChild(label)
|
layer:addChild(label)
|
||||||
|
|
||||||
local s = cc.Director:getInstance():getWinSize()
|
|
||||||
|
|
||||||
label:setPosition( cc.p(s.width/2, s.height/2) )
|
label:setPosition( cc.p(s.width/2, s.height/2) )
|
||||||
label:setAnchorPoint( cc.p(0.5, 0.5) )
|
label:setAnchorPoint( cc.p(0.5, 0.5) )
|
||||||
|
@ -174,12 +180,6 @@ function LabelFNTSpriteActions.create()
|
||||||
return layer
|
return layer
|
||||||
end
|
end
|
||||||
|
|
||||||
function LabelFNTSpriteActions.draw()
|
|
||||||
local s = cc.Director:getInstance():getWinSize()
|
|
||||||
cc.DrawPrimitives.drawLine( cc.p(0, s.height/2), cc.p(s.width, s.height/2) )
|
|
||||||
cc.DrawPrimitives.drawLine( cc.p(s.width/2, 0), cc.p(s.width/2, s.height) )
|
|
||||||
end
|
|
||||||
|
|
||||||
function LabelFNTSpriteActions.step(dt)
|
function LabelFNTSpriteActions.step(dt)
|
||||||
m_time = m_time + dt
|
m_time = m_time + dt
|
||||||
|
|
||||||
|
@ -1652,6 +1652,21 @@ function LabelTTFOldNew.create()
|
||||||
label1:setPosition(cc.p(s.width/2, delta * 2))
|
label1:setPosition(cc.p(s.width/2, delta * 2))
|
||||||
label1:setColor(cc.c3b(255, 0, 0))
|
label1:setColor(cc.c3b(255, 0, 0))
|
||||||
|
|
||||||
|
local labelSize = label1:getContentSize()
|
||||||
|
local origin = cc.Director:getInstance():getWinSize()
|
||||||
|
origin.width = origin.width / 2 - (labelSize.width / 2)
|
||||||
|
origin.height = origin.height / 2 - (labelSize.height / 2)
|
||||||
|
local vertices =
|
||||||
|
{
|
||||||
|
cc.p(origin.width, origin.height),
|
||||||
|
cc.p(labelSize.width + origin.width, origin.height),
|
||||||
|
cc.p(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
|
cc.p(origin.width, labelSize.height + origin.height),
|
||||||
|
}
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
drawNode:drawPoly(vertices, 4, true, cc.c4f(1,0,0,1))
|
||||||
|
layer:addChild(drawNode)
|
||||||
|
|
||||||
local ttfConfig = {}
|
local ttfConfig = {}
|
||||||
ttfConfig.fontFilePath = "fonts/arial.ttf"
|
ttfConfig.fontFilePath = "fonts/arial.ttf"
|
||||||
ttfConfig.fontSize = 24
|
ttfConfig.fontSize = 24
|
||||||
|
@ -1659,54 +1674,20 @@ function LabelTTFOldNew.create()
|
||||||
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
layer:addChild(label2, 0, kTagBitmapAtlas2)
|
||||||
label2:setPosition(cc.p(s.width/2, delta * 2))
|
label2:setPosition(cc.p(s.width/2, delta * 2))
|
||||||
|
|
||||||
local function onDraw(transform, transformUpdated)
|
labelSize = label2:getContentSize()
|
||||||
kmGLPushMatrix()
|
origin = cc.Director:getInstance():getWinSize()
|
||||||
kmGLLoadMatrix(transform)
|
origin.width = origin.width / 2 - (labelSize.width / 2)
|
||||||
|
origin.height = origin.height / 2 - (labelSize.height / 2)
|
||||||
local label1 = layer:getChildByTag(kTagBitmapAtlas1)
|
local vertices2 =
|
||||||
local labelSize = label1:getContentSize()
|
{
|
||||||
local origin = cc.Director:getInstance():getWinSize()
|
cc.p(origin.width, origin.height),
|
||||||
|
cc.p(labelSize.width + origin.width, origin.height),
|
||||||
origin.width = origin.width / 2 - (labelSize.width / 2)
|
cc.p(labelSize.width + origin.width, labelSize.height + origin.height),
|
||||||
origin.height = origin.height / 2 - (labelSize.height / 2)
|
cc.p(origin.width, labelSize.height + origin.height),
|
||||||
|
}
|
||||||
local vertices =
|
local drawNode2 = cc.DrawNode:create()
|
||||||
{
|
drawNode2:drawPoly(vertices2, 4, true, cc.c4f(1,1,1,1))
|
||||||
cc.p(origin.width, origin.height),
|
layer:addChild(drawNode2)
|
||||||
cc.p(labelSize.width + origin.width, origin.height),
|
|
||||||
cc.p(labelSize.width + origin.width, labelSize.height + origin.height),
|
|
||||||
cc.p(origin.width, labelSize.height + origin.height),
|
|
||||||
}
|
|
||||||
|
|
||||||
cc.DrawPrimitives.drawColor4B(255, 0, 0, 255)
|
|
||||||
cc.DrawPrimitives.drawPoly(vertices, 4, true)
|
|
||||||
|
|
||||||
local label2 = layer:getChildByTag(kTagBitmapAtlas2)
|
|
||||||
labelSize = label2:getContentSize()
|
|
||||||
origin = cc.Director:getInstance():getWinSize()
|
|
||||||
|
|
||||||
origin.width = origin.width / 2 - (labelSize.width / 2)
|
|
||||||
origin.height = origin.height / 2 - (labelSize.height / 2)
|
|
||||||
|
|
||||||
local vertices2 =
|
|
||||||
{
|
|
||||||
cc.p(origin.width, origin.height),
|
|
||||||
cc.p(labelSize.width + origin.width, origin.height),
|
|
||||||
cc.p(labelSize.width + origin.width, labelSize.height + origin.height),
|
|
||||||
cc.p(origin.width, labelSize.height + origin.height),
|
|
||||||
}
|
|
||||||
cc.DrawPrimitives.drawColor4B(255, 255, 255, 255)
|
|
||||||
cc.DrawPrimitives.drawPoly(vertices2, 4, true)
|
|
||||||
|
|
||||||
kmGLPopMatrix()
|
|
||||||
end
|
|
||||||
|
|
||||||
local glNode = gl.glNodeCreate()
|
|
||||||
glNode:setContentSize(cc.size(s.width, s.height))
|
|
||||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
|
||||||
glNode:setPosition( s.width / 2, s.height / 2)
|
|
||||||
glNode:registerScriptDrawHandler(onDraw)
|
|
||||||
layer:addChild(glNode,-10)
|
|
||||||
|
|
||||||
return layer
|
return layer
|
||||||
end
|
end
|
||||||
|
|
|
@ -626,6 +626,9 @@ local function TMXOrthoObjectsTest()
|
||||||
local s = map:getContentSize()
|
local s = map:getContentSize()
|
||||||
cclog("ContentSize: %f, %f", s.width,s.height)
|
cclog("ContentSize: %f, %f", s.width,s.height)
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
map:addChild(drawNode, 10)
|
||||||
|
|
||||||
--------cclog("---: Iterating over all the group objets")
|
--------cclog("---: Iterating over all the group objets")
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
local group = map:getObjectGroup("Object Group 1")
|
||||||
local objects = group:getObjects()
|
local objects = group:getObjects()
|
||||||
|
@ -641,29 +644,6 @@ local function TMXOrthoObjectsTest()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
--------cclog("object: %x", dict)
|
--------cclog("object: %x", dict)
|
||||||
end
|
|
||||||
|
|
||||||
--------cclog("---: Fetching 1 object by name")
|
|
||||||
-- local platform = group:objectNamed("platform")
|
|
||||||
--------cclog("platform: %x", platform)
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
local function draw()
|
|
||||||
|
|
||||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
|
||||||
|
|
||||||
local objects = group:getObjects()
|
|
||||||
local dict = nil
|
|
||||||
local i = 0
|
|
||||||
local len = table.getn(objects)
|
|
||||||
for i = 0, len-1, 1 do
|
|
||||||
dict = objects[i + 1]
|
|
||||||
|
|
||||||
if dict == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
local key = "x"
|
local key = "x"
|
||||||
local x = dict["x"]
|
local x = dict["x"]
|
||||||
|
@ -674,15 +654,18 @@ local function draw()
|
||||||
key = "height"
|
key = "height"
|
||||||
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
local height = dict["height"]--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||||
|
|
||||||
glLineWidth(3)
|
local color = cc.c4f(1,1,1,1)
|
||||||
|
drawNode:drawLine( cc.p(x, y), cc.p((x+width), y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x, y), cc.p((x+width), y) )
|
drawNode:drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)) )
|
drawNode:drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)) )
|
drawNode:drawLine( cc.p(x, (y+height)), cc.p(x, y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x, (y+height)), cc.p(x, y) )
|
|
||||||
|
|
||||||
glLineWidth(1)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--------cclog("---: Fetching 1 object by name")
|
||||||
|
-- local platform = group:objectNamed("platform")
|
||||||
|
--------cclog("platform: %x", platform)
|
||||||
|
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
@ -701,6 +684,9 @@ local function TMXIsoObjectsTest()
|
||||||
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
local group = map:getObjectGroup("Object Group 1")
|
||||||
|
|
||||||
|
local drawNode = cc.DrawNode:create()
|
||||||
|
map:addChild(drawNode, 10)
|
||||||
|
|
||||||
--UxMutableArray* objects = group:objects()
|
--UxMutableArray* objects = group:objects()
|
||||||
local objects = group:getObjects()
|
local objects = group:getObjects()
|
||||||
--UxMutableDictionary<std:string>* dict
|
--UxMutableDictionary<std:string>* dict
|
||||||
|
@ -714,25 +700,6 @@ local function TMXIsoObjectsTest()
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
--------cclog("object: %x", dict)
|
--------cclog("object: %x", dict)
|
||||||
end
|
|
||||||
return ret
|
|
||||||
end
|
|
||||||
|
|
||||||
local function draw()
|
|
||||||
|
|
||||||
local map = tolua.cast(getChildByTag(kTagTileMap), "cc.TMXTiledMap")
|
|
||||||
local group = map:getObjectGroup("Object Group 1")
|
|
||||||
|
|
||||||
local objects = group:getObjects()
|
|
||||||
local dict = nil
|
|
||||||
local i = 0
|
|
||||||
local len = table.getn(objects)
|
|
||||||
for i = 0, len-1, 1 do
|
|
||||||
dict = tolua.cast(objects[i + 1], "cc.Dictionary")
|
|
||||||
|
|
||||||
if dict == nil then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
|
|
||||||
local key = "x"
|
local key = "x"
|
||||||
local x = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("x")):getNumber()
|
local x = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("x")):getNumber()
|
||||||
|
@ -743,15 +710,13 @@ local function draw()
|
||||||
key = "height"
|
key = "height"
|
||||||
local height = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
local height = (tolua.cast(dict:objectForKey(key), "cc.String")):intValue()--dynamic_cast<NSNumber*>(dict:objectForKey("height")):getNumber()
|
||||||
|
|
||||||
glLineWidth(3)
|
local color = cc.c4f(1,1,1,1)
|
||||||
|
drawNode:drawLine( cc.p(x, y), cc.p((x+width), y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x,y), cc.p(x+width,y) )
|
drawNode:drawLine( cc.p((x+width), y), cc.p((x+width), (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y), cc.p(x+width,y+height) )
|
drawNode:drawLine( cc.p((x+width), (y+height)), cc.p(x, (y+height)), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x+width,y+height), cc.p(x,y+height) )
|
drawNode:drawLine( cc.p(x, (y+height)), cc.p(x, y), color)
|
||||||
cc.DrawPrimitives.drawLine( cc.p(x,y+height), cc.p(x,y) )
|
|
||||||
|
|
||||||
glLineWidth(1)
|
|
||||||
end
|
end
|
||||||
|
return ret
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
|
|
|
@ -43,7 +43,7 @@ skip = Node::[setGLServerState description getUserObject .*UserData getGLServerS
|
||||||
ParticleBatchNode::[getBlendFunc setBlendFunc],
|
ParticleBatchNode::[getBlendFunc setBlendFunc],
|
||||||
LayerColor::[getBlendFunc setBlendFunc],
|
LayerColor::[getBlendFunc setBlendFunc],
|
||||||
ParticleSystem::[(g|s)etBlendFunc updateQuadWithParticle initParticle],
|
ParticleSystem::[(g|s)etBlendFunc updateQuadWithParticle initParticle],
|
||||||
DrawNode::[getBlendFunc setBlendFunc drawPolygon listenBackToForeground],
|
DrawNode::[getBlendFunc setBlendFunc drawPolygon drawSolidPoly drawPoly drawCardinalSpline drawCatmullRom drawPoints listenBackToForeground],
|
||||||
Director::[getAccelerometer getProjection getFrustum getRenderer],
|
Director::[getAccelerometer getProjection getFrustum getRenderer],
|
||||||
Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased],
|
Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased],
|
||||||
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
|
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
|
||||||
|
|
Loading…
Reference in New Issue