mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into test-rebase
This commit is contained in:
commit
9d040ff09c
|
@ -4,6 +4,7 @@ cocos2d-x-3.0final ?.? ?
|
||||||
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
[NEW] Console: added the 'textures', 'fileutils dump' and 'config' commands
|
||||||
[NEW] GLCache: glActiveTexture() is cached with GL::activeTexture(). All code MUST call the cached version in order to work correctly
|
[NEW] GLCache: glActiveTexture() is cached with GL::activeTexture(). All code MUST call the cached version in order to work correctly
|
||||||
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
[NEW] Label: Uses a struct of TTF configuration for Label::createWithTTF to reduce parameters and make this interface more easily to use.
|
||||||
|
[NEW] Label: Integrates LabelAtlas into new Label.
|
||||||
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
[NEW] Renderer: Added BatchCommand. This command is not "batchable" with other commands, but improves performance in about 10%
|
||||||
|
|
||||||
[FIX] CocoStudio: TestColliderDetector in ArmatureTest can't work.
|
[FIX] CocoStudio: TestColliderDetector in ArmatureTest can't work.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
88c095bbe123ab56df3f7870692c6631f4464c8d
|
e1e5a1169e92834330092c45165660c6cbd03609
|
|
@ -1 +1 @@
|
||||||
b6abaf935c97f8f1dc7a7179e54850928015b442
|
1fa58d8cba77ef923c83d2860d5511d28dad6c27
|
|
@ -47,6 +47,7 @@ CCEventListenerTouch.cpp \
|
||||||
CCEventMouse.cpp \
|
CCEventMouse.cpp \
|
||||||
CCEventTouch.cpp \
|
CCEventTouch.cpp \
|
||||||
CCFont.cpp \
|
CCFont.cpp \
|
||||||
|
CCFontCharMap.cpp \
|
||||||
CCFontAtlas.cpp \
|
CCFontAtlas.cpp \
|
||||||
CCFontAtlasCache.cpp \
|
CCFontAtlasCache.cpp \
|
||||||
CCFontAtlasFactory.cpp \
|
CCFontAtlasFactory.cpp \
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@
|
||||||
|
|
||||||
#include "CCFontFNT.h"
|
#include "CCFontFNT.h"
|
||||||
#include "CCFontFreeType.h"
|
#include "CCFontFreeType.h"
|
||||||
|
#include "CCFontCharMap.h"
|
||||||
#include "edtaa3func.h"
|
#include "edtaa3func.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -116,6 +117,21 @@ Font* Font::createWithFNT(const std::string& fntFilePath)
|
||||||
return FontFNT::create(fntFilePath);
|
return FontFNT::create(fntFilePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Font* Font::createWithCharMap(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
return FontCharMap::create(plistFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
Font* Font::createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
return FontCharMap::create(texture,itemWidth,itemHeight,startCharMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
Font* Font::createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
return FontCharMap::create(charMapFile,itemWidth,itemHeight,startCharMap);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned char * Font::makeDistanceMap( unsigned char *img, unsigned int width, unsigned int height)
|
unsigned char * Font::makeDistanceMap( unsigned char *img, unsigned int width, unsigned int height)
|
||||||
{
|
{
|
||||||
unsigned int pixelAmount = (width + 2 * DistanceMapSpread) * (height + 2 * DistanceMapSpread);
|
unsigned int pixelAmount = (width + 2 * DistanceMapSpread) * (height + 2 * DistanceMapSpread);
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "cocos2d.h"
|
|
||||||
#include "CCLabel.h"
|
#include "CCLabel.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -46,6 +45,10 @@ public:
|
||||||
static Font* createWithTTF(const std::string& fntName, int fontSize, GlyphCollection glyphs, const char *customGlyphs);
|
static Font* createWithTTF(const std::string& fntName, int fontSize, GlyphCollection glyphs, const char *customGlyphs);
|
||||||
static Font* createWithFNT(const std::string& fntFilePath);
|
static Font* createWithFNT(const std::string& fntFilePath);
|
||||||
|
|
||||||
|
static Font * createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static Font * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static Font * createWithCharMap(const std::string& plistFile);
|
||||||
|
|
||||||
static unsigned char * makeDistanceMap(unsigned char *img, unsigned int width, unsigned int height);
|
static unsigned char * makeDistanceMap(unsigned char *img, unsigned int width, unsigned int height);
|
||||||
void setDistanceFieldEnabled(bool distanceFieldEnabled);
|
void setDistanceFieldEnabled(bool distanceFieldEnabled);
|
||||||
bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;}
|
bool isDistanceFieldEnabled() const { return _distanceFieldEnabled;}
|
||||||
|
|
|
@ -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
|
||||||
|
@ -129,7 +131,6 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
|
|
||||||
FontLetterDefinition tempDef;
|
FontLetterDefinition tempDef;
|
||||||
tempDef.offsetX = 0;
|
|
||||||
tempDef.anchorX = 0.0f;
|
tempDef.anchorX = 0.0f;
|
||||||
tempDef.anchorY = 1.0f;
|
tempDef.anchorY = 1.0f;
|
||||||
|
|
||||||
|
@ -142,6 +143,7 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
|
||||||
tempDef.height = 0;
|
tempDef.height = 0;
|
||||||
tempDef.U = 0;
|
tempDef.U = 0;
|
||||||
tempDef.V = 0;
|
tempDef.V = 0;
|
||||||
|
tempDef.offsetX = 0;
|
||||||
tempDef.offsetY = 0;
|
tempDef.offsetY = 0;
|
||||||
tempDef.textureID = 0;
|
tempDef.textureID = 0;
|
||||||
}
|
}
|
||||||
|
@ -151,6 +153,7 @@ bool FontAtlas::prepareLetterDefinitions(unsigned short *utf16String)
|
||||||
tempDef.letteCharUTF16 = utf16String[i];
|
tempDef.letteCharUTF16 = utf16String[i];
|
||||||
tempDef.width = tempRect.size.width + _letterPadding;
|
tempDef.width = tempRect.size.width + _letterPadding;
|
||||||
tempDef.height = _currentPageLineHeight - 1;
|
tempDef.height = _currentPageLineHeight - 1;
|
||||||
|
tempDef.offsetX = tempRect.origin.x;
|
||||||
tempDef.offsetY = tempRect.origin.y;
|
tempDef.offsetY = tempRect.origin.y;
|
||||||
tempDef.commonLineHeight = _currentPageLineHeight;
|
tempDef.commonLineHeight = _currentPageLineHeight;
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,6 +23,8 @@
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
|
||||||
#include "CCFontAtlasCache.h"
|
#include "CCFontAtlasCache.h"
|
||||||
#include "CCFontAtlasFactory.h"
|
#include "CCFontAtlasFactory.h"
|
||||||
|
|
||||||
|
@ -69,6 +71,65 @@ FontAtlas * FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName)
|
||||||
return tempAtlas;
|
return tempAtlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
std::string atlasName = generateFontName(plistFile, 0, GlyphCollection::CUSTOM,false);
|
||||||
|
FontAtlas *tempAtlas = _atlasMap[atlasName];
|
||||||
|
|
||||||
|
if ( !tempAtlas )
|
||||||
|
{
|
||||||
|
tempAtlas = FontAtlasFactory::createAtlasFromCharMap(plistFile);
|
||||||
|
if (tempAtlas)
|
||||||
|
_atlasMap[atlasName] = tempAtlas;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempAtlas->retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
char tmp[30];
|
||||||
|
sprintf(tmp,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap);
|
||||||
|
std::string atlasName = generateFontName(tmp, 0, GlyphCollection::CUSTOM,false);
|
||||||
|
FontAtlas *tempAtlas = _atlasMap[atlasName];
|
||||||
|
|
||||||
|
if ( !tempAtlas )
|
||||||
|
{
|
||||||
|
tempAtlas = FontAtlasFactory::createAtlasFromCharMap(texture,itemWidth,itemHeight,startCharMap);
|
||||||
|
if (tempAtlas)
|
||||||
|
_atlasMap[atlasName] = tempAtlas;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempAtlas->retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
std::string atlasName = generateFontName(charMapFile, 0, GlyphCollection::CUSTOM,false);
|
||||||
|
FontAtlas *tempAtlas = _atlasMap[atlasName];
|
||||||
|
|
||||||
|
if ( !tempAtlas )
|
||||||
|
{
|
||||||
|
tempAtlas = FontAtlasFactory::createAtlasFromCharMap(charMapFile,itemWidth,itemHeight,startCharMap);
|
||||||
|
if (tempAtlas)
|
||||||
|
_atlasMap[atlasName] = tempAtlas;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tempAtlas->retain();
|
||||||
|
}
|
||||||
|
|
||||||
|
return tempAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
std::string FontAtlasCache::generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField)
|
std::string FontAtlasCache::generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField)
|
||||||
{
|
{
|
||||||
std::string tempName(fontFileName);
|
std::string tempName(fontFileName);
|
||||||
|
|
|
@ -29,23 +29,24 @@
|
||||||
#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
|
||||||
|
|
||||||
class CC_DLL FontAtlasCache
|
class CC_DLL FontAtlasCache
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static FontAtlas * getFontAtlasTTF(const std::string& fontFileName, int size, GlyphCollection glyphs, const char *customGlyphs = 0, bool useDistanceField = false);
|
static FontAtlas * getFontAtlasTTF(const std::string& fontFileName, int size, GlyphCollection glyphs, const char *customGlyphs = 0, bool useDistanceField = false);
|
||||||
static FontAtlas * getFontAtlasFNT(const std::string& fontFileName);
|
static FontAtlas * getFontAtlasFNT(const std::string& fontFileName);
|
||||||
|
|
||||||
|
static FontAtlas * getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontAtlas * getFontAtlasCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontAtlas * getFontAtlasCharMap(const std::string& plistFile);
|
||||||
|
|
||||||
static bool releaseFontAtlas(FontAtlas *atlas);
|
static bool releaseFontAtlas(FontAtlas *atlas);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
static std::string generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField);
|
static std::string generateFontName(const std::string& fontFileName, int size, GlyphCollection theGlyphs, bool useDistanceField);
|
||||||
static std::unordered_map<std::string, FontAtlas *> _atlasMap;
|
static std::unordered_map<std::string, FontAtlas *> _atlasMap;
|
||||||
};
|
};
|
||||||
|
|
|
@ -60,4 +60,46 @@ FontAtlas * FontAtlasFactory::createAtlasFromFNT(const std::string& fntFilePath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasFactory::createAtlasFromCharMap(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
Font *font = Font::createWithCharMap(plistFile);
|
||||||
|
|
||||||
|
if(font)
|
||||||
|
{
|
||||||
|
return font->createFontAtlas();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasFactory::createAtlasFromCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
Font *font = Font::createWithCharMap(texture,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if(font)
|
||||||
|
{
|
||||||
|
return font->createFontAtlas();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontAtlasFactory::createAtlasFromCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
Font *font = Font::createWithCharMap(charMapFile,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if(font)
|
||||||
|
{
|
||||||
|
return font->createFontAtlas();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -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
|
||||||
|
@ -40,6 +40,10 @@ public:
|
||||||
static FontAtlas * createAtlasFromTTF(const std::string& fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0, bool useDistanceField = false);
|
static FontAtlas * createAtlasFromTTF(const std::string& fntFilePath, int fontSize, GlyphCollection glyphs, const char *customGlyphs = 0, bool useDistanceField = false);
|
||||||
static FontAtlas * createAtlasFromFNT(const std::string& fntFilePath);
|
static FontAtlas * createAtlasFromFNT(const std::string& fntFilePath);
|
||||||
|
|
||||||
|
static FontAtlas * createAtlasFromCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontAtlas * createAtlasFromCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontAtlas * createAtlasFromCharMap(const std::string& plistFile);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,171 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2013 Zynga Inc.
|
||||||
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "CCFontCharMap.h"
|
||||||
|
#include "CCFontAtlas.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
FontCharMap * FontCharMap::create(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
std::string pathStr = FileUtils::getInstance()->fullPathForFilename(plistFile);
|
||||||
|
std::string relPathStr = pathStr.substr(0, pathStr.find_last_of("/"))+"/";
|
||||||
|
|
||||||
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr.c_str());
|
||||||
|
|
||||||
|
CCASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
|
||||||
|
|
||||||
|
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
||||||
|
|
||||||
|
unsigned int width = dict["itemWidth"].asInt() / CC_CONTENT_SCALE_FACTOR();
|
||||||
|
unsigned int height = dict["itemHeight"].asInt() / CC_CONTENT_SCALE_FACTOR();
|
||||||
|
unsigned int startChar = dict["firstChar"].asInt();
|
||||||
|
|
||||||
|
Texture2D *tempTexture = Director::getInstance()->getTextureCache()->addImage(textureFilename);
|
||||||
|
if (!tempTexture)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontCharMap *tempFont = new FontCharMap(tempTexture,width,height,startChar);
|
||||||
|
|
||||||
|
if (!tempFont)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
tempFont->autorelease();
|
||||||
|
return tempFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontCharMap* FontCharMap::create(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
Texture2D *tempTexture = Director::getInstance()->getTextureCache()->addImage(charMapFile);
|
||||||
|
|
||||||
|
if (!tempTexture)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontCharMap *tempFont = new FontCharMap(tempTexture,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if (!tempFont)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
tempFont->autorelease();
|
||||||
|
return tempFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontCharMap* FontCharMap::create(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
FontCharMap *tempFont = new FontCharMap(texture,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if (!tempFont)
|
||||||
|
{
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
tempFont->autorelease();
|
||||||
|
return tempFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontCharMap::~FontCharMap()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Size * FontCharMap::getAdvancesForTextUTF16(unsigned short *text, int &outNumLetters) const
|
||||||
|
{
|
||||||
|
if (!text)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
outNumLetters = cc_wcslen(text);
|
||||||
|
|
||||||
|
if (!outNumLetters)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
Size *sizes = new Size[outNumLetters];
|
||||||
|
if (!sizes)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int advance = _itemWidth * CC_CONTENT_SCALE_FACTOR();
|
||||||
|
for (int c = 0; c < outNumLetters; ++c)
|
||||||
|
{
|
||||||
|
sizes[c].width = advance;
|
||||||
|
}
|
||||||
|
|
||||||
|
return sizes;
|
||||||
|
}
|
||||||
|
|
||||||
|
Rect FontCharMap::getRectForChar(unsigned short theChar) const
|
||||||
|
{
|
||||||
|
return _charRect;
|
||||||
|
}
|
||||||
|
|
||||||
|
FontAtlas * FontCharMap::createFontAtlas()
|
||||||
|
{
|
||||||
|
FontAtlas *tempAtlas = new FontAtlas(*this);
|
||||||
|
if (!tempAtlas)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
Size s = _texture->getContentSize();
|
||||||
|
|
||||||
|
int itemsPerColumn = (int)(s.height / _itemHeight);
|
||||||
|
int itemsPerRow = (int)(s.width / _itemWidth);
|
||||||
|
|
||||||
|
tempAtlas->setCommonLineHeight(_itemHeight);
|
||||||
|
|
||||||
|
FontLetterDefinition tempDefinition;
|
||||||
|
tempDefinition.textureID = 0;
|
||||||
|
tempDefinition.anchorX = 0.5f;
|
||||||
|
tempDefinition.anchorY = 0.5f;
|
||||||
|
tempDefinition.offsetX = 0.0f;
|
||||||
|
tempDefinition.offsetY = 0.0f;
|
||||||
|
tempDefinition.validDefinition = true;
|
||||||
|
tempDefinition.width = _itemWidth;
|
||||||
|
tempDefinition.height = _itemHeight;
|
||||||
|
|
||||||
|
int charId = _mapStartChar;
|
||||||
|
float itemWidthInPixels = _itemWidth * CC_CONTENT_SCALE_FACTOR();
|
||||||
|
float itemHeightInPixels = _itemHeight * CC_CONTENT_SCALE_FACTOR();
|
||||||
|
for (int row = 0; row < itemsPerColumn; ++row)
|
||||||
|
{
|
||||||
|
for (int col = 0; col < itemsPerRow; ++col)
|
||||||
|
{
|
||||||
|
tempDefinition.letteCharUTF16 = charId;
|
||||||
|
|
||||||
|
tempDefinition.U = _itemWidth * col;
|
||||||
|
tempDefinition.V = _itemHeight * row;
|
||||||
|
|
||||||
|
tempAtlas->addLetterDefinition(tempDefinition);
|
||||||
|
charId++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tempAtlas->addTexture(*_texture,0);
|
||||||
|
|
||||||
|
return tempAtlas;
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_CC_END
|
|
@ -0,0 +1,70 @@
|
||||||
|
/****************************************************************************
|
||||||
|
Copyright (c) 2013 Zynga Inc.
|
||||||
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
||||||
|
|
||||||
|
http://www.cocos2d-x.org
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _CCFontCharMap_h_
|
||||||
|
#define _CCFontCharMap_h_
|
||||||
|
|
||||||
|
#include "cocos2d.h"
|
||||||
|
#include "CCFont.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
class FontCharMap : public Font
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static FontCharMap * create(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontCharMap * create(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static FontCharMap * create(const std::string& plistFile);
|
||||||
|
|
||||||
|
virtual Size* getAdvancesForTextUTF16(unsigned short *text, int &outNumLetters) const override;
|
||||||
|
virtual Rect getRectForChar(unsigned short theChar) const override;
|
||||||
|
virtual FontAtlas *createFontAtlas() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FontCharMap(Texture2D* texture,int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
:_texture(texture)
|
||||||
|
,_mapStartChar(startCharMap)
|
||||||
|
,_itemWidth(itemWidth)
|
||||||
|
,_itemHeight(itemHeight)
|
||||||
|
,_charRect(0,0,itemWidth,itemHeight)
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~FontCharMap();
|
||||||
|
|
||||||
|
private:
|
||||||
|
Texture2D* _texture;
|
||||||
|
int _mapStartChar;
|
||||||
|
int _itemWidth;
|
||||||
|
int _itemHeight;
|
||||||
|
|
||||||
|
Rect _charRect;
|
||||||
|
};
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
||||||
|
#endif /* defined(_CCFontCharMap_h_) */
|
|
@ -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
|
||||||
|
|
||||||
|
@ -221,7 +222,6 @@ FontAtlas * FontDefinitionTTF::createFontAtlas()
|
||||||
if ( item.second.validDefinition )
|
if ( item.second.validDefinition )
|
||||||
{
|
{
|
||||||
FontLetterDefinition tempDefinition = item.second;
|
FontLetterDefinition tempDefinition = item.second;
|
||||||
tempDefinition.offsetX = 0;
|
|
||||||
tempDefinition.anchorX = 0.0f;
|
tempDefinition.anchorX = 0.0f;
|
||||||
tempDefinition.anchorY = 1.0f;
|
tempDefinition.anchorY = 1.0f;
|
||||||
retAtlas->addLetterDefinition(tempDefinition);
|
retAtlas->addLetterDefinition(tempDefinition);
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -175,7 +176,7 @@ bool FontFreeType::getBBOXFotChar(unsigned short theChar, Rect &outRect) const
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// store result in the passed rectangle
|
// store result in the passed rectangle
|
||||||
outRect.origin.x = 0;
|
outRect.origin.x = _fontRef->glyph->metrics.horiBearingX >> 6;
|
||||||
outRect.origin.y = - (_fontRef->glyph->metrics.horiBearingY >> 6);
|
outRect.origin.y = - (_fontRef->glyph->metrics.horiBearingY >> 6);
|
||||||
outRect.size.width = (_fontRef->glyph->metrics.width >> 6);
|
outRect.size.width = (_fontRef->glyph->metrics.width >> 6);
|
||||||
outRect.size.height = (_fontRef->glyph->metrics.height >> 6);
|
outRect.size.height = (_fontRef->glyph->metrics.height >> 6);
|
||||||
|
@ -267,7 +268,7 @@ Size * FontFreeType::getAdvancesForTextUTF16(unsigned short *text, int &outNumLe
|
||||||
int advance = 0;
|
int advance = 0;
|
||||||
int kerning = 0;
|
int kerning = 0;
|
||||||
|
|
||||||
advance = getAdvanceForChar(text[c]) - getBearingXForChar(text[c]);
|
advance = getAdvanceForChar(text[c]);
|
||||||
|
|
||||||
if (c < (outNumLetters-1))
|
if (c < (outNumLetters-1))
|
||||||
kerning = getHorizontalKerningForChars(text[c], text[c+1]);
|
kerning = getHorizontalKerningForChars(text[c], text[c+1]);
|
||||||
|
@ -294,7 +295,7 @@ int FontFreeType::getAdvanceForChar(unsigned short theChar) const
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// get to the advance for this glyph
|
// get to the advance for this glyph
|
||||||
return (static_cast<int>(_fontRef->glyph->advance.x >> 6));
|
return (static_cast<int>(_fontRef->glyph->metrics.horiAdvance >> 6));
|
||||||
}
|
}
|
||||||
|
|
||||||
int FontFreeType::getBearingXForChar(unsigned short theChar) const
|
int FontFreeType::getBearingXForChar(unsigned short theChar) const
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
@ -92,6 +98,93 @@ Label* Label::createWithBMFont(const std::string& bmfontFilePath, const std::str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label* Label::createWithCharMap(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
Label *ret = new Label();
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (ret->setCharMap(plistFile))
|
||||||
|
{
|
||||||
|
ret->autorelease();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete ret;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label* Label::createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
Label *ret = new Label();
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (ret->setCharMap(texture,itemWidth,itemHeight,startCharMap))
|
||||||
|
{
|
||||||
|
ret->autorelease();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete ret;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label* Label::createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
Label *ret = new Label();
|
||||||
|
|
||||||
|
if (!ret)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
if (ret->setCharMap(charMapFile,itemWidth,itemHeight,startCharMap))
|
||||||
|
{
|
||||||
|
ret->autorelease();
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
delete ret;
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Label::setCharMap(const std::string& plistFile)
|
||||||
|
{
|
||||||
|
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(plistFile);
|
||||||
|
|
||||||
|
if (!newAtlas)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return initWithFontAtlas(newAtlas);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Label::setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(texture,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if (!newAtlas)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return initWithFontAtlas(newAtlas);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
|
||||||
|
{
|
||||||
|
FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(charMapFile,itemWidth,itemHeight,startCharMap);
|
||||||
|
|
||||||
|
if (!newAtlas)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return initWithFontAtlas(newAtlas);
|
||||||
|
}
|
||||||
|
|
||||||
Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,bool useA8Shader)
|
Label::Label(FontAtlas *atlas, TextHAlignment alignment, bool useDistanceField,bool useA8Shader)
|
||||||
: _reusedLetter(nullptr)
|
: _reusedLetter(nullptr)
|
||||||
, _commonLineHeight(0.0f)
|
, _commonLineHeight(0.0f)
|
||||||
|
|
|
@ -62,12 +62,12 @@ typedef struct _ttfConfig
|
||||||
const char *customGlyphs;
|
const char *customGlyphs;
|
||||||
bool distanceFieldEnabled;
|
bool distanceFieldEnabled;
|
||||||
|
|
||||||
_ttfConfig(const char* filePath,int fontSize = 36, const GlyphCollection& glyphs = GlyphCollection::NEHE,
|
_ttfConfig(const char* filePath,int size = 36, const GlyphCollection& glyphCollection = GlyphCollection::NEHE,
|
||||||
const char *customGlyphs = nullptr,bool useDistanceField = false)
|
const char *customGlyphCollection = nullptr,bool useDistanceField = false)
|
||||||
:fontFilePath(filePath)
|
:fontFilePath(filePath)
|
||||||
,fontSize(fontSize)
|
,fontSize(size)
|
||||||
,glyphs(glyphs)
|
,glyphs(glyphCollection)
|
||||||
,customGlyphs(customGlyphs)
|
,customGlyphs(customGlyphCollection)
|
||||||
,distanceFieldEnabled(useDistanceField)
|
,distanceFieldEnabled(useDistanceField)
|
||||||
{}
|
{}
|
||||||
}TTFConfig;
|
}TTFConfig;
|
||||||
|
@ -82,10 +82,18 @@ public:
|
||||||
|
|
||||||
static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment = TextHAlignment::CENTER, int lineWidth = 0);
|
static Label* createWithBMFont(const std::string& bmfontFilePath, const std::string& text,const TextHAlignment& alignment = TextHAlignment::CENTER, int lineWidth = 0);
|
||||||
|
|
||||||
|
static Label * createWithCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static Label * createWithCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
static Label * createWithCharMap(const std::string& plistFile);
|
||||||
|
|
||||||
bool setTTFConfig(const TTFConfig& ttfConfig);
|
bool setTTFConfig(const TTFConfig& ttfConfig);
|
||||||
|
|
||||||
bool setBMFontFilePath(const std::string& bmfontFilePath);
|
bool setBMFontFilePath(const std::string& bmfontFilePath);
|
||||||
|
|
||||||
|
bool setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
bool setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap);
|
||||||
|
bool setCharMap(const std::string& plistFile);
|
||||||
|
|
||||||
bool setString(const std::string& text, const TextHAlignment& alignment = TextHAlignment::CENTER, float lineWidth = -1, bool lineBreakWithoutSpaces = false);
|
bool setString(const std::string& text, const TextHAlignment& alignment = TextHAlignment::CENTER, float lineWidth = -1, bool lineBreakWithoutSpaces = false);
|
||||||
|
|
||||||
//only support for TTF
|
//only support for TTF
|
||||||
|
@ -172,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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -353,7 +353,7 @@ bool LabelTextFormatter::createStringSprites(LabelTextFormatProtocol *theLabel)
|
||||||
|
|
||||||
|
|
||||||
Point fontPos = Point((float)nextFontPositionX + charXOffset + charRect.size.width * 0.5f + kerningAmount,
|
Point fontPos = Point((float)nextFontPositionX + charXOffset + charRect.size.width * 0.5f + kerningAmount,
|
||||||
(float)nextFontPositionY + yOffset - charRect.size.height * 0.5f);
|
(float)nextFontPositionY + yOffset - charRect.size.height * 0.5f);
|
||||||
|
|
||||||
if( theLabel->recordLetterInfo(CC_POINT_PIXELS_TO_POINTS(fontPos),c,i) == false)
|
if( theLabel->recordLetterInfo(CC_POINT_PIXELS_TO_POINTS(fontPos),c,i) == false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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; }
|
|
||||||
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; }
|
|
||||||
|
|
||||||
private:
|
unsigned short int getUTF8Letter() const { return _uTF16Letter; }
|
||||||
|
const Rect& getRect() const { return _gliphRect; }
|
||||||
|
|
||||||
Rect _gliphRect;
|
void setPadding(float padding) { _padding = padding; }
|
||||||
unsigned short int _uTF16Letter;
|
float getPadding() const { return _padding; }
|
||||||
float _padding;
|
|
||||||
float _commonHeight;
|
void setCommonHeight(float commonHeight) { _commonHeight = commonHeight; }
|
||||||
bool _validGlyph;
|
float getCommonHeight() const { return _commonHeight; }
|
||||||
|
|
||||||
|
void setValid(bool isValid) { _validGlyph = isValid; }
|
||||||
|
bool isValid() const { return _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);
|
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_
|
||||||
|
|
|
@ -624,10 +624,10 @@ 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);
|
||||||
|
|
|
@ -71,6 +71,7 @@ set(COCOS2D_SRC
|
||||||
CCFontDefinition.cpp
|
CCFontDefinition.cpp
|
||||||
CCFontFNT.cpp
|
CCFontFNT.cpp
|
||||||
CCFontFreeType.cpp
|
CCFontFreeType.cpp
|
||||||
|
CCFontCharMap.cpp
|
||||||
CCLabel.cpp
|
CCLabel.cpp
|
||||||
CCLabelAtlas.cpp
|
CCLabelAtlas.cpp
|
||||||
CCLabelBMFont.cpp
|
CCLabelBMFont.cpp
|
||||||
|
|
|
@ -73,7 +73,7 @@ void ccArrayEnsureExtraCapacity(ccArray *arr, ssize_t extra)
|
||||||
{
|
{
|
||||||
while (arr->max < arr->num + extra)
|
while (arr->max < arr->num + extra)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: ccCArray: resizing ccArray capacity from [%d] to [%d].",
|
CCLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%d] to [%d].",
|
||||||
static_cast<int>(arr->max),
|
static_cast<int>(arr->max),
|
||||||
static_cast<int>(arr->max*2));
|
static_cast<int>(arr->max*2));
|
||||||
|
|
||||||
|
|
|
@ -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\
|
||||||
|
|
|
@ -279,7 +279,7 @@ cc_utf8_get_char (const char * p)
|
||||||
|
|
||||||
unsigned short* cc_utf8_to_utf16(const char* str_old, int length/* = -1 */, int* rUtf16Size/* = nullptr */)
|
unsigned short* cc_utf8_to_utf16(const char* str_old, int length/* = -1 */, int* rUtf16Size/* = nullptr */)
|
||||||
{
|
{
|
||||||
unsigned short len = cc_utf8_strlen(str_old, length);
|
long len = cc_utf8_strlen(str_old, length);
|
||||||
if (rUtf16Size != nullptr) {
|
if (rUtf16Size != nullptr) {
|
||||||
*rUtf16Size = len;
|
*rUtf16Size = len;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -248,6 +248,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClCompile Include="CCFontAtlas.cpp" />
|
<ClCompile Include="CCFontAtlas.cpp" />
|
||||||
<ClCompile Include="CCFontAtlasCache.cpp" />
|
<ClCompile Include="CCFontAtlasCache.cpp" />
|
||||||
<ClCompile Include="CCFontAtlasFactory.cpp" />
|
<ClCompile Include="CCFontAtlasFactory.cpp" />
|
||||||
|
<ClCompile Include="CCFontCharMap.cpp" />
|
||||||
<ClCompile Include="CCFontDefinition.cpp" />
|
<ClCompile Include="CCFontDefinition.cpp" />
|
||||||
<ClCompile Include="CCFontFNT.cpp" />
|
<ClCompile Include="CCFontFNT.cpp" />
|
||||||
<ClCompile Include="CCFontFreeType.cpp" />
|
<ClCompile Include="CCFontFreeType.cpp" />
|
||||||
|
@ -429,6 +430,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClInclude Include="CCFontAtlas.h" />
|
<ClInclude Include="CCFontAtlas.h" />
|
||||||
<ClInclude Include="CCFontAtlasCache.h" />
|
<ClInclude Include="CCFontAtlasCache.h" />
|
||||||
<ClInclude Include="CCFontAtlasFactory.h" />
|
<ClInclude Include="CCFontAtlasFactory.h" />
|
||||||
|
<ClInclude Include="CCFontCharMap.h" />
|
||||||
<ClInclude Include="CCFontDefinition.h" />
|
<ClInclude Include="CCFontDefinition.h" />
|
||||||
<ClInclude Include="CCFontFNT.h" />
|
<ClInclude Include="CCFontFNT.h" />
|
||||||
<ClInclude Include="CCFontFreeType.h" />
|
<ClInclude Include="CCFontFreeType.h" />
|
||||||
|
|
|
@ -601,6 +601,9 @@
|
||||||
<ClCompile Include="renderer\CCBatchCommand.cpp">
|
<ClCompile Include="renderer\CCBatchCommand.cpp">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="CCFontCharMap.cpp">
|
||||||
|
<Filter>label_nodes</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
<ClInclude Include="..\physics\CCPhysicsBody.h">
|
||||||
|
@ -1213,5 +1216,8 @@
|
||||||
<ClInclude Include="renderer\CCBatchCommand.h">
|
<ClInclude Include="renderer\CCBatchCommand.h">
|
||||||
<Filter>renderer</Filter>
|
<Filter>renderer</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="CCFontCharMap.h">
|
||||||
|
<Filter>label_nodes</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -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();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "CCCustomCommand.h"
|
#include "renderer/CCCustomCommand.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -40,11 +40,11 @@ public:
|
||||||
|
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
|
UNKNOWN_COMMAND,
|
||||||
QUAD_COMMAND,
|
QUAD_COMMAND,
|
||||||
CUSTOM_COMMAND,
|
CUSTOM_COMMAND,
|
||||||
BATCH_COMMAND,
|
BATCH_COMMAND,
|
||||||
GROUP_COMMAND,
|
GROUP_COMMAND,
|
||||||
UNKNOWN_COMMAND,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual int64_t generateID() = 0;
|
virtual int64_t generateID() = 0;
|
||||||
|
|
|
@ -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"
|
||||||
|
@ -177,12 +177,15 @@ void Renderer::mapBuffers()
|
||||||
|
|
||||||
void Renderer::addCommand(RenderCommand* command)
|
void Renderer::addCommand(RenderCommand* command)
|
||||||
{
|
{
|
||||||
command->generateID();
|
int renderQueue =_commandGroupStack.top();
|
||||||
_renderGroups[_commandGroupStack.top()].push_back(command);
|
addCommand(command, renderQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Renderer::addCommand(RenderCommand* command, int renderQueue)
|
void Renderer::addCommand(RenderCommand* command, int renderQueue)
|
||||||
{
|
{
|
||||||
|
CCASSERT(renderQueue >=0, "Invalid render queue");
|
||||||
|
CCASSERT(command->getType() != RenderCommand::Type::UNKNOWN_COMMAND, "Invalid Command Type");
|
||||||
|
|
||||||
command->generateID();
|
command->generateID();
|
||||||
_renderGroups[renderQueue].push_back(command);
|
_renderGroups[renderQueue].push_back(command);
|
||||||
}
|
}
|
||||||
|
@ -290,6 +293,7 @@ void Renderer::render()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
CCASSERT(true, "Invalid command");
|
||||||
flush();
|
flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -330,6 +334,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 +374,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));
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
||||||
{
|
{
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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()
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue