Merge branch 'develop' into develop_nutty_modify_framework_addlayoutparameterclone

This commit is contained in:
CaiWenzhi 2014-01-17 14:12:19 +08:00
commit 58ed383c01
110 changed files with 370 additions and 227 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -27,6 +27,12 @@
#include "CCFontDefinition.h" #include "CCFontDefinition.h"
#include "CCFontAtlasCache.h" #include "CCFontAtlasCache.h"
#include "CCLabelTextFormatter.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 #define DISTANCEFIELD_ATLAS_FONTSIZE 50

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,10 +28,10 @@
#include <vector> #include <vector>
#include <string> #include <string>
#include "cocos2d.h"
#include "CCTextImage.h" #include "CCTextImage.h"
#include "CCFontFreeType.h" #include "CCFontFreeType.h"
#include "CCFont.h" #include "CCFont.h"
#include "ccUTF8.h"
NS_CC_BEGIN NS_CC_BEGIN
@ -295,7 +295,7 @@ bool TextImage::createPageDefinitions(unsigned short int *inText, int imageWidth
return true; 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) if (!strUTF8)
return 0; return 0;

View File

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

View File

@ -38,7 +38,7 @@ varying vec2 v_texCoord; \n\
\n\ \n\
void main() \n\ void main() \n\
{ \n\ { \n\
gl_Position = CC_PMatrix * a_position; \n\ gl_Position = CC_PMatrix * a_position; \n\
v_fragmentColor = a_color; \n\ v_fragmentColor = a_color; \n\
v_texCoord = a_texCoord; \n\ v_texCoord = a_texCoord; \n\
} \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. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "cocos2d.h" #include "CCPlatformMacros.h"
NS_CC_BEGIN NS_CC_BEGIN

View File

@ -459,7 +459,7 @@ bool Image::initWithString(
{ {
bool bRet = false; bool bRet = false;
do do
{ {
CC_BREAK_IF(! pText); CC_BREAK_IF(! pText);
BitmapDC &dc = sharedBitmapDC(); BitmapDC &dc = sharedBitmapDC();

View File

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

View File

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

View File

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

View File

@ -22,13 +22,13 @@
THE SOFTWARE. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCRenderer.h" #include "renderer/CCRenderer.h"
#include "CCShaderCache.h"
#include "ccGLStateCache.h"
#include "CCCustomCommand.h"
#include "renderer/CCQuadCommand.h" #include "renderer/CCQuadCommand.h"
#include "renderer/CCBatchCommand.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 "CCConfiguration.h"
#include "CCDirector.h" #include "CCDirector.h"
#include "CCEventDispatcher.h" #include "CCEventDispatcher.h"
@ -330,6 +330,10 @@ void Renderer::render()
void Renderer::convertToWorldCoordiantes(V3F_C4B_T2F_Quad* quads, ssize_t quantity, const kmMat4& modelView) 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) { for(ssize_t i=0; i<quantity; ++i) {
V3F_C4B_T2F_Quad *q = &quads[i]; V3F_C4B_T2F_Quad *q = &quads[i];
@ -366,6 +370,13 @@ void Renderer::drawBatchedQuads()
//Set VBO data //Set VBO data
glBindBuffer(GL_ARRAY_BUFFER, _buffersVBO[0]); 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); glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (_numQuads), nullptr, GL_DYNAMIC_DRAW);
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY); void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
memcpy(buf, _quads, sizeof(_quads[0])* (_numQuads)); memcpy(buf, _quads, sizeof(_quads[0])* (_numQuads));
@ -454,4 +465,4 @@ void Renderer::flush()
_lastMaterialID = 0; _lastMaterialID = 0;
} }
NS_CC_END NS_CC_END

View File

@ -1,7 +1,11 @@
#ifndef __CCB_CCBANIMATION_MANAGER_H__ #ifndef __CCB_CCBANIMATION_MANAGER_H__
#define __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 "extensions/ExtensionMacros.h"
#include "CCBSequence.h" #include "CCBSequence.h"
#include "CCBSequenceProperty.h" #include "CCBSequenceProperty.h"

View File

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

View File

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

View File

@ -1,7 +1,13 @@
#include "CCBReader.h" #include <ctype.h>
#include <algorithm> #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 "CCNodeLoader.h"
#include "CCNodeLoaderLibrary.h" #include "CCNodeLoaderLibrary.h"
#include "CCNodeLoaderListener.h" #include "CCNodeLoaderListener.h"
@ -11,7 +17,7 @@
#include "CCBSequenceProperty.h" #include "CCBSequenceProperty.h"
#include "CCBKeyframe.h" #include "CCBKeyframe.h"
#include <ctype.h>
using namespace std; using namespace std;
using namespace cocos2d; using namespace cocos2d;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -28,9 +28,12 @@ THE SOFTWARE.
#include "cocostudio/CCDataReaderHelper.h" #include "cocostudio/CCDataReaderHelper.h"
#include "cocostudio/CCDatas.h" #include "cocostudio/CCDatas.h"
#include "cocostudio/CCSkin.h" #include "cocostudio/CCSkin.h"
#include "renderer/CCQuadCommand.h" #include "renderer/CCQuadCommand.h"
#include "CCRenderer.h" #include "renderer/CCRenderer.h"
#include "CCGroupCommand.h" #include "renderer/CCGroupCommand.h"
#include "CCShaderCache.h"
#include "CCDrawingPrimitives.h"
#if ENABLE_PHYSICS_BOX2D_DETECT #if ENABLE_PHYSICS_BOX2D_DETECT
#include "Box2D/Box2D.h" #include "Box2D/Box2D.h"
@ -570,7 +573,7 @@ void CCArmature::drawContour()
} }
DrawPrimitives::drawPoly( points, (unsigned int)length, true ); 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. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCSpriteFrameCache.h"
#include "cocostudio/CCArmatureDataManager.h" #include "cocostudio/CCArmatureDataManager.h"
#include "cocostudio/CCTransformHelp.h" #include "cocostudio/CCTransformHelp.h"

View File

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

View File

@ -26,8 +26,11 @@ THE SOFTWARE.
#include "cocostudio/CCArmatureDefine.h" #include "cocostudio/CCArmatureDefine.h"
#include "cocostudio/CCArmature.h" #include "cocostudio/CCArmature.h"
#include "cocostudio/CCSkin.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; using namespace cocos2d;

View File

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

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __CC_EXTENTIONS_CCCOMBASE_H__ #ifndef __CC_EXTENTIONS_CCCOMBASE_H__
#define __CC_EXTENTIONS_CCCOMBASE_H__ #define __CC_EXTENTIONS_CCCOMBASE_H__
#include "cocos2d.h"
#include "ObjectFactory.h" #include "ObjectFactory.h"
#include "DictionaryHelper.h" #include "DictionaryHelper.h"
#include <string> #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. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "platform/CCFileUtils.h"
#include "CCDirector.h"
#include "CCScheduler.h"
#include "tinyxml2.h" #include "tinyxml2.h"
#include "cocostudio/CCDataReaderHelper.h" #include "cocostudio/CCDataReaderHelper.h"
#include "cocostudio/CCArmatureDataManager.h" #include "cocostudio/CCArmatureDataManager.h"
#include "cocostudio/CCTransformHelp.h" #include "cocostudio/CCTransformHelp.h"
@ -288,7 +293,7 @@ void DataReaderHelper::addDataFromFile(const std::string& filePath)
std::string str = &filePathStr[startPos]; std::string str = &filePathStr[startPos];
// Read content from file // 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); std::string contentStr = FileUtils::getInstance()->getStringFromFile(fullPath);
DataInfo dataInfo; DataInfo dataInfo;
@ -384,7 +389,7 @@ void DataReaderHelper::addDataFromFileAsync(const std::string& imagePath, const
size_t startPos = filePathStr.find_last_of("."); size_t startPos = filePathStr.find_last_of(".");
std::string str = &filePathStr[startPos]; std::string str = &filePathStr[startPos];
std::string fullPath = CCFileUtils::getInstance()->fullPathForFilename(filePath); std::string fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
// XXX fileContent is being leaked // XXX fileContent is being leaked
data->fileContent = FileUtils::getInstance()->getStringFromFile(fullPath); data->fileContent = FileUtils::getInstance()->getStringFromFile(fullPath);
@ -461,7 +466,7 @@ void DataReaderHelper::addDataAsyncCallBack(float dt)
if (0 == _asyncRefCount) if (0 == _asyncRefCount)
{ {
_asyncRefTotalCount = 0; _asyncRefTotalCount = 0;
CCDirector::getInstance()->getScheduler()->unscheduleSelector(schedule_selector(DataReaderHelper::addDataAsyncCallBack), this); Director::getInstance()->getScheduler()->unscheduleSelector(schedule_selector(DataReaderHelper::addDataAsyncCallBack), this);
} }
} }
} }

View File

@ -35,6 +35,7 @@ THE SOFTWARE.
#include <list> #include <list>
#include <mutex> #include <mutex>
#include <thread> #include <thread>
#include <condition_variable>
namespace tinyxml2 namespace tinyxml2
{ {

View File

@ -25,6 +25,12 @@ THE SOFTWARE.
#ifndef __CCARMATURE_DATAS_H__ #ifndef __CCARMATURE_DATAS_H__
#define __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/CCArmatureDefine.h"
#include "cocostudio/CCTweenFunction.h" #include "cocostudio/CCTweenFunction.h"

View File

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

View File

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

View File

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

View File

@ -25,7 +25,12 @@ THE SOFTWARE.
#ifndef __CC_EXTENTIONS_CCINPUTDELEGATE_H__ #ifndef __CC_EXTENTIONS_CCINPUTDELEGATE_H__
#define __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 { namespace cocostudio {

View File

@ -25,7 +25,6 @@ THE SOFTWARE.
#ifndef __CCSSCENEREADER_H__ #ifndef __CCSSCENEREADER_H__
#define __CCSSCENEREADER_H__ #define __CCSSCENEREADER_H__
#include "cocos2d.h"
#include "cocostudio/DictionaryHelper.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. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCSpriteFrame.h"
#include "CCSpriteFrameCache.h"
#include "CCDirector.h"
#include "renderer/CCRenderer.h"
#include "cocostudio/CCSkin.h" #include "cocostudio/CCSkin.h"
#include "cocostudio/CCTransformHelp.h" #include "cocostudio/CCTransformHelp.h"
#include "cocostudio/CCSpriteFrameCacheHelper.h" #include "cocostudio/CCSpriteFrameCacheHelper.h"
#include "cocostudio/CCArmature.h" #include "cocostudio/CCArmature.h"
using namespace cocos2d; using namespace cocos2d;
namespace cocostudio { namespace cocostudio {

View File

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

View File

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

View File

@ -24,8 +24,10 @@ THE SOFTWARE.
#ifndef __CCSPRITEFRAMECACHEHELPER_H__ #ifndef __CCSPRITEFRAMECACHEHELPER_H__
#define __CCSPRITEFRAMECACHEHELPER_H__ #define __CCSPRITEFRAMECACHEHELPER_H__
#include "CCPlatformMacros.h"
#include "cocostudio/CCArmatureDefine.h" #include "cocostudio/CCArmatureDefine.h"
#include <stack> #include <stack>
#include <string>
namespace cocostudio { namespace cocostudio {

View File

@ -25,6 +25,7 @@ THE SOFTWARE.
#ifndef __CCUTILMATH_H__ #ifndef __CCUTILMATH_H__
#define __CCUTILMATH_H__ #define __CCUTILMATH_H__
#include "CCSprite.h"
#include "cocostudio/CCArmatureDefine.h" #include "cocostudio/CCArmatureDefine.h"
#include <math.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. THE SOFTWARE.
****************************************************************************/ ****************************************************************************/
#include "CCPlatformMacros.h"
#include "cocostudio/DictionaryHelper.h" #include "cocostudio/DictionaryHelper.h"
namespace cocostudio { namespace cocostudio {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -26,7 +26,12 @@
*/ */
#include "CCControlSwitch.h" #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 NS_CC_EXT_BEGIN
// ControlSwitchSprite // ControlSwitchSprite

View File

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

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