Commit Graph

50 Commits

Author SHA1 Message Date
James Chen cdb3985f0d fixed #2151: Commenting a log in CCFileUtils::fullPathForFilename. 2013-05-13 21:48:25 +08:00
Darragh Coy 032aed4499 Fix custom font loading on Android when using fonts that are in resource mapped directories/paths.
1: Use the CCFileUtils::fullPathForFilename function to lookup the resolved path for the font in the Android specific function, CCImage::getBitmapFromJava.

2: Remove a warning previously added in pull request 2422 (https://github.com/cocos2d/cocos2d-x/pull/2422) in CCFileUtils::fullPathForFilename in order to support change (1) above. If we pass just a system font name to CCFileUtils::fullPathForFilename such as 'Arial' (instead of a path) then it should just return 'Arial' and not generate a warning. We can't assume that when a path (or handle) given to CCFileUtils::fullPathForFilename isn't found within Cocos2dx that it doesn't exist or isn't valid. Depending on the platform there might be files or folders or handles that could be accessible to the app which might exist outside of the knowledge of Cocos2dx. The correct place to warn about missing resource files would be at the point where the resource loading itself fails; e.g if a texture or sound fails to load for example.
2013-05-09 14:29:42 +01:00
James Chen c45ebfa628 Merge pull request #2422 from brawsome/master
fixed #2127: Adding CCLOG before original path is returned in CCFileUtils::fullPathForFileName to aid in debugging.
The PR has fix two issues:
1) Added additional CCLOG to CCFileUtils::fullPathForFilename:
There's currently no way to be sure, from a calling function, that
fullPathForFilename has returned an invalid file path, which makes it
difficult to quickly track down missing, or incorrect file paths. Added
a CCLOG before the original string is returned to make debugging
missing or incorrect file paths easier.

2) Optmization to ccArrayGetIndexOfObject …
Optimized loop of ccArrayGetIndexOfObject to remove the overhead of 3
pointer dereferences per iteration, and pre-increment the int for
speed. If this function is called a lot, and with a large list, this
will result in a good performance win.
This can probably be done with just pointers, but I haven't taken the
time to validate all function calls to make sure it would be
appropriate. Though I can guarantee that if this worked fine before, it
will work fine with this change.
2013-05-07 01:40:57 -07:00
James Chen 2418e72a0e Fix compilation errors for linux port. 2013-05-07 14:36:01 +08:00
tiantian 2ba5035e5a Make sure XMLDocument is deleted; Code clean up; Add test; 2013-04-28 00:36:37 +08:00
Andrew Goulding 3c6bb725e7 Added additional CCLOG to CCFileUtils::fullPathForFilename
There's currently no way to be sure, from a calling function, that
fullPathForFilename has returned an invalid file path, which makes it
difficult to quickly track down missing, or incorrect file paths. Added
a CCLOG before the original string is returned to make debugging
missing or incorrect file paths easier.
2013-04-23 06:24:12 +10:00
tianTian 91ddfe7382 Add support for CCDictionary contains CCArray; 2013-04-16 12:34:09 +08:00
tianTian 96359950cf Implement CCDictionary::writeToFile();
Use NSDictionay to do the job for iOS and Mac, and using tinyxml2 for other platform;
2013-04-13 16:55:24 +08:00
Darragh Coy d0f8aaad9e Fix CCFileUtils 'createXXXXWithContentsOfFile' path lookup issue
When calling 'CCFileUtils::createCCDictionaryWithContentsOfFile' and 'CCFileUtils::createCCArrayWithContentsOfFile' on iOS/OSX these functions call upon 'CCFileUtils::fullPathForFilename' to resolve the path given into a full path which can be used with system file IO functions. This matches the convention found throughout the cocos2dx library and is expected behaviour. However, on Android and other platforms it appears calling 'CCFileUtils::createCCDictionaryWithContentsOfFile' or 'CCFileUtils:: createCCArrayWithContentsOfFile' does not do the same resolution using 'CCFileUtils::fullPathForFilename' - resulting in file paths which are correctly specified (and which worked on iOS/OSX) to fail to load on these platforms.

Fix this issue by performing a lookup/resolve of the file path using 'CCFileUtils::fullPathForFilename' before doing the low level loading work itself. This brings the behaviour of other platforms in line with iOS and OSX.
2013-03-29 22:51:25 -07:00
Sam Clegg 38878b084b Fix all compiler warnings produced by gcc.
This allows the linux and NaCl builds (and perhaps others)
to be compiles with -Wall and -Werror, and it makes the build
output much less noisy.
2013-03-05 17:01:00 -08:00
folecr f26f254daa Use CCLOG instead of CCMessageBox to report file system errors 2013-02-21 17:05:17 -08:00
minggo 9a7cca5ed4 issue #1703:remove dependence of libxml2 2013-02-06 14:12:52 +08:00
dualface 5904512ac6 add CCFileUtils Lua support 2013-02-04 12:41:24 +08:00
James Chen ae0b973cf1 issue #1687: Moving the global function( ccFileUtils_dictionaryWithContentsOfFileThreadSafe, ccFileUtils_arrayWithContentsOfFileThreadSafe) to the CCFileUtils class.
)
2013-02-01 18:48:44 +08:00
James Chen 357da4f2fc issue #1687: Updating the comments for CCFileUtils. 2013-02-01 16:46:15 +08:00
James Chen a110778739 issue #1687: Updating comments for CCFileUtils. 2013-02-01 15:41:41 +08:00
James Chen c296ab363f issue #1687: Comments some logs output for CCFileUtils. 2013-02-01 11:53:05 +08:00
James Chen 3a9346e6ff issue #1687: Refactoring CCFileUtils, abstracting the same implementations for all platforms. 2013-02-01 11:20:46 +08:00
James Chen 0f36a89c7e issue #1188: Refactor directory. Compile successfully on android and win32(vs2008 debug). 2012-04-25 16:18:04 +08:00
James Chen e8b826b7a6 fixed #1187: spanish(Buen día) cannot be shown completely in CCLabelBMFont unicode test. 2012-04-25 10:55:59 +08:00
James Chen 230b8a386b issue #1176: Changed linebreak symbol to UNIX format ('\n'),replaced 'tab'
with four spaces. Also,
1. Used macro NS_CC_BEGIN instead of namespace cocos2d {, NS_CC_END instead
of }.
2. Removed some unused files.
3. Renamed the name of some folders, for example,
"test.android"-->"proj.android" .
2012-04-19 14:35:52 +08:00
James Chen 4068be84e9 Refactored project folders. 2012-04-19 11:46:08 +08:00
James Chen 783b2fe79b Removed some unused codes regard to WOPHONE. 2012-04-19 10:46:37 +08:00
James Chen 77919439bc fixed #1166: Added CCArray::arrayWithContentOfFile function. 2012-04-16 15:41:01 +08:00
James Chen d01f1277af optimize data struct. 2012-04-14 19:11:57 +08:00
minggo 86b13a64c4 CCFileUtils::fullPathFromRelativePath() works correct 2012-04-08 14:52:47 +08:00
minggo 355e27dada merge commit 928a28e37d3469fcd41aff14cb136b1415f2fc86 2012-04-08 14:16:29 +08:00
James Chen 6ce06bd906 issue #1056: Remove CCMutableArray and CCMutableDictionary template, offer CCDictionary to improve the performance of dictionary by 60%, it means that CCDictionary can save about 2/3 time cost. 2012-03-20 15:04:53 +08:00
James Chen dac63dd2c2 rename include file name from uppercase to lowercase for linux platform 2012-02-14 22:41:33 +08:00
dumganhar ef753afb6b modify eclipse project setting for linux port 2012-01-12 19:15:23 +08:00
dumganhar 4b9cbb85ff #issue 908: Merge marmalade to latest cocos2d-x source
Merge branch 'master' of https://github.com/gzito/cocos2d-x into marmalade

Conflicts:
	cocos2dx/platform/CCFileUtils.cpp
	cocos2dx/platform/CCPlatformConfig.h
	cocos2dx/support/zip_support/ioapi.cpp
2011-12-12 17:46:21 +08:00
Giovanni Zito 0c1b058629 Changed symbols from "airplay" to "marmalade", added files and folders for marmalade 2011-12-08 12:16:32 +01:00
Giovanni Zito b60eac2505 integrating libXml2 2011-12-07 23:49:52 +01:00
dumganhar bfdb908d01 add Cocos2dx project
add HelloWorld project and rename proj.blackberry fold to proj.qnx
2011-12-06 14:56:37 +08:00
minggo f0d22ae504 issue #879: replase assert with CCAssert 2011-11-28 17:28:43 +08:00
minggo d48da20b0f synchrolize to master 2011-11-18 18:53:53 +08:00
minggo 5273819e83 offer a thread safe function to read contents of xml file, and the engine use it internal 2011-11-15 10:41:18 +08:00
dumganhar c94adc58b9 changed bada projects directory, add bada macro 2011-09-19 17:53:45 +08:00
natural-law 214e86a5b6 Merge branch 'master' of https://github.com/cocos2d/cocos2d-x
Conflicts:
	cocos2dx/platform/CCFileUtils.cpp
2011-06-14 15:05:52 +08:00
natural-law 489fb7824b fixed #524, Parse the special format of plist files. 2011-06-14 14:53:00 +08:00
liswei 1591c7edc8 fixed #512 fix warnings in /Wall flag 2011-06-10 17:51:37 +08:00
minggo 7d52161804 fixed #441: Initialize pointer in contruction & detect pointer value in destruction 2011-04-01 16:06:53 +08:00
walzer 70eb85e6df Merge branch 'yangws-439' 2011-03-30 11:47:10 +08:00
yangws 7e81c56231 Merge branch 'master' of https://github.com/cocos2d/cocos2d-x into 439
Conflicts:
	cocos2dx/platform/ios/CCFileUtils_ios.mm
2011-03-30 11:05:23 +08:00
natural-law 87ea85a986 fixed #411,support .plist format generated by zwoptex in the last version. 2011-03-29 16:59:50 +08:00
natural-law 5f7357bf09 fixed #391,CCSpriteFrameCache support *.plist files with format value is not 0. 2011-03-29 11:56:14 +08:00
yangws 041953151a issue #439 CCFileData and imageWithImageFile modified on win32. 2011-03-29 11:41:44 +08:00
natural-law ed2566e201 issue #434,Refactor class CCFileUtils on platform airplay. 2011-03-28 16:27:26 +08:00
natural-law cee82fe9fa issue #434,refactor class CCFileUtils on android and ios. 2011-03-26 17:24:37 +08:00
natural-law 28a940ab57 issue #434,refactor class CCFileUtils on win32 and wophone. 2011-03-26 13:52:33 +08:00