Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
d8382c1
Adds Configuration::getInfoAsMap() (#19381)
gestern Feb 13, 2019
9011e84
[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json au…
CocosRobot Feb 13, 2019
378e3cd
Checking, does the touch is within the height of the line, not the he…
kasandko Feb 14, 2019
17704df
If path to file is tool long crash is possible. (#19383)
sbrednikhin Feb 14, 2019
2675f1d
Font atlas texture initialization delayed (#19384)
sbrednikhin Feb 14, 2019
4db6353
fix header path include style (#19395)
Feb 14, 2019
fa3ab72
Fix memory leak if invoking Texture2D::setAlphaTexture many times. (#…
dumganhar Feb 18, 2019
d9a3493
need to generate binding codes for all targets (#19424)
drelaptop Feb 22, 2019
0e996a9
remove unneeded codes (#19421)
Feb 25, 2019
d7212ea
refine travis, don't generate binding codes for cpp only target (#19430)
drelaptop Feb 25, 2019
eda0c24
[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json au…
CocosRobot Feb 26, 2019
0c57689
Lua: add manual bindings for EventDispatcher::addCustomEventListener …
turgenevivan Feb 27, 2019
6b2f160
[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json au…
CocosRobot Feb 27, 2019
9483182
fix the member parameter:_percent is always be 0 during the update pr…
EricDDK Feb 27, 2019
d3e6727
Method to check if any IME dispatcher is active. (#19451)
sbrednikhin Mar 1, 2019
f0f732c
[Android] fix FileUtils::listFiles with path 'assets/' (#19457)
PatriceJiang Mar 4, 2019
80c6a69
Getting current clearing color in Renderer
sbrednikhin Mar 15, 2019
7634d12
Merge pull request #19518 from sbrednikhin/patch-1
Mar 18, 2019
7dbd0d5
Tabs to spaces
sbrednikhin Mar 18, 2019
e5fa917
Tabs to spaces
sbrednikhin Mar 18, 2019
66dbafe
Methods of changing clearing color
sbrednikhin Mar 18, 2019
9caa7b2
Getting clearing color from Director interface
sbrednikhin Mar 18, 2019
b9ff3dd
Ability to change title position
gestern Mar 19, 2019
b16292a
Merge pull request #19520 from sbrednikhin/v3
Mar 19, 2019
d8787b4
[ci skip][AUTO]: updating luabinding & jsbinding & cocos_file.json au…
CocosRobot Mar 19, 2019
a19fae8
Merge pull request #19525 from CocosRobot/update_lua_bindings_1552959478
Mar 19, 2019
a3a536e
Merge pull request #19524 from gestern/patch-1
Mar 19, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ matrix:
sudo: required
# android ndk-build
- os: linux
env: BUILD_TARGET=android_ndk-build
env: BUILD_TARGET=android_cpp_ndk-build
language: android
sudo: required
# android_lua ndk-build
Expand All @@ -35,7 +35,7 @@ matrix:
sudo: required
# android cmake
- os: linux
env: BUILD_TARGET=android_cmake
env: BUILD_TARGET=android_cpp_cmake
language: android
sudo: required
# android_lua cmake
Expand All @@ -61,12 +61,12 @@ matrix:
osx_image: xcode9.3
sudo: required
- os: linux
env: BUILD_TARGET=android_cocos_new_test
env: BUILD_TARGET=android_cocos_new_cpp_test
language: android
sudo: required
- os: linux
dist: xenial
env: BUILD_TARGET=linux_cocos_new_test
env: BUILD_TARGET=linux_cocos_new_lua_test
language: cpp
sudo: required

Expand Down
8 changes: 4 additions & 4 deletions build/cocos2d_libs.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -13718,7 +13718,7 @@
1551A34D158F2AB200E66CFE /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_EXTENSION = a;
Expand Down Expand Up @@ -13759,7 +13759,7 @@
1551A34E158F2AB200E66CFE /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
EXECUTABLE_EXTENSION = a;
Expand Down Expand Up @@ -13872,7 +13872,7 @@
A07A4D621783777C0073F6A7 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
ENABLE_BITCODE = NO;
EXECUTABLE_PREFIX = "";
Expand Down Expand Up @@ -13909,7 +13909,7 @@
A07A4D631783777C0073F6A7 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ENABLE_OBJC_WEAK = YES;
ENABLE_BITCODE = NO;
EXECUTABLE_PREFIX = "";
Expand Down
6 changes: 4 additions & 2 deletions build/cocos2d_tests.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7520,6 +7520,7 @@
1A0EE41118CDF775004CD58F /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test";
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
Expand All @@ -7540,6 +7541,7 @@
1A0EE41218CDF775004CD58F /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_APPICON_NAME = "AppIcon-cpp-empty-test";
CODE_SIGN_IDENTITY = "iPhone Developer";
ENABLE_BITCODE = NO;
Expand Down Expand Up @@ -8250,7 +8252,7 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
Expand Down Expand Up @@ -8281,7 +8283,7 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = YES;
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
Expand Down
7 changes: 4 additions & 3 deletions cocos/2d/CCFontAtlas.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ FontAtlas::FontAtlas(Font &theFont)
{
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
}

reinit();

#if CC_ENABLE_CACHE_TEXTURE_DATA
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
Expand Down Expand Up @@ -343,7 +341,10 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
{
return false;
}


if (!_currentPageData)
reinit();

std::unordered_map<unsigned int, unsigned int> codeMapOfNewChar;
findNewCharacters(utf32Text, codeMapOfNewChar);
if (codeMapOfNewChar.empty())
Expand Down
43 changes: 21 additions & 22 deletions cocos/2d/CCFontAtlasCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
NS_CC_BEGIN

std::unordered_map<std::string, FontAtlas *> FontAtlasCache::_atlasMap;
#define ATLAS_MAP_KEY_BUFFER 255
#define ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE 255

void FontAtlasCache::purgeCachedData()
{
Expand All @@ -60,15 +60,11 @@ FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config)
useDistanceField = false;
}

char tmp[ATLAS_MAP_KEY_BUFFER];
if (useDistanceField) {
snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "df %.2f %d %s", config->fontSize, config->outlineSize,
realFontFilename.c_str());
} else {
snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %d %s", config->fontSize, config->outlineSize,
realFontFilename.c_str());
}
std::string atlasName = tmp;
std::string key;
char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE];
snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, useDistanceField ? "df %.2f %d " : "%.2f %d ", config->fontSize, config->outlineSize);
std::string atlasName(keyPrefix);
atlasName += realFontFilename;

auto it = _atlasMap.find(atlasName);

Expand All @@ -95,9 +91,10 @@ FontAtlas* FontAtlasCache::getFontAtlasTTF(const _ttfConfig* config)
FontAtlas* FontAtlasCache::getFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset /* = Vec2::ZERO */)
{
auto realFontFilename = FileUtils::getInstance()->getNewFilename(fontFileName); // resolves real file path, to prevent storing multiple atlases for the same file.
char tmp[ATLAS_MAP_KEY_BUFFER];
snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s", imageOffset.x, imageOffset.y, realFontFilename.c_str());
std::string atlasName = tmp;
char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE];
snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageOffset.x, imageOffset.y);
std::string atlasName(keyPrefix);
atlasName += realFontFilename;

auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() )
Expand Down Expand Up @@ -147,9 +144,9 @@ FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& plistFile)

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 = tmp;
char key[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE];
sprintf(key,"name:%u_%d_%d_%d",texture->getName(),itemWidth,itemHeight,startCharMap);
std::string atlasName = key;

auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() )
Expand All @@ -174,9 +171,10 @@ FontAtlas* FontAtlasCache::getFontAtlasCharMap(Texture2D* texture, int itemWidth

FontAtlas* FontAtlasCache::getFontAtlasCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap)
{
char tmp[ATLAS_MAP_KEY_BUFFER];
snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%d %d %d %s", itemWidth, itemHeight, startCharMap, charMapFile.c_str());
std::string atlasName = tmp;
char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE];
snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%d %d %d ", itemWidth, itemHeight, startCharMap);
std::string atlasName(keyPrefix);
atlasName += charMapFile;

auto it = _atlasMap.find(atlasName);
if ( it == _atlasMap.end() )
Expand Down Expand Up @@ -224,9 +222,10 @@ bool FontAtlasCache::releaseFontAtlas(FontAtlas *atlas)

void FontAtlasCache::reloadFontAtlasFNT(const std::string& fontFileName, const Vec2& imageOffset/* = Vec2::ZERO*/)
{
char tmp[ATLAS_MAP_KEY_BUFFER];
snprintf(tmp, ATLAS_MAP_KEY_BUFFER, "%.2f %.2f %s", imageOffset.x, imageOffset.y, fontFileName.c_str());
std::string atlasName = tmp;
char keyPrefix[ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE];
snprintf(keyPrefix, ATLAS_MAP_KEY_PREFIX_BUFFER_SIZE, "%.2f %.2f ", imageOffset.x, imageOffset.y);
std::string atlasName(keyPrefix);
atlasName += fontFileName;

auto it = _atlasMap.find(atlasName);
if (it != _atlasMap.end())
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCFontFreeType.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include "2d/CCFont.h"

#include <string>
#include <ft2build.h>
#include "ft2build.h"

#if (CC_TARGET_PLATFORM == CC_PLATFORM_WINRT)
#define generic GenericFromFreeTypeLibrary
Expand Down
2 changes: 1 addition & 1 deletion cocos/2d/CCTextFieldTTF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ void TextFieldTTF::setCursorFromPoint(const Vec2 &point, const Camera* camera)
auto sprite = getLetter(latterPosition);
if (sprite)
{
rect.size = sprite->getContentSize();
rect.size = Size(sprite->getContentSize().width, _lineHeight);
if (isScreenPointInRect(point, camera, sprite->getWorldToNodeTransform(), rect, nullptr))
{
setCursorPosition(latterPosition);
Expand Down
9 changes: 9 additions & 0 deletions cocos/base/CCConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ class CC_DLL Configuration : public Ref
* @return The Configuration info.
*/
std::string getInfo() const;

/**
Returns the configuration as value map
@return the configuration map
@since 3.18
@js NA
@lua NA
*/
const ValueMap& getInfoAsMap()const { return _valueDict; }

/** Gathers OpenGL / GPU information.
*/
Expand Down
Loading