Merge pull request #5101 from ricardoquesada/header_dependency_fixes

Header dependency fixes
This commit is contained in:
Ricardo Quesada 2014-01-16 21:37:40 -08:00
commit d6719470ad
108 changed files with 368 additions and 229 deletions

View File

@ -34,7 +34,7 @@ THE SOFTWARE.
#include "ccGLStateCache.h"
#include "CCDirector.h"
#include "TransformUtils.h"
#include "CCRenderer.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
// external

View File

@ -31,9 +31,10 @@
#include "CCShaderCache.h"
#include "CCDirector.h"
#include "CCDrawingPrimitives.h"
#include "CCRenderer.h"
#include "CCGroupCommand.h"
#include "CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN

View File

@ -31,13 +31,13 @@ THE SOFTWARE.
#include "CCDictionary.h"
#include "CCInteger.h"
#include "CCBool.h"
#include "cocos2d.h"
#include "platform/CCFileUtils.h"
using namespace std;
NS_CC_BEGIN
extern const char* cocos2dVersion();
Configuration* Configuration::s_sharedConfiguration = nullptr;

View File

@ -60,9 +60,10 @@ THE SOFTWARE.
#include "CCEventDispatcher.h"
#include "CCEventCustom.h"
#include "CCFontFreeType.h"
#include "CCRenderer.h"
#include "CCConsole.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCFrustum.h"
#include "CCConsole.h"
/**
Position of the FPS

View File

@ -26,9 +26,9 @@
#include "CCGL.h"
#include "CCEventType.h"
#include "CCConfiguration.h"
#include "CCCustomCommand.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "CCDirector.h"
#include "CCRenderer.h"
#include "CCEventListenerCustom.h"
#include "CCEventDispatcher.h"

View File

@ -28,7 +28,6 @@
#include <string>
#include "cocos2d.h"
#include "CCLabel.h"
NS_CC_BEGIN

View File

@ -22,10 +22,12 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "cocos2d.h"
#include "CCFontAtlas.h"
#include "CCFont.h"
#include "CCFontFreeType.h"
#include "ccUTF8.h"
#include "CCDirector.h"
#define PAGE_WIDTH 1024
#define PAGE_HEIGHT 1024

View File

@ -26,11 +26,14 @@
#define _CCFontAtlas_h_
#include <unordered_map>
#include "CCPlatformMacros.h"
#include "CCObject.h"
NS_CC_BEGIN
//fwd
class Font;
class Texture2D;
struct FontLetterDefinition
{

View File

@ -23,6 +23,8 @@
THE SOFTWARE.
****************************************************************************/
#include <sstream>
#include "CCFontAtlasCache.h"
#include "CCFontAtlasFactory.h"

View File

@ -29,8 +29,8 @@
#include <iostream>
#include <unordered_map>
#include "cocos2d.h"
#include "CCFontAtlas.h"
#include "CCLabel.h"
NS_CC_BEGIN

View File

@ -26,8 +26,8 @@
#ifndef _CCFontAtlasFactory_h_
#define _CCFontAtlasFactory_h_
#include "cocos2d.h"
#include "CCFontAtlas.h"
#include "CCLabel.h"
NS_CC_BEGIN

View File

@ -23,8 +23,9 @@
THE SOFTWARE.
****************************************************************************/
#include "cocos2d.h"
#include "CCFontDefinition.h"
#include "CCDirector.h"
NS_CC_BEGIN

View File

@ -25,6 +25,10 @@
#include "CCFontFNT.h"
#include "CCFontAtlas.h"
#include "CCLabelBMFont.h"
#include "CCDirector.h"
#include "CCTextureCache.h"
#include "ccUTF8.h"
NS_CC_BEGIN

View File

@ -26,11 +26,12 @@
#ifndef _CCFontFNT_h_
#define _CCFontFNT_h_
#include "cocos2d.h"
#include "CCFont.h"
NS_CC_BEGIN
class CCBMFontConfiguration;
class FontFNT : public Font
{

View File

@ -31,6 +31,7 @@ THE SOFTWARE.
#include "CCTextImage.h"
#include "CCFont.h"
#include "CCFontDefinition.h"
#include "platform/CCFileUtils.h"
NS_CC_BEGIN

View File

@ -27,6 +27,12 @@
#include "CCFontDefinition.h"
#include "CCFontAtlasCache.h"
#include "CCLabelTextFormatter.h"
#include "CCSprite.h"
#include "CCShaderCache.h"
#include "ccUTF8.h"
#include "CCSpriteFrame.h"
#include "CCDirector.h"
#include "renderer/CCRenderer.h"
#define DISTANCEFIELD_ATLAS_FONTSIZE 50

View File

@ -180,29 +180,29 @@ private:
virtual void updateColor() override;
//! used for optimization
Sprite *_reusedLetter;
std::vector<LetterInfo> _lettersInfo;
Sprite *_reusedLetter;
std::vector<LetterInfo> _lettersInfo;
float _commonLineHeight;
bool _lineBreakWithoutSpaces;
float _width;
TextHAlignment _alignment;
unsigned short int * _currentUTF16String;
unsigned short int * _originalUTF16String;
Size * _advances;
FontAtlas * _fontAtlas;
bool _isOpacityModifyRGB;
float _commonLineHeight;
bool _lineBreakWithoutSpaces;
float _width;
TextHAlignment _alignment;
unsigned short int * _currentUTF16String;
unsigned short int * _originalUTF16String;
Size * _advances;
FontAtlas * _fontAtlas;
bool _isOpacityModifyRGB;
bool _useDistanceField;
bool _useA8Shader;
int _fontSize;
bool _useDistanceField;
bool _useA8Shader;
int _fontSize;
LabelEffect _currLabelEffect;
Color3B _effectColor;
LabelEffect _currLabelEffect;
Color3B _effectColor;
GLuint _uniformEffectColor;
GLuint _uniformEffectColor;
CustomCommand _customCommand;
CustomCommand _customCommand;
};

View File

@ -25,11 +25,16 @@
#ifndef _CCLabelTextFormatProtocol_h_
#define _CCLabelTextFormatProtocol_h_
#include "CCFontAtlas.h"
#include <vector>
#include "CCFontAtlas.h"
#include "CCGeometry.h"
#include "ccTypes.h"
NS_CC_BEGIN
class Sprite;
struct LetterInfo
{
@ -46,13 +51,13 @@ public:
virtual ~LabelTextFormatProtocol() {}
virtual bool recordLetterInfo(const cocos2d::Point& point,unsigned short int theChar, int spriteIndex) = 0;
virtual bool recordLetterInfo(const Point& point,unsigned short int theChar, int spriteIndex) = 0;
virtual bool recordPlaceholderInfo(int spriteIndex) = 0;
virtual std::vector<LetterInfo> *getLettersInfo() = 0;
virtual float getLetterPosXLeft(int index) const = 0;
virtual float getLetterPosXRight(int index) const = 0;
// sprite related stuff
virtual cocos2d::Sprite *getLetter(int ID) = 0;
virtual Sprite *getLetter(int ID) = 0;
// font related stuff
virtual int getCommonLineHeight() const = 0;
@ -60,7 +65,7 @@ public:
virtual int getXOffsetForChar(unsigned short c) const = 0;
virtual int getYOffsetForChar(unsigned short c) const = 0;
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) const = 0;
virtual cocos2d::Rect getRectForChar(unsigned short c) const = 0;
virtual Rect getRectForChar(unsigned short c) const = 0;
// string related stuff
virtual int getStringNumLines() const = 0;
@ -68,7 +73,7 @@ public:
virtual unsigned short getCharAtStringPosition(int position) const = 0;
virtual unsigned short * getUTF8String() const = 0;
virtual void assignNewUTF8String(unsigned short *newString) = 0;
virtual TextHAlignment getTextAlignment() const = 0;
virtual TextHAlignment getTextAlignment() const = 0;
// label related stuff
virtual float getMaxLineWidth() const = 0;

View File

@ -25,9 +25,9 @@
#include <vector>
#include "cocos2d.h"
#include "ccUTF8.h"
#include "CCLabelTextFormatter.h"
#include "CCDirector.h"
using namespace std;

View File

@ -44,8 +44,8 @@ THE SOFTWARE.
#include "CCEventListenerAcceleration.h"
#include "platform/CCDevice.h"
#include "CCScene.h"
#include "CCCustomCommand.h"
#include "CCRenderer.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCRenderer.h"
NS_CC_BEGIN

View File

@ -31,8 +31,8 @@ THE SOFTWARE.
#include "ccMacros.h"
#include "CCDirector.h"
#include "CCVertex.h"
#include "CCCustomCommand.h"
#include "CCRenderer.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCRenderer.h"
NS_CC_BEGIN

View File

@ -25,9 +25,9 @@
#include "CCNodeGrid.h"
#include "CCGrid.h"
#include "CCGroupCommand.h"
#include "CCRenderer.h"
#include "CCCustomCommand.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN

View File

@ -44,7 +44,7 @@
#include "kazmath/GL/matrix.h"
#include "CCProfiling.h"
#include "renderer/CCQuadCommand.h"
#include "CCRenderer.h"
#include "renderer/CCRenderer.h"
NS_CC_BEGIN

View File

@ -38,9 +38,9 @@ THE SOFTWARE.
#include "TransformUtils.h"
#include "CCEventType.h"
#include "CCConfiguration.h"
#include "CCRenderer.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
#include "CCCustomCommand.h"
#include "renderer/CCCustomCommand.h"
// extern
#include "kazmath/GL/matrix.h"

View File

@ -33,8 +33,8 @@ THE SOFTWARE.
#include "CCDirector.h"
#include "TransformUtils.h"
#include "CCDrawingPrimitives.h"
#include "CCRenderer.h"
#include "CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCCustomCommand.h"
// extern
#include "kazmath/GL/matrix.h"

View File

@ -38,9 +38,9 @@ THE SOFTWARE.
#include "CCEventType.h"
#include "CCGrid.h"
#include "CCRenderer.h"
#include "CCGroupCommand.h"
#include "CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCCustomCommand.h"
// extern
#include "kazmath/GL/matrix.h"

View File

@ -45,9 +45,9 @@ THE SOFTWARE.
#include "CCAffineTransform.h"
#include "TransformUtils.h"
#include "CCProfiling.h"
#include "CCRenderer.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
#include "CCFrustum.h"
#include "renderer/CCFrustum.h"
// external
#include "kazmath/GL/matrix.h"

View File

@ -43,7 +43,7 @@ THE SOFTWARE.
#include "CCProfiling.h"
#include "CCLayer.h"
#include "CCScene.h"
#include "CCRenderer.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
// external
#include "kazmath/GL/matrix.h"

View File

@ -28,10 +28,10 @@
#include <vector>
#include <string>
#include "cocos2d.h"
#include "CCTextImage.h"
#include "CCFontFreeType.h"
#include "CCFont.h"
#include "ccUTF8.h"
NS_CC_BEGIN
@ -295,7 +295,7 @@ bool TextImage::createPageDefinitions(unsigned short int *inText, int imageWidth
return true;
}
int TextImage::getNumGlyphsFittingInSize(std::map<unsigned short int, GlyphDef> &glyphDefs, unsigned short int *strUTF8, Font *font, Size *constrainSize, int &outNewSize)
int TextImage::getNumGlyphsFittingInSize(std::unordered_map<unsigned short int, GlyphDef> &glyphDefs, unsigned short int *strUTF8, Font *font, Size *constrainSize, int &outNewSize)
{
if (!strUTF8)
return 0;

View File

@ -23,15 +23,19 @@
THE SOFTWARE.
****************************************************************************/
#ifndef _TextImage_h_
#define _TextImage_h_
#ifndef _CCTextImage_h_
#define _CCTextImage_h_
//#include "CCFont.h"
#include <vector>
#include <unordered_map>
#include "CCPlatformMacros.h"
#include "CCGeometry.h"
NS_CC_BEGIN
class Font;
class Texture2D;
/** @brief GlyphDef defines one single glyph (character) in a text image
*
@ -43,27 +47,33 @@ class CC_DLL GlyphDef
{
public:
GlyphDef() : _validGlyph(false) { /*do nothing*/ }
GlyphDef(unsigned short int letterUTF8, const Rect &rect) { _gliphRect = rect; _uTF16Letter = letterUTF8; }
GlyphDef() : _validGlyph(false) {}
GlyphDef(unsigned short int letterUTF8, const Rect &rect) {
_gliphRect = rect;
_uTF16Letter = letterUTF8;
}
void setUTF16Letter(unsigned short int letterUTF8) { _uTF16Letter = letterUTF8; }
void setRect(const Rect & theRect) { _gliphRect = theRect; }
unsigned short int getUTF8Letter() { return _uTF16Letter; }
const Rect & getRect() const { return _gliphRect; }
void setPadding(float padding) { _padding = padding; }
float getPadding() { return _padding; }
void setCommonHeight(float commonHeight) { _commonHeight = commonHeight; }
float getCommonHeight() { return _commonHeight; }
void setValid(bool isValid) { _validGlyph = isValid; }
bool isValid() { return _validGlyph; }
void setUTF16Letter(unsigned short int letterUTF8) { _uTF16Letter = letterUTF8; }
void setRect(const Rect & theRect) { _gliphRect = theRect; }
unsigned short int getUTF8Letter() const { return _uTF16Letter; }
const Rect& getRect() const { return _gliphRect; }
void setPadding(float padding) { _padding = padding; }
float getPadding() const { return _padding; }
void setCommonHeight(float commonHeight) { _commonHeight = commonHeight; }
float getCommonHeight() const { return _commonHeight; }
void setValid(bool isValid) { _validGlyph = isValid; }
bool isValid() const { return _validGlyph; }
private:
Rect _gliphRect;
unsigned short int _uTF16Letter;
float _padding;
float _commonHeight;
bool _validGlyph;
protected:
Rect _gliphRect;
unsigned short int _uTF16Letter;
float _padding;
float _commonHeight;
bool _validGlyph;
};
@ -78,23 +88,21 @@ public:
TextLineDef(float x, float y, float width, float height);
float getX() const { return _x; }
float getY() const { return _y; }
float getWidth() const { return _width; }
float getHeight() const { return _height; }
float getX() const { return _x; }
float getY() const { return _y; }
float getWidth() const { return _width; }
float getHeight() const { return _height; }
void addGlyph(GlyphDef theGlyph) { _glyphs.push_back(theGlyph); }
int getNumGlyph() const { return static_cast<int>(_glyphs.size()); }
const GlyphDef & getGlyphAt(int index) const { return _glyphs[index]; }
private:
float _x;
float _y;
float _width;
float _height;
std::vector<GlyphDef> _glyphs;
void addGlyph(GlyphDef theGlyph) { _glyphs.push_back(theGlyph); }
int getNumGlyph() const { return static_cast<int>(_glyphs.size()); }
const GlyphDef & getGlyphAt(int index) const { return _glyphs[index]; }
protected:
float _x;
float _y;
float _width;
float _height;
std::vector<GlyphDef> _glyphs;
};
/** @brief TextPageDef defines one text image page (a TextImage can have/use more than one page)
@ -115,28 +123,26 @@ public:
*/
~TextPageDef();
void addLine(TextLineDef *theLine) { _lines.push_back(theLine); }
int getNumLines() const { return static_cast<int>(_lines.size()); }
TextLineDef * getLineAt(int index) const { return _lines[index]; }
int getWidth() const { return _width; }
int getHeight() const { return _height; }
int getPageNumber() const { return _pageNum; }
void setPageData(unsigned char *data) { _pageData = data; }
const unsigned char * getPageData() const { return _pageData; }
Texture2D *getPageTexture();
void addLine(TextLineDef *theLine) { _lines.push_back(theLine); }
int getNumLines() const { return static_cast<int>(_lines.size()); }
TextLineDef * getLineAt(int index) const { return _lines[index]; }
int getWidth() const { return _width; }
int getHeight() const { return _height; }
int getPageNumber() const { return _pageNum; }
void setPageData(unsigned char *data) { _pageData = data; }
const unsigned char * getPageData() const { return _pageData; }
Texture2D *getPageTexture();
void preparePageTexture(bool releaseRAWData = true);
private:
protected:
bool generatePageTexture(bool releasePageData = false);
int _pageNum;
int _width;
int _height;
unsigned char * _pageData;
Texture2D * _pageTexture;
std::vector<TextLineDef *> _lines;
int _pageNum;
int _width;
int _height;
unsigned char * _pageData;
Texture2D* _pageTexture;
std::vector<TextLineDef*> _lines;
};
/** @brief CCTextFontPages collection of pages (TextPageDef)
@ -156,13 +162,12 @@ public:
*/
~TextFontPagesDef();
void addPage(TextPageDef *newPage) { _pages.push_back(newPage); }
int getNumPages() const { return static_cast<int>(_pages.size()); }
TextPageDef* getPageAt(int index) const { return _pages[index]; }
void addPage(TextPageDef *newPage) { _pages.push_back(newPage); }
int getNumPages() const { return static_cast<int>(_pages.size()); }
TextPageDef* getPageAt(int index) const { return _pages[index]; }
private:
std::vector<TextPageDef *> _pages;
protected:
std::vector<TextPageDef*> _pages;
};
@ -184,28 +189,27 @@ public:
bool initWithString(const char *text, int width, int height, Font* font, bool releaseRAWData = true);
TextFontPagesDef * getPages() const { return _fontPages; }
Font * getFont() const { return _font; }
private:
TextFontPagesDef* getPages() const { return _fontPages; }
Font* getFont() const { return _font; }
protected:
bool createImageDataFromPages(TextFontPagesDef *thePages, bool releaseRAWData = true);
bool addGlyphsToLine(TextLineDef *line, const char *lineText, bool textIsUTF16 = false);
bool generateTextGlyphs(const char * text);
int getNumGlyphsFittingInSize(std::map<unsigned short int, GlyphDef> &glyphDefs, unsigned short int *strUTF8, Font *font, Size *constrainSize, int &outNewSize);
int getNumGlyphsFittingInSize(std::unordered_map<unsigned short int, GlyphDef> &glyphDefs, unsigned short int *strUTF8, Font *font, Size *constrainSize, int &outNewSize);
bool createPageDefinitions(unsigned short int *inText, int imageWidth, int imageHeight, int lineHeight);
unsigned char * preparePageGlyphData(TextPageDef *thePage);
// glyph rendering
unsigned char * renderGlyphData(TextPageDef *thePage);
std::map<unsigned short int, GlyphDef> _textGlyphs;
TextFontPagesDef * _fontPages;
Font * _font;
std::unordered_map<unsigned short int, GlyphDef> _textGlyphs;
TextFontPagesDef* _fontPages;
Font* _font;
};
NS_CC_END
#endif
#endif // _CCTextImage_h_

View File

@ -624,11 +624,11 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start)
{
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
// option 1: subdata
//glBufferSubData(GL_ARRAY_BUFFER, sizeof(_quads[0])*start, sizeof(_quads[0]) * n , &_quads[start] );
// glBufferSubData(GL_ARRAY_BUFFER, sizeof(_quads[0])*start, sizeof(_quads[0]) * n , &_quads[start] );
// option 2: data
// glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW);
// glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW);
// option 3: orphaning + glMapBuffer
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (numberOfQuads-start), nullptr, GL_DYNAMIC_DRAW);
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);

View File

@ -38,7 +38,7 @@ varying vec2 v_texCoord; \n\
\n\
void main() \n\
{ \n\
gl_Position = CC_PMatrix * a_position; \n\
gl_Position = CC_PMatrix * a_position; \n\
v_fragmentColor = a_color; \n\
v_texCoord = a_texCoord; \n\
} \n\

View File

@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "cocos2d.h"
#include "CCPlatformMacros.h"
NS_CC_BEGIN

View File

@ -22,7 +22,7 @@
THE SOFTWARE.
****************************************************************************/
#include "CCCustomCommand.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN

View File

@ -22,7 +22,7 @@
THE SOFTWARE.
****************************************************************************/
#include "CCFrustum.h"
#include "renderer/CCFrustum.h"
#include "CCConsole.h"
#include <stdlib.h>

View File

@ -23,8 +23,8 @@
****************************************************************************/
#include "CCGroupCommand.h"
#include "CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCRenderer.h"
#include "CCDirector.h"
NS_CC_BEGIN

View File

@ -22,13 +22,13 @@
THE SOFTWARE.
****************************************************************************/
#include "CCRenderer.h"
#include "CCShaderCache.h"
#include "ccGLStateCache.h"
#include "CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCQuadCommand.h"
#include "renderer/CCBatchCommand.h"
#include "CCGroupCommand.h"
#include "renderer/CCCustomCommand.h"
#include "renderer/CCGroupCommand.h"
#include "CCShaderCache.h"
#include "ccGLStateCache.h"
#include "CCConfiguration.h"
#include "CCDirector.h"
#include "CCEventDispatcher.h"
@ -330,20 +330,24 @@ void Renderer::render()
void Renderer::convertToWorldCoordiantes(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const kmMat4& modelView)
{
// kmMat4 matrixP, mvp;
// kmGLGetMatrix(KM_GL_PROJECTION, &matrixP);
// kmMat4Multiply(&mvp, &matrixP, &modelView);
for(ssize_t i=0; i<quantity; ++i) {
V3F_C4B_T2F_Quad *q = &quads[i];
kmVec3 *vec1 = (kmVec3*)&q->bl.vertices;
kmVec3Transform(vec1, vec1, &modelView);
kmVec3TransformCoord(vec1, vec1, &modelView);
kmVec3 *vec2 = (kmVec3*)&q->br.vertices;
kmVec3Transform(vec2, vec2, &modelView);
kmVec3TransformCoord(vec2, vec2, &modelView);
kmVec3 *vec3 = (kmVec3*)&q->tr.vertices;
kmVec3Transform(vec3, vec3, &modelView);
kmVec3TransformCoord(vec3, vec3, &modelView);
kmVec3 *vec4 = (kmVec3*)&q->tl.vertices;
kmVec3Transform(vec4, vec4, &modelView);
kmVec3TransformCoord(vec4, vec4, &modelView);
}
}
@ -366,6 +370,13 @@ void Renderer::drawBatchedQuads()
//Set VBO data
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]);
// option 1: subdata
// glBufferSubData(GL_ARRAY_BUFFER, sizeof(_quads[0])*start, sizeof(_quads[0]) * n , &_quads[start] );
// option 2: data
// glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW);
// option 3: orphaning + glMapBuffer
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (_numQuads), nullptr, GL_DYNAMIC_DRAW);
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
memcpy(buf, _quads, sizeof(_quads[0])* (_numQuads));

View File

@ -1,7 +1,11 @@
#ifndef __CCB_CCBANIMATION_MANAGER_H__
#define __CCB_CCBANIMATION_MANAGER_H__
#include "cocos2d.h"
#include "CCMap.h"
#include "CCActionInterval.h"
#include "CCActionInstant.h"
#include "CCActionEase.h"
#include "extensions/ExtensionMacros.h"
#include "CCBSequence.h"
#include "CCBSequenceProperty.h"

View File

@ -1,7 +1,9 @@
#ifndef __CCB_KEYFRAME_H__
#define __CCB_KEYFRAME_H__
#include "cocos2d.h"
#include "CCObject.h"
#include "CCValue.h"
namespace cocosbuilder {

View File

@ -1,7 +1,6 @@
#ifndef _CCB_CCBMEMBERVARIABLEASSIGNER_H_
#define _CCB_CCBMEMBERVARIABLEASSIGNER_H_
#include "cocos2d.h"
namespace cocosbuilder {

View File

@ -1,7 +1,13 @@
#include "CCBReader.h"
#include <ctype.h>
#include <algorithm>
#include "CCDirector.h"
#include "platform/CCFileUtils.h"
#include "CCScene.h"
#include "CCTextureCache.h"
#include "CCSpriteFrameCache.h"
#include "CCBReader.h"
#include "CCNodeLoader.h"
#include "CCNodeLoaderLibrary.h"
#include "CCNodeLoaderListener.h"
@ -11,7 +17,7 @@
#include "CCBSequenceProperty.h"
#include "CCBKeyframe.h"
#include <ctype.h>
using namespace std;
using namespace cocos2d;

View File

@ -1,9 +1,12 @@
#ifndef _CCB_CCBREADER_H_
#define _CCB_CCBREADER_H_
#include "cocos2d.h"
#include <string>
#include <vector>
#include "CCNode.h"
#include "CCData.h"
#include "CCMap.h"
#include "CCBSequence.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"

View File

@ -1,7 +1,6 @@
#ifndef _CCB_CCBSELECTORRESOLVER_H_
#define _CCB_CCBSELECTORRESOLVER_H_
#include "cocos2d.h"
#include "extensions//GUI/CCControlExtension/CCInvocation.h"

View File

@ -2,7 +2,8 @@
#define __CCB_CCSEQUENCE_H__
#include <string>
#include "cocos2d.h"
#include "CCObject.h"
#include "CCBSequenceProperty.h"
namespace cocosbuilder {

View File

@ -1,7 +1,8 @@
#ifndef __CCB_SEQUENCE_PROPERTY_H__
#define __CCB_SEQUENCE_PROPERTY_H__
#include "cocos2d.h"
#include "CCObject.h"
#include "CCVector.h"
#include "CCBKeyframe.h"
namespace cocosbuilder {

View File

@ -1,6 +1,9 @@
#ifndef _CCB_CCLABELBMFONTLOADER_H_
#define _CCB_CCLABELBMFONTLOADER_H_
#include "CCObject.h"
#include "CCLabelBMFont.h"
#include "CCNodeLoader.h"
namespace cocosbuilder {

View File

@ -1,6 +1,9 @@
#ifndef _CCB_CCLABELTTFLOADER_H_
#define _CCB_CCLABELTTFLOADER_H_
#include "CCObject.h"
#include "CCLabelTTF.h"
#include "CCNodeLoader.h"
namespace cocosbuilder {

View File

@ -1,6 +1,9 @@
#ifndef _CCB_CCMENUITEMLOADER_H_
#define _CCB_CCMENUITEMLOADER_H_
#include "CCObject.h"
#include "CCMenuItem.h"
#include "CCLayerLoader.h"
namespace cocosbuilder {

View File

@ -2,6 +2,8 @@
#define _CCB_CCMENULOADER_H_
#include "CCLayerLoader.h"
#include "CCObject.h"
#include "CCMenu.h"
namespace cocosbuilder {

View File

@ -1,7 +1,6 @@
#ifndef __CCB_CCNODE_RELATIVEPOSITIONING_H__
#define __CCB_CCNODE_RELATIVEPOSITIONING_H__
#include "cocos2d.h"
#include "CCBReader.h"
namespace cocosbuilder {

View File

@ -1,9 +1,12 @@
#include "cocos2d.h"
#include "CCNodeLoader.h"
#include "CCBSelectorResolver.h"
#include "CCBMemberVariableAssigner.h"
#include "CCBAnimationManager.h"
#include "CCNode+CCBRelativePositioning.h"
using namespace std;
using namespace cocos2d;
using namespace cocos2d::extension;

View File

@ -2,7 +2,6 @@
#define _CCB_CCNODELOADER_H_
#include "extensions/GUI/CCControlExtension/CCInvocation.h"
#include "cocos2d.h"
#include "CCBReader.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"

View File

@ -1,7 +1,6 @@
#ifndef _CCB_CCNODELOADERLIBRARY_H_
#define _CCB_CCNODELOADERLIBRARY_H_
#include "cocos2d.h"
#include "CCBReader.h"
namespace cocosbuilder {

View File

@ -1,7 +1,6 @@
#ifndef _CCB_CCNODELOADERLISTENER_H_
#define _CCB_CCNODELOADERLISTENER_H_
#include "cocos2d.h"
namespace cocosbuilder {

View File

@ -1,6 +1,9 @@
#ifndef _CCB_CCPARTICLESYSTEMQUADLOADER_H_
#define _CCB_CCPARTICLESYSTEMQUADLOADER_H_
#include "CCObject.h"
#include "CCParticleSystemQuad.h"
#include "CCNodeLoader.h"
namespace cocosbuilder {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __ActionEaseEx_H__
#define __ActionEaseEx_H__
#include "cocos2d.h"
#include "cocostudio/CocoStudio.h"
namespace cocostudio {

View File

@ -25,7 +25,8 @@ THE SOFTWARE.
#ifndef __ActionFRAME_H__
#define __ActionFRAME_H__
#include "cocos2d.h"
#include "CCGeometry.h"
#include "CCActionInterval.h"
namespace cocostudio {

View File

@ -25,7 +25,7 @@ THE SOFTWARE.
#ifndef __ActionFrameEasing_H__
#define __ActionFrameEasing_H__
#include "cocos2d.h"
#include "CCObject.h"
namespace cocostudio {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __ActionMANAGER_H__
#define __ActionMANAGER_H__
#include "cocos2d.h"
#include "cocostudio/CCActionObject.h"
#include "cocostudio/DictionaryHelper.h"

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __ActionNODE_H__
#define __ActionNODE_H__
#include "cocos2d.h"
#include "cocostudio/CCActionFrame.h"
#include "cocostudio/DictionaryHelper.h"

View File

@ -25,6 +25,10 @@ THE SOFTWARE.
#include "cocostudio/CCActionObject.h"
#include "cocostudio/DictionaryHelper.h"
#include "CCDirector.h"
#include "CCScheduler.h"
#include "CCActionInstant.h"
using namespace cocos2d;
namespace cocostudio {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __ActionObject_H__
#define __ActionObject_H__
#include "cocos2d.h"
#include "CCActionNode.h"
#include "cocostudio/DictionaryHelper.h"

View File

@ -28,9 +28,12 @@ THE SOFTWARE.
#include "cocostudio/CCDataReaderHelper.h"
#include "cocostudio/CCDatas.h"
#include "cocostudio/CCSkin.h"
#include "renderer/CCQuadCommand.h"
#include "CCRenderer.h"
#include "CCGroupCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "CCShaderCache.h"
#include "CCDrawingPrimitives.h"
#if ENABLE_PHYSICS_BOX2D_DETECT
#include "Box2D/Box2D.h"
@ -570,7 +573,7 @@ void CCArmature::drawContour()
}
DrawPrimitives::drawPoly( points, (unsigned int)length, true );
delete points;
delete []points;
}
}
}

View File

@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCSpriteFrameCache.h"
#include "cocostudio/CCArmatureDataManager.h"
#include "cocostudio/CCTransformHelp.h"

View File

@ -26,8 +26,6 @@ THE SOFTWARE.
#define __CCARMATUREDEFINE_H__
#include "cocos2d.h"
#define VERSION_COMBINED 0.30f
#define VERSION_CHANGE_ROTATION_RANGE 1.0f
#define VERSION_COLOR_READING 1.1f

View File

@ -26,8 +26,11 @@ THE SOFTWARE.
#include "cocostudio/CCArmatureDefine.h"
#include "cocostudio/CCArmature.h"
#include "cocostudio/CCSkin.h"
#include "CCRenderer.h"
#include "CCGroupCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "CCShaderCache.h"
#include "CCDirector.h"
using namespace cocos2d;

View File

@ -25,6 +25,7 @@ THE SOFTWARE.
#ifndef __CCBATCHNODE_H__
#define __CCBATCHNODE_H__
#include "CCNode.h"
#include "cocostudio/CCArmatureDefine.h"
namespace cocos2d {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __CC_EXTENTIONS_CCCOMBASE_H__
#define __CC_EXTENTIONS_CCCOMBASE_H__
#include "cocos2d.h"
#include "ObjectFactory.h"
#include "DictionaryHelper.h"
#include <string>

View File

@ -22,7 +22,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "platform/CCFileUtils.h"
#include "CCDirector.h"
#include "CCScheduler.h"
#include "tinyxml2.h"
#include "cocostudio/CCDataReaderHelper.h"
#include "cocostudio/CCArmatureDataManager.h"
#include "cocostudio/CCTransformHelp.h"
@ -288,7 +293,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
std::string str = &filePathStr[startPos];
// Read content from file
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
std::string contentStr = FileUtils::getInstance()->getStringFromFile(fullPath);
DataInfo dataInfo;
@ -384,7 +389,7 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
size_t startPos = filePathStr.find_last_of(".");
std::string str = &filePathStr[startPos];
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath);
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
// XXX fileContent is being leaked
data->fileContent = FileUtils::getInstance()->getStringFromFile(fullPath);
@ -461,7 +466,7 @@ void DataReaderHelper::addDataAsyncCallBack(float dt)
if (0 == _asyncRefCount)
{
_asyncRefTotalCount = 0;
CCDirector::getInstance()->getScheduler()->unscheduleSelector(schedule_selector(DataReaderHelper::addDataAsyncCallBack), this);
Director::getInstance()->getScheduler()->unscheduleSelector(schedule_selector(DataReaderHelper::addDataAsyncCallBack), this);
}
}
}

View File

@ -25,6 +25,12 @@ THE SOFTWARE.
#ifndef __CCARMATURE_DATAS_H__
#define __CCARMATURE_DATAS_H__
#include "CCObject.h"
#include "ccTypes.h"
#include "CCVector.h"
#include "CCMap.h"
#include "CCAffineTransform.h"
#include "CCNode.h"
#include "cocostudio/CCArmatureDefine.h"
#include "cocostudio/CCTweenFunction.h"

View File

@ -30,6 +30,8 @@ THE SOFTWARE.
#include "cocostudio/CCArmatureDataManager.h"
#include "cocostudio/CCTransformHelp.h"
#include "CCParticleSystemQuad.h"
using namespace cocos2d;
namespace cocostudio {

View File

@ -28,6 +28,8 @@ THE SOFTWARE.
#include "cocostudio/CCUtilMath.h"
#include "cocostudio/CCSkin.h"
#include "CCParticleSystemQuad.h"
using namespace cocos2d;
namespace cocostudio {

View File

@ -23,6 +23,11 @@ THE SOFTWARE.
****************************************************************************/
#include "cocostudio/CCInputDelegate.h"
#include "CCDirector.h"
#include "CCDevice.h"
#include "CCEventListenerTouch.h"
#include "CCEventListenerAcceleration.h"
#include "CCEventListenerKeyboard.h"
using namespace cocos2d;

View File

@ -25,7 +25,12 @@ THE SOFTWARE.
#ifndef __CC_EXTENTIONS_CCINPUTDELEGATE_H__
#define __CC_EXTENTIONS_CCINPUTDELEGATE_H__
#include "cocos2d.h"
#include "CCPlatformMacros.h"
#include "CCTouch.h"
#include "CCEvent.h"
#include "ccTypes.h"
#include "CCEventKeyboard.h"
#include "CCEventListener.h"
namespace cocostudio {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __CCSSCENEREADER_H__
#define __CCSSCENEREADER_H__
#include "cocos2d.h"
#include "cocostudio/DictionaryHelper.h"

View File

@ -22,11 +22,17 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCSpriteFrame.h"
#include "CCSpriteFrameCache.h"
#include "CCDirector.h"
#include "renderer/CCRenderer.h"
#include "cocostudio/CCSkin.h"
#include "cocostudio/CCTransformHelp.h"
#include "cocostudio/CCSpriteFrameCacheHelper.h"
#include "cocostudio/CCArmature.h"
using namespace cocos2d;
namespace cocostudio {

View File

@ -25,9 +25,11 @@ THE SOFTWARE.
#ifndef __CCSKIN_H__
#define __CCSKIN_H__
#include "CCSprite.h"
#include "renderer/CCQuadCommand.h"
#include "cocostudio/CCArmatureDefine.h"
#include "cocostudio/CCBone.h"
#include "renderer/CCQuadCommand.h"
namespace cocostudio {

View File

@ -24,6 +24,8 @@ THE SOFTWARE.
#include "cocostudio/CCSpriteFrameCacheHelper.h"
#include "CCSpriteFrameCache.h"
using namespace cocos2d;
@ -49,7 +51,7 @@ void SpriteFrameCacheHelper::purge()
void SpriteFrameCacheHelper::addSpriteFrameFromFile(const std::string& plistPath, const std::string& imagePath)
{
CCSpriteFrameCache::getInstance()->addSpriteFramesWithFile(plistPath, imagePath);
SpriteFrameCache::getInstance()->addSpriteFramesWithFile(plistPath, imagePath);
}
SpriteFrameCacheHelper::SpriteFrameCacheHelper()

View File

@ -24,6 +24,7 @@ THE SOFTWARE.
#ifndef __CCSPRITEFRAMECACHEHELPER_H__
#define __CCSPRITEFRAMECACHEHELPER_H__
#include "CCPlatformMacros.h"
#include "cocostudio/CCArmatureDefine.h"
#include <stack>

View File

@ -25,6 +25,7 @@ THE SOFTWARE.
#ifndef __CCUTILMATH_H__
#define __CCUTILMATH_H__
#include "CCSprite.h"
#include "cocostudio/CCArmatureDefine.h"
#include <math.h>

View File

@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCPlatformMacros.h"
#include "cocostudio/DictionaryHelper.h"
namespace cocostudio {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __DICTIONARYHELPER_H__
#define __DICTIONARYHELPER_H__
#include "cocos2d.h"
#include "json/document.h"
#define DICTOOL DictionaryHelper::getInstance()

View File

@ -35,7 +35,11 @@
#define SPINE_CCSKELETON_H_
#include <spine/spine.h>
#include "cocos2d.h"
#include "CCNode.h"
#include "CCProtocols.h"
#include "CCTextureAtlas.h"
#include "renderer/CCCustomCommand.h"
namespace spine {

View File

@ -36,7 +36,6 @@
#include <spine/spine.h>
#include <spine/CCSkeleton.h>
#include "cocos2d.h"
namespace spine {

View File

@ -30,9 +30,9 @@ THE SOFTWARE.
#include "CCShaderCache.h"
#include "CCDirector.h"
#include "CCDrawingPrimitives.h"
#include "CCRenderer.h"
#include "CCGroupCommand.h"
#include "CCCustomCommand.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCCustomCommand.h"
NS_CC_BEGIN

View File

@ -25,10 +25,15 @@
****************************************************************************/
#include "HttpClient.h"
#include <thread>
#include <queue>
#include <errno.h>
#include "CCVector.h"
#include "CCDirector.h"
#include "CCScheduler.h"
#include "curl/curl.h"
#include "platform/CCFileUtils.h"

View File

@ -27,8 +27,6 @@
#ifndef __CCHTTPREQUEST_H__
#define __CCHTTPREQUEST_H__
#include "cocos2d.h"
#include "network/HttpRequest.h"
#include "network/HttpResponse.h"
#include "network/HttpClient.h"

View File

@ -26,7 +26,8 @@
#ifndef __HTTP_REQUEST_H__
#define __HTTP_REQUEST_H__
#include "cocos2d.h"
#include "CCPlatformMacros.h"
#include "CCObject.h"
NS_CC_BEGIN

View File

@ -26,7 +26,6 @@
#ifndef __HTTP_RESPONSE__
#define __HTTP_RESPONSE__
#include "cocos2d.h"
#include "network/HttpRequest.h"
NS_CC_BEGIN

View File

@ -300,29 +300,29 @@ protected:
virtual ~PhysicsBody();
protected:
Node* _node;
std::vector<PhysicsJoint*> _joints;
Vector<PhysicsShape*> _shapes;
PhysicsWorld* _world;
PhysicsBodyInfo* _info;
bool _dynamic;
bool _enable;
bool _rotationEnable;
bool _gravityEnable;
bool _massDefault;
bool _momentDefault;
float _mass;
float _area;
float _density;
float _moment;
float _linearDamping;
float _angularDamping;
int _tag;
Node* _node;
std::vector<PhysicsJoint*> _joints;
Vector<PhysicsShape*> _shapes;
PhysicsWorld* _world;
PhysicsBodyInfo* _info;
bool _dynamic;
bool _enable;
bool _rotationEnable;
bool _gravityEnable;
bool _massDefault;
bool _momentDefault;
float _mass;
float _area;
float _density;
float _moment;
float _linearDamping;
float _angularDamping;
int _tag;
int _categoryBitmask;
int _collisionBitmask;
int _contactTestBitmask;
int _group;
int _categoryBitmask;
int _collisionBitmask;
int _contactTestBitmask;
int _group;
friend class PhysicsWorld;
friend class PhysicsShape;

View File

@ -32,6 +32,8 @@ extern "C" {
}
#endif
#include <map>
#include <sstream>
#include "network/HttpClient.h"

View File

@ -31,12 +31,11 @@
#define __CCCONTROL_H__
#include "CCControlUtils.h"
#include "cocos2d.h"
#include "CCLayer.h"
NS_CC_EXT_BEGIN
class Invocation;
/**

View File

@ -33,6 +33,7 @@
#include "CCControl.h"
#include "CCInvocation.h"
#include "CCScale9Sprite.h"
#include "CCMap.h"
NS_CC_EXT_BEGIN

View File

@ -26,7 +26,6 @@
*/
#include "CCControlPotentiometer.h"
#include "cocos2d.h"
NS_CC_EXT_BEGIN

View File

@ -28,6 +28,7 @@
#define __CCCONTROLPOTENTIOMETER_H__
#include "CCControl.h"
#include "CCProgressTimer.h"
NS_CC_EXT_BEGIN

View File

@ -29,6 +29,7 @@
#define __CCCONTROLSTEPPER_H__
#include "CCControl.h"
#include "CCLabelTTF.h"
NS_CC_EXT_BEGIN

View File

@ -26,7 +26,12 @@
*/
#include "CCControlSwitch.h"
#include "cocos2d.h"
#include "CCSprite.h"
#include "CCActionTween.h"
#include "CClabelTTF.h"
#include "CCClippingNode.h"
#include "ccShaders.h"
#include "CCRenderTexture.h"
NS_CC_EXT_BEGIN
// ControlSwitchSprite

View File

@ -26,6 +26,9 @@ THE SOFTWARE.
****************************************************************************/
#include "CCScale9Sprite.h"
#include "CCPlatformMacros.h"
#include "CCSprite.h"
#include "CCSpriteFrameCache.h"
NS_CC_EXT_BEGIN

View File

@ -28,7 +28,10 @@ THE SOFTWARE.
#ifndef __CCScale9Sprite_H__
#define __CCScale9Sprite_H__
#include "cocos2d.h"
#include "CCNode.h"
#include "CCSpriteFrame.h"
#include "CCSpriteBatchNode.h"
#include "../../ExtensionMacros.h"
NS_CC_EXT_BEGIN

View File

@ -26,7 +26,7 @@
#ifndef __CCEDITTEXT_H__
#define __CCEDITTEXT_H__
#include "cocos2d.h"
#include "CCIMEDelegate.h"
#include "extensions/ExtensionMacros.h"
#include "../CCControlExtension/CCControlExtensions.h"

Some files were not shown because too many files have changed in this diff Show More