mirror of https://github.com/axmolengine/axmol.git
Pulled changes from github.
This commit is contained in:
commit
4a027082be
|
@ -1,66 +1,69 @@
|
|||
|
||||
#ignore thumbnails created by windows
|
||||
Thumbs.db
|
||||
#Ignore files build by Visual Studio
|
||||
*.obj
|
||||
*.exe
|
||||
*.pdb
|
||||
*.aps
|
||||
*.vcproj.*.user
|
||||
*.vspscc
|
||||
*_i.c
|
||||
*.i
|
||||
*.icf
|
||||
*_p.c
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.cache
|
||||
*.ilk
|
||||
*.log
|
||||
[Bb]in
|
||||
[Dd]ebug*/
|
||||
*.sbr
|
||||
*.sdf
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
[Tt]est[Rr]esult*
|
||||
|
||||
# Ignore files build by ndk and eclipse
|
||||
libs/
|
||||
bin/
|
||||
obj/
|
||||
assets/
|
||||
.classpath
|
||||
.project
|
||||
.cproject
|
||||
|
||||
# Ignore files build by linux
|
||||
*.o
|
||||
|
||||
# Ignore files build by airplay
|
||||
build_*_xcode/
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
*.pbxuser
|
||||
*.xcbkptlist
|
||||
*.xcscheme
|
||||
*.xcworkspacedata
|
||||
*.xcuserstate
|
||||
xcschememanagement.plist
|
||||
build/
|
||||
.DS_Store
|
||||
|
||||
# Ignore files built by bada
|
||||
.Simulator-Debug/
|
||||
.Target-Debug/
|
||||
.Target-Release/
|
||||
|
||||
# Ignore files built by blackberry
|
||||
Simulator/
|
||||
Device-Debug/
|
||||
Device-Release/
|
||||
#ignore thumbnails created by windows
|
||||
Thumbs.db
|
||||
#Ignore files build by Visual Studio
|
||||
*.obj
|
||||
*.exe
|
||||
*.pdb
|
||||
*.aps
|
||||
*.vcproj.*.user
|
||||
*.vspscc
|
||||
*_i.c
|
||||
*.i
|
||||
*.icf
|
||||
*_p.c
|
||||
*.ncb
|
||||
*.suo
|
||||
*.tlb
|
||||
*.tlh
|
||||
*.bak
|
||||
*.cache
|
||||
*.ilk
|
||||
*.log
|
||||
[Bb]in
|
||||
[Dd]ebug*/
|
||||
*.sbr
|
||||
*.sdf
|
||||
obj/
|
||||
[Rr]elease*/
|
||||
_ReSharper*/
|
||||
[Tt]est[Rr]esult*
|
||||
|
||||
# Ignore files build by ndk and eclipse
|
||||
libs/
|
||||
bin/
|
||||
obj/
|
||||
assets/
|
||||
.classpath
|
||||
.project
|
||||
.cproject
|
||||
|
||||
# Ignore files build by linux
|
||||
*.o
|
||||
|
||||
# Ignore files build by airplay
|
||||
build_*_xcode/
|
||||
|
||||
# Ignore files build by xcode
|
||||
*.mode*v*
|
||||
*.pbxuser
|
||||
*.xcbkptlist
|
||||
*.xcscheme
|
||||
*.xcworkspacedata
|
||||
*.xcuserstate
|
||||
xcschememanagement.plist
|
||||
build/
|
||||
.DS_Store
|
||||
xcuserdata/
|
||||
|
||||
# Ignore files built by bada
|
||||
.Simulator-Debug/
|
||||
.Target-Debug/
|
||||
.Target-Release/
|
||||
|
||||
# Ignore files built by blackberry
|
||||
Simulator/
|
||||
Device-Debug/
|
||||
Device-Release/
|
||||
|
||||
# Ignore vim swaps
|
||||
*.swp
|
||||
|
|
9
AUTHORS
9
AUTHORS
|
@ -8,9 +8,13 @@ Core Developers:
|
|||
JianHua Chen (Dumganhar)
|
||||
|
||||
Developers:
|
||||
Ricardo Quesada
|
||||
Rolando Abarca
|
||||
Javascript Binding and testjs
|
||||
|
||||
XiaoLong Zhang (Chukong Inc)
|
||||
Mike McGary (Zynga)
|
||||
Di Wu
|
||||
Di Wu (Zynga China)
|
||||
CCBReader and cpp reflection mechanic
|
||||
|
||||
Angus Comrie
|
||||
|
@ -79,6 +83,9 @@ Developers:
|
|||
YuLei Liao(dualface)
|
||||
contribute the factor of lua binding
|
||||
|
||||
jreitman
|
||||
fix the bug of asynchronous loading resources for iOS
|
||||
|
||||
Retired Core Developers:
|
||||
WenSheng Yang
|
||||
Author of windows port, CCTextField,
|
||||
|
|
120
Box2D/Android.mk
120
Box2D/Android.mk
|
@ -1,60 +1,60 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := box2d_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libbox2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
Collision/Shapes/b2ChainShape.cpp \
|
||||
Collision/Shapes/b2CircleShape.cpp \
|
||||
Collision/Shapes/b2EdgeShape.cpp \
|
||||
Collision/Shapes/b2PolygonShape.cpp \
|
||||
Collision/b2BroadPhase.cpp \
|
||||
Collision/b2CollideCircle.cpp \
|
||||
Collision/b2CollideEdge.cpp \
|
||||
Collision/b2CollidePolygon.cpp \
|
||||
Collision/b2Collision.cpp \
|
||||
Collision/b2Distance.cpp \
|
||||
Collision/b2DynamicTree.cpp \
|
||||
Collision/b2TimeOfImpact.cpp \
|
||||
Common/b2BlockAllocator.cpp \
|
||||
Common/b2Draw.cpp \
|
||||
Common/b2Math.cpp \
|
||||
Common/b2Settings.cpp \
|
||||
Common/b2StackAllocator.cpp \
|
||||
Common/b2Timer.cpp \
|
||||
Dynamics/Contacts/b2ChainAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2ChainAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2CircleContact.cpp \
|
||||
Dynamics/Contacts/b2Contact.cpp \
|
||||
Dynamics/Contacts/b2ContactSolver.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonContact.cpp \
|
||||
Dynamics/Joints/b2DistanceJoint.cpp \
|
||||
Dynamics/Joints/b2FrictionJoint.cpp \
|
||||
Dynamics/Joints/b2GearJoint.cpp \
|
||||
Dynamics/Joints/b2Joint.cpp \
|
||||
Dynamics/Joints/b2MouseJoint.cpp \
|
||||
Dynamics/Joints/b2PrismaticJoint.cpp \
|
||||
Dynamics/Joints/b2PulleyJoint.cpp \
|
||||
Dynamics/Joints/b2RevoluteJoint.cpp \
|
||||
Dynamics/Joints/b2RopeJoint.cpp \
|
||||
Dynamics/Joints/b2WeldJoint.cpp \
|
||||
Dynamics/Joints/b2WheelJoint.cpp \
|
||||
Dynamics/b2Body.cpp \
|
||||
Dynamics/b2ContactManager.cpp \
|
||||
Dynamics/b2Fixture.cpp \
|
||||
Dynamics/b2Island.cpp \
|
||||
Dynamics/b2World.cpp \
|
||||
Dynamics/b2WorldCallbacks.cpp \
|
||||
Rope/b2Rope.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := box2d_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libbox2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
Collision/Shapes/b2ChainShape.cpp \
|
||||
Collision/Shapes/b2CircleShape.cpp \
|
||||
Collision/Shapes/b2EdgeShape.cpp \
|
||||
Collision/Shapes/b2PolygonShape.cpp \
|
||||
Collision/b2BroadPhase.cpp \
|
||||
Collision/b2CollideCircle.cpp \
|
||||
Collision/b2CollideEdge.cpp \
|
||||
Collision/b2CollidePolygon.cpp \
|
||||
Collision/b2Collision.cpp \
|
||||
Collision/b2Distance.cpp \
|
||||
Collision/b2DynamicTree.cpp \
|
||||
Collision/b2TimeOfImpact.cpp \
|
||||
Common/b2BlockAllocator.cpp \
|
||||
Common/b2Draw.cpp \
|
||||
Common/b2Math.cpp \
|
||||
Common/b2Settings.cpp \
|
||||
Common/b2StackAllocator.cpp \
|
||||
Common/b2Timer.cpp \
|
||||
Dynamics/Contacts/b2ChainAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2ChainAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2CircleContact.cpp \
|
||||
Dynamics/Contacts/b2Contact.cpp \
|
||||
Dynamics/Contacts/b2ContactSolver.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2EdgeAndPolygonContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonAndCircleContact.cpp \
|
||||
Dynamics/Contacts/b2PolygonContact.cpp \
|
||||
Dynamics/Joints/b2DistanceJoint.cpp \
|
||||
Dynamics/Joints/b2FrictionJoint.cpp \
|
||||
Dynamics/Joints/b2GearJoint.cpp \
|
||||
Dynamics/Joints/b2Joint.cpp \
|
||||
Dynamics/Joints/b2MouseJoint.cpp \
|
||||
Dynamics/Joints/b2PrismaticJoint.cpp \
|
||||
Dynamics/Joints/b2PulleyJoint.cpp \
|
||||
Dynamics/Joints/b2RevoluteJoint.cpp \
|
||||
Dynamics/Joints/b2RopeJoint.cpp \
|
||||
Dynamics/Joints/b2WeldJoint.cpp \
|
||||
Dynamics/Joints/b2WheelJoint.cpp \
|
||||
Dynamics/b2Body.cpp \
|
||||
Dynamics/b2ContactManager.cpp \
|
||||
Dynamics/b2Fixture.cpp \
|
||||
Dynamics/b2Island.cpp \
|
||||
Dynamics/b2World.cpp \
|
||||
Dynamics/b2WorldCallbacks.cpp \
|
||||
Rope/b2Rope.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/..
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
|
87
CHANGELOG
87
CHANGELOG
|
@ -1,3 +1,90 @@
|
|||
cocos2d-2.0-rc0a-x-2.0 @May.31 2012
|
||||
[all platforms]
|
||||
Bug #1094: fix a bug that nothing will be shown when using CCParticleBatchNode
|
||||
Bug #1115: fix a bug that CCFileUtils::fullPathFromRelativePath() with resolution parameter return error value with empty string
|
||||
Bug #1137: fix a memory leak in CCLabelBMFont and sync the implementation of CCLabelBMFont to gles20 branch
|
||||
Bug #1138: fix a memory leak in CCTextureCache::addPVRImage.
|
||||
Bug #1155: revert CCDirector singleton to original implementation
|
||||
Bug #1157: fix a bug that nothing is shown in TMX Orthogonal Test
|
||||
Bug #1158: fix a bug in CCParticleSystemQuad
|
||||
Bug #1159: update "CallFuncND + auto remove" test demo
|
||||
Bug #1160: rename 'CGFloat' to 'CCFloat'
|
||||
Bug #1164: add the render mode which uses VBO without VAO in CCParticleSystemQuad
|
||||
Bug #1165: merge pull request #842
|
||||
Bug #1187: fix a bug that spanish(Buen día) cannot be shown completely in CCLabelBMFont unicode test
|
||||
Bug #1189: CCLabelBMFont updateLabel() optimizations and fixes
|
||||
Bug #1212: fix a bug that TMXBug787Test crash.
|
||||
Bug #1217: fix a bug that EaseActions reverse broken
|
||||
Bug #1232: fix a bug that CCLayerGradient::updateColor() assign wrong value to m_pSquareColors
|
||||
Bug #1244: fix memory leak in CCParticleSystem::initWithDictionary()
|
||||
Bug #1273: fix a bug that app will crash after clicking closed button in TextureCacheTest
|
||||
Bug #1275: fix memory leaks in tests project
|
||||
Bug #1277: implement CCToggleVisibility::copyWithZone()
|
||||
Feature #1114: integrate CCControlExtension and implement corresponding tests
|
||||
Feature #1180: synchronize CCConfiguration
|
||||
Feature #1194: merge texturewatcher contributed by NetGragon
|
||||
Feature #1205: add ccbreader and test case for CocosBuilder
|
||||
Feature #1240: support TIFF format picture
|
||||
Feature #1258: merge Rolando's testjs into gles20 branch
|
||||
Refactor #1156: synchronize CCDirector
|
||||
Refactor #1166: improve CCString and CCArray, optimize CCDictionary
|
||||
Refactor #1176: change linebreak symbol to UNIX format ('\n'), replace 'tab' with four spaces
|
||||
Refactor #1177: refactor platform
|
||||
Refactor #1178: use macro NS_CC_BEGIN instead of "namespace cocos2d {", NS_CC_END instead of "}"
|
||||
Refactor #1188: refactor directory structure
|
||||
Refactor #1191: update templates for all platforms
|
||||
Refactor #1198: optimize CCTextureCache::removeUnusedTextures()
|
||||
Refactor #1203: remove CCFileUtils::setResource(const char* pszZipFileName) and SimpleAudioEngine::setResource
|
||||
Refactor #1204: refactor AppDelegate::initInstance()
|
||||
Refactor #1206: remove some unused files, only supports iOS, win32 and android
|
||||
Refactor #1211: translate Chinese comments to English for CCTextureWatcher and CCListView
|
||||
Refactor #1246: fix CCDirector using CCLabelBMFont instead of CCLabelTTF
|
||||
Refactor #1252: add CCEGLViewProtocol::getFrameSize() method for getting the real screen size of device
|
||||
Refactor #1253: add static method "purgeConfiguration" for CCConfiguration to avoid memory leak
|
||||
[iOS]
|
||||
Bug #1109: add parentheses to remove Xcode warnings
|
||||
Bug #1230: fix a bug that Calculation of string width may be wrong on iOS
|
||||
Bug #1266: fix a bug that CCTextureCahce::addImageAsync() don't work correctly on iOS
|
||||
Feature #1095: IOS screen resolution support
|
||||
[android]
|
||||
Bug #1139: fix a bug that screen becomes black when backing from background
|
||||
Bug #1140: fix a bug that ParticleTest crashed
|
||||
Bug #1141: fix a bug that NodeTest crashed in StressTest1 and StressTest2
|
||||
Bug #1142: fix a bug that TouchesTest crashed
|
||||
Bug #1143: fix a bug that MenuTest crashed
|
||||
Bug #1144: fix a bug that ParallaxTest crashed
|
||||
Bug #1145: fix a bug that TileMap crashed
|
||||
Bug #1146: fix a bug that IntervalTest crashed
|
||||
Bug #1147: fix a bug that ChipmunkAccelTouchTest crashed
|
||||
Bug #1148: fix a bug that LabelTest crashed
|
||||
Bug #1149: fix a bug that SpriteTest crashed when go to second test case
|
||||
Bug #1150: fix a bug that RenderTextureTest crashed at second test case
|
||||
Bug #1151: fix a bug that Box2DTest crashed
|
||||
Bug #1152: fix a bug that PerformanceTest crashed at 1, 2, 5 test cases
|
||||
Bug #1185: fix a bug that when backing to foreground, will lost texture if it uses sprite batch node
|
||||
Bug #1216: fix JNI memory leaks
|
||||
Bug #1229: fix a bug that android port can not be compiled on ndk android-8 level
|
||||
Bug #1236: fix a bug that JniHelper::jstring2string may crash when parameter is null
|
||||
Bug #1237: fix a bug that line number message printed by CCAssert is wrong
|
||||
Bug #1279: fix a bug that NodeNonOpaqueTest can't be shown correctly
|
||||
Feature #1247: add profiler support for android
|
||||
Feature #1265: build dynamic library of spidermonkey for Android, and implement testjs for android
|
||||
Refactor #1179: popup a message box when invoking CCAssert() on Android
|
||||
Refactor #1201: simplify the usage of writing Android.mk
|
||||
[windows]
|
||||
Bug #1215: fix a bug that Win32 retina cannot work
|
||||
Bug #1251: add CocosBuilderTest to the test project for VS2008
|
||||
Bug #1264: fix wrong string alignment when using utf-8 encoded text with CCLabelTTF
|
||||
Bug #1268: fix a bug that Testjs will crash after clicking the close button on win32
|
||||
Bug #1270: fix some warning on win32
|
||||
Feature #1186: add console window for Win32 application, all debug message output to this console window
|
||||
Feature #1263: build dynamic library of spidermonkey for win32, and add testjs project to solution
|
||||
Refactor #1170: remove win32 template of wophone
|
||||
[lua]
|
||||
Refactor #1190: update lua binding to 2.0
|
||||
Refactor #1220: using CCString::stringWithContentsOfFile to get string from lua script files
|
||||
|
||||
|
||||
cocos2d-1.0.1-x-0.12.0 @ Mar.5 2012
|
||||
[all platforms]
|
||||
Bug #925: rename HelloWorld/Resource to HelloWorld/Resources
|
||||
|
|
|
@ -1,21 +1,21 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocosdenshion_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocosdenshion
|
||||
|
||||
LOCAL_SRC_FILES := SimpleAudioEngine.cpp \
|
||||
jni/SimpleAudioEngineJni.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
|
||||
$(LOCAL_PATH)/../../cocos2dx/include \
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocosdenshion_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocosdenshion
|
||||
|
||||
LOCAL_SRC_FILES := SimpleAudioEngine.cpp \
|
||||
jni/SimpleAudioEngineJni.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/../include
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../include \
|
||||
$(LOCAL_PATH)/../../cocos2dx/include \
|
||||
$(LOCAL_PATH)/../../cocos2dx/platform \
|
||||
$(LOCAL_PATH)/../../cocos2dx/platform/android \
|
||||
$(LOCAL_PATH)/../../cocos2dx/platform/android/jni
|
||||
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
$(LOCAL_PATH)/../../cocos2dx/platform/android \
|
||||
$(LOCAL_PATH)/../../cocos2dx/platform/android/jni
|
||||
|
||||
LOCAL_LDLIBS := -llog
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
|
|
@ -41,12 +41,12 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
CCScriptEngineProtocol* pEngine = CCLuaEngine::engine();
|
||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
CCString* pstrFileContent = CCString::stringWithContentsOfFile("hello.lua");
|
||||
if (pstrFileContent)
|
||||
{
|
||||
pEngine->executeString(pstrFileContent->getCString());
|
||||
}
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
CCString* pstrFileContent = CCString::stringWithContentsOfFile("hello.lua");
|
||||
if (pstrFileContent)
|
||||
{
|
||||
pEngine->executeString(pstrFileContent->getCString());
|
||||
}
|
||||
#else
|
||||
std::string path = CCFileUtils::fullPathFromRelativePath("hello.lua");
|
||||
pEngine->addSearchPath(path.substr(0, path.find_last_of("/")).c_str());
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
abc899cd55086105f439df7a6d01db84168aebb5
|
|
@ -1,26 +0,0 @@
|
|||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package org.cocos2dx.hellolua;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int test_demo_gl_surfaceview=0x7f050001;
|
||||
public static final int textField=0x7f050000;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int game_demo=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
}
|
||||
}
|
|
@ -1,26 +1,26 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := game_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libgame
|
||||
|
||||
LOCAL_SRC_FILES := helloworld/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../../lua/cocos2dx_support/CCLuaEngine.cpp \
|
||||
../../../lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \
|
||||
../../../lua/cocos2dx_support/LuaCocos2d.cpp \
|
||||
../../../lua/cocos2dx_support/tolua_fix.c
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := game_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libgame
|
||||
|
||||
LOCAL_SRC_FILES := helloworld/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../../lua/cocos2dx_support/CCLuaEngine.cpp \
|
||||
../../../lua/cocos2dx_support/Cocos2dxLuaLoader.cpp \
|
||||
../../../lua/cocos2dx_support/LuaCocos2d.cpp \
|
||||
../../../lua/cocos2dx_support/tolua_fix.c
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_lua_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
$(call import-module,CocosDenshion/android)
|
||||
$(call import-module,lua/proj.android/jni)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
$(call import-module,CocosDenshion/android)
|
||||
$(call import-module,lua/proj.android/jni)
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
APP_CPPFLAGS := -frtti
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
|
|
|
@ -27,15 +27,15 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
|||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||
view->setFrameSize(w, h);
|
||||
// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
|
||||
// view.setDesignResolutionSize(480, 320);
|
||||
view->setDesignResolutionSize(480, 320);
|
||||
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
CCApplication::sharedApplication().run();
|
||||
}
|
||||
else
|
||||
{
|
||||
ccDrawInit();
|
||||
ccGLInvalidateStateCache();
|
||||
ccDrawInit();
|
||||
ccGLInvalidateStateCache();
|
||||
|
||||
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
|
||||
CCTextureCache::reloadAllTextures();
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
target=android-8
|
||||
|
|
|
@ -1 +1 @@
|
|||
3ffb5ef04b897f971e1e9c941002d06e5a91da50
|
||||
842462907b895bea8fcf8fc4a567560e546e440f
|
|
@ -135,7 +135,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..\Classes;"$(SolutionDir)lua\cocos2dx_support";"$(SolutionDir)lua\CocosDenshion_support";"$(SolutionDir)lua\tolua";"$(SolutionDir)lua\lua";"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";"$(SolutionDir)CocosDenshion\Include""
|
||||
AdditionalIncludeDirectories="..\Classes;"$(SolutionDir)\lua\cocos2dx_support";"$(SolutionDir)\lua\CocosDenshion_support";"$(SolutionDir)\lua\lua";"$(SolutionDir)\lua\tolua";"$(SolutionDir)\lua\src";.;"$(SolutionDir)cocos2dx";"$(SolutionDir)cocos2dx\actions";"$(SolutionDir)cocos2dx\base_nodes";"$(SolutionDir)cocos2dx\cocoa";"$(SolutionDir)cocos2dx\effects";"$(SolutionDir)cocos2dx\include";"$(SolutionDir)cocos2dx\kazmath\include";"$(SolutionDir)cocos2dx\keypad_dispatcher";"$(SolutionDir)cocos2dx\label_nodes";"$(SolutionDir)cocos2dx\layers_scenes_transitions_nodes";"$(SolutionDir)cocos2dx\menu_nodes";"$(SolutionDir)cocos2dx\misc_nodes";"$(SolutionDir)cocos2dx\particle_nodes";"$(SolutionDir)cocos2dx\script_support";"$(SolutionDir)cocos2dx\shaders";"$(SolutionDir)cocos2dx\sprite_nodes";"$(SolutionDir)cocos2dx\support";"$(SolutionDir)cocos2dx\text_input_node";"$(SolutionDir)cocos2dx\textures";"$(SolutionDir)cocos2dx\tileMap_parallax_nodes";"$(SolutionDir)cocos2dx\touch_dispatcher";"$(SolutionDir)cocos2dx\platform";"$(SolutionDir)cocos2dx\platform\win32";"$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES";"$(SolutionDir)CocosDenshion\include""
|
||||
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG"
|
||||
ExceptionHandling="0"
|
||||
RuntimeLibrary="2"
|
||||
|
@ -158,7 +158,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libgles_cm.lib liblua.lib"
|
||||
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libGLESv2.lib liblua.lib"
|
||||
LinkIncremental="1"
|
||||
AdditionalLibraryDirectories="$(OutDir)"
|
||||
SubSystem="2"
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libCocosDenshion.lib;libgles_cm.lib;liblua.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libcocos2d.lib;libCocosDenshion.lib;liblua.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
abc899cd55086105f439df7a6d01db84168aebb5
|
|
@ -1,6 +1,6 @@
|
|||
# set params
|
||||
NDK_ROOT_LOCAL=/cygdrive/d/programe/android/ndk/android-ndk-r7b
|
||||
COCOS2DX_ROOT_LOCAL=/cygdrive/e/cocos2d-x
|
||||
NDK_ROOT_LOCAL=/cygdrive/e/android/android-ndk-r8
|
||||
COCOS2DX_ROOT_LOCAL=/cygdrive/f/Project/dumganhar/cocos2d-x
|
||||
|
||||
buildexternalsfromsource=
|
||||
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
/* AUTO-GENERATED FILE. DO NOT MODIFY.
|
||||
*
|
||||
* This class was automatically generated by the
|
||||
* aapt tool from the resource data it found. It
|
||||
* should not be modified by hand.
|
||||
*/
|
||||
|
||||
package org.cocos2dx.application;
|
||||
|
||||
public final class R {
|
||||
public static final class attr {
|
||||
}
|
||||
public static final class drawable {
|
||||
public static final int icon=0x7f020000;
|
||||
}
|
||||
public static final class id {
|
||||
public static final int helloworld_gl_surfaceview=0x7f050001;
|
||||
public static final int textField=0x7f050000;
|
||||
}
|
||||
public static final class layout {
|
||||
public static final int helloworld_demo=0x7f030000;
|
||||
}
|
||||
public static final class string {
|
||||
public static final int app_name=0x7f040000;
|
||||
}
|
||||
}
|
|
@ -1,20 +1,20 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := helloworld_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libhelloworld
|
||||
|
||||
LOCAL_SRC_FILES := helloworld/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/HelloWorldScene.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := helloworld_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libhelloworld
|
||||
|
||||
LOCAL_SRC_FILES := helloworld/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/HelloWorldScene.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti
|
|
@ -30,7 +30,7 @@ void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thi
|
|||
CCEGLView *view = &CCEGLView::sharedOpenGLView();
|
||||
view->setFrameSize(w, h);
|
||||
// set the design resolution screen size, if you want to use Design Resoulution scaled to current screen, please uncomment next line.
|
||||
// view.setDesignResolutionSize(480, 320);
|
||||
// view->setDesignResolutionSize(480, 320);
|
||||
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
CCApplication::sharedApplication().run();
|
||||
|
|
|
@ -8,4 +8,4 @@
|
|||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
target=android-8
|
||||
|
|
|
@ -1 +1 @@
|
|||
92dc1f3cb8db6691dae94a502b38db89e5293d2d
|
||||
c7a3fbb2c6d8e698889720796681db135c37b25b
|
|
@ -46,6 +46,7 @@ set CC_TEST_BIN=tests.exe
|
|||
set CC_TEST_RES=..\tests\Resources\*.*
|
||||
set CC_HELLOWORLD_RES=..\HelloWorld\Resources\*.*
|
||||
set CC_HELLOLUA_RES=..\HelloLua\Resources\*.*
|
||||
set CC_TESTJS_RES=..\testjs\Resources\*.*
|
||||
|
||||
if not exist "%CC_TEST_BIN%" (
|
||||
echo Can't find the binary "tests.exe", is there build error?
|
||||
|
@ -59,6 +60,8 @@ echo.
|
|||
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||
|
||||
call "%CC_TEST_BIN%"
|
||||
start http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide
|
||||
goto EOF
|
||||
|
@ -66,4 +69,4 @@ goto EOF
|
|||
:ERROR
|
||||
pause
|
||||
|
||||
:EOF
|
||||
:EOF
|
||||
|
|
|
@ -1,45 +1,45 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := chipmunk_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libchipmunk
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
src/chipmunk.c \
|
||||
src/constraints/cpConstraint.c \
|
||||
src/constraints/cpDampedRotarySpring.c \
|
||||
src/constraints/cpDampedSpring.c \
|
||||
src/constraints/cpGearJoint.c \
|
||||
src/constraints/cpGrooveJoint.c \
|
||||
src/constraints/cpPinJoint.c \
|
||||
src/constraints/cpPivotJoint.c \
|
||||
src/constraints/cpRatchetJoint.c \
|
||||
src/constraints/cpRotaryLimitJoint.c \
|
||||
src/constraints/cpSimpleMotor.c \
|
||||
src/constraints/cpSlideJoint.c \
|
||||
src/cpArbiter.c \
|
||||
src/cpArray.c \
|
||||
src/cpBB.c \
|
||||
src/cpBBTree.c \
|
||||
src/cpBody.c \
|
||||
src/cpCollision.c \
|
||||
src/cpHashSet.c \
|
||||
src/cpPolyShape.c \
|
||||
src/cpShape.c \
|
||||
src/cpSpace.c \
|
||||
src/cpSpaceComponent.c \
|
||||
src/cpSpaceHash.c \
|
||||
src/cpSpaceQuery.c \
|
||||
src/cpSpaceStep.c \
|
||||
src/cpSpatialIndex.c \
|
||||
src/cpSweep1D.c \
|
||||
src/cpVect.c
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
LOCAL_CFLAGS := -std=c99
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := chipmunk_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libchipmunk
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
src/chipmunk.c \
|
||||
src/constraints/cpConstraint.c \
|
||||
src/constraints/cpDampedRotarySpring.c \
|
||||
src/constraints/cpDampedSpring.c \
|
||||
src/constraints/cpGearJoint.c \
|
||||
src/constraints/cpGrooveJoint.c \
|
||||
src/constraints/cpPinJoint.c \
|
||||
src/constraints/cpPivotJoint.c \
|
||||
src/constraints/cpRatchetJoint.c \
|
||||
src/constraints/cpRotaryLimitJoint.c \
|
||||
src/constraints/cpSimpleMotor.c \
|
||||
src/constraints/cpSlideJoint.c \
|
||||
src/cpArbiter.c \
|
||||
src/cpArray.c \
|
||||
src/cpBB.c \
|
||||
src/cpBBTree.c \
|
||||
src/cpBody.c \
|
||||
src/cpCollision.c \
|
||||
src/cpHashSet.c \
|
||||
src/cpPolyShape.c \
|
||||
src/cpShape.c \
|
||||
src/cpSpace.c \
|
||||
src/cpSpaceComponent.c \
|
||||
src/cpSpaceHash.c \
|
||||
src/cpSpaceQuery.c \
|
||||
src/cpSpaceStep.c \
|
||||
src/cpSpatialIndex.c \
|
||||
src/cpSweep1D.c \
|
||||
src/cpVect.c
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
|
||||
LOCAL_CFLAGS := -std=c99
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
|
|
@ -32,6 +32,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "tests", "tests\proj.win32\t
|
|||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjs", "testjs\proj.win32\testjs.win32.vcproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
|
@ -70,6 +76,10 @@ Global
|
|||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -17,7 +17,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "HelloLua\proj.w
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloWorld", "HelloWorld\proj.win32\HelloWorld.win32.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testjs", "testjs\proj.win32\testjs.win32.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
|
@ -55,11 +64,12 @@ Global
|
|||
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Release|Win32.Build.0 = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
|
@ -1,220 +1,222 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocos2dx_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocos2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CCConfiguration.cpp \
|
||||
CCDrawingPrimitives.cpp \
|
||||
CCScheduler.cpp \
|
||||
CCCamera.cpp \
|
||||
actions/CCAction.cpp \
|
||||
actions/CCActionCamera.cpp \
|
||||
actions/CCActionEase.cpp \
|
||||
actions/CCActionGrid.cpp \
|
||||
actions/CCActionGrid3D.cpp \
|
||||
actions/CCActionInstant.cpp \
|
||||
actions/CCActionInterval.cpp \
|
||||
actions/CCActionManager.cpp \
|
||||
actions/CCActionPageTurn3D.cpp \
|
||||
actions/CCActionProgressTimer.cpp \
|
||||
actions/CCActionTiledGrid.cpp \
|
||||
actions/CCActionTween.cpp \
|
||||
base_nodes/CCAtlasNode.cpp \
|
||||
base_nodes/CCNode.cpp \
|
||||
cocoa/CCAffineTransform.cpp \
|
||||
cocoa/CCGeometry.cpp \
|
||||
cocoa/CCAutoreleasePool.cpp \
|
||||
cocoa/CCData.cpp \
|
||||
cocoa/CCDictionary.cpp \
|
||||
cocoa/CCNS.cpp \
|
||||
cocoa/CCObject.cpp \
|
||||
cocoa/CCSet.cpp \
|
||||
cocoa/CCString.cpp \
|
||||
cocoa/CCZone.cpp \
|
||||
cocoa/CCArray.cpp \
|
||||
cocos2d.cpp \
|
||||
CCDirector.cpp \
|
||||
effects/CCGrabber.cpp \
|
||||
effects/CCGrid.cpp \
|
||||
extensions/CCNotificationCenter/CCNotificationCenter.cpp \
|
||||
extensions/CCControlExtension/CCControl.cpp \
|
||||
extensions/CCControlExtension/CCControlButton.cpp \
|
||||
extensions/CCControlExtension/CCControlColourPicker.cpp \
|
||||
extensions/CCControlExtension/CCControlHuePicker.cpp \
|
||||
extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp \
|
||||
extensions/CCControlExtension/CCControlSlider.cpp \
|
||||
extensions/CCControlExtension/CCControlSwitch.cpp \
|
||||
extensions/CCControlExtension/CCControlUtils.cpp \
|
||||
extensions/CCControlExtension/CCInvocation.cpp \
|
||||
extensions/CCControlExtension/CCMenuPassive.cpp \
|
||||
extensions/CCControlExtension/CCScale9Sprite.cpp \
|
||||
extensions/CCControlExtension/CCSpacer.cpp \
|
||||
extensions/CCListView/CCListView.cpp \
|
||||
extensions/CCListView/CCListViewCell.cpp \
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocos2dx_static
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocos2d
|
||||
|
||||
LOCAL_SRC_FILES := \
|
||||
CCConfiguration.cpp \
|
||||
CCDrawingPrimitives.cpp \
|
||||
CCScheduler.cpp \
|
||||
CCCamera.cpp \
|
||||
actions/CCAction.cpp \
|
||||
actions/CCActionCamera.cpp \
|
||||
actions/CCActionEase.cpp \
|
||||
actions/CCActionGrid.cpp \
|
||||
actions/CCActionGrid3D.cpp \
|
||||
actions/CCActionInstant.cpp \
|
||||
actions/CCActionInterval.cpp \
|
||||
actions/CCActionManager.cpp \
|
||||
actions/CCActionPageTurn3D.cpp \
|
||||
actions/CCActionProgressTimer.cpp \
|
||||
actions/CCActionTiledGrid.cpp \
|
||||
actions/CCActionTween.cpp \
|
||||
base_nodes/CCAtlasNode.cpp \
|
||||
base_nodes/CCNode.cpp \
|
||||
cocoa/CCAffineTransform.cpp \
|
||||
cocoa/CCGeometry.cpp \
|
||||
cocoa/CCAutoreleasePool.cpp \
|
||||
cocoa/CCData.cpp \
|
||||
cocoa/CCDictionary.cpp \
|
||||
cocoa/CCNS.cpp \
|
||||
cocoa/CCObject.cpp \
|
||||
cocoa/CCSet.cpp \
|
||||
cocoa/CCString.cpp \
|
||||
cocoa/CCZone.cpp \
|
||||
cocoa/CCArray.cpp \
|
||||
cocos2d.cpp \
|
||||
CCDirector.cpp \
|
||||
effects/CCGrabber.cpp \
|
||||
effects/CCGrid.cpp \
|
||||
extensions/CCNotificationCenter/CCNotificationCenter.cpp \
|
||||
extensions/CCControlExtension/CCControl.cpp \
|
||||
extensions/CCControlExtension/CCControlButton.cpp \
|
||||
extensions/CCControlExtension/CCControlColourPicker.cpp \
|
||||
extensions/CCControlExtension/CCControlHuePicker.cpp \
|
||||
extensions/CCControlExtension/CCControlSaturationBrightnessPicker.cpp \
|
||||
extensions/CCControlExtension/CCControlSlider.cpp \
|
||||
extensions/CCControlExtension/CCControlSwitch.cpp \
|
||||
extensions/CCControlExtension/CCControlUtils.cpp \
|
||||
extensions/CCControlExtension/CCInvocation.cpp \
|
||||
extensions/CCControlExtension/CCMenuPassive.cpp \
|
||||
extensions/CCControlExtension/CCScale9Sprite.cpp \
|
||||
extensions/CCControlExtension/CCSpacer.cpp \
|
||||
extensions/CCListView/CCListView.cpp \
|
||||
extensions/CCListView/CCListViewCell.cpp \
|
||||
extensions/CCTextureWatcher/CCTextureWatcher.cpp \
|
||||
extensions/CCBReader/CCBCustomClass.cpp \
|
||||
extensions/CCBReader/CCBReader_v2.cpp \
|
||||
kazmath/src/aabb.c \
|
||||
kazmath/src/mat3.c \
|
||||
kazmath/src/mat4.c \
|
||||
kazmath/src/neon_matrix_impl.c \
|
||||
kazmath/src/plane.c \
|
||||
kazmath/src/quaternion.c \
|
||||
kazmath/src/ray2.c \
|
||||
kazmath/src/utility.c \
|
||||
kazmath/src/vec2.c \
|
||||
kazmath/src/vec3.c \
|
||||
kazmath/src/vec4.c \
|
||||
kazmath/src/GL/mat4stack.c \
|
||||
kazmath/src/GL/matrix.c \
|
||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransition.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionProgress.cpp \
|
||||
menu_nodes/CCMenu.cpp \
|
||||
menu_nodes/CCMenuItem.cpp \
|
||||
misc_nodes/CCMotionStreak.cpp \
|
||||
misc_nodes/CCProgressTimer.cpp \
|
||||
misc_nodes/CCRenderTexture.cpp \
|
||||
particle_nodes/CCParticleExamples.cpp \
|
||||
particle_nodes/CCParticleSystem.cpp \
|
||||
particle_nodes/CCParticleBatchNode.cpp \
|
||||
particle_nodes/CCParticleSystemQuad.cpp \
|
||||
platform/CCStdC.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
platform/CCThread.cpp \
|
||||
platform/platform.cpp \
|
||||
platform/CCEGLViewProtocol.cpp \
|
||||
platform/android/CCEGLView.cpp \
|
||||
platform/android/CCAccelerometer.cpp \
|
||||
platform/android/CCApplication.cpp \
|
||||
platform/android/CCCommon.cpp \
|
||||
platform/android/CCFileUtils.cpp \
|
||||
platform/android/CCImage.cpp \
|
||||
platform/android/jni/JniHelper.cpp \
|
||||
platform/android/jni/IMEJni.cpp \
|
||||
platform/android/jni/MessageJni.cpp \
|
||||
platform/android/jni/SensorJni.cpp \
|
||||
platform/android/jni/SystemInfoJni.cpp \
|
||||
platform/android/jni/TouchesJni.cpp \
|
||||
script_support/CCScriptSupport.cpp \
|
||||
shaders/ccShaders.cpp \
|
||||
shaders/CCGLProgram.cpp \
|
||||
shaders/ccGLStateCache.cpp \
|
||||
shaders/CCShaderCache.cpp \
|
||||
sprite_nodes/CCAnimation.cpp \
|
||||
sprite_nodes/CCAnimationCache.cpp \
|
||||
sprite_nodes/CCSprite.cpp \
|
||||
sprite_nodes/CCSpriteBatchNode.cpp \
|
||||
sprite_nodes/CCSpriteFrame.cpp \
|
||||
sprite_nodes/CCSpriteFrameCache.cpp \
|
||||
support/CCProfiling.cpp \
|
||||
support/CCPointExtension.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/CCUserDefault.cpp \
|
||||
support/base64.cpp \
|
||||
support/ccUtils.cpp \
|
||||
support/CCVertex.cpp \
|
||||
support/image_support/TGAlib.cpp \
|
||||
support/zip_support/ZipUtils.cpp \
|
||||
support/zip_support/ioapi.cpp \
|
||||
support/zip_support/unzip.cpp \
|
||||
text_input_node/CCIMEDispatcher.cpp \
|
||||
text_input_node/CCTextFieldTTF.cpp \
|
||||
textures/CCTexture2D.cpp \
|
||||
textures/CCTextureAtlas.cpp \
|
||||
textures/CCTextureCache.cpp \
|
||||
textures/CCTexturePVR.cpp \
|
||||
tileMap_parallax_nodes/CCParallaxNode.cpp \
|
||||
tileMap_parallax_nodes/CCTMXLayer.cpp \
|
||||
tileMap_parallax_nodes/CCTMXObjectGroup.cpp \
|
||||
tileMap_parallax_nodes/CCTMXTiledMap.cpp \
|
||||
tileMap_parallax_nodes/CCTMXXMLParser.cpp \
|
||||
tileMap_parallax_nodes/CCTileMapAtlas.cpp \
|
||||
touch_dispatcher/CCTouchDispatcher.cpp \
|
||||
touch_dispatcher/CCTouchHandler.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ \
|
||||
$(LOCAL_PATH)/actions \
|
||||
$(LOCAL_PATH)/base_nodes \
|
||||
$(LOCAL_PATH)/cocoa \
|
||||
$(LOCAL_PATH)/effects \
|
||||
$(LOCAL_PATH)/extensions \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/kazmath/include \
|
||||
$(LOCAL_PATH)/keypad_dispatcher \
|
||||
$(LOCAL_PATH)/label_nodes \
|
||||
$(LOCAL_PATH)/layers_scenes_transitions_nodes \
|
||||
$(LOCAL_PATH)/menu_nodes \
|
||||
$(LOCAL_PATH)/misc_nodes \
|
||||
$(LOCAL_PATH)/particle_nodes \
|
||||
$(LOCAL_PATH)/platform \
|
||||
$(LOCAL_PATH)/platform/android \
|
||||
$(LOCAL_PATH)/script_support \
|
||||
$(LOCAL_PATH)/shaders \
|
||||
$(LOCAL_PATH)/sprite_nodes \
|
||||
$(LOCAL_PATH)/support \
|
||||
$(LOCAL_PATH)/text_input_node \
|
||||
$(LOCAL_PATH)/textures \
|
||||
$(LOCAL_PATH)/tileMap_parallax_nodes \
|
||||
$(LOCAL_PATH)/touch_dispatcher
|
||||
|
||||
|
||||
LOCAL_EXPORT_LDLIBS := -llog\
|
||||
-lz \
|
||||
-lGLESv2
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \
|
||||
$(LOCAL_PATH)/actions \
|
||||
$(LOCAL_PATH)/base_nodes \
|
||||
$(LOCAL_PATH)/cocoa \
|
||||
$(LOCAL_PATH)/effects \
|
||||
$(LOCAL_PATH)/extensions \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/kazmath/include \
|
||||
$(LOCAL_PATH)/keypad_dispatcher \
|
||||
$(LOCAL_PATH)/label_nodes \
|
||||
$(LOCAL_PATH)/layers_scenes_transitions_nodes \
|
||||
$(LOCAL_PATH)/menu_nodes \
|
||||
$(LOCAL_PATH)/misc_nodes \
|
||||
$(LOCAL_PATH)/particle_nodes \
|
||||
$(LOCAL_PATH)/platform \
|
||||
$(LOCAL_PATH)/platform/android \
|
||||
$(LOCAL_PATH)/script_support \
|
||||
$(LOCAL_PATH)/shaders \
|
||||
$(LOCAL_PATH)/sprite_nodes \
|
||||
$(LOCAL_PATH)/support \
|
||||
$(LOCAL_PATH)/text_input_node \
|
||||
$(LOCAL_PATH)/textures \
|
||||
$(LOCAL_PATH)/tileMap_parallax_nodes \
|
||||
$(LOCAL_PATH)/touch_dispatcher
|
||||
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv2 \
|
||||
-lEGL \
|
||||
-llog \
|
||||
-lz
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libxml2_static
|
||||
|
||||
# define the macro to compile through support/zip_support/ioapi.c
|
||||
LOCAL_CFLAGS := -DUSE_FILE32API
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
$(call import-module,libjpeg)
|
||||
$(call import-module,libpng)
|
||||
$(call import-module,libxml2)
|
||||
|
||||
extensions/CCBReader/CCBReader_v2.cpp \
|
||||
kazmath/src/aabb.c \
|
||||
kazmath/src/mat3.c \
|
||||
kazmath/src/mat4.c \
|
||||
kazmath/src/neon_matrix_impl.c \
|
||||
kazmath/src/plane.c \
|
||||
kazmath/src/quaternion.c \
|
||||
kazmath/src/ray2.c \
|
||||
kazmath/src/utility.c \
|
||||
kazmath/src/vec2.c \
|
||||
kazmath/src/vec3.c \
|
||||
kazmath/src/vec4.c \
|
||||
kazmath/src/GL/mat4stack.c \
|
||||
kazmath/src/GL/matrix.c \
|
||||
keypad_dispatcher/CCKeypadDelegate.cpp \
|
||||
keypad_dispatcher/CCKeypadDispatcher.cpp \
|
||||
label_nodes/CCLabelAtlas.cpp \
|
||||
label_nodes/CCLabelBMFont.cpp \
|
||||
label_nodes/CCLabelTTF.cpp \
|
||||
layers_scenes_transitions_nodes/CCLayer.cpp \
|
||||
layers_scenes_transitions_nodes/CCScene.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionPageTurn.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransition.cpp \
|
||||
layers_scenes_transitions_nodes/CCTransitionProgress.cpp \
|
||||
menu_nodes/CCMenu.cpp \
|
||||
menu_nodes/CCMenuItem.cpp \
|
||||
misc_nodes/CCMotionStreak.cpp \
|
||||
misc_nodes/CCProgressTimer.cpp \
|
||||
misc_nodes/CCRenderTexture.cpp \
|
||||
particle_nodes/CCParticleExamples.cpp \
|
||||
particle_nodes/CCParticleSystem.cpp \
|
||||
particle_nodes/CCParticleBatchNode.cpp \
|
||||
particle_nodes/CCParticleSystemQuad.cpp \
|
||||
platform/CCSAXParser.cpp \
|
||||
platform/CCThread.cpp \
|
||||
platform/platform.cpp \
|
||||
platform/CCEGLViewProtocol.cpp \
|
||||
platform/android/CCEGLView.cpp \
|
||||
platform/android/CCAccelerometer.cpp \
|
||||
platform/android/CCApplication.cpp \
|
||||
platform/android/CCCommon.cpp \
|
||||
platform/android/CCFileUtils.cpp \
|
||||
platform/android/CCImage.cpp \
|
||||
platform/android/jni/JniHelper.cpp \
|
||||
platform/android/jni/IMEJni.cpp \
|
||||
platform/android/jni/MessageJni.cpp \
|
||||
platform/android/jni/SensorJni.cpp \
|
||||
platform/android/jni/SystemInfoJni.cpp \
|
||||
platform/android/jni/TouchesJni.cpp \
|
||||
script_support/CCScriptSupport.cpp \
|
||||
shaders/ccShaders.cpp \
|
||||
shaders/CCGLProgram.cpp \
|
||||
shaders/ccGLStateCache.cpp \
|
||||
shaders/CCShaderCache.cpp \
|
||||
sprite_nodes/CCAnimation.cpp \
|
||||
sprite_nodes/CCAnimationCache.cpp \
|
||||
sprite_nodes/CCSprite.cpp \
|
||||
sprite_nodes/CCSpriteBatchNode.cpp \
|
||||
sprite_nodes/CCSpriteFrame.cpp \
|
||||
sprite_nodes/CCSpriteFrameCache.cpp \
|
||||
support/CCProfiling.cpp \
|
||||
support/CCPointExtension.cpp \
|
||||
support/TransformUtils.cpp \
|
||||
support/CCUserDefault.cpp \
|
||||
support/base64.cpp \
|
||||
support/ccUtils.cpp \
|
||||
support/CCVertex.cpp \
|
||||
support/image_support/TGAlib.cpp \
|
||||
support/zip_support/ZipUtils.cpp \
|
||||
support/zip_support/ioapi.cpp \
|
||||
support/zip_support/unzip.cpp \
|
||||
text_input_node/CCIMEDispatcher.cpp \
|
||||
text_input_node/CCTextFieldTTF.cpp \
|
||||
textures/CCTexture2D.cpp \
|
||||
textures/CCTextureAtlas.cpp \
|
||||
textures/CCTextureCache.cpp \
|
||||
textures/CCTexturePVR.cpp \
|
||||
tileMap_parallax_nodes/CCParallaxNode.cpp \
|
||||
tileMap_parallax_nodes/CCTMXLayer.cpp \
|
||||
tileMap_parallax_nodes/CCTMXObjectGroup.cpp \
|
||||
tileMap_parallax_nodes/CCTMXTiledMap.cpp \
|
||||
tileMap_parallax_nodes/CCTMXXMLParser.cpp \
|
||||
tileMap_parallax_nodes/CCTileMapAtlas.cpp \
|
||||
touch_dispatcher/CCTouchDispatcher.cpp \
|
||||
touch_dispatcher/CCTouchHandler.cpp
|
||||
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/ \
|
||||
$(LOCAL_PATH)/actions \
|
||||
$(LOCAL_PATH)/base_nodes \
|
||||
$(LOCAL_PATH)/cocoa \
|
||||
$(LOCAL_PATH)/effects \
|
||||
$(LOCAL_PATH)/extensions \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/kazmath/include \
|
||||
$(LOCAL_PATH)/keypad_dispatcher \
|
||||
$(LOCAL_PATH)/label_nodes \
|
||||
$(LOCAL_PATH)/layers_scenes_transitions_nodes \
|
||||
$(LOCAL_PATH)/menu_nodes \
|
||||
$(LOCAL_PATH)/misc_nodes \
|
||||
$(LOCAL_PATH)/particle_nodes \
|
||||
$(LOCAL_PATH)/platform \
|
||||
$(LOCAL_PATH)/platform/android \
|
||||
$(LOCAL_PATH)/script_support \
|
||||
$(LOCAL_PATH)/shaders \
|
||||
$(LOCAL_PATH)/sprite_nodes \
|
||||
$(LOCAL_PATH)/support \
|
||||
$(LOCAL_PATH)/text_input_node \
|
||||
$(LOCAL_PATH)/textures \
|
||||
$(LOCAL_PATH)/tileMap_parallax_nodes \
|
||||
$(LOCAL_PATH)/touch_dispatcher
|
||||
|
||||
|
||||
LOCAL_EXPORT_LDLIBS := -llog\
|
||||
-lz \
|
||||
-lGLESv2
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/ \
|
||||
$(LOCAL_PATH)/actions \
|
||||
$(LOCAL_PATH)/base_nodes \
|
||||
$(LOCAL_PATH)/cocoa \
|
||||
$(LOCAL_PATH)/effects \
|
||||
$(LOCAL_PATH)/extensions \
|
||||
$(LOCAL_PATH)/include \
|
||||
$(LOCAL_PATH)/kazmath/include \
|
||||
$(LOCAL_PATH)/keypad_dispatcher \
|
||||
$(LOCAL_PATH)/label_nodes \
|
||||
$(LOCAL_PATH)/layers_scenes_transitions_nodes \
|
||||
$(LOCAL_PATH)/menu_nodes \
|
||||
$(LOCAL_PATH)/misc_nodes \
|
||||
$(LOCAL_PATH)/particle_nodes \
|
||||
$(LOCAL_PATH)/platform \
|
||||
$(LOCAL_PATH)/platform/android \
|
||||
$(LOCAL_PATH)/script_support \
|
||||
$(LOCAL_PATH)/shaders \
|
||||
$(LOCAL_PATH)/sprite_nodes \
|
||||
$(LOCAL_PATH)/support \
|
||||
$(LOCAL_PATH)/text_input_node \
|
||||
$(LOCAL_PATH)/textures \
|
||||
$(LOCAL_PATH)/tileMap_parallax_nodes \
|
||||
$(LOCAL_PATH)/touch_dispatcher
|
||||
|
||||
|
||||
LOCAL_LDLIBS := -lGLESv2 \
|
||||
-lEGL \
|
||||
-llog \
|
||||
-lz
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_libpng_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jpeg_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libxml2_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_libtiff_static
|
||||
|
||||
|
||||
# define the macro to compile through support/zip_support/ioapi.c
|
||||
LOCAL_CFLAGS := -DUSE_FILE32API
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
|
||||
$(call import-module,libjpeg)
|
||||
$(call import-module,libpng)
|
||||
$(call import-module,libxml2)
|
||||
$(call import-module,libtiff)
|
||||
|
||||
|
|
|
@ -104,6 +104,11 @@ CCConfiguration* CCConfiguration::sharedConfiguration(void)
|
|||
return s_gSharedConfiguration;
|
||||
}
|
||||
|
||||
void CCConfiguration::purgeConfiguration(void)
|
||||
{
|
||||
CC_SAFE_RELEASE_NULL(s_gSharedConfiguration);
|
||||
}
|
||||
|
||||
bool CCConfiguration::checkForGLExtension(const string &searchName)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
|
|
@ -39,9 +39,10 @@ NS_CC_BEGIN
|
|||
class CC_DLL CCConfiguration : public CCObject
|
||||
{
|
||||
public:
|
||||
/** returns a shared instance of the CCConfiguration */
|
||||
/** returns a shared instance of CCConfiguration */
|
||||
static CCConfiguration *sharedConfiguration(void);
|
||||
|
||||
/** purge the shared instance of CCConfiguration */
|
||||
static void purgeConfiguration(void);
|
||||
public:
|
||||
|
||||
/** OpenGL Max texture size. */
|
||||
|
|
|
@ -54,6 +54,7 @@ THE SOFTWARE.
|
|||
#include "CCEGLView.h"
|
||||
#include "extensions/CCNotificationCenter/CCNotificationCenter.h"
|
||||
#include "extensions/CCTextureWatcher/CCTextureWatcher.h"
|
||||
#include "extensions/CCBReader/CCBCustomClass.h"
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
@ -582,14 +583,16 @@ void CCDirector::purgeDirector()
|
|||
|
||||
// purge all managers / caches
|
||||
CCAnimationCache::purgeSharedAnimationCache();
|
||||
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
||||
CCSpriteFrameCache::purgeSharedSpriteFrameCache();
|
||||
CCTextureCache::purgeSharedTextureCache();
|
||||
CCShaderCache::purgeSharedShaderCache();
|
||||
|
||||
CCConfiguration::purgeConfiguration();
|
||||
|
||||
// cocos2d-x specific data structures
|
||||
CCUserDefault::purgeSharedUserDefault();
|
||||
extension::CCNotificationCenter::purgeNotificationCenter();
|
||||
extension::CCTextureWatcher::purgeTextureWatcher();
|
||||
extension::CCBCustomClassFactory::purgeFactory();
|
||||
|
||||
ccGLInvalidateStateCache();
|
||||
|
||||
|
@ -718,9 +721,9 @@ void CCDirector::createStatsLabel()
|
|||
CC_SAFE_RELEASE_NULL(m_pSPFLabel);
|
||||
CC_SAFE_RELEASE_NULL(m_pDrawsLabel);
|
||||
|
||||
m_pFPSLabel = CCLabelBMFont::labelWithString("00.0", "fonts/fps_images.fnt");
|
||||
m_pSPFLabel = CCLabelBMFont::labelWithString("0.000", "fonts/fps_images.fnt");
|
||||
m_pDrawsLabel = CCLabelBMFont::labelWithString("000", "fonts/fps_images.fnt");
|
||||
m_pFPSLabel = CCLabelBMFont::labelWithString("00.0", "fps_images.fnt");
|
||||
m_pSPFLabel = CCLabelBMFont::labelWithString("0.000", "fps_images.fnt");
|
||||
m_pDrawsLabel = CCLabelBMFont::labelWithString("000", "fps_images.fnt");
|
||||
|
||||
m_pFPSLabel->retain();
|
||||
m_pSPFLabel->retain();
|
||||
|
|
|
@ -263,9 +263,6 @@ public:
|
|||
|
||||
virtual void mainLoop(void) = 0;
|
||||
|
||||
/** rotates the screen if an orientation different than Portrait is used */
|
||||
void applyOrientation(void);
|
||||
|
||||
/** The size in pixels of the surface. It could be different than the screen size.
|
||||
High-res devices might have a higher surface size than the screen size.
|
||||
Only available when compiled using SDK >= 4.0.
|
||||
|
|
|
@ -226,7 +226,7 @@ void ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor
|
|||
CC_INCREMENT_GL_DRAWS(1);
|
||||
}
|
||||
|
||||
void ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter)
|
||||
void ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -265,7 +265,7 @@ void ccDrawCircle( const CCPoint& center, float radius, float angle, int segment
|
|||
CC_INCREMENT_GL_DRAWS(1);
|
||||
}
|
||||
|
||||
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments)
|
||||
void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
@ -294,7 +294,7 @@ void ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoi
|
|||
CC_INCREMENT_GL_DRAWS(1);
|
||||
}
|
||||
|
||||
void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments)
|
||||
void ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments)
|
||||
{
|
||||
lazy_init();
|
||||
|
||||
|
|
|
@ -73,17 +73,17 @@ void CC_DLL ccDrawPoly( const CCPoint *vertices, unsigned int numOfVertices, boo
|
|||
void CC_DLL ccDrawFilledPoly( const CCPoint *poli, unsigned int numberOfPoints, ccColor4F color );
|
||||
|
||||
/** draws a circle given the center, radius and number of segments. */
|
||||
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, int segments, bool drawLineToCenter);
|
||||
void CC_DLL ccDrawCircle( const CCPoint& center, float radius, float angle, unsigned int segments, bool drawLineToCenter);
|
||||
|
||||
/** draws a quad bezier path
|
||||
@since v0.8
|
||||
*/
|
||||
void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, int segments);
|
||||
void CC_DLL ccDrawQuadBezier(const CCPoint& origin, const CCPoint& control, const CCPoint& destination, unsigned int segments);
|
||||
|
||||
/** draws a cubic bezier path
|
||||
@since v0.8
|
||||
*/
|
||||
void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, int segments);
|
||||
void CC_DLL ccDrawCubicBezier(const CCPoint& origin, const CCPoint& control1, const CCPoint& control2, const CCPoint& destination, unsigned int segments);
|
||||
|
||||
/** set the drawing color with 4 unsigned bytes
|
||||
@since v2.0
|
||||
|
|
|
@ -103,7 +103,7 @@ CCObject* CCShow::copyWithZone(CCZone *pZone) {
|
|||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -141,7 +141,7 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
|
|||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCFiniteTimeAction::copyWithZone(pZone);
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -149,21 +149,41 @@ CCObject* CCHide::copyWithZone(CCZone *pZone) {
|
|||
//
|
||||
// ToggleVisibility
|
||||
//
|
||||
CCToggleVisibility * CCToggleVisibility::action() {
|
||||
CCToggleVisibility * CCToggleVisibility::action()
|
||||
{
|
||||
CCToggleVisibility *pRet = new CCToggleVisibility();
|
||||
|
||||
if (pRet) {
|
||||
if (pRet)
|
||||
{
|
||||
pRet->autorelease();
|
||||
}
|
||||
|
||||
return pRet;
|
||||
}
|
||||
|
||||
void CCToggleVisibility::update(ccTime time) {
|
||||
void CCToggleVisibility::update(ccTime time)
|
||||
{
|
||||
CC_UNUSED_PARAM(time);
|
||||
m_pTarget->setIsVisible(!m_pTarget->getIsVisible());
|
||||
}
|
||||
|
||||
CCObject* CCToggleVisibility::copyWithZone(CCZone *pZone)
|
||||
{
|
||||
CCZone *pNewZone = NULL;
|
||||
CCToggleVisibility *pRet = NULL;
|
||||
|
||||
if (pZone && pZone->m_pCopyObject) {
|
||||
pRet = (CCToggleVisibility*) (pZone->m_pCopyObject);
|
||||
} else {
|
||||
pRet = new CCToggleVisibility();
|
||||
pZone = pNewZone = new CCZone(pRet);
|
||||
}
|
||||
|
||||
CCActionInstant::copyWithZone(pZone);
|
||||
CC_SAFE_DELETE(pNewZone);
|
||||
return pRet;
|
||||
}
|
||||
|
||||
//
|
||||
// FlipX
|
||||
//
|
||||
|
|
|
@ -96,6 +96,7 @@ public:
|
|||
virtual ~CCToggleVisibility(){}
|
||||
//super method
|
||||
virtual void update(ccTime time);
|
||||
virtual CCObject* copyWithZone(CCZone *pZone);
|
||||
public:
|
||||
//override static method
|
||||
/** Allocates and initializes the action */
|
||||
|
|
|
@ -30,7 +30,7 @@ NS_CC_BEGIN
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "cocos2d-2.0-rc0a-x-0.1.0";
|
||||
return "cocos2d-2.0-rc0a-x-2.0";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
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 "CCBCustomClass.h"
|
||||
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
static CCBCustomClassFactory* g_pFactoryInstance = NULL;
|
||||
|
||||
// CCBCustomClassFactory
|
||||
CCBCustomClassFactory::CCBCustomClassFactory()
|
||||
{
|
||||
m_pCustomCreatorsMap = new CUSTOM_CLASS_MAP;
|
||||
}
|
||||
|
||||
CCBCustomClassFactory::~CCBCustomClassFactory()
|
||||
{
|
||||
CC_SAFE_DELETE(m_pCustomCreatorsMap);
|
||||
}
|
||||
|
||||
CCBCustomClassFactory* CCBCustomClassFactory::sharedFactory()
|
||||
{
|
||||
if (g_pFactoryInstance == NULL)
|
||||
{
|
||||
g_pFactoryInstance = new CCBCustomClassFactory();
|
||||
}
|
||||
return g_pFactoryInstance;
|
||||
}
|
||||
|
||||
void CCBCustomClassFactory::purgeFactory()
|
||||
{
|
||||
CC_SAFE_DELETE(g_pFactoryInstance);
|
||||
}
|
||||
|
||||
bool CCBCustomClassFactory::registCustomClass(const char* name, FUNC_CUSTON_CLASS_CREATOR pfnCreator)
|
||||
{
|
||||
bool bRetVal = false;
|
||||
|
||||
if (! (*m_pCustomCreatorsMap)[name] )
|
||||
{
|
||||
(*m_pCustomCreatorsMap)[name] = pfnCreator;
|
||||
bRetVal = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("CCB: key = [%s] in m_pCustomCreatorsMap is already registed", name);
|
||||
}
|
||||
|
||||
return bRetVal;
|
||||
}
|
||||
|
||||
CCBCustomClassProtocol* CCBCustomClassFactory::createCustomClassWithName(const char* name)
|
||||
{
|
||||
CCBCustomClassProtocol* pRetVal = NULL;
|
||||
FUNC_CUSTON_CLASS_CREATOR pfnCreator = (*m_pCustomCreatorsMap)[name];
|
||||
|
||||
if (pfnCreator)
|
||||
{
|
||||
CCLOG("CCB: creating [%s] object", name);
|
||||
pRetVal = pfnCreator();
|
||||
}
|
||||
|
||||
return pRetVal;
|
||||
}
|
||||
|
|
@ -0,0 +1,100 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
|
||||
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 _CC_CUSTOM_CLASS_H_
|
||||
#define _CC_CUSTOM_CLASS_H_
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include <map>
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
@brief This is a simple reflection implement for custom classes in CocosBuilder
|
||||
|
||||
You should declare your custom class like:
|
||||
class MyCustomLayer : public CCBCustomClass, public CCLayer
|
||||
CCBCustomClass is a pure virtual class. It doesn't inherit CCObject to prevent dead-diamond.
|
||||
*/
|
||||
class CCBCustomClassProtocol
|
||||
{
|
||||
public:
|
||||
/** You should implement this static function in your custom class, and return a valid object */
|
||||
static CCBCustomClassProtocol* createInstance() { return NULL; }; // cannot create virual class here
|
||||
|
||||
CCBCustomClassProtocol() {};
|
||||
virtual ~CCBCustomClassProtocol() {};
|
||||
|
||||
/** This pure virtual methods should be implemented in your custom class
|
||||
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
|
||||
virtual bool callbackSetChildren(const char* name, cocos2d::CCObject* node) = 0;
|
||||
|
||||
/** This pure virtual methods should be implemented in your custom class
|
||||
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
|
||||
virtual cocos2d::SEL_MenuHandler callbackGetSelectors(const char* selectorName) = 0;
|
||||
|
||||
/** This pure virtual methods should be implemented in your custom class
|
||||
please refer to tests/ExtensionsTest/CocosBuilderTest as a sample */
|
||||
virtual void callbackAfterCCBLoaded() = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
@brief CCBCustomClass should be registed into this factory, then CCBReader can create your custom class via its name string.
|
||||
|
||||
See tests/Extensionstest/CocosBuilderTest/CocosBuilderTest.cpp as the reference
|
||||
*/
|
||||
class CC_DLL CCBCustomClassFactory
|
||||
{
|
||||
private:
|
||||
/// a function pointer for CCCustomClassProtocol::createInstance
|
||||
typedef CCBCustomClassProtocol* (*FUNC_CUSTON_CLASS_CREATOR)();
|
||||
typedef std::map<std::string, FUNC_CUSTON_CLASS_CREATOR> CUSTOM_CLASS_MAP;
|
||||
CUSTOM_CLASS_MAP* m_pCustomCreatorsMap;
|
||||
|
||||
public:
|
||||
CCBCustomClassFactory();
|
||||
virtual ~CCBCustomClassFactory();
|
||||
|
||||
/** get the singleton */
|
||||
static CCBCustomClassFactory* sharedFactory();
|
||||
|
||||
/** purge the singleton */
|
||||
static void purgeFactory();
|
||||
|
||||
/** Note that you should regist custom class before invoke CCBReader::nodeGraphFromFile
|
||||
For example:
|
||||
CCBCustomClassFactory::sharedFactory()->registCustomClass("HelloCocosBuilder",
|
||||
HelloCocosBuilder::createInstance);
|
||||
*/
|
||||
bool registCustomClass(const char* name, FUNC_CUSTON_CLASS_CREATOR pfnCreator);
|
||||
|
||||
/** This function is only used in CCBReader. Developers don't need to know it */
|
||||
CCBCustomClassProtocol* createCustomClassWithName(const char* name);
|
||||
|
||||
|
||||
};
|
||||
|
||||
NS_CC_EXT_END;
|
||||
|
||||
#endif // _CC_CUSTOM_CLASS_H_
|
|
@ -0,0 +1,126 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
Copyright (c) 2012 XiaoLong Zhang, Chukong 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 __CCB_READER_H__
|
||||
#define __CCB_READER_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCBCustomClass.h"
|
||||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
/**
|
||||
@brief Parse CCB file which is generated by CocosBuilder
|
||||
@warning support CocosBuilder v1 currently. I will update this to v3 when CCB format is stable
|
||||
*/
|
||||
class CC_DLL CCBReader : public CCObject
|
||||
{
|
||||
public:
|
||||
static CCNode* nodeGraphFromFile(const char* ccbFileName, CCNode* owner = NULL);
|
||||
|
||||
private:
|
||||
static CCNode* nodeGraphFromDictionary(CCDictionary* dict,
|
||||
CCDictionary* extraProps,
|
||||
const char* ccbFilePath,
|
||||
CCNode* owner);
|
||||
static CCNode* createCustomClassWithName(CCString* className);
|
||||
|
||||
static CCNode* ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extraProps,
|
||||
const char* assetsDir, CCNode* owner, CCNode* root);
|
||||
|
||||
// read different types of values from dict
|
||||
|
||||
static int intValFromDict(CCDictionary* dict, const std::string key);
|
||||
|
||||
static float floatValFromDict(CCDictionary* dict, const std::string key);
|
||||
|
||||
static bool boolValFromDict(CCDictionary* dict, const std::string key);
|
||||
|
||||
static CCPoint pointValFromDict(CCDictionary* dict, const std::string key);
|
||||
|
||||
static CCSize sizeValFromDict(CCDictionary* dict, const std::string key);
|
||||
|
||||
static ccColor3B ccColor3ValFromDict(CCDictionary* dict,
|
||||
const std::string key);
|
||||
|
||||
static ccColor4F ccColor4fValFromDict(CCDictionary* dict,
|
||||
const std::string key);
|
||||
|
||||
static ccBlendFunc blendFuncValFromDict(CCDictionary* dict,
|
||||
const std::string key);
|
||||
|
||||
private:
|
||||
// set properties
|
||||
|
||||
static void setExtraProp(CCObject* prop, const char* key, int tag, CCDictionary* dict);
|
||||
|
||||
static void setPropsForNode(CCNode* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForSprite(CCSprite* node, CCDictionary* props,
|
||||
CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForLabelBMFont(CCLabelBMFont* node, CCDictionary* props,
|
||||
CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForParticleSystem(CCParticleSystem* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForMenu(CCMenu* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForMenuItem(CCMenuItem* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForMenuItemImage(CCMenuItemImage* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForLayer(CCLayer* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForLayerColor(CCLayerColor* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
static void setPropsForLayerGradient(CCLayerGradient* node, CCDictionary* props, CCDictionary* extraProps);
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
kCCBMemberVarAssignmentTypeNone = 0,
|
||||
kCCBMemberVarAssignmentTypeDocumentRoot = 1,
|
||||
kCCBMemberVarAssignmentTypeOwner = 2,
|
||||
};
|
||||
|
||||
enum {
|
||||
kInvalidRelativePosition = 0,
|
||||
kBottomLeft = 1,
|
||||
kBottom = 2,
|
||||
kBottomRight = 3,
|
||||
kCenterLeft = 4,
|
||||
kCenter = 5,
|
||||
kCenterRight = 6,
|
||||
kTopLeft = 7,
|
||||
kTop = 8,
|
||||
kTopRight = 9,
|
||||
};
|
||||
}; // end of class CCBReader
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
||||
#endif // __CCB_READER_H__
|
|
@ -0,0 +1,707 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
Copyright (c) 2012 XiaoLong Zhang, Chukong 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 "CCBReader.h"
|
||||
#include "CCBCustomClass.h"
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
// Read value from dictionary
|
||||
|
||||
int CCBReader::intValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return valueString? valueString->intValue() : 0;
|
||||
}
|
||||
|
||||
float CCBReader::floatValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return valueString? valueString->floatValue() : 0.0f;
|
||||
}
|
||||
|
||||
bool CCBReader::boolValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return (valueString && valueString->intValue()) ? true : false;
|
||||
}
|
||||
|
||||
CCPoint CCBReader::pointValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*)dict->objectForKey(key.c_str());
|
||||
|
||||
if (!arr)
|
||||
{
|
||||
return ccp(0,0);
|
||||
}
|
||||
|
||||
float x = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
float y = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
return ccp(x, y);
|
||||
}
|
||||
|
||||
CCSize CCBReader::sizeValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
if (!arr)
|
||||
{
|
||||
return CCSize(0, 0);
|
||||
}
|
||||
|
||||
float w = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
float h = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
return CCSize(w, h);
|
||||
}
|
||||
|
||||
ccColor3B CCBReader::ccColor3ValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
int r = ((CCString*)arr->objectAtIndex(0))->intValue();
|
||||
int g = ((CCString*)arr->objectAtIndex(1))->intValue();
|
||||
int b = ((CCString*)arr->objectAtIndex(2))->intValue();
|
||||
|
||||
return ccc3(r, g, b);
|
||||
}
|
||||
|
||||
ccColor4F CCBReader::ccColor4fValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
ccColor4F color;
|
||||
color.r = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
color.g = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
color.b = ((CCString*)arr->objectAtIndex(2))->floatValue();
|
||||
color.a = ((CCString*)arr->objectAtIndex(3))->floatValue();
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
ccBlendFunc CCBReader::blendFuncValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
int src = ((CCString*)arr->objectAtIndex(0))->intValue();
|
||||
int dst = ((CCString*)arr->objectAtIndex(1))->intValue();
|
||||
|
||||
ccBlendFunc blendFunc;
|
||||
blendFunc.src = src;
|
||||
blendFunc.dst = dst;
|
||||
|
||||
return blendFunc;
|
||||
}
|
||||
|
||||
// set extra properties
|
||||
|
||||
void CCBReader::setExtraProp(CCObject* prop, const char* key, int tag, CCDictionary* dict)
|
||||
{
|
||||
std::string tagString;
|
||||
tagString += tag;
|
||||
CCDictionary* props = (CCDictionary*) dict->objectForKey(tagString.c_str());
|
||||
|
||||
if (!props)
|
||||
{
|
||||
props = new CCDictionary();
|
||||
dict->setObject(props, tagString.c_str());
|
||||
}
|
||||
|
||||
props->setObject(prop, key);
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenuItem(CCMenuItem* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setIsEnabled(boolValFromDict(props, "isEnabled"));
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp((CCDictionary*) props->objectForKey("selector"), "selector", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("target"), "target", node->getTag(), extraProps);
|
||||
CCString* spriteFramesFile = (CCString*) props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteFramesFile)
|
||||
{
|
||||
setExtraProp(spriteFramesFile, "spriteSheetFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenuItemImage(CCMenuItemImage* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFileNormal"), "spriteFileNormal", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("spriteFileSelected"), "spriteFileSelected", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("spriteFileDisabled"), "spriteFileDisabled", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayerColor(CCLayerColor* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayer(CCLayer* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("touchEnabled"), "touchEnabled", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("accelerometerEnabled"), "accelerometerEnabled", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("mouseEnabled"), "mouseEnabled", node->getTag() ,extraProps);
|
||||
setExtraProp(props->objectForKey("keyboardEnabled"), "keyboardEnabled", node->getTag(), extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setIsTouchEnabled(boolValFromDict(props, "touchEnabled"));
|
||||
node->setIsAccelerometerEnabled(boolValFromDict(props, "accelerometerEnabled"));
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenu(CCMenu* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLabelBMFont(CCLabelBMFont* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("fontFile"), "fontFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForParticleSystem(CCParticleSystem* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setEmitterMode(intValFromDict(props, "emitterMode"));
|
||||
node->setEmissionRate(floatValFromDict(props, "emissionRate"));
|
||||
node->setDuration(floatValFromDict(props, "duration"));
|
||||
node->setPosVar(pointValFromDict(props, "posVar"));
|
||||
node->setTotalParticles(intValFromDict(props, "totalParticles"));
|
||||
node->setLife(floatValFromDict(props, "life"));
|
||||
node->setLifeVar(floatValFromDict(props, "lifeVar"));
|
||||
node->setStartSize(intValFromDict(props, "startSize"));
|
||||
node->setStartSizeVar(intValFromDict(props, "startSizeVar"));
|
||||
node->setEndSize(intValFromDict(props, "endSize"));
|
||||
node->setEndSizeVar(intValFromDict(props, "endSizeVar"));
|
||||
|
||||
if (dynamic_cast<CCParticleSystemQuad*>(node))
|
||||
{
|
||||
node->setStartSpin(intValFromDict(props, "startSpin"));
|
||||
node->setStartSpinVar(intValFromDict(props, "startSpinVar"));
|
||||
node->setEndSpin(intValFromDict(props, "endSpin"));
|
||||
node->setEndSpinVar(intValFromDict(props, "endSpinVar"));
|
||||
}
|
||||
|
||||
node->setStartColor(ccColor4fValFromDict(props, "startColor"));
|
||||
node->setStartColorVar(ccColor4fValFromDict(props, "startColorVar"));
|
||||
node->setEndColor(ccColor4fValFromDict(props, "endColor"));
|
||||
node->setEndColorVar(ccColor4fValFromDict(props, "endColorVar"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
|
||||
if (node->getEmitterMode() == kCCParticleModeGravity)
|
||||
{
|
||||
node->setGravity(pointValFromDict(props, "gravity"));
|
||||
node->setAngle(intValFromDict(props, "angle"));
|
||||
node->setAngleVar(intValFromDict(props, "angleVar"));
|
||||
node->setSpeed(intValFromDict(props, "speed"));
|
||||
node->setSpeedVar(intValFromDict(props, "speedVar"));
|
||||
node->setTangentialAccel(intValFromDict(props, "tangentialAccel"));
|
||||
node->setTangentialAccelVar(intValFromDict(props, "tangentialAccelVar"));
|
||||
node->setRadialAccel(intValFromDict(props, "radialAccel"));
|
||||
node->setRadialAccelVar(intValFromDict(props, "radialAccelVar"));
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setStartRadius(intValFromDict(props, "startRadius"));
|
||||
node->setStartRadiusVar(intValFromDict(props, "startRadiusVar"));
|
||||
node->setEndRadius(intValFromDict(props, "endRadius"));
|
||||
node->setEndRadiusVar(intValFromDict(props, "endRadiusVar"));
|
||||
node->setRotatePerSecond(intValFromDict(props, "rotatePerSecond"));
|
||||
node->setRotatePerSecondVar(intValFromDict(props, "rotatePerSecondVar"));
|
||||
}
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFile"), "spriteFile", node->getTag(), extraProps);
|
||||
}
|
||||
node->setPositionType(kCCPositionTypeGrouped);
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayerGradient(CCLayerGradient* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setStartColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setStartOpacity(intValFromDict(props, "opacity"));
|
||||
node->setEndColor(ccColor3ValFromDict(props, "endColor"));
|
||||
node->setEndOpacity(intValFromDict(props, "endOpacity"));
|
||||
node->setVector(pointValFromDict(props, "vector"));
|
||||
}
|
||||
|
||||
CCNode* CCBReader::createCustomClassWithName(CCString* className)
|
||||
{
|
||||
CCNode* pRetVal = NULL;
|
||||
|
||||
if (className && className->length())
|
||||
{
|
||||
CCBCustomClassProtocol* pNewClass = CCBCustomClassFactory::sharedFactory()->createCustomClassWithName(className->getCString());
|
||||
pRetVal = dynamic_cast<CCNode*>(pNewClass);
|
||||
pRetVal->autorelease();
|
||||
}
|
||||
|
||||
return pRetVal;
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForSprite(CCSprite* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setFlipX(boolValFromDict(props, "flipX"));
|
||||
node->setFlipY(boolValFromDict(props, "flipY"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFile"), "spriteFile", node->getTag(), extraProps);
|
||||
CCString* spriteFramesFile = (CCString*) props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteFramesFile)
|
||||
{
|
||||
setExtraProp(spriteFramesFile, "spriteSheetFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForNode(CCNode* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
CCPoint position = pointValFromDict(props, "position");
|
||||
node->setPosition(position);
|
||||
|
||||
if (dynamic_cast<CCSprite*>(node) == NULL &&
|
||||
dynamic_cast<CCMenuItemImage*>(node) == NULL &&
|
||||
dynamic_cast<CCLabelBMFont*>(node) == NULL)
|
||||
{
|
||||
CCSize size = sizeValFromDict(props, "contentSize");
|
||||
//node->setContentSize(size);
|
||||
}
|
||||
|
||||
node->setScaleX(floatValFromDict(props, "scaleX"));
|
||||
node->setScaleY(floatValFromDict(props, "scaleY"));
|
||||
node->setAnchorPoint(pointValFromDict(props, "anchorPoint"));
|
||||
node->setRotation(floatValFromDict(props, "rotation"));
|
||||
node->setIsRelativeAnchorPoint(boolValFromDict(props, "isRelativeAnchorPoint"));
|
||||
node->setIsVisible(boolValFromDict(props, "visible"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
if (node->getTag() == -1)
|
||||
{
|
||||
node->setTag(extraProps->count() + 1);
|
||||
}
|
||||
|
||||
setExtraProp(props->objectForKey("tag"), "tag", node->getTag(), extraProps);
|
||||
|
||||
setExtraProp((CCDictionary*) props->objectForKey("customClass"), "customClass", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("memberVarAssignmentType"), "memberVarAssignmentType", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("memberVarAssignmentName"), "memberVarAssignmentName", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("lockedScaleRatio"), "lockedScaleRatio", node->getTag(), extraProps);
|
||||
|
||||
// Expanded nodes
|
||||
bool isExpanded;
|
||||
CCString* isExpandedObj = (CCString*) props->objectForKey("isExpanded");
|
||||
|
||||
if (isExpandedObj) {
|
||||
isExpanded = !isExpandedObj->m_sString.empty();
|
||||
} else {
|
||||
isExpanded = true;
|
||||
}
|
||||
|
||||
setExtraProp(isExpandedObj, "isExpanded", node->getTag(), extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setTag(intValFromDict(props, "tag"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extraProps,
|
||||
const char* assetsDir, CCNode* owner, CCNode* root)
|
||||
{
|
||||
CCString* className = (CCString*) dict->objectForKey("class");
|
||||
CCDictionary* props = (CCDictionary*) dict->objectForKey("properties");
|
||||
CCArray* children = (CCArray*) dict->objectForKey("children");
|
||||
|
||||
CCString* customClass = (CCString*)props->objectForKey("customClass");
|
||||
|
||||
if (extraProps) customClass = NULL;
|
||||
|
||||
CCNode* node = NULL;
|
||||
|
||||
if (className->m_sString.compare("CCParticleSystem") == 0)
|
||||
{
|
||||
CCString* spriteFile = new CCString(assetsDir);
|
||||
spriteFile->m_sString += ((CCString*)props->objectForKey("spriteFile"))->m_sString;
|
||||
|
||||
CCParticleSystem* sys = new CCParticleSystemQuad();
|
||||
sys->autorelease();
|
||||
sys->initWithTotalParticles(2048);
|
||||
sys->setTexture(CCTextureCache::sharedTextureCache()->addImage(spriteFile->m_sString.c_str()));
|
||||
CC_SAFE_RELEASE_NULL(spriteFile);
|
||||
|
||||
node = (CCNode*)sys;
|
||||
|
||||
setPropsForNode((CCNode*)node, (CCDictionary*) props, extraProps);
|
||||
setPropsForParticleSystem((CCParticleSystem*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCMenuItemImage") == 0)
|
||||
{
|
||||
CCString* spriteFileNormal = new CCString(assetsDir);
|
||||
spriteFileNormal->m_sString += ((CCString*)props->objectForKey("spriteFileNormal"))->getCString();
|
||||
CCString* spriteFileSelected = new CCString(assetsDir);
|
||||
spriteFileSelected->m_sString += ((CCString*)props->objectForKey("spriteFileSelected"))->getCString();
|
||||
CCString* spriteFileDisabled = new CCString(assetsDir);
|
||||
spriteFileDisabled->m_sString += ((CCString*)props->objectForKey("spriteFileDisabled"))->getCString();
|
||||
|
||||
CCSprite* spriteNormal = NULL;
|
||||
CCSprite* spriteSelected = NULL;
|
||||
CCSprite* spriteDisabled = NULL;
|
||||
|
||||
CCString* spriteSheetFile = (CCString*)props->objectForKey("spriteFramesFile");
|
||||
if (spriteSheetFile && !spriteSheetFile->length()) {
|
||||
spriteSheetFile->m_sString.insert(0, assetsDir);
|
||||
}
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
|
||||
|
||||
spriteNormal = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileNormal"))->getCString());
|
||||
spriteSelected = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileSelected"))->getCString());
|
||||
spriteDisabled = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileDisabled"))->getCString());
|
||||
// TBD: how to defense if exception raise here?
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteNormal = CCSprite::spriteWithFile(spriteFileNormal->m_sString.c_str());
|
||||
spriteSelected = CCSprite::spriteWithFile(spriteFileSelected->m_sString.c_str());
|
||||
spriteDisabled = CCSprite::spriteWithFile(spriteFileDisabled->m_sString.c_str());
|
||||
}
|
||||
|
||||
//deallocate
|
||||
CC_SAFE_RELEASE_NULL(spriteFileNormal);
|
||||
CC_SAFE_RELEASE_NULL(spriteFileSelected);
|
||||
CC_SAFE_RELEASE_NULL(spriteFileDisabled);
|
||||
|
||||
if (!spriteNormal) spriteNormal = CCSprite::spriteWithFile("missing-texture.png");
|
||||
if (!spriteSelected) spriteSelected = CCSprite::spriteWithFile("missing-texture.png");
|
||||
if (!spriteDisabled) spriteDisabled = CCSprite::spriteWithFile("missing-texture.png");
|
||||
|
||||
CCNode *target = NULL ;
|
||||
if ( extraProps == NULL )
|
||||
{
|
||||
int targetType = ((CCString*)(props->objectForKey("target")))->intValue() ;
|
||||
if ( targetType == kCCBMemberVarAssignmentTypeDocumentRoot )
|
||||
target = (CCNode*)root ;
|
||||
else if ( targetType == kCCBMemberVarAssignmentTypeOwner )
|
||||
target = (CCNode*)owner ;
|
||||
|
||||
}
|
||||
|
||||
CCString *selectorName = (CCString*)props->objectForKey("selector") ;
|
||||
SEL_MenuHandler sel = NULL;
|
||||
|
||||
if ( selectorName->length() )
|
||||
{
|
||||
sel = dynamic_cast<CCBCustomClassProtocol*>(target)->callbackGetSelectors(selectorName->getCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! CCMenuItemImage target doesn't respond to selector %@",selectorName) ;
|
||||
target = NULL ;
|
||||
}
|
||||
|
||||
node = (CCNode*)CCMenuItemImage::itemWithNormalSprite((CCNode*) spriteNormal, (CCNode*) spriteSelected, (CCNode*) spriteDisabled, target, sel);
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenuItem((CCMenuItem*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenuItemImage((CCMenuItemImage*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCMenu") == 0)
|
||||
{
|
||||
node = (CCNode*)CCMenu::menuWithItems(NULL);
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenu((CCMenu*)node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLabelBMFont") == 0)
|
||||
{
|
||||
CCString* fontFile = new CCString(assetsDir);
|
||||
fontFile->m_sString += ((CCString*)props->objectForKey("fontFile"))->m_sString;
|
||||
CCString* stringText = ((CCString*)props->objectForKey("string"));
|
||||
|
||||
node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(),
|
||||
fontFile->m_sString.c_str() );
|
||||
|
||||
CC_SAFE_RELEASE_NULL(fontFile);
|
||||
|
||||
if (!node) node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(), "missing-font.fnt");
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLabelBMFont((CCLabelBMFont*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCSprite") == 0)
|
||||
{
|
||||
CCString* spriteFile = new CCString(assetsDir);
|
||||
spriteFile->m_sString += ((CCString*)props->objectForKey("spriteFile"))->m_sString;
|
||||
CCString* spriteSheetFile = (CCString*)props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
spriteSheetFile->m_sString.insert(0, assetsDir);
|
||||
}
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
|
||||
node = (CCNode*)CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFile"))->m_sString.c_str());
|
||||
// TBD: how to defense if exception raise here?
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("spriteFile->m_string.cstr is %s\n", spriteFile->m_sString.c_str()) ;
|
||||
node = (CCNode*)CCSprite::spriteWithFile(spriteFile->m_sString.c_str());
|
||||
}
|
||||
|
||||
CC_SAFE_RELEASE_NULL(spriteFile);
|
||||
|
||||
if (!node) node = (CCNode*)CCSprite::spriteWithFile("missing-texture.png");
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForSprite((CCSprite*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayerGradient") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayerGradient*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayerGradient::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerColor((CCLayerColor*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerGradient((CCLayerGradient*) node, (CCDictionary*) props, extraProps);
|
||||
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayerColor") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayerColor*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayerColor::node();
|
||||
}
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerColor((CCLayerColor*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayer") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayer*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayer::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCNode") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCNode*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCNode::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! Class of type %@ couldn't be found", className);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!root) root = node;
|
||||
|
||||
// Add children
|
||||
for (unsigned int i = 0; i < children->count(); i++)
|
||||
{
|
||||
CCDictionary* childDict = (CCDictionary*) children->objectAtIndex(i);
|
||||
CCNode* child = ccObjectFromDictionary(childDict, extraProps, assetsDir, owner, root);
|
||||
int zOrder = intValFromDict((CCDictionary*) childDict->objectForKey("properties"), "zOrder");
|
||||
|
||||
if (child && node)
|
||||
{
|
||||
node->addChild(child, zOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! Failed to add child to node");
|
||||
}
|
||||
}
|
||||
|
||||
if ( !extraProps )
|
||||
{
|
||||
CCString* assignmentName = (CCString*)props->objectForKey("memberVarAssignmentName");
|
||||
CCLOG("assignmentName is %s", assignmentName->getCString()) ;
|
||||
int assignmentType = ((CCString*)(props->objectForKey("memberVarAssignmentType")))->intValue() ;
|
||||
|
||||
if ( !assignmentName->m_sString.empty() &&
|
||||
assignmentType)
|
||||
{
|
||||
CCBCustomClassProtocol* assignTo = NULL ;
|
||||
if ( assignmentType == kCCBMemberVarAssignmentTypeOwner )
|
||||
{
|
||||
assignTo = dynamic_cast<CCBCustomClassProtocol*>(owner);
|
||||
}
|
||||
else if ( assignmentType == kCCBMemberVarAssignmentTypeDocumentRoot )
|
||||
{
|
||||
assignTo = dynamic_cast<CCBCustomClassProtocol*>(root);
|
||||
}
|
||||
|
||||
if ( assignTo != NULL )
|
||||
{
|
||||
CCLOG("assign [%s]", assignmentName->getCString());
|
||||
assignTo->callbackSetChildren(assignmentName->getCString(), node);
|
||||
}
|
||||
}
|
||||
if (customClass->length())
|
||||
{
|
||||
CCBCustomClassProtocol* pCustom = dynamic_cast<CCBCustomClassProtocol*>(node);
|
||||
if (pCustom)
|
||||
{
|
||||
pCustom->callbackAfterCCBLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
// initialize ccbreader
|
||||
|
||||
CCNode* CCBReader::nodeGraphFromDictionary(CCDictionary* dict,
|
||||
CCDictionary* extraProps,
|
||||
const char* assetsDir,
|
||||
CCNode* owner)
|
||||
{
|
||||
if (!dict)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load invalid file type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCString* fileType = (CCString*) dict->objectForKey("fileType");
|
||||
int fileVersion = ((CCString*) dict->objectForKey("fileVersion"))->intValue();
|
||||
|
||||
if (!fileType || fileType->m_sString.compare("CocosBuilder") != 0)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load invalid file type");
|
||||
}
|
||||
|
||||
if (fileVersion > 1)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load file made with a newer version of CocosBuilder, please update the CCBReader class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCDictionary* nodeGraph = (CCDictionary*) dict->objectForKey("nodeGraph");
|
||||
return ccObjectFromDictionary(nodeGraph, extraProps, assetsDir, owner, NULL);
|
||||
}
|
||||
|
||||
CCNode* CCBReader::nodeGraphFromFile(const char* file, CCNode* owner)
|
||||
{
|
||||
CCLOG("CCBReader path is: %s", file);
|
||||
std::string ccbFilePath(file);
|
||||
std::string ccbFileDir;
|
||||
|
||||
// find ccbFileDir before "/" or "\"
|
||||
// for example, if ccbFilePath = "CocosBuilder/example.ccb",
|
||||
// then we should make ccbFileDir = "CocosBuilder/"
|
||||
size_t lastSlash = ccbFilePath.find_last_of("/");
|
||||
if (lastSlash != std::string::npos)
|
||||
{
|
||||
ccbFileDir = ccbFilePath.substr(0, lastSlash) + "/";
|
||||
}
|
||||
|
||||
CCDictionary* dict = CCDictionary::dictionaryWithContentsOfFile(ccbFilePath.c_str());
|
||||
CCAssert(dict != NULL, "CCBReader: file not found");
|
||||
return nodeGraphFromDictionary(dict, NULL, ccbFileDir.c_str(), owner);
|
||||
}
|
||||
|
|
@ -0,0 +1,768 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2012 cocos2d-x.org
|
||||
Copyright (c) 2012 XiaoLong Zhang, Chukong 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 "CCBReader.h"
|
||||
#include "CCBCustomClass.h"
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
// Read value from dictionary
|
||||
|
||||
int CCBReader::intValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return valueString? valueString->intValue() : 0;
|
||||
}
|
||||
|
||||
float CCBReader::floatValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return valueString? valueString->floatValue() : 0.0f;
|
||||
}
|
||||
|
||||
bool CCBReader::boolValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCString* valueString = (CCString*) dict->objectForKey(key.c_str());
|
||||
return (valueString && valueString->intValue()) ? true : false;
|
||||
}
|
||||
|
||||
CCPoint CCBReader::pointValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*)dict->objectForKey(key.c_str());
|
||||
|
||||
if (!arr)
|
||||
{
|
||||
return ccp(0,0);
|
||||
}
|
||||
|
||||
float x = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
float y = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
return ccp(x, y);
|
||||
}
|
||||
|
||||
CCSize CCBReader::sizeValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
if (!arr)
|
||||
{
|
||||
return CCSize(0, 0);
|
||||
}
|
||||
|
||||
float w = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
float h = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
return CCSize(w, h);
|
||||
}
|
||||
|
||||
ccColor3B CCBReader::ccColor3ValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
int r = ((CCString*)arr->objectAtIndex(0))->intValue();
|
||||
int g = ((CCString*)arr->objectAtIndex(1))->intValue();
|
||||
int b = ((CCString*)arr->objectAtIndex(2))->intValue();
|
||||
|
||||
return ccc3(r, g, b);
|
||||
}
|
||||
|
||||
ccColor4F CCBReader::ccColor4fValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
ccColor4F color;
|
||||
color.r = ((CCString*)arr->objectAtIndex(0))->floatValue();
|
||||
color.g = ((CCString*)arr->objectAtIndex(1))->floatValue();
|
||||
color.b = ((CCString*)arr->objectAtIndex(2))->floatValue();
|
||||
color.a = ((CCString*)arr->objectAtIndex(3))->floatValue();
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
ccBlendFunc CCBReader::blendFuncValFromDict(CCDictionary* dict, const std::string key)
|
||||
{
|
||||
CCArray* arr = (CCArray*) dict->objectForKey(key.c_str());
|
||||
|
||||
int src = ((CCString*)arr->objectAtIndex(0))->intValue();
|
||||
int dst = ((CCString*)arr->objectAtIndex(1))->intValue();
|
||||
|
||||
ccBlendFunc blendFunc;
|
||||
blendFunc.src = src;
|
||||
blendFunc.dst = dst;
|
||||
|
||||
return blendFunc;
|
||||
}
|
||||
|
||||
// set extra properties
|
||||
|
||||
void CCBReader::setExtraProp(CCObject* prop, const char* key, int tag, CCDictionary* dict)
|
||||
{
|
||||
std::string tagString;
|
||||
tagString += tag;
|
||||
CCDictionary* props = (CCDictionary*) dict->objectForKey(tagString.c_str());
|
||||
|
||||
if (!props)
|
||||
{
|
||||
props = new CCDictionary();
|
||||
dict->setObject(props, tagString.c_str());
|
||||
}
|
||||
|
||||
props->setObject(prop, key);
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenuItem(CCMenuItem* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setIsEnabled(boolValFromDict(props, "isEnabled"));
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp((CCDictionary*) props->objectForKey("selector"), "selector", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("target"), "target", node->getTag(), extraProps);
|
||||
CCString* spriteFramesFile = (CCString*) props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteFramesFile)
|
||||
{
|
||||
setExtraProp(spriteFramesFile, "spriteSheetFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenuItemImage(CCMenuItemImage* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFileNormal"), "spriteFileNormal", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("spriteFileSelected"), "spriteFileSelected", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("spriteFileDisabled"), "spriteFileDisabled", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayerColor(CCLayerColor* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayer(CCLayer* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("touchEnabled"), "touchEnabled", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("accelerometerEnabled"), "accelerometerEnabled", node->getTag(), extraProps);
|
||||
setExtraProp(props->objectForKey("mouseEnabled"), "mouseEnabled", node->getTag() ,extraProps);
|
||||
setExtraProp(props->objectForKey("keyboardEnabled"), "keyboardEnabled", node->getTag(), extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setIsTouchEnabled(boolValFromDict(props, "touchEnabled"));
|
||||
node->setIsAccelerometerEnabled(boolValFromDict(props, "accelerometerEnabled"));
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForMenu(CCMenu* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
if (extraProps)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLabelBMFont(CCLabelBMFont* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("fontFile"), "fontFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForParticleSystem(CCParticleSystem* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setEmitterMode(intValFromDict(props, "emitterMode"));
|
||||
node->setEmissionRate(floatValFromDict(props, "emissionRate"));
|
||||
node->setDuration(floatValFromDict(props, "duration"));
|
||||
node->setPosVar(pointValFromDict(props, "posVar"));
|
||||
node->setTotalParticles(intValFromDict(props, "totalParticles"));
|
||||
node->setLife(floatValFromDict(props, "life"));
|
||||
node->setLifeVar(floatValFromDict(props, "lifeVar"));
|
||||
node->setStartSize(intValFromDict(props, "startSize"));
|
||||
node->setStartSizeVar(intValFromDict(props, "startSizeVar"));
|
||||
node->setEndSize(intValFromDict(props, "endSize"));
|
||||
node->setEndSizeVar(intValFromDict(props, "endSizeVar"));
|
||||
|
||||
if (dynamic_cast<CCParticleSystemQuad*>(node))
|
||||
{
|
||||
node->setStartSpin(intValFromDict(props, "startSpin"));
|
||||
node->setStartSpinVar(intValFromDict(props, "startSpinVar"));
|
||||
node->setEndSpin(intValFromDict(props, "endSpin"));
|
||||
node->setEndSpinVar(intValFromDict(props, "endSpinVar"));
|
||||
}
|
||||
|
||||
node->setStartColor(ccColor4fValFromDict(props, "startColor"));
|
||||
node->setStartColorVar(ccColor4fValFromDict(props, "startColorVar"));
|
||||
node->setEndColor(ccColor4fValFromDict(props, "endColor"));
|
||||
node->setEndColorVar(ccColor4fValFromDict(props, "endColorVar"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
|
||||
if (node->getEmitterMode() == kCCParticleModeGravity)
|
||||
{
|
||||
node->setGravity(pointValFromDict(props, "gravity"));
|
||||
node->setAngle(intValFromDict(props, "angle"));
|
||||
node->setAngleVar(intValFromDict(props, "angleVar"));
|
||||
node->setSpeed(intValFromDict(props, "speed"));
|
||||
node->setSpeedVar(intValFromDict(props, "speedVar"));
|
||||
node->setTangentialAccel(intValFromDict(props, "tangentialAccel"));
|
||||
node->setTangentialAccelVar(intValFromDict(props, "tangentialAccelVar"));
|
||||
node->setRadialAccel(intValFromDict(props, "radialAccel"));
|
||||
node->setRadialAccelVar(intValFromDict(props, "radialAccelVar"));
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setStartRadius(intValFromDict(props, "startRadius"));
|
||||
node->setStartRadiusVar(intValFromDict(props, "startRadiusVar"));
|
||||
node->setEndRadius(intValFromDict(props, "endRadius"));
|
||||
node->setEndRadiusVar(intValFromDict(props, "endRadiusVar"));
|
||||
node->setRotatePerSecond(intValFromDict(props, "rotatePerSecond"));
|
||||
node->setRotatePerSecondVar(intValFromDict(props, "rotatePerSecondVar"));
|
||||
}
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFile"), "spriteFile", node->getTag(), extraProps);
|
||||
}
|
||||
node->setPositionType(kCCPositionTypeGrouped);
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForLayerGradient(CCLayerGradient* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setStartColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setStartOpacity(intValFromDict(props, "opacity"));
|
||||
node->setEndColor(ccColor3ValFromDict(props, "endColor"));
|
||||
node->setEndOpacity(intValFromDict(props, "endOpacity"));
|
||||
node->setVector(pointValFromDict(props, "vector"));
|
||||
}
|
||||
|
||||
CCNode* CCBReader::createCustomClassWithName(CCString* className)
|
||||
{
|
||||
CCNode* pRetVal = NULL;
|
||||
|
||||
if (className && className->length())
|
||||
{
|
||||
CCBCustomClassProtocol* pNewClass = CCBCustomClassFactory::sharedFactory()->createCustomClassWithName(className->getCString());
|
||||
pRetVal = dynamic_cast<CCNode*>(pNewClass);
|
||||
pRetVal->autorelease();
|
||||
}
|
||||
|
||||
return pRetVal;
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForSprite(CCSprite* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
node->setOpacity(intValFromDict(props, "opacity"));
|
||||
node->setColor(ccColor3ValFromDict(props, "color"));
|
||||
node->setFlipX(boolValFromDict(props, "flipX"));
|
||||
node->setFlipY(boolValFromDict(props, "flipY"));
|
||||
node->setBlendFunc(blendFuncValFromDict(props, "blendFunc"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
setExtraProp(props->objectForKey("spriteFile"), "spriteFile", node->getTag(), extraProps);
|
||||
CCString* spriteFramesFile = (CCString*) props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteFramesFile)
|
||||
{
|
||||
setExtraProp(spriteFramesFile, "spriteSheetFile", node->getTag(), extraProps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCBReader::setPropsForNode(CCNode* node, CCDictionary* props, CCDictionary* extraProps)
|
||||
{
|
||||
CCPoint position = pointValFromDict(props, "position");
|
||||
int refPointType = intValFromDict(props, "refPointType");
|
||||
|
||||
if (refPointType == kInvalidRelativePosition)
|
||||
{
|
||||
// normal process.
|
||||
node->setPosition(position);
|
||||
}
|
||||
else
|
||||
{
|
||||
// support walzer's relative position
|
||||
CCPoint positionRelative = pointValFromDict(props, "positionRelative");
|
||||
CCPoint refPoint(0,0);
|
||||
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
switch (refPointType)
|
||||
{
|
||||
case kInvalidRelativePosition:
|
||||
|
||||
case kBottomLeft:
|
||||
refPoint.x = 0;
|
||||
refPoint.y = 0;
|
||||
break;
|
||||
case kBottom:
|
||||
refPoint.x = screenSize.width / 2;
|
||||
refPoint.y = 0;
|
||||
break;
|
||||
case kBottomRight:
|
||||
refPoint.x = screenSize.width;
|
||||
refPoint.y = 0;
|
||||
break;
|
||||
case kCenterLeft:
|
||||
refPoint.x = 0;
|
||||
refPoint.y = screenSize.height / 2;
|
||||
break;
|
||||
case kCenter:
|
||||
refPoint.x = screenSize.width / 2;
|
||||
refPoint.y = screenSize.height / 2;
|
||||
break;
|
||||
case kCenterRight:
|
||||
refPoint.x = screenSize.width;
|
||||
refPoint.y = screenSize.height / 2;
|
||||
break;
|
||||
case kTopLeft:
|
||||
refPoint.x = 0;
|
||||
refPoint.y = screenSize.height;
|
||||
break;
|
||||
case kTop:
|
||||
refPoint.x = screenSize.width / 2;
|
||||
refPoint.y = screenSize.height;
|
||||
break;
|
||||
case kTopRight:
|
||||
refPoint.x = screenSize.width;
|
||||
refPoint.y = screenSize.height;
|
||||
break;
|
||||
default:
|
||||
CCLOG("CCReader::setPropsForNode, unexcpeted refPointType");
|
||||
}
|
||||
|
||||
position.x = positionRelative.x + refPoint.x;
|
||||
position.y = positionRelative.y + refPoint.y;
|
||||
node->setPosition(position);
|
||||
}
|
||||
|
||||
if (dynamic_cast<CCSprite*>(node) == NULL &&
|
||||
dynamic_cast<CCMenuItemImage*>(node) == NULL &&
|
||||
dynamic_cast<CCLabelBMFont*>(node) == NULL)
|
||||
{
|
||||
CCSize size = sizeValFromDict(props, "contentSize");
|
||||
//node->setContentSize(size);
|
||||
}
|
||||
|
||||
node->setScaleX(floatValFromDict(props, "scaleX"));
|
||||
node->setScaleY(floatValFromDict(props, "scaleY"));
|
||||
node->setAnchorPoint(pointValFromDict(props, "anchorPoint"));
|
||||
node->setRotation(floatValFromDict(props, "rotation"));
|
||||
node->setIsRelativeAnchorPoint(boolValFromDict(props, "isRelativeAnchorPoint"));
|
||||
node->setIsVisible(boolValFromDict(props, "visible"));
|
||||
|
||||
if (extraProps)
|
||||
{
|
||||
if (node->getTag() == -1)
|
||||
{
|
||||
node->setTag(extraProps->count() + 1);
|
||||
}
|
||||
|
||||
setExtraProp(props->objectForKey("tag"), "tag", node->getTag(), extraProps);
|
||||
|
||||
setExtraProp((CCDictionary*) props->objectForKey("customClass"), "customClass", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("memberVarAssignmentType"), "memberVarAssignmentType", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("memberVarAssignmentName"), "memberVarAssignmentName", node->getTag(), extraProps);
|
||||
setExtraProp((CCDictionary*) props->objectForKey("lockedScaleRatio"), "lockedScaleRatio", node->getTag(), extraProps);
|
||||
|
||||
// Expanded nodes
|
||||
bool isExpanded;
|
||||
CCString* isExpandedObj = (CCString*) props->objectForKey("isExpanded");
|
||||
|
||||
if (isExpandedObj) {
|
||||
isExpanded = !isExpandedObj->m_sString.empty();
|
||||
} else {
|
||||
isExpanded = true;
|
||||
}
|
||||
|
||||
setExtraProp(isExpandedObj, "isExpanded", node->getTag(), extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
node->setTag(intValFromDict(props, "tag"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CCNode* CCBReader::ccObjectFromDictionary(CCDictionary* dict, CCDictionary* extraProps,
|
||||
const char* assetsDir, CCNode* owner, CCNode* root)
|
||||
{
|
||||
CCString* className = (CCString*) dict->objectForKey("class");
|
||||
CCDictionary* props = (CCDictionary*) dict->objectForKey("properties");
|
||||
CCArray* children = (CCArray*) dict->objectForKey("children");
|
||||
|
||||
CCString* customClass = (CCString*)props->objectForKey("customClass");
|
||||
|
||||
if (extraProps) customClass = NULL;
|
||||
|
||||
CCNode* node = NULL;
|
||||
|
||||
if (className->m_sString.compare("CCParticleSystem") == 0)
|
||||
{
|
||||
CCString* spriteFile = new CCString(assetsDir);
|
||||
spriteFile->m_sString += ((CCString*)props->objectForKey("spriteFile"))->m_sString;
|
||||
|
||||
CCParticleSystem* sys = new CCParticleSystemQuad();
|
||||
sys->autorelease();
|
||||
sys->initWithTotalParticles(2048);
|
||||
sys->setTexture(CCTextureCache::sharedTextureCache()->addImage(spriteFile->m_sString.c_str()));
|
||||
CC_SAFE_RELEASE_NULL(spriteFile);
|
||||
|
||||
node = (CCNode*)sys;
|
||||
|
||||
setPropsForNode((CCNode*)node, (CCDictionary*) props, extraProps);
|
||||
setPropsForParticleSystem((CCParticleSystem*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCMenuItemImage") == 0)
|
||||
{
|
||||
CCString* spriteFileNormal = new CCString(assetsDir);
|
||||
spriteFileNormal->m_sString += ((CCString*)props->objectForKey("spriteFileNormal"))->getCString();
|
||||
CCString* spriteFileSelected = new CCString(assetsDir);
|
||||
spriteFileSelected->m_sString += ((CCString*)props->objectForKey("spriteFileSelected"))->getCString();
|
||||
CCString* spriteFileDisabled = new CCString(assetsDir);
|
||||
spriteFileDisabled->m_sString += ((CCString*)props->objectForKey("spriteFileDisabled"))->getCString();
|
||||
|
||||
CCSprite* spriteNormal = NULL;
|
||||
CCSprite* spriteSelected = NULL;
|
||||
CCSprite* spriteDisabled = NULL;
|
||||
|
||||
CCString* spriteSheetFile = (CCString*)props->objectForKey("spriteFramesFile");
|
||||
if (spriteSheetFile && !spriteSheetFile->length()) {
|
||||
spriteSheetFile->m_sString.insert(0, assetsDir);
|
||||
}
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
|
||||
|
||||
spriteNormal = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileNormal"))->getCString());
|
||||
spriteSelected = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileSelected"))->getCString());
|
||||
spriteDisabled = CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFileDisabled"))->getCString());
|
||||
// TBD: how to defense if exception raise here?
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteNormal = CCSprite::spriteWithFile(spriteFileNormal->m_sString.c_str());
|
||||
spriteSelected = CCSprite::spriteWithFile(spriteFileSelected->m_sString.c_str());
|
||||
spriteDisabled = CCSprite::spriteWithFile(spriteFileDisabled->m_sString.c_str());
|
||||
}
|
||||
|
||||
//deallocate
|
||||
CC_SAFE_RELEASE_NULL(spriteFileNormal);
|
||||
CC_SAFE_RELEASE_NULL(spriteFileSelected);
|
||||
CC_SAFE_RELEASE_NULL(spriteFileDisabled);
|
||||
|
||||
if (!spriteNormal) spriteNormal = CCSprite::spriteWithFile("missing-texture.png");
|
||||
if (!spriteSelected) spriteSelected = CCSprite::spriteWithFile("missing-texture.png");
|
||||
if (!spriteDisabled) spriteDisabled = CCSprite::spriteWithFile("missing-texture.png");
|
||||
|
||||
CCNode *target = NULL ;
|
||||
if ( extraProps == NULL )
|
||||
{
|
||||
int targetType = ((CCString*)(props->objectForKey("target")))->intValue() ;
|
||||
if ( targetType == kCCBMemberVarAssignmentTypeDocumentRoot )
|
||||
target = (CCNode*)root ;
|
||||
else if ( targetType == kCCBMemberVarAssignmentTypeOwner )
|
||||
target = (CCNode*)owner ;
|
||||
|
||||
}
|
||||
|
||||
CCString *selectorName = (CCString*)props->objectForKey("selector") ;
|
||||
SEL_MenuHandler sel = NULL;
|
||||
|
||||
if ( selectorName->length() )
|
||||
{
|
||||
sel = dynamic_cast<CCBCustomClassProtocol*>(target)->callbackGetSelectors(selectorName->getCString());
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! CCMenuItemImage target doesn't respond to selector %@",selectorName) ;
|
||||
target = NULL ;
|
||||
}
|
||||
|
||||
node = (CCNode*)CCMenuItemImage::itemWithNormalSprite((CCNode*) spriteNormal, (CCNode*) spriteSelected, (CCNode*) spriteDisabled, target, sel);
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenuItem((CCMenuItem*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenuItemImage((CCMenuItemImage*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCMenu") == 0)
|
||||
{
|
||||
node = (CCNode*)CCMenu::menuWithItems(NULL);
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForMenu((CCMenu*)node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLabelBMFont") == 0)
|
||||
{
|
||||
CCString* fontFile = new CCString(assetsDir);
|
||||
fontFile->m_sString += ((CCString*)props->objectForKey("fontFile"))->m_sString;
|
||||
CCString* stringText = ((CCString*)props->objectForKey("string"));
|
||||
|
||||
node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(),
|
||||
fontFile->m_sString.c_str() );
|
||||
|
||||
CC_SAFE_RELEASE_NULL(fontFile);
|
||||
|
||||
if (!node) node = (CCNode*)CCLabelBMFont::labelWithString(stringText->m_sString.c_str(), "missing-font.fnt");
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLabelBMFont((CCLabelBMFont*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCSprite") == 0)
|
||||
{
|
||||
CCString* spriteFile = new CCString(assetsDir);
|
||||
spriteFile->m_sString += ((CCString*)props->objectForKey("spriteFile"))->m_sString;
|
||||
CCString* spriteSheetFile = (CCString*)props->objectForKey("spriteFramesFile");
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
spriteSheetFile->m_sString.insert(0, assetsDir);
|
||||
}
|
||||
|
||||
if (spriteSheetFile && !spriteSheetFile->length())
|
||||
{
|
||||
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile(spriteSheetFile->m_sString.c_str());
|
||||
node = (CCNode*)CCSprite::spriteWithSpriteFrameName(((CCString*)props->objectForKey("spriteFile"))->m_sString.c_str());
|
||||
// TBD: how to defense if exception raise here?
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("spriteFile->m_string.cstr is %s\n", spriteFile->m_sString.c_str()) ;
|
||||
node = (CCNode*)CCSprite::spriteWithFile(spriteFile->m_sString.c_str());
|
||||
}
|
||||
|
||||
CC_SAFE_RELEASE_NULL(spriteFile);
|
||||
|
||||
if (!node) node = (CCNode*)CCSprite::spriteWithFile("missing-texture.png");
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForSprite((CCSprite*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayerGradient") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayerGradient*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayerGradient::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerColor((CCLayerColor*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerGradient((CCLayerGradient*) node, (CCDictionary*) props, extraProps);
|
||||
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayerColor") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayerColor*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayerColor::node();
|
||||
}
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayerColor((CCLayerColor*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCLayer") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCLayer*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCLayer::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
setPropsForLayer((CCLayer*) node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else if (className->m_sString.compare("CCNode") == 0)
|
||||
{
|
||||
node = (CCNode*)createCustomClassWithName(customClass) ;
|
||||
|
||||
if (node)
|
||||
{
|
||||
if (dynamic_cast<CCNode*>(node) == NULL)
|
||||
{
|
||||
CCLOG("WARNING! %s is not subclass of CCNode", customClass);
|
||||
delete node;
|
||||
node = NULL;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
node = (CCNode*)CCNode::node();
|
||||
}
|
||||
|
||||
setPropsForNode(node, (CCDictionary*) props, extraProps);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! Class of type %@ couldn't be found", className);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!root) root = node;
|
||||
|
||||
// Add children
|
||||
for (unsigned int i = 0; i < children->count(); i++)
|
||||
{
|
||||
CCDictionary* childDict = (CCDictionary*) children->objectAtIndex(i);
|
||||
CCNode* child = ccObjectFromDictionary(childDict, extraProps, assetsDir, owner, root);
|
||||
int zOrder = intValFromDict((CCDictionary*) childDict->objectForKey("properties"), "zOrder");
|
||||
|
||||
if (child && node)
|
||||
{
|
||||
node->addChild(child, zOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("WARNING! Failed to add child to node");
|
||||
}
|
||||
}
|
||||
|
||||
if ( !extraProps )
|
||||
{
|
||||
CCString* assignmentName = (CCString*)props->objectForKey("memberVarAssignmentName");
|
||||
CCLOG("assignmentName is %s", assignmentName->getCString()) ;
|
||||
int assignmentType = ((CCString*)(props->objectForKey("memberVarAssignmentType")))->intValue() ;
|
||||
|
||||
if ( !assignmentName->m_sString.empty() &&
|
||||
assignmentType)
|
||||
{
|
||||
CCBCustomClassProtocol* assignTo = NULL ;
|
||||
if ( assignmentType == kCCBMemberVarAssignmentTypeOwner )
|
||||
{
|
||||
assignTo = dynamic_cast<CCBCustomClassProtocol*>(owner);
|
||||
}
|
||||
else if ( assignmentType == kCCBMemberVarAssignmentTypeDocumentRoot )
|
||||
{
|
||||
assignTo = dynamic_cast<CCBCustomClassProtocol*>(root);
|
||||
}
|
||||
|
||||
if ( assignTo != NULL )
|
||||
{
|
||||
CCLOG("assign [%s]", assignmentName->getCString());
|
||||
assignTo->callbackSetChildren(assignmentName->getCString(), node);
|
||||
}
|
||||
}
|
||||
if (customClass->length())
|
||||
{
|
||||
CCBCustomClassProtocol* pCustom = dynamic_cast<CCBCustomClassProtocol*>(node);
|
||||
if (pCustom)
|
||||
{
|
||||
pCustom->callbackAfterCCBLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
// initialize ccbreader
|
||||
|
||||
CCNode* CCBReader::nodeGraphFromDictionary(CCDictionary* dict,
|
||||
CCDictionary* extraProps,
|
||||
const char* assetsDir,
|
||||
CCNode* owner)
|
||||
{
|
||||
if (!dict)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load invalid file type");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCString* fileType = (CCString*) dict->objectForKey("fileType");
|
||||
int fileVersion = ((CCString*) dict->objectForKey("fileVersion"))->intValue();
|
||||
|
||||
if (!fileType || fileType->m_sString.compare("CocosBuilder") != 0)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load invalid file type");
|
||||
}
|
||||
|
||||
if (fileVersion > 2)
|
||||
{
|
||||
CCLOG("WARNING! Trying to load file made with a newer version of CocosBuilder, please update the CCBReader class");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
CCDictionary* nodeGraph = (CCDictionary*) dict->objectForKey("nodeGraph");
|
||||
return ccObjectFromDictionary(nodeGraph, extraProps, assetsDir, owner, NULL);
|
||||
}
|
||||
|
||||
CCNode* CCBReader::nodeGraphFromFile(const char* file, CCNode* owner)
|
||||
{
|
||||
CCLOG("CCBReader path is: %s", file);
|
||||
std::string ccbFilePath(file);
|
||||
std::string ccbFileDir;
|
||||
|
||||
// find ccbFileDir before "/" or "\"
|
||||
// for example, if ccbFilePath = "CocosBuilder/example.ccb",
|
||||
// then we should make ccbFileDir = "CocosBuilder/"
|
||||
size_t lastSlash = ccbFilePath.find_last_of("/");
|
||||
if (lastSlash != std::string::npos)
|
||||
{
|
||||
ccbFileDir = ccbFilePath.substr(0, lastSlash) + "/";
|
||||
}
|
||||
|
||||
CCDictionary* dict = CCDictionary::dictionaryWithContentsOfFile(ccbFilePath.c_str());
|
||||
CCAssert(dict != NULL, "CCBReader: file not found");
|
||||
return nodeGraphFromDictionary(dict, NULL, ccbFileDir.c_str(), owner);
|
||||
}
|
||||
|
|
@ -94,8 +94,8 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
|
|||
// Clamp the position of the icon within the circle
|
||||
|
||||
// Get the center point of the bkgd image
|
||||
float centerX = m_startPos.x + m_background->boundingBox().size.width*.5;
|
||||
float centerY = m_startPos.y + m_background->boundingBox().size.height*.5;
|
||||
float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f;
|
||||
float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f;
|
||||
|
||||
// Work out the distance difference between the location and center
|
||||
float dx = sliderPosition.x - centerX;
|
||||
|
@ -106,7 +106,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
|
|||
float angle = atan2f(dy, dx);
|
||||
|
||||
// Set the limit to the slider movement within the colour picker
|
||||
float limit = m_background->boundingBox().size.width*.5;
|
||||
float limit = m_background->boundingBox().size.width*0.5f;
|
||||
|
||||
// Check distance doesn't exceed the bounds of the circle
|
||||
if (dist > limit)
|
||||
|
@ -126,7 +126,7 @@ void CCControlSaturationBrightnessPicker::updateSliderPosition(CCPoint sliderPos
|
|||
else if (sliderPosition.y > m_startPos.y + boxPos + boxSize) sliderPosition.y = m_startPos.y + boxPos + boxSize;
|
||||
|
||||
// Use the position / slider width to determin the percentage the dragger is at
|
||||
m_saturation = 1.0 - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize);
|
||||
m_saturation = 1.0f - fabs((m_startPos.x + (float)boxPos - sliderPosition.x)/(float)boxSize);
|
||||
m_brightness = fabs((m_startPos.y + (float)boxPos - sliderPosition.y)/(float)boxSize);
|
||||
}
|
||||
|
||||
|
@ -135,8 +135,8 @@ bool CCControlSaturationBrightnessPicker::checkSliderPosition(CCPoint location)
|
|||
// Clamp the position of the icon within the circle
|
||||
|
||||
// get the center point of the bkgd image
|
||||
float centerX = m_startPos.x + m_background->boundingBox().size.width*.5;
|
||||
float centerY = m_startPos.y + m_background->boundingBox().size.height*.5;
|
||||
float centerX = m_startPos.x + m_background->boundingBox().size.width*0.5f;
|
||||
float centerY = m_startPos.y + m_background->boundingBox().size.height*0.5f;
|
||||
|
||||
// work out the distance difference between the location and center
|
||||
float dx = location.x - centerX;
|
||||
|
|
|
@ -206,7 +206,7 @@ void CCControlSwitchSprite::needsLayout()
|
|||
m_pOffSprite->getContentSize().height / 2));
|
||||
}
|
||||
|
||||
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight(m_pMaskTexture->getContentSize().width, m_pMaskTexture->getContentSize().height);
|
||||
CCRenderTexture *rt = CCRenderTexture::renderTextureWithWidthAndHeight((int)m_pMaskTexture->getContentSize().width, (int)m_pMaskTexture->getContentSize().height);
|
||||
|
||||
rt->begin();
|
||||
m_pOnSprite->visit();
|
||||
|
@ -358,7 +358,7 @@ void CCControlSwitch::setIsEnabled(bool enabled)
|
|||
{
|
||||
m_bEnabled = enabled;
|
||||
|
||||
m_pSwitchSprite->setOpacity((enabled) ? 255.0f : 128.0f);
|
||||
m_pSwitchSprite->setOpacity((enabled) ? 255 : 128);
|
||||
}
|
||||
|
||||
CCPoint CCControlSwitch::locationFromTouch(CCTouch* pTouch)
|
||||
|
|
|
@ -31,7 +31,7 @@ using namespace std;
|
|||
|
||||
NS_CC_EXT_BEGIN
|
||||
|
||||
#define ND_LISTVIEW_ACTION_INTERVAL 0.6666
|
||||
#define ND_LISTVIEW_ACTION_INTERVAL 0.6666f
|
||||
/******************************************
|
||||
**************Public Functions*************
|
||||
*******************************************/
|
||||
|
@ -1142,6 +1142,9 @@ unsigned int CCListView::triggerNumberOfCells(void)
|
|||
{
|
||||
unsigned int nRow = 0;
|
||||
CCListViewProtrolData data;
|
||||
data.nNumberOfRows = 0;
|
||||
data.nRow = 0;
|
||||
data.cell = NULL;
|
||||
|
||||
if (m_strDeletegate.size() > 0)
|
||||
{
|
||||
|
@ -2151,7 +2154,7 @@ bool CCListView::isMenuTouch(CCTouch *touch, CCNode *parent)
|
|||
CCArray *pChildrens = parent->getChildren();
|
||||
if (pChildrens && pChildrens->count() > 0)
|
||||
{
|
||||
for (int i = 0; i < pChildrens->count(); i++)
|
||||
for (unsigned int i = 0; i < pChildrens->count(); i++)
|
||||
{
|
||||
CCNode *pChildren = (CCNode*)pChildrens->objectAtIndex(i);
|
||||
if (this->isMenuTouch(touch, pChildren))
|
||||
|
|
|
@ -45,7 +45,7 @@ CCTextureWatcher::CCTextureWatcher()
|
|||
|
||||
// layer
|
||||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
size.height *= 0.6;
|
||||
size.height *= 0.6f;
|
||||
m_pLayer->setContentSize(size);
|
||||
|
||||
// the menu of disabling touch event
|
||||
|
@ -256,12 +256,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
|
|||
|
||||
CCSize listItemSize = CCSize(m_pList->getContentSize().width / NUM_PER_PAGE, m_pList->getContentSize().height);
|
||||
|
||||
CCSize size = CCSize(listItemSize.width * 0.9, listItemSize.height * 0.6);
|
||||
CCSize size = CCSize(listItemSize.width * 0.9f, listItemSize.height * 0.6f);
|
||||
|
||||
sprintf(m_pszString, "%d/%d", m_nCurrnetPage, m_nTotalPage);
|
||||
m_labelPage->setString(m_pszString);
|
||||
|
||||
float offX = 0, offY = 0, offsetX = 0, offsetY = 0;
|
||||
float offX = 0.0f, offY = 0.0f, offsetX = 0.0f, offsetY = 0.0f;
|
||||
CC_UNUSED_PARAM(offsetY);
|
||||
int nCount = 0;
|
||||
int nStart = (m_nCurrnetPage - 1) * NUM_PER_PAGE;
|
||||
|
@ -288,8 +288,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
|
|||
{
|
||||
labelCount->setColor(ccc3(255, 0, 0));
|
||||
}
|
||||
offX = offsetX + listItemSize.width * 0.5 - labelCount->getContentSize().width * 0.5;
|
||||
offY = (listItemSize.height - size.height) * 0.5 - labelCount->getContentSize().height;
|
||||
offX = offsetX + listItemSize.width * 0.5f - labelCount->getContentSize().width * 0.5f;
|
||||
offY = (listItemSize.height - size.height) * 0.5f - labelCount->getContentSize().height;
|
||||
labelCount->setPosition(ccp(offX, offY));
|
||||
labelCount->setAnchorPoint(ccp(0, 0));
|
||||
cell->addChild(labelCount);
|
||||
|
@ -297,10 +297,10 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
|
|||
// texture size
|
||||
sprintf(m_pszString, "%.0f*%.0f", textrue->getContentSize().width, textrue->getContentSize().height);
|
||||
CCLabelTTF *labelSize = CCLabelTTF::labelWithString(m_pszString, "Arial", 16);
|
||||
offX = offsetX + listItemSize.width * 0.5;
|
||||
offY = (listItemSize.height - size.height) * 0.5 + size.height;
|
||||
offX = offsetX + listItemSize.width * 0.5f;
|
||||
offY = (listItemSize.height - size.height) * 0.5f + size.height;
|
||||
labelSize->setPosition(ccp(offX, offY));
|
||||
labelSize->setAnchorPoint(ccp(0.5, 0));
|
||||
labelSize->setAnchorPoint(ccp(0.5f, 0));
|
||||
cell->addChild(labelSize);
|
||||
|
||||
// texture name
|
||||
|
@ -313,12 +313,12 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
|
|||
|
||||
string name = key.substr(pos, len - pos);
|
||||
sprintf(m_pszString, "%s", name.c_str());
|
||||
CCSize dimensions = CCSizeMake(listItemSize.width * 0.9, labelSize->getContentSize().height);
|
||||
CCSize dimensions = CCSizeMake(listItemSize.width * 0.9f, labelSize->getContentSize().height);
|
||||
CCLabelTTF *labelName = CCLabelTTF::labelWithString(m_pszString, dimensions, CCTextAlignmentCenter, "Arial", 16);
|
||||
offX = offsetX + listItemSize.width * 0.5;
|
||||
offX = offsetX + listItemSize.width * 0.5f;
|
||||
offY = offY + labelName->getContentSize().height;
|
||||
labelName->setPosition(ccp(offX, offY));
|
||||
labelName->setAnchorPoint(ccp(0.5, 0));
|
||||
labelName->setAnchorPoint(ccp(0.5f, 0));
|
||||
cell->addChild(labelName);
|
||||
|
||||
CCSprite *sprite = CCSprite::spriteWithTexture(textrue);
|
||||
|
@ -341,8 +341,8 @@ void CCTextureWatcher::CCListView_cellForRow(CCListView *listView, CCListViewPro
|
|||
sprite->setScale(scale);
|
||||
spriteSize.width *= scale;
|
||||
spriteSize.height *= scale;
|
||||
offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5;
|
||||
offY = (listItemSize.height - spriteSize.height) * 0.5;
|
||||
offX = offsetX + (listItemSize.width - spriteSize.width) * 0.5f;
|
||||
offY = (listItemSize.height - spriteSize.height) * 0.5f;
|
||||
sprite->setPosition(ccp(offX, offY));
|
||||
cell->addChild(sprite);
|
||||
offsetX += listItemSize.width;
|
||||
|
|
|
@ -92,7 +92,7 @@ kmMat3* const kmMat3Inverse(kmMat3* pOut, const kmScalar pDeterminate, const kmM
|
|||
return NULL;
|
||||
}
|
||||
|
||||
detInv = 1.0 / pDeterminate;
|
||||
detInv = 1.0f / pDeterminate;
|
||||
|
||||
kmMat3Adjugate(&adjugate, pM);
|
||||
kmMat3ScalarMultiply(pOut, &adjugate, detInv);
|
||||
|
|
|
@ -216,7 +216,6 @@ static bool isspace_unicode(unsigned short ch)
|
|||
|
||||
static void cc_utf8_trim_ws(std::vector<unsigned short>* str)
|
||||
{
|
||||
using namespace std;
|
||||
int len = str->size();
|
||||
|
||||
if ( len <= 0 )
|
||||
|
@ -321,14 +320,14 @@ cc_utf8_get_char (const char * p)
|
|||
}
|
||||
|
||||
/*
|
||||
* cc_utf8_from_cstr:
|
||||
* cc_utf16_from_utf8:
|
||||
* @str_old: pointer to the start of a C string.
|
||||
*
|
||||
* Creates a utf8 string from a cstring.
|
||||
*
|
||||
* Return value: the newly created utf8 string.
|
||||
* */
|
||||
static unsigned short* cc_utf8_from_cstr(const char* str_old)
|
||||
static unsigned short* cc_utf16_from_utf8(const char* str_old)
|
||||
{
|
||||
int len = cc_utf8_strlen(str_old, -1);
|
||||
|
||||
|
@ -344,14 +343,15 @@ static unsigned short* cc_utf8_from_cstr(const char* str_old)
|
|||
return str_new;
|
||||
}
|
||||
|
||||
static std::vector<unsigned short> cc_utf8_vec_from_cstr(const unsigned short* str)
|
||||
static std::vector<unsigned short> cc_utf16_vec_from_utf16_str(const unsigned short* str)
|
||||
{
|
||||
int len = cc_wcslen(str);
|
||||
std::vector<unsigned short> str_new;
|
||||
|
||||
for (int i = 0; i < len; ++i)
|
||||
{
|
||||
str_new.push_back(str[i]);
|
||||
|
||||
}
|
||||
return str_new;
|
||||
}
|
||||
|
||||
|
@ -790,7 +790,7 @@ bool CCLabelBMFont::initWithString(const char *theString, const char *fntFile, f
|
|||
m_tImageOffset = imageOffset;
|
||||
m_fWidth = width;
|
||||
CC_SAFE_DELETE_ARRAY(m_sString);
|
||||
m_sString = cc_utf8_from_cstr(theString);
|
||||
m_sString = cc_utf16_from_utf8(theString);
|
||||
m_cOpacity = 255;
|
||||
m_tColor = ccWHITE;
|
||||
m_tContentSize = CCSizeZero;
|
||||
|
@ -864,7 +864,7 @@ void CCLabelBMFont::createFontChars()
|
|||
}
|
||||
|
||||
totalHeight = m_pConfiguration->m_uCommonHeight * quantityOfLines;
|
||||
nextFontPositionY = -(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines);
|
||||
nextFontPositionY = 0-(m_pConfiguration->m_uCommonHeight - m_pConfiguration->m_uCommonHeight * quantityOfLines);
|
||||
|
||||
for (unsigned int i= 0; i < stringLen; i++)
|
||||
{
|
||||
|
@ -943,7 +943,7 @@ void CCLabelBMFont::createFontChars()
|
|||
tmpSize.height = (float) totalHeight;
|
||||
|
||||
this->setContentSize(CC_SIZE_PIXELS_TO_POINTS(tmpSize));
|
||||
|
||||
|
||||
}
|
||||
|
||||
//LabelBMFont - CCLabelProtocol protocol
|
||||
|
@ -955,7 +955,7 @@ void CCLabelBMFont::setString(const char *newString)
|
|||
void CCLabelBMFont::setString(const char *newString, bool fromUpdate)
|
||||
{
|
||||
CC_SAFE_DELETE_ARRAY(m_sString);
|
||||
m_sString = cc_utf8_from_cstr(newString);
|
||||
m_sString = cc_utf16_from_utf8(newString);
|
||||
m_sString_initial = newString;
|
||||
|
||||
updateString(fromUpdate);
|
||||
|
@ -963,7 +963,6 @@ void CCLabelBMFont::setString(const char *newString, bool fromUpdate)
|
|||
|
||||
void CCLabelBMFont::updateString(bool fromUpdate)
|
||||
{
|
||||
|
||||
if (m_pChildren && m_pChildren->count() != 0)
|
||||
{
|
||||
CCObject* child;
|
||||
|
@ -1076,17 +1075,19 @@ void CCLabelBMFont::setAnchorPoint(const CCPoint& point)
|
|||
// LabelBMFont - Alignment
|
||||
void CCLabelBMFont::updateLabel()
|
||||
{
|
||||
this->setString(m_sString_initial.c_str(), true);
|
||||
|
||||
if (m_fWidth > 0)
|
||||
{
|
||||
// Step 1: Make multiline
|
||||
vector<unsigned short> str_whole = cc_utf8_vec_from_cstr(m_sString);
|
||||
vector<unsigned short> str_whole = cc_utf16_vec_from_utf16_str(m_sString);
|
||||
unsigned int stringLength = str_whole.size();
|
||||
vector<unsigned short> multiline_string;
|
||||
multiline_string.reserve( stringLength );
|
||||
vector<unsigned short> last_word;
|
||||
last_word.reserve( stringLength );
|
||||
|
||||
int line = 1, i = 0;
|
||||
unsigned int line = 1, i = 0;
|
||||
bool start_line = false, start_word = false;
|
||||
float startOfLine = -1, startOfWord = -1;
|
||||
int skip = 0;
|
||||
|
@ -1101,7 +1102,7 @@ void CCLabelBMFont::updateLabel()
|
|||
|
||||
if (!characterSprite->getIsVisible()) continue;
|
||||
|
||||
if (i >= stringLength || i < 0)
|
||||
if (i >= stringLength)
|
||||
break;
|
||||
|
||||
unsigned short character = str_whole[i];
|
||||
|
@ -1132,7 +1133,7 @@ void CCLabelBMFont::updateLabel()
|
|||
i++;
|
||||
line++;
|
||||
|
||||
if (i >= stringLength || i < 0)
|
||||
if (i >= stringLength)
|
||||
break;
|
||||
|
||||
character = str_whole[i];
|
||||
|
@ -1195,7 +1196,7 @@ void CCLabelBMFont::updateLabel()
|
|||
startOfLine = -1;
|
||||
line++;
|
||||
|
||||
if (i >= stringLength || i < 0)
|
||||
if (i >= stringLength)
|
||||
break;
|
||||
|
||||
if (!startOfWord)
|
||||
|
@ -1229,7 +1230,9 @@ void CCLabelBMFont::updateLabel()
|
|||
unsigned short* str_new = new unsigned short[size + 1];
|
||||
|
||||
for (int i = 0; i < size; ++i)
|
||||
{
|
||||
str_new[i] = multiline_string[i];
|
||||
}
|
||||
|
||||
str_new[size] = 0;
|
||||
|
||||
|
|
|
@ -285,7 +285,7 @@ bool CCLayer::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
|
|||
{
|
||||
if (m_pScriptHandlerEntry)
|
||||
{
|
||||
return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch);
|
||||
return excuteScriptTouchHandler(CCTOUCHBEGAN, pTouch) == 0 ? false : true;
|
||||
}
|
||||
CC_UNUSED_PARAM(pTouch);
|
||||
CC_UNUSED_PARAM(pEvent);
|
||||
|
|
|
@ -62,7 +62,7 @@ void CCTransitionProgress::onEnter()
|
|||
CCSize size = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// create the second render texture for outScene
|
||||
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight(size.width, size.height);
|
||||
CCRenderTexture *texture = CCRenderTexture::renderTextureWithWidthAndHeight((int)size.width, (int)size.height);
|
||||
texture->getSprite()->setAnchorPoint(ccp(0.5f,0.5f));
|
||||
texture->setPosition(ccp(size.width/2, size.height/2));
|
||||
texture->setAnchorPoint(ccp(0.5f,0.5f));
|
||||
|
|
|
@ -48,6 +48,7 @@ typedef enum {
|
|||
class CC_DLL CCProgressTimer : public CCNode, public CCRGBAProtocol
|
||||
{
|
||||
public:
|
||||
CCProgressTimer();
|
||||
~CCProgressTimer(void);
|
||||
|
||||
/** Change the percentage to change progress. */
|
||||
|
@ -118,9 +119,6 @@ protected:
|
|||
CC_SYNTHESIZE(CCPoint, m_tBarChangeRate, BarChangeRate);
|
||||
|
||||
CC_SYNTHESIZE(bool ,m_bReverseDirection, IsReverseDirection);
|
||||
|
||||
private:
|
||||
CCProgressTimer();
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -308,13 +308,15 @@ bool CCParticleSystem::initWithDictionary(CCDictionary *dictionary)
|
|||
CCAssert( deflated != NULL, "CCParticleSystem: error ungzipping textureImageData");
|
||||
CC_BREAK_IF(!deflated);
|
||||
|
||||
// don't delete image, VolatileTexture use it in CCTextureCache::sharedTextureCache()->addUIImage()
|
||||
// For android, we should retain it in VolatileTexture::addCCImage which invoked in CCTextureCache::sharedTextureCache()->addUIImage()
|
||||
image = new CCImage();
|
||||
bool isOK = image->initWithImageData(deflated, deflatedLen);
|
||||
CCAssert(isOK, "CCParticleSystem: error init image with Data");
|
||||
CC_BREAK_IF(!isOK);
|
||||
|
||||
setTexture(CCTextureCache::sharedTextureCache()->addUIImage(image, fullpath.c_str()));
|
||||
|
||||
image->release();
|
||||
}
|
||||
}
|
||||
CCAssert( this->m_pTexture != NULL, "CCParticleSystem: error loading the texture");
|
||||
|
@ -345,7 +347,7 @@ bool CCParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
|
|||
|
||||
if (m_pBatchNode)
|
||||
{
|
||||
for (int i = 0; i < m_uTotalParticles; i++)
|
||||
for (unsigned int i = 0; i < m_uTotalParticles; i++)
|
||||
{
|
||||
m_pParticles[i].atlasIndex=i;
|
||||
}
|
||||
|
@ -1201,7 +1203,7 @@ void CCParticleSystem::setBatchNode(CCParticleBatchNode* batchNode)
|
|||
|
||||
if( batchNode ) {
|
||||
//each particle needs a unique index
|
||||
for (int i = 0; i < m_uTotalParticles; i++)
|
||||
for (unsigned int i = 0; i < m_uTotalParticles; i++)
|
||||
{
|
||||
m_pParticles[i].atlasIndex=i;
|
||||
}
|
||||
|
|
|
@ -416,7 +416,7 @@ void CCParticleSystemQuad::setTotalParticles(unsigned int tp)
|
|||
// Init particles
|
||||
if (m_pBatchNode)
|
||||
{
|
||||
for (int i = 0; i < m_uTotalParticles; i++)
|
||||
for (unsigned int i = 0; i < m_uTotalParticles; i++)
|
||||
{
|
||||
m_pParticles[i].atlasIndex=i;
|
||||
}
|
||||
|
|
|
@ -66,6 +66,11 @@ void CCEGLViewProtocol::setFrameSize(float width, float height)
|
|||
m_rcViewPort.size.setSize(width, height);
|
||||
}
|
||||
|
||||
CCSize CCEGLViewProtocol::getFrameSize()
|
||||
{
|
||||
return m_sSizeInPixel;
|
||||
}
|
||||
|
||||
void CCEGLViewProtocol::setDesignResolutionSize(float width, float height)
|
||||
{
|
||||
if (width == 0.0f || height == 0.0f)
|
||||
|
@ -78,8 +83,8 @@ void CCEGLViewProtocol::setDesignResolutionSize(float width, float height)
|
|||
// calculate the factor and the rect of viewport
|
||||
m_fScreenScaleFactor = MIN((float)m_sSizeInPixel.width / m_sSizeInPoint.width,
|
||||
(float)m_sSizeInPixel.height / m_sSizeInPoint.height);
|
||||
int viewPortW = (int)(m_sSizeInPoint.width * m_fScreenScaleFactor);
|
||||
int viewPortH = (int)(m_sSizeInPoint.height * m_fScreenScaleFactor);
|
||||
float viewPortW = m_sSizeInPoint.width * m_fScreenScaleFactor;
|
||||
float viewPortH = m_sSizeInPoint.height * m_fScreenScaleFactor;
|
||||
|
||||
m_rcViewPort.setRect((m_sSizeInPixel.width - viewPortW) / 2, (m_sSizeInPixel.height - viewPortH) / 2, viewPortW, viewPortH);
|
||||
|
||||
|
@ -131,8 +136,8 @@ void CCEGLViewProtocol::setViewPortInPoints(float x , float y , float w , float
|
|||
if (m_bNeedScale)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glViewport((GLint)(x * factor) + m_rcViewPort.origin.x,
|
||||
(GLint)(y * factor) + m_rcViewPort.origin.y,
|
||||
glViewport((GLint)(x * factor + m_rcViewPort.origin.x),
|
||||
(GLint)(y * factor + m_rcViewPort.origin.y),
|
||||
(GLsizei)(w * factor),
|
||||
(GLsizei)(h * factor));
|
||||
}
|
||||
|
@ -150,8 +155,8 @@ void CCEGLViewProtocol::setScissorInPoints(float x , float y , float w , float h
|
|||
if (m_bNeedScale)
|
||||
{
|
||||
float factor = m_fScreenScaleFactor / CC_CONTENT_SCALE_FACTOR();
|
||||
glScissor((GLint)(x * factor) + m_rcViewPort.origin.x,
|
||||
(GLint)(y * factor) + m_rcViewPort.origin.y,
|
||||
glScissor((GLint)(x * factor + m_rcViewPort.origin.x),
|
||||
(GLint)(y * factor + m_rcViewPort.origin.y),
|
||||
(GLsizei)(w * factor),
|
||||
(GLsizei)(h * factor));
|
||||
}
|
||||
|
@ -208,12 +213,12 @@ void CCEGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float
|
|||
CCTouch* pTouch = s_pTouches[nUnusedIndex] = new CCTouch();
|
||||
if (m_bNeedScale)
|
||||
{
|
||||
pTouch->SetTouchInfo(nUnusedIndex, (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
pTouch->setTouchInfo(nUnusedIndex, (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
pTouch->SetTouchInfo(nUnusedIndex, x, y);
|
||||
pTouch->setTouchInfo(nUnusedIndex, x, y);
|
||||
}
|
||||
CCInteger* pInterObj = new CCInteger(nUnusedIndex);
|
||||
s_TouchesIntergerDict.setObject(pInterObj, id);
|
||||
|
@ -252,12 +257,12 @@ void CCEGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float
|
|||
{
|
||||
if (m_bNeedScale)
|
||||
{
|
||||
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
pTouch->setTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
pTouch->SetTouchInfo(pIndex->getValue(), x, y);
|
||||
pTouch->setTouchInfo(pIndex->getValue(), x, y);
|
||||
}
|
||||
set.addObject(pTouch);
|
||||
}
|
||||
|
@ -300,12 +305,12 @@ void CCEGLViewProtocol::getSetOfTouchesEndOrCancel(CCSet& set, int num, int ids[
|
|||
|
||||
if (m_bNeedScale)
|
||||
{
|
||||
pTouch->SetTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
pTouch->setTouchInfo(pIndex->getValue(), (x - m_rcViewPort.origin.x) / m_fScreenScaleFactor,
|
||||
(y - m_rcViewPort.origin.y) / m_fScreenScaleFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
pTouch->SetTouchInfo(pIndex->getValue(), x, y);
|
||||
pTouch->setTouchInfo(pIndex->getValue(), x, y);
|
||||
}
|
||||
|
||||
set.addObject(pTouch);
|
||||
|
|
|
@ -25,6 +25,7 @@ public:
|
|||
virtual CCRect getViewPort();
|
||||
virtual CCSize getSize();
|
||||
virtual void setFrameSize(float width, float height);
|
||||
virtual CCSize getFrameSize();
|
||||
virtual void setDesignResolutionSize(float width, float height);
|
||||
virtual void setTouchDelegate(EGLTouchDelegate * pDelegate);
|
||||
virtual float getScreenScaleFactor();
|
||||
|
|
|
@ -25,11 +25,11 @@ THE SOFTWARE.
|
|||
#ifndef __CC_IMAGE_H__
|
||||
#define __CC_IMAGE_H__
|
||||
|
||||
#include "CCCommon.h"
|
||||
#include "CCObject.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL CCImage
|
||||
class CC_DLL CCImage : public CCObject
|
||||
{
|
||||
public:
|
||||
CCImage();
|
||||
|
@ -39,6 +39,7 @@ public:
|
|||
{
|
||||
kFmtJpg = 0,
|
||||
kFmtPng,
|
||||
kFmtTiff,
|
||||
kFmtRawData,
|
||||
kFmtUnKnown
|
||||
}EImageFormat;
|
||||
|
@ -84,7 +85,7 @@ public:
|
|||
*/
|
||||
bool initWithImageData(void * pData,
|
||||
int nDataLen,
|
||||
EImageFormat eFmt = kFmtPng,
|
||||
EImageFormat eFmt = kFmtUnKnown,
|
||||
int nWidth = 0,
|
||||
int nHeight = 0,
|
||||
int nBitsPerComponent = 8);
|
||||
|
@ -112,8 +113,6 @@ public:
|
|||
bool hasAlpha() { return m_bHasAlpha; }
|
||||
bool isPremultipliedAlpha() { return m_bPreMulti; }
|
||||
|
||||
void release();
|
||||
|
||||
/**
|
||||
@brief Save the CCImage data to specified file with specified format.
|
||||
@param pszFilePath the file's absolute path, including file subfix
|
||||
|
@ -121,14 +120,14 @@ public:
|
|||
*/
|
||||
bool saveToFile(const char *pszFilePath, bool bIsToRGB = true);
|
||||
|
||||
CC_SYNTHESIZE_READONLY(short, m_nWidth, Width);
|
||||
CC_SYNTHESIZE_READONLY(short, m_nHeight, Height);
|
||||
CC_SYNTHESIZE_READONLY(unsigned short, m_nWidth, Width);
|
||||
CC_SYNTHESIZE_READONLY(unsigned short, m_nHeight, Height);
|
||||
CC_SYNTHESIZE_READONLY(int, m_nBitsPerComponent, BitsPerComponent);
|
||||
|
||||
protected:
|
||||
bool _initWithJpgData(void *pData, int nDatalen);
|
||||
bool _initWithPngData(void *pData, int nDatalen);
|
||||
|
||||
bool _initWithTiffData(void* pData, int nDataLen);
|
||||
// @warning kFmtRawData only support RGBA8888
|
||||
bool _initWithRawData(void *pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent);
|
||||
|
||||
|
|
|
@ -32,10 +32,22 @@ THE SOFTWARE.
|
|||
#include "CCFileUtils.h"
|
||||
#include "png.h"
|
||||
#include "jpeglib.h"
|
||||
#include "tiffio.h"
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
// premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D,
|
||||
// such as RGB888, RGB5A1
|
||||
#define CC_RGB_PREMULTIPLY_APLHA(vr, vg, vb, va) \
|
||||
(unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \
|
||||
((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \
|
||||
((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16) | \
|
||||
((unsigned)(unsigned char)(va) << 24))
|
||||
|
||||
// on ios, we should use platform/ios/CCImage_ios.mm instead
|
||||
|
||||
typedef struct
|
||||
|
@ -60,8 +72,6 @@ static void pngReadCallback(png_structp png_ptr, png_bytep data, png_size_t leng
|
|||
}
|
||||
}
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Impliment CCImage
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
@ -118,11 +128,61 @@ bool CCImage::initWithImageData(void * pData,
|
|||
bRet = _initWithJpgData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
else if (kFmtTiff == eFmt)
|
||||
{
|
||||
bRet = _initWithTiffData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
else if (kFmtRawData == eFmt)
|
||||
{
|
||||
bRet = _initWithRawData(pData, nDataLen, nWidth, nHeight, nBitsPerComponent);
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if it is a png file buffer.
|
||||
if (nDataLen > 8)
|
||||
{
|
||||
unsigned char* pHead = (unsigned char*)pData;
|
||||
if ( pHead[0] == 0x89
|
||||
&& pHead[1] == 0x50
|
||||
&& pHead[2] == 0x4E
|
||||
&& pHead[3] == 0x47
|
||||
&& pHead[4] == 0x0D
|
||||
&& pHead[5] == 0x0A
|
||||
&& pHead[6] == 0x1A
|
||||
&& pHead[7] == 0x0A)
|
||||
{
|
||||
bRet = _initWithPngData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if it is a tiff file buffer.
|
||||
if (nDataLen > 2)
|
||||
{
|
||||
unsigned char* pHead = (unsigned char*)pData;
|
||||
if ( (pHead[0] == 0x49 && pHead[1] == 0x49)
|
||||
|| (pHead[0] == 0x4d && pHead[1] == 0x4d)
|
||||
)
|
||||
{
|
||||
bRet = _initWithTiffData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// if it is a jpeg file buffer.
|
||||
if (nDataLen > 2)
|
||||
{
|
||||
unsigned char* pHead = (unsigned char*)pData;
|
||||
if ( pHead[0] == 0xff
|
||||
&& pHead[1] == 0xd8)
|
||||
{
|
||||
bRet = _initWithJpgData(pData, nDataLen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
|
@ -184,8 +244,10 @@ bool CCImage::_initWithJpgData(void * data, int nSize)
|
|||
while( cinfo.output_scanline < cinfo.image_height )
|
||||
{
|
||||
jpeg_read_scanlines( &cinfo, row_pointer, 1 );
|
||||
for( i=0; i<cinfo.image_width*cinfo.num_components;i++)
|
||||
for( i=0; i<cinfo.image_width*cinfo.output_components;i++)
|
||||
{
|
||||
m_pData[location++] = row_pointer[0][i];
|
||||
}
|
||||
}
|
||||
|
||||
jpeg_finish_decompress( &cinfo );
|
||||
|
@ -294,7 +356,7 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
|
|||
if (row_pointers)
|
||||
{
|
||||
const unsigned int stride = m_nWidth * channels;
|
||||
for (size_t i = 0; i < m_nHeight; ++i)
|
||||
for (unsigned short i = 0; i < m_nHeight; ++i)
|
||||
{
|
||||
png_uint_32 q = i * stride;
|
||||
row_pointers[i] = (png_bytep)m_pData + q;
|
||||
|
@ -303,18 +365,10 @@ bool CCImage::_initWithPngData(void * pData, int nDatalen)
|
|||
|
||||
if (m_bHasAlpha)
|
||||
{
|
||||
// premultiply alpha, or the effect will wrong when want to use other pixel format in CCTexture2D,
|
||||
// such as RGB888, RGB5A1
|
||||
#define CC_RGB_PREMULTIPLY_APLHA(vr, vg, vb, va) \
|
||||
(unsigned)(((unsigned)((unsigned char)(vr) * ((unsigned char)(va) + 1)) >> 8) | \
|
||||
((unsigned)((unsigned char)(vg) * ((unsigned char)(va) + 1) >> 8) << 8) | \
|
||||
((unsigned)((unsigned char)(vb) * ((unsigned char)(va) + 1) >> 8) << 16) | \
|
||||
((unsigned)(unsigned char)(va) << 24))
|
||||
|
||||
unsigned int *tmp = (unsigned int *)m_pData;
|
||||
for(unsigned int i = 0; i < m_nHeight; i++)
|
||||
for(unsigned short i = 0; i < m_nHeight; i++)
|
||||
{
|
||||
for(int j = 0; j < m_nWidth * channels; j += 4)
|
||||
for(unsigned int j = 0; j < m_nWidth * channels; j += 4)
|
||||
{
|
||||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( row_pointers[i][j], row_pointers[i][j + 1],
|
||||
row_pointers[i][j + 2], row_pointers[i][j + 3] );
|
||||
|
@ -337,6 +391,183 @@ out:
|
|||
return bRet;
|
||||
}
|
||||
|
||||
static tmsize_t _tiffReadProc(thandle_t fd, void* buf, tmsize_t size)
|
||||
{
|
||||
tImageSource* isource = (tImageSource*)fd;
|
||||
uint8* ma;
|
||||
uint64 mb;
|
||||
unsigned long n;
|
||||
unsigned long o;
|
||||
tmsize_t p;
|
||||
ma=(uint8*)buf;
|
||||
mb=size;
|
||||
p=0;
|
||||
while (mb>0)
|
||||
{
|
||||
n=0x80000000UL;
|
||||
if ((uint64)n>mb)
|
||||
n=(unsigned long)mb;
|
||||
|
||||
|
||||
if((int)(isource->offset + n) <= isource->size)
|
||||
{
|
||||
memcpy(ma, isource->data+isource->offset, n);
|
||||
isource->offset += n;
|
||||
o = n;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ma+=o;
|
||||
mb-=o;
|
||||
p+=o;
|
||||
if (o!=n)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static tmsize_t _tiffWriteProc(thandle_t fd, void* buf, tmsize_t size)
|
||||
{
|
||||
CC_UNUSED_PARAM(fd);
|
||||
CC_UNUSED_PARAM(buf);
|
||||
CC_UNUSED_PARAM(size);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static uint64 _tiffSeekProc(thandle_t fd, uint64 off, int whence)
|
||||
{
|
||||
tImageSource* isource = (tImageSource*)fd;
|
||||
uint64 ret = -1;
|
||||
do
|
||||
{
|
||||
if (whence == SEEK_SET)
|
||||
{
|
||||
CC_BREAK_IF(off > isource->size-1);
|
||||
ret = isource->offset = (uint32)off;
|
||||
}
|
||||
else if (whence == SEEK_CUR)
|
||||
{
|
||||
CC_BREAK_IF(isource->offset + off > isource->size-1);
|
||||
ret = isource->offset += (uint32)off;
|
||||
}
|
||||
else if (whence == SEEK_END)
|
||||
{
|
||||
CC_BREAK_IF(off > isource->size-1);
|
||||
ret = isource->offset = (uint32)(isource->size-1 - off);
|
||||
}
|
||||
else
|
||||
{
|
||||
CC_BREAK_IF(off > isource->size-1);
|
||||
ret = isource->offset = (uint32)off;
|
||||
}
|
||||
} while (0);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static uint64 _tiffSizeProc(thandle_t fd)
|
||||
{
|
||||
tImageSource* pImageSrc = (tImageSource*)fd;
|
||||
return pImageSrc->size;
|
||||
}
|
||||
|
||||
static int _tiffCloseProc(thandle_t fd)
|
||||
{
|
||||
CC_UNUSED_PARAM(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int _tiffMapProc(thandle_t fd, void** pbase, toff_t* psize)
|
||||
{
|
||||
CC_UNUSED_PARAM(fd);
|
||||
CC_UNUSED_PARAM(pbase);
|
||||
CC_UNUSED_PARAM(psize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void _tiffUnmapProc(thandle_t fd, void* base, toff_t size)
|
||||
{
|
||||
CC_UNUSED_PARAM(fd);
|
||||
CC_UNUSED_PARAM(base);
|
||||
CC_UNUSED_PARAM(size);
|
||||
}
|
||||
|
||||
bool CCImage::_initWithTiffData(void* pData, int nDataLen)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
// set the read call back function
|
||||
tImageSource imageSource;
|
||||
imageSource.data = (unsigned char*)pData;
|
||||
imageSource.size = nDataLen;
|
||||
imageSource.offset = 0;
|
||||
|
||||
TIFF* tif = TIFFClientOpen("file.tif", "r", (thandle_t)&imageSource,
|
||||
_tiffReadProc, _tiffWriteProc,
|
||||
_tiffSeekProc, _tiffCloseProc, _tiffSizeProc,
|
||||
_tiffMapProc,
|
||||
_tiffUnmapProc);
|
||||
|
||||
CC_BREAK_IF(NULL == tif);
|
||||
|
||||
uint32 w = 0, h = 0;
|
||||
uint16 bitsPerSample = 0, samplePerPixel = 0, planarConfig = 0;
|
||||
size_t npixels = 0;
|
||||
|
||||
TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
|
||||
TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h);
|
||||
TIFFGetField(tif, TIFFTAG_BITSPERSAMPLE, &bitsPerSample);
|
||||
TIFFGetField(tif, TIFFTAG_SAMPLESPERPIXEL, &samplePerPixel);
|
||||
TIFFGetField(tif, TIFFTAG_PLANARCONFIG, &planarConfig);
|
||||
|
||||
npixels = w * h;
|
||||
|
||||
m_bHasAlpha = true;
|
||||
m_nWidth = w;
|
||||
m_nHeight = h;
|
||||
m_nBitsPerComponent = 8;
|
||||
|
||||
m_pData = new unsigned char[npixels * sizeof (uint32)];
|
||||
|
||||
uint32* raster = (uint32*) _TIFFmalloc(npixels * sizeof (uint32));
|
||||
if (raster != NULL)
|
||||
{
|
||||
if (TIFFReadRGBAImageOriented(tif, w, h, raster, ORIENTATION_TOPLEFT, 0))
|
||||
{
|
||||
unsigned char* src = (unsigned char*)raster;
|
||||
unsigned int* tmp = (unsigned int*)m_pData;
|
||||
|
||||
/* the raster data is pre-multiplied by the alpha component
|
||||
after invoking TIFFReadRGBAImageOriented
|
||||
for(int j = 0; j < m_nWidth * m_nHeight * 4; j += 4)
|
||||
{
|
||||
*tmp++ = CC_RGB_PREMULTIPLY_APLHA( src[j], src[j + 1],
|
||||
src[j + 2], src[j + 3] );
|
||||
}
|
||||
*/
|
||||
m_bPreMulti = true;
|
||||
|
||||
memcpy(m_pData, raster, npixels*sizeof (uint32));
|
||||
}
|
||||
|
||||
_TIFFfree(raster);
|
||||
}
|
||||
|
||||
|
||||
TIFFClose(tif);
|
||||
|
||||
bRet = true;
|
||||
} while (0);
|
||||
return bRet;
|
||||
}
|
||||
|
||||
bool CCImage::_initWithRawData(void * pData, int nDatalen, int nWidth, int nHeight, int nBitsPerComponent)
|
||||
{
|
||||
bool bRet = false;
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
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 __CC_STD_C_H__
|
||||
#define __CC_STD_C_H__
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif // MIN
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) < (y)) ? (y) : (x))
|
||||
#endif // MAX
|
||||
|
||||
#endif // __CC_STD_C_H__
|
|
@ -43,6 +43,7 @@ public:
|
|||
bool canSetContentScaleFactor();
|
||||
bool isIpad();
|
||||
void setContentScaleFactor(float contentScaleFactor);
|
||||
virtual CCSize getFrameSize();
|
||||
|
||||
// keep compatible
|
||||
void end();
|
||||
|
|
|
@ -83,6 +83,10 @@ void CCEGLView::swapBuffers()
|
|||
[[EAGLView sharedEGLView] swapBuffers];
|
||||
}
|
||||
|
||||
CCSize CCEGLView::getFrameSize()
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
|
||||
void CCEGLView::setIMEKeyboardState(bool bOpen)
|
||||
{
|
||||
|
|
|
@ -217,35 +217,6 @@ void CCFileUtils::setResourcePath(const char *pszResourcePath)
|
|||
assert(0);
|
||||
}
|
||||
|
||||
int CCFileUtils::ccLoadFileIntoMemory(const char *filename, unsigned char **out)
|
||||
{
|
||||
CCAssert( out, "ccLoadFileIntoMemory: invalid 'out' parameter");
|
||||
CCAssert( &*out, "ccLoadFileIntoMemory: invalid 'out' parameter");
|
||||
|
||||
size_t size = 0;
|
||||
FILE *f = fopen(filename, "rb");
|
||||
if( !f ) {
|
||||
*out = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
|
||||
*out = (unsigned char*)malloc(size);
|
||||
size_t read = fread(*out, 1, size, f);
|
||||
if( read != size ) {
|
||||
free(*out);
|
||||
*out = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
fclose(f);
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
std::string& CCFileUtils::removeSuffixFromFile(std::string& cpath )
|
||||
{
|
||||
NSString *ret = nil;
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
#ifndef __CCPLATFORMDEFINE_H__
|
||||
#define __CCPLATFORMDEFINE_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#define CC_DLL
|
||||
|
||||
#define CC_ASSERT(cond) \
|
||||
if (! (cond)) \
|
||||
{ \
|
||||
char content[100]; \
|
||||
sprintf(content, "%s function:%s line:%d", __FILE__, __FUNCTION__, __LINE__ - 3); \
|
||||
CCMessageBox(content, "Assert error"); \
|
||||
}
|
||||
#define CC_ASSERT(cond) assert(cond)
|
||||
|
||||
|
||||
#define CC_UNUSED_PARAM(unusedparam) (void)unusedparam
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
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 __CC_STD_C_H__
|
||||
#define __CC_STD_C_H__
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include <float.h>
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif // MIN
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) < (y)) ? (y) : (x))
|
||||
#endif // MAX
|
||||
|
||||
#endif // __CC_STD_C_H__
|
|
@ -0,0 +1,14 @@
|
|||
TARGET_thumb_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_thumb_release_CFLAGS))
|
||||
TARGET_thumb_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_thumb_release_CFLAGS))
|
||||
TARGET_arm_release_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_arm_release_CFLAGS))
|
||||
TARGET_arm_release_CFLAGS := $(filter-out -fomit-frame-pointer,$(TARGET_arm_release_CFLAGS))
|
||||
TARGET_CFLAGS := $(filter-out -ffunction-sections,$(TARGET_CFLAGS))
|
||||
|
||||
# include libandprof.a in the build
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := cocos_libprofiler_static
|
||||
LOCAL_MODULE_FILENAME := profiler
|
||||
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libandprof.a
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
@ -0,0 +1,13 @@
|
|||
#ifndef prof_h_seen
|
||||
#define prof_h_seen
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void monstartup(const char *libname);
|
||||
void moncleanup(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1,8 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := cocos_libtiff_static
|
||||
LOCAL_MODULE_FILENAME := tiff
|
||||
LOCAL_SRC_FILES := libs/$(TARGET_ARCH_ABI)/libtiff.a
|
||||
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
|
@ -0,0 +1,647 @@
|
|||
/* $Id: tiff.h,v 1.43 2006-10-05 15:20:40 dron Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFF_
|
||||
#define _TIFF_
|
||||
|
||||
#include "tiffconf.h"
|
||||
|
||||
/*
|
||||
* Tag Image File Format (TIFF)
|
||||
*
|
||||
* Based on Rev 6.0 from:
|
||||
* Developer's Desk
|
||||
* Aldus Corporation
|
||||
* 411 First Ave. South
|
||||
* Suite 200
|
||||
* Seattle, WA 98104
|
||||
* 206-622-5500
|
||||
*
|
||||
* (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
|
||||
*
|
||||
* For Big TIFF design notes see the following link
|
||||
* http://www.remotesensing.org/libtiff/bigtiffdesign.html
|
||||
*/
|
||||
#define TIFF_VERSION 42
|
||||
#define TIFF_BIGTIFF_VERSION 43
|
||||
|
||||
#define TIFF_BIGENDIAN 0x4d4d
|
||||
#define TIFF_LITTLEENDIAN 0x4949
|
||||
#define MDI_LITTLEENDIAN 0x5045
|
||||
#define MDI_BIGENDIAN 0x4550
|
||||
/*
|
||||
* Intrinsic data types required by the file format:
|
||||
*
|
||||
* 8-bit quantities int8/uint8
|
||||
* 16-bit quantities int16/uint16
|
||||
* 32-bit quantities int32/uint32
|
||||
* strings unsigned char*
|
||||
*/
|
||||
|
||||
#ifndef HAVE_INT8
|
||||
typedef signed char int8; /* NB: non-ANSI compilers may not grok */
|
||||
#endif
|
||||
typedef unsigned char uint8;
|
||||
#ifndef HAVE_INT16
|
||||
typedef short int16;
|
||||
#endif
|
||||
typedef unsigned short uint16; /* sizeof (uint16) must == 2 */
|
||||
#if SIZEOF_INT == 4
|
||||
#ifndef HAVE_INT32
|
||||
typedef int int32;
|
||||
#endif
|
||||
typedef unsigned int uint32; /* sizeof (uint32) must == 4 */
|
||||
#elif SIZEOF_LONG == 4
|
||||
#ifndef HAVE_INT32
|
||||
typedef long int32;
|
||||
#endif
|
||||
typedef unsigned long uint32; /* sizeof (uint32) must == 4 */
|
||||
#endif
|
||||
|
||||
/* For TIFFReassignTagToIgnore */
|
||||
enum TIFFIgnoreSense /* IGNORE tag table */
|
||||
{
|
||||
TIS_STORE,
|
||||
TIS_EXTRACT,
|
||||
TIS_EMPTY
|
||||
};
|
||||
|
||||
/*
|
||||
* TIFF header.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||
#define TIFF_MAGIC_SIZE 2
|
||||
uint16 tiff_version; /* TIFF version number */
|
||||
#define TIFF_VERSION_SIZE 2
|
||||
uint32 tiff_diroff; /* byte offset to first directory */
|
||||
#define TIFF_DIROFFSET_SIZE 4
|
||||
} TIFFHeader;
|
||||
|
||||
|
||||
/*
|
||||
* TIFF Image File Directories are comprised of a table of field
|
||||
* descriptors of the form shown below. The table is sorted in
|
||||
* ascending order by tag. The values associated with each entry are
|
||||
* disjoint and may appear anywhere in the file (so long as they are
|
||||
* placed on a word boundary).
|
||||
*
|
||||
* If the value is 4 bytes or less, then it is placed in the offset
|
||||
* field to save space. If the value is less than 4 bytes, it is
|
||||
* left-justified in the offset field.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16 tdir_tag; /* see below */
|
||||
uint16 tdir_type; /* data type; see below */
|
||||
uint32 tdir_count; /* number of items; length in spec */
|
||||
uint32 tdir_offset; /* byte offset to field data */
|
||||
} TIFFDirEntry;
|
||||
|
||||
/*
|
||||
* NB: In the comments below,
|
||||
* - items marked with a + are obsoleted by revision 5.0,
|
||||
* - items marked with a ! are introduced in revision 6.0.
|
||||
* - items marked with a % are introduced post revision 6.0.
|
||||
* - items marked with a $ are obsoleted by revision 6.0.
|
||||
* - items marked with a & are introduced by Adobe DNG specification.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tag data type information.
|
||||
*
|
||||
* Note: RATIONALs are the ratio of two 32-bit integer values.
|
||||
*/
|
||||
typedef enum {
|
||||
TIFF_NOTYPE = 0, /* placeholder */
|
||||
TIFF_BYTE = 1, /* 8-bit unsigned integer */
|
||||
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
|
||||
TIFF_SHORT = 3, /* 16-bit unsigned integer */
|
||||
TIFF_LONG = 4, /* 32-bit unsigned integer */
|
||||
TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
|
||||
TIFF_SBYTE = 6, /* !8-bit signed integer */
|
||||
TIFF_UNDEFINED = 7, /* !8-bit untyped data */
|
||||
TIFF_SSHORT = 8, /* !16-bit signed integer */
|
||||
TIFF_SLONG = 9, /* !32-bit signed integer */
|
||||
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
|
||||
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
|
||||
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
|
||||
TIFF_IFD = 13 /* %32-bit unsigned integer (offset) */
|
||||
} TIFFDataType;
|
||||
|
||||
/*
|
||||
* TIFF Tag Definitions.
|
||||
*/
|
||||
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
|
||||
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
|
||||
#define FILETYPE_PAGE 0x2 /* one page of many */
|
||||
#define FILETYPE_MASK 0x4 /* transparency mask */
|
||||
#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
|
||||
#define OFILETYPE_IMAGE 1 /* full resolution image data */
|
||||
#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
|
||||
#define OFILETYPE_PAGE 3 /* one page of many */
|
||||
#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
|
||||
#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
|
||||
#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
|
||||
#define TIFFTAG_COMPRESSION 259 /* data compression technique */
|
||||
#define COMPRESSION_NONE 1 /* dump mode */
|
||||
#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
|
||||
#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
|
||||
#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
|
||||
#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
|
||||
#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
|
||||
#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
|
||||
#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
|
||||
#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
|
||||
#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
|
||||
#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
|
||||
#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
|
||||
#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
|
||||
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
|
||||
#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
|
||||
#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
|
||||
#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
|
||||
#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
|
||||
/* compression codes 32908-32911 are reserved for Pixar */
|
||||
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
|
||||
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
|
||||
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
|
||||
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
|
||||
as recognized by Adobe */
|
||||
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
|
||||
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
|
||||
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
|
||||
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
|
||||
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
|
||||
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
|
||||
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
|
||||
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
|
||||
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
|
||||
#define PHOTOMETRIC_RGB 2 /* RGB color model */
|
||||
#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
|
||||
#define PHOTOMETRIC_MASK 4 /* $holdout mask */
|
||||
#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
|
||||
#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
|
||||
#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
|
||||
#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
|
||||
#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
|
||||
#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
|
||||
#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
|
||||
#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
|
||||
#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
|
||||
#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
|
||||
#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
|
||||
#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
|
||||
#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
|
||||
#define TIFFTAG_FILLORDER 266 /* data order within a byte */
|
||||
#define FILLORDER_MSB2LSB 1 /* most significant -> least */
|
||||
#define FILLORDER_LSB2MSB 2 /* least significant -> most */
|
||||
#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
|
||||
#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
|
||||
#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
|
||||
#define TIFFTAG_MODEL 272 /* scanner model name/number */
|
||||
#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
|
||||
#define TIFFTAG_ORIENTATION 274 /* +image orientation */
|
||||
#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
|
||||
#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
|
||||
#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
|
||||
#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
|
||||
#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
|
||||
#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
|
||||
#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
|
||||
#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
|
||||
#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
|
||||
#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
|
||||
#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
|
||||
#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
|
||||
#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
|
||||
#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
|
||||
#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
|
||||
#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
|
||||
#define PLANARCONFIG_CONTIG 1 /* single image plane */
|
||||
#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
|
||||
#define TIFFTAG_PAGENAME 285 /* page name image is from */
|
||||
#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
|
||||
#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
|
||||
#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
|
||||
#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
|
||||
#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
|
||||
#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
|
||||
#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
|
||||
#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
|
||||
#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
|
||||
#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
|
||||
#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
|
||||
#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
|
||||
#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
|
||||
#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
|
||||
#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
|
||||
#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
|
||||
#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
|
||||
#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
|
||||
#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
|
||||
#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
|
||||
#define RESUNIT_NONE 1 /* no meaningful units */
|
||||
#define RESUNIT_INCH 2 /* english */
|
||||
#define RESUNIT_CENTIMETER 3 /* metric */
|
||||
#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
|
||||
#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
|
||||
#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
|
||||
#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
|
||||
#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
|
||||
#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
|
||||
#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
|
||||
#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
|
||||
#define TIFFTAG_SOFTWARE 305 /* name & release */
|
||||
#define TIFFTAG_DATETIME 306 /* creation date and time */
|
||||
#define TIFFTAG_ARTIST 315 /* creator of image */
|
||||
#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
|
||||
#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
|
||||
#define PREDICTOR_NONE 1 /* no prediction scheme used */
|
||||
#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */
|
||||
#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
|
||||
#define TIFFTAG_WHITEPOINT 318 /* image white point */
|
||||
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
|
||||
#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
|
||||
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
|
||||
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
|
||||
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
|
||||
#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
|
||||
#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
|
||||
#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
|
||||
#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
|
||||
#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
|
||||
#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
|
||||
#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
|
||||
#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
|
||||
#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
|
||||
#define TIFFTAG_INKSET 332 /* !inks in separated image */
|
||||
#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
|
||||
#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
|
||||
#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
|
||||
#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
|
||||
#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
|
||||
#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
|
||||
#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
|
||||
#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
|
||||
#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
|
||||
#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
|
||||
#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
|
||||
#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
|
||||
#define SAMPLEFORMAT_INT 2 /* !signed integer data */
|
||||
#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
|
||||
#define SAMPLEFORMAT_VOID 4 /* !untyped data */
|
||||
#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
|
||||
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
|
||||
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
|
||||
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
|
||||
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_INDEXED 346 /* %Indexed
|
||||
[Adobe TIFF Technote 3] */
|
||||
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
|
||||
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
|
||||
/*
|
||||
* Tags 512-521 are obsoleted by Technical Note #2 which specifies a
|
||||
* revised JPEG-in-TIFF scheme.
|
||||
*/
|
||||
#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
|
||||
#define JPEGPROC_BASELINE 1 /* !baseline sequential */
|
||||
#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
|
||||
#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
|
||||
#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
|
||||
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
|
||||
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
|
||||
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
|
||||
#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
|
||||
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
|
||||
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
|
||||
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
|
||||
#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
|
||||
#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
|
||||
#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
|
||||
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
|
||||
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
|
||||
#define TIFFTAG_XMLPACKET 700 /* %XML packet
|
||||
[Adobe XMP Specification,
|
||||
January 2004 */
|
||||
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
|
||||
[Adobe TIFF technote] */
|
||||
/* tags 32952-32956 are private tags registered to Island Graphics */
|
||||
#define TIFFTAG_REFPTS 32953 /* image reference points */
|
||||
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
|
||||
#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
|
||||
#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
|
||||
/* tags 32995-32999 are private tags registered to SGI */
|
||||
#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
|
||||
#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
|
||||
#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
|
||||
#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
|
||||
/* tags 33300-33309 are private tags registered to Pixar */
|
||||
/*
|
||||
* TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
|
||||
* are set when an image has been cropped out of a larger image.
|
||||
* They reflect the size of the original uncropped image.
|
||||
* The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
|
||||
* to determine the position of the smaller image in the larger one.
|
||||
*/
|
||||
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
|
||||
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
|
||||
/* Tags 33302-33306 are used to identify special image modes and data
|
||||
* used by Pixar's texture formats.
|
||||
*/
|
||||
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
|
||||
#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
|
||||
#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
|
||||
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
|
||||
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
|
||||
/* tag 33405 is a private tag registered to Eastman Kodak */
|
||||
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
|
||||
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
|
||||
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
|
||||
/* IPTC TAG from RichTIFF specifications */
|
||||
#define TIFFTAG_RICHTIFFIPTC 33723
|
||||
/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
|
||||
#define TIFFTAG_IT8SITE 34016 /* site name */
|
||||
#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
|
||||
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
|
||||
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
|
||||
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
|
||||
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
|
||||
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
|
||||
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
|
||||
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
|
||||
#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
|
||||
#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
|
||||
#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
|
||||
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
|
||||
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
|
||||
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
|
||||
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
|
||||
(untrapped=0, trapped=1) */
|
||||
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
|
||||
/* tags 34232-34236 are private tags registered to Texas Instruments */
|
||||
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
|
||||
/* tag 34377 is private tag registered to Adobe for PhotoShop */
|
||||
#define TIFFTAG_PHOTOSHOP 34377
|
||||
/* tags 34665, 34853 and 40965 are documented in EXIF specification */
|
||||
#define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */
|
||||
/* tag 34750 is a private tag registered to Adobe? */
|
||||
#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
|
||||
/* tag 34750 is a private tag registered to Pixel Magic */
|
||||
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
|
||||
#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
|
||||
/* tags 34908-34914 are private tags registered to SGI */
|
||||
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
|
||||
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
|
||||
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
|
||||
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
|
||||
/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
|
||||
#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
|
||||
/* tag 34929 is a private tag registered to FedEx */
|
||||
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
|
||||
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
|
||||
/* Adobe Digital Negative (DNG) format tags */
|
||||
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
|
||||
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
|
||||
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
|
||||
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
|
||||
name */
|
||||
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
|
||||
mapping */
|
||||
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
|
||||
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
|
||||
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
|
||||
the BlackLevel tag */
|
||||
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
|
||||
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
|
||||
differences (columns) */
|
||||
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
|
||||
differences (rows) */
|
||||
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
|
||||
level */
|
||||
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
|
||||
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
|
||||
area */
|
||||
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
|
||||
area */
|
||||
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
|
||||
transformation matrix 1 */
|
||||
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
|
||||
transformation matrix 2 */
|
||||
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
|
||||
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
|
||||
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
|
||||
matrix 1 */
|
||||
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
|
||||
matrix 2 */
|
||||
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
|
||||
values*/
|
||||
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
|
||||
linear reference space */
|
||||
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
|
||||
x-y chromaticity
|
||||
coordinates */
|
||||
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
|
||||
point */
|
||||
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
|
||||
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
|
||||
sharpening */
|
||||
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
|
||||
the green pixels in the
|
||||
blue/green rows track the
|
||||
values of the green pixels
|
||||
in the red/green rows */
|
||||
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
|
||||
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
|
||||
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
|
||||
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
|
||||
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
|
||||
camera's anti-alias filter */
|
||||
#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
|
||||
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
|
||||
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
|
||||
tag is safe to preserve
|
||||
along with the rest of the
|
||||
EXIF data */
|
||||
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
|
||||
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
|
||||
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
|
||||
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
|
||||
the raw image data */
|
||||
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
|
||||
raw file */
|
||||
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
|
||||
raw file */
|
||||
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
|
||||
of the sensor */
|
||||
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
|
||||
of fully masked pixels */
|
||||
#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
|
||||
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
|
||||
into ICC profile space */
|
||||
#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
|
||||
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
|
||||
/* tag 65535 is an undefined tag used by Eastman Kodak */
|
||||
#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
|
||||
|
||||
/*
|
||||
* The following are ``pseudo tags'' that can be used to control
|
||||
* codec-specific functionality. These tags are not written to file.
|
||||
* Note that these values start at 0xffff+1 so that they'll never
|
||||
* collide with Aldus-assigned tags.
|
||||
*
|
||||
* If you want your private pseudo tags ``registered'' (i.e. added to
|
||||
* this file), please post a bug report via the tracking system at
|
||||
* http://www.remotesensing.org/libtiff/bugs.html with the appropriate
|
||||
* C definitions to add.
|
||||
*/
|
||||
#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
|
||||
#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
|
||||
#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
|
||||
#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
|
||||
#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
|
||||
#define FAXMODE_WORDALIGN 0x0008 /* word align row */
|
||||
#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
|
||||
#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
|
||||
/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
|
||||
#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
|
||||
#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
|
||||
#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
|
||||
#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
|
||||
#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
|
||||
#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
|
||||
/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
|
||||
#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
|
||||
#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
|
||||
#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
|
||||
#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
|
||||
#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
|
||||
#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
|
||||
#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
|
||||
#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
|
||||
/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
|
||||
#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
|
||||
#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
|
||||
#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
|
||||
#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
|
||||
#define DCSIMAGERFILTER_IR 0 /* infrared filter */
|
||||
#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
|
||||
#define DCSIMAGERFILTER_CFA 2 /* color filter array */
|
||||
#define DCSIMAGERFILTER_OTHER 3 /* other filter */
|
||||
#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
|
||||
#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
|
||||
#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
|
||||
#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
|
||||
#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
|
||||
#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
|
||||
#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
|
||||
#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
|
||||
/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
|
||||
#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
|
||||
#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
|
||||
/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
|
||||
#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
|
||||
#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
|
||||
#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
|
||||
#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
|
||||
#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
|
||||
#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
|
||||
#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
|
||||
#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
|
||||
#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
|
||||
|
||||
/*
|
||||
* EXIF tags
|
||||
*/
|
||||
#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */
|
||||
#define EXIFTAG_FNUMBER 33437 /* F number */
|
||||
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
|
||||
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
|
||||
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
|
||||
#define EXIFTAG_OECF 34856 /* Optoelectric conversion
|
||||
factor */
|
||||
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
|
||||
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
|
||||
data generation */
|
||||
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
|
||||
data generation */
|
||||
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
|
||||
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
|
||||
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
|
||||
#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */
|
||||
#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */
|
||||
#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */
|
||||
#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
|
||||
#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */
|
||||
#define EXIFTAG_METERINGMODE 37383 /* Metering mode */
|
||||
#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */
|
||||
#define EXIFTAG_FLASH 37385 /* Flash */
|
||||
#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */
|
||||
#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */
|
||||
#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */
|
||||
#define EXIFTAG_USERCOMMENT 37510 /* User comments */
|
||||
#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */
|
||||
#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */
|
||||
#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */
|
||||
#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */
|
||||
#define EXIFTAG_COLORSPACE 40961 /* Color space information */
|
||||
#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */
|
||||
#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */
|
||||
#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */
|
||||
#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */
|
||||
#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
|
||||
#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */
|
||||
#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */
|
||||
#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
|
||||
#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */
|
||||
#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */
|
||||
#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */
|
||||
#define EXIFTAG_FILESOURCE 41728 /* File source */
|
||||
#define EXIFTAG_SCENETYPE 41729 /* Scene type */
|
||||
#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */
|
||||
#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */
|
||||
#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */
|
||||
#define EXIFTAG_WHITEBALANCE 41987 /* White balance */
|
||||
#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */
|
||||
#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */
|
||||
#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_CONTRAST 41992 /* Contrast */
|
||||
#define EXIFTAG_SATURATION 41993 /* Saturation */
|
||||
#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
|
||||
#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
|
||||
#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
|
||||
|
||||
#endif /* _TIFF_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
|
@ -0,0 +1,158 @@
|
|||
/* libtiff/tiffconf.h. Generated from tiffconf.h.in by configure. */
|
||||
/*
|
||||
Configuration defines for installed libtiff.
|
||||
This file maintained for backward compatibility. Do not use definitions
|
||||
from this file in your programs.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFCONF_
|
||||
#define _TIFFCONF_
|
||||
|
||||
/* Signed 8-bit type */
|
||||
#define TIFF_INT8_T signed char
|
||||
|
||||
/* Unsigned 8-bit type */
|
||||
#define TIFF_UINT8_T unsigned char
|
||||
|
||||
/* Signed 16-bit type */
|
||||
#define TIFF_INT16_T signed short
|
||||
|
||||
/* Unsigned 16-bit type */
|
||||
#define TIFF_UINT16_T unsigned short
|
||||
|
||||
/* Signed 32-bit type formatter */
|
||||
#define TIFF_INT32_FORMAT "%d"
|
||||
|
||||
/* Signed 32-bit type */
|
||||
#define TIFF_INT32_T signed int
|
||||
|
||||
/* Unsigned 32-bit type formatter */
|
||||
#define TIFF_UINT32_FORMAT "%u"
|
||||
|
||||
/* Unsigned 32-bit type */
|
||||
#define TIFF_UINT32_T unsigned int
|
||||
|
||||
/* Signed 64-bit type formatter */
|
||||
#define TIFF_INT64_FORMAT "%I64d"
|
||||
|
||||
/* Signed 64-bit type */
|
||||
#define TIFF_INT64_T signed __int64
|
||||
|
||||
/* Unsigned 64-bit type formatter */
|
||||
#define TIFF_UINT64_FORMAT "%I64u"
|
||||
|
||||
/* Unsigned 64-bit type */
|
||||
#define TIFF_UINT64_T unsigned __int64
|
||||
|
||||
/* Signed size type */
|
||||
#if defined(_WIN64)
|
||||
#define TIFF_SSIZE_T signed __int64
|
||||
#else
|
||||
#define TIFF_SSIZE_T signed int
|
||||
#endif
|
||||
|
||||
/* Signed size type formatter */
|
||||
#if defined(_WIN64)
|
||||
#define TIFF_SSIZE_FORMAT "%I64d"
|
||||
#else
|
||||
#define TIFF_SSIZE_FORMAT "%ld"
|
||||
#endif
|
||||
|
||||
/* Pointer difference type */
|
||||
#define TIFF_PTRDIFF_T long
|
||||
|
||||
|
||||
/* Define to 1 if the system has the type `int16'. */
|
||||
/* #undef HAVE_INT16 */
|
||||
|
||||
/* Define to 1 if the system has the type `int32'. */
|
||||
/* #undef HAVE_INT32 */
|
||||
|
||||
/* Define to 1 if the system has the type `int8'. */
|
||||
/* #undef HAVE_INT8 */
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* The size of a `long', as computed by sizeof. */
|
||||
#define SIZEOF_LONG 4
|
||||
|
||||
/* Compatibility stuff. */
|
||||
|
||||
/* Define as 0 or 1 according to the floating point format suported by the
|
||||
machine */
|
||||
#define HAVE_IEEEFP 1
|
||||
|
||||
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
|
||||
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
||||
|
||||
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
||||
(Intel) */
|
||||
#define HOST_BIGENDIAN 0
|
||||
|
||||
/* Support CCITT Group 3 & 4 algorithms */
|
||||
#define CCITT_SUPPORT 1
|
||||
|
||||
/* Support JPEG compression (requires IJG JPEG library) */
|
||||
#define JPEG_SUPPORT 1
|
||||
|
||||
/* Support JBIG compression (requires JBIG-KIT library) */
|
||||
/* #undef JBIG_SUPPORT */
|
||||
|
||||
/* Support LogLuv high dynamic range encoding */
|
||||
#define LOGLUV_SUPPORT 1
|
||||
|
||||
/* Support LZW algorithm */
|
||||
#define LZW_SUPPORT 1
|
||||
|
||||
/* Support NeXT 2-bit RLE algorithm */
|
||||
#define NEXT_SUPPORT 1
|
||||
|
||||
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
|
||||
fails with unpatched IJG JPEG library) */
|
||||
#define OJPEG_SUPPORT 1
|
||||
|
||||
/* Support Macintosh PackBits algorithm */
|
||||
#define PACKBITS_SUPPORT 1
|
||||
|
||||
/* Support Pixar log-format algorithm (requires Zlib) */
|
||||
#define PIXARLOG_SUPPORT 1
|
||||
|
||||
/* Support ThunderScan 4-bit RLE algorithm */
|
||||
#define THUNDER_SUPPORT 1
|
||||
|
||||
/* Support Deflate compression */
|
||||
#define ZIP_SUPPORT 1
|
||||
|
||||
/* Support strip chopping (whether or not to convert single-strip uncompressed
|
||||
images to mutiple strips of ~8Kb to reduce memory usage) */
|
||||
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
|
||||
|
||||
/* Enable SubIFD tag (330) support */
|
||||
#define SUBIFD_SUPPORT 1
|
||||
|
||||
/* Treat extra sample as alpha (default enabled). The RGBA interface will
|
||||
treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
|
||||
packages produce RGBA files but don't mark the alpha properly. */
|
||||
#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
|
||||
|
||||
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
|
||||
lacking the tag (default enabled). */
|
||||
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
|
||||
|
||||
/* Support MS MDI magic number files as TIFF */
|
||||
#define MDI_SUPPORT 1
|
||||
|
||||
/*
|
||||
* Feature support definitions.
|
||||
* XXX: These macros are obsoleted. Don't use them in your apps!
|
||||
* Macros stays here for backward compatibility and should be always defined.
|
||||
*/
|
||||
#define COLORIMETRY_SUPPORT
|
||||
#define YCBCR_SUPPORT
|
||||
#define CMYK_SUPPORT
|
||||
#define ICC_SUPPORT
|
||||
#define PHOTOSHOP_SUPPORT
|
||||
#define IPTC_SUPPORT
|
||||
|
||||
#endif /* _TIFFCONF_ */
|
|
@ -0,0 +1,523 @@
|
|||
/* $Id: tiffio.h,v 1.56.2.3 2009-01-01 00:10:43 bfriesen Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFIO_
|
||||
#define _TIFFIO_
|
||||
|
||||
/*
|
||||
* TIFF I/O Library Definitions.
|
||||
*/
|
||||
#include "tiff.h"
|
||||
#include "tiffvers.h"
|
||||
|
||||
/*
|
||||
* TIFF is defined as an incomplete type to hide the
|
||||
* library's internal data structures from clients.
|
||||
*/
|
||||
typedef struct tiff TIFF;
|
||||
|
||||
typedef TIFF_SSIZE_T tmsize_t;
|
||||
|
||||
|
||||
/*
|
||||
* The following typedefs define the intrinsic size of
|
||||
* data types used in the *exported* interfaces. These
|
||||
* definitions depend on the proper definition of types
|
||||
* in tiff.h. Note also that the varargs interface used
|
||||
* to pass tag types and values uses the types defined in
|
||||
* tiff.h directly.
|
||||
*
|
||||
* NB: ttag_t is unsigned int and not unsigned short because
|
||||
* ANSI C requires that the type before the ellipsis be a
|
||||
* promoted type (i.e. one of int, unsigned int, pointer,
|
||||
* or double) and because we defined pseudo-tags that are
|
||||
* outside the range of legal Aldus-assigned tags.
|
||||
* NB: tsize_t is int32 and not uint32 because some functions
|
||||
* return -1.
|
||||
* NB: toff_t is not off_t for many reasons; TIFFs max out at
|
||||
* 32-bit file offsets being the most important, and to ensure
|
||||
* that it is unsigned, rather than signed.
|
||||
*/
|
||||
typedef uint32 ttag_t; /* directory tag */
|
||||
typedef uint16 tdir_t; /* directory index */
|
||||
typedef uint16 tsample_t; /* sample number */
|
||||
typedef uint32 tstrile_t; /* strip or tile number */
|
||||
typedef tstrile_t tstrip_t; /* strip number */
|
||||
typedef tstrile_t ttile_t; /* tile number */
|
||||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||
typedef void* tdata_t; /* image data ref */
|
||||
typedef uint32 toff_t; /* file offset */
|
||||
typedef uint32 uint64;
|
||||
|
||||
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
|
||||
#define __WIN32__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
|
||||
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
|
||||
*
|
||||
* By default tif_unix.c is assumed.
|
||||
*/
|
||||
|
||||
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
||||
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
|
||||
# define AVOID_WIN32_FILEIO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_WIN32_FILEIO)
|
||||
# define VC_EXTRALEAN
|
||||
# include <windows.h>
|
||||
# ifdef __WIN32__
|
||||
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
|
||||
# else
|
||||
typedef HFILE thandle_t; /* client data handle */
|
||||
# endif /* __WIN32__ */
|
||||
#else
|
||||
typedef void* thandle_t; /* client data handle */
|
||||
#endif /* USE_WIN32_FILEIO */
|
||||
|
||||
/*
|
||||
* Flags to pass to TIFFPrintDirectory to control
|
||||
* printing of data structures that are potentially
|
||||
* very large. Bit-or these flags to enable printing
|
||||
* multiple items.
|
||||
*/
|
||||
#define TIFFPRINT_NONE 0x0 /* no extra info */
|
||||
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
|
||||
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
|
||||
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
|
||||
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
|
||||
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
||||
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
||||
|
||||
/*
|
||||
* Colour conversion stuff
|
||||
*/
|
||||
|
||||
/* reference white */
|
||||
#define D65_X0 (95.0470F)
|
||||
#define D65_Y0 (100.0F)
|
||||
#define D65_Z0 (108.8827F)
|
||||
|
||||
#define D50_X0 (96.4250F)
|
||||
#define D50_Y0 (100.0F)
|
||||
#define D50_Z0 (82.4680F)
|
||||
|
||||
/* Structure for holding information about a display device. */
|
||||
|
||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||
|
||||
typedef struct {
|
||||
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||
float d_YCR; /* Light o/p for reference white */
|
||||
float d_YCG;
|
||||
float d_YCB;
|
||||
uint32 d_Vrwr; /* Pixel values for ref. white */
|
||||
uint32 d_Vrwg;
|
||||
uint32 d_Vrwb;
|
||||
float d_Y0R; /* Residual light for black pixel */
|
||||
float d_Y0G;
|
||||
float d_Y0B;
|
||||
float d_gammaR; /* Gamma values for the three guns */
|
||||
float d_gammaG;
|
||||
float d_gammaB;
|
||||
} TIFFDisplay;
|
||||
|
||||
typedef struct { /* YCbCr->RGB support */
|
||||
TIFFRGBValue* clamptab; /* range clamping table */
|
||||
int* Cr_r_tab;
|
||||
int* Cb_b_tab;
|
||||
int32* Cr_g_tab;
|
||||
int32* Cb_g_tab;
|
||||
int32* Y_tab;
|
||||
} TIFFYCbCrToRGB;
|
||||
|
||||
typedef struct { /* CIE Lab 1976->RGB support */
|
||||
int range; /* Size of conversion table */
|
||||
#define CIELABTORGB_TABLE_RANGE 1500
|
||||
float rstep, gstep, bstep;
|
||||
float X0, Y0, Z0; /* Reference white point */
|
||||
TIFFDisplay display;
|
||||
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
|
||||
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
|
||||
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||
} TIFFCIELabToRGB;
|
||||
|
||||
/*
|
||||
* RGBA-style image support.
|
||||
*/
|
||||
typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
||||
/*
|
||||
* The image reading and conversion routines invoke
|
||||
* ``put routines'' to copy/image/whatever tiles of
|
||||
* raw image data. A default set of routines are
|
||||
* provided to convert/copy raw image data to 8-bit
|
||||
* packed ABGR format rasters. Applications can supply
|
||||
* alternate routines that unpack the data into a
|
||||
* different format or, for example, unpack the data
|
||||
* and draw the unpacked raster on the display.
|
||||
*/
|
||||
typedef void (*tileContigRoutine)
|
||||
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*);
|
||||
typedef void (*tileSeparateRoutine)
|
||||
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||
/*
|
||||
* RGBA-reader state.
|
||||
*/
|
||||
struct _TIFFRGBAImage {
|
||||
TIFF* tif; /* image handle */
|
||||
int stoponerr; /* stop on read error */
|
||||
int isContig; /* data is packed/separate */
|
||||
int alpha; /* type of alpha data present */
|
||||
uint32 width; /* image width */
|
||||
uint32 height; /* image height */
|
||||
uint16 bitspersample; /* image bits/sample */
|
||||
uint16 samplesperpixel; /* image samples/pixel */
|
||||
uint16 orientation; /* image orientation */
|
||||
uint16 req_orientation; /* requested orientation */
|
||||
uint16 photometric; /* image photometric interp */
|
||||
uint16* redcmap; /* colormap pallete */
|
||||
uint16* greencmap;
|
||||
uint16* bluecmap;
|
||||
/* get image data routine */
|
||||
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||
/* put decoded strip/tile */
|
||||
union {
|
||||
void (*any)(TIFFRGBAImage*);
|
||||
tileContigRoutine contig;
|
||||
tileSeparateRoutine separate;
|
||||
} put;
|
||||
TIFFRGBValue* Map; /* sample mapping array */
|
||||
uint32** BWmap; /* black&white map */
|
||||
uint32** PALmap; /* palette image map */
|
||||
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
||||
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
||||
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for extracting components from the
|
||||
* packed ABGR form returned by TIFFReadRGBAImage.
|
||||
*/
|
||||
#define TIFFGetR(abgr) ((abgr) & 0xff)
|
||||
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
|
||||
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
|
||||
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
|
||||
|
||||
/*
|
||||
* A CODEC is a software package that implements decoding,
|
||||
* encoding, or decoding+encoding of a compression algorithm.
|
||||
* The library provides a collection of builtin codecs.
|
||||
* More codecs may be registered through calls to the library
|
||||
* and/or the builtin implementations may be overridden.
|
||||
*/
|
||||
typedef int (*TIFFInitMethod)(TIFF*, int);
|
||||
typedef struct {
|
||||
char* name;
|
||||
uint16 scheme;
|
||||
TIFFInitMethod init;
|
||||
} TIFFCodec;
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* share internal LogLuv conversion routines? */
|
||||
#ifndef LOGLUV_PUBLIC
|
||||
#define LOGLUV_PUBLIC 1
|
||||
#endif
|
||||
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
# define __attribute__(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
|
||||
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
|
||||
typedef tsize_t (*TIFFReadWriteProc)(thandle_t, tdata_t, tsize_t);
|
||||
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
||||
typedef int (*TIFFCloseProc)(thandle_t);
|
||||
typedef toff_t (*TIFFSizeProc)(thandle_t);
|
||||
typedef int (*TIFFMapFileProc)(thandle_t, tdata_t*, toff_t*);
|
||||
typedef void (*TIFFUnmapFileProc)(thandle_t, tdata_t, toff_t);
|
||||
typedef void (*TIFFExtendProc)(TIFF*);
|
||||
|
||||
extern const char* TIFFGetVersion(void);
|
||||
|
||||
extern const TIFFCodec* TIFFFindCODEC(uint16);
|
||||
extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
|
||||
extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
||||
extern int TIFFIsCODECConfigured(uint16);
|
||||
extern TIFFCodec* TIFFGetConfiguredCODECs(void);
|
||||
|
||||
/*
|
||||
* Auxiliary functions.
|
||||
*/
|
||||
|
||||
extern tdata_t _TIFFmalloc(tsize_t);
|
||||
extern tdata_t _TIFFrealloc(tdata_t, tsize_t);
|
||||
extern void _TIFFmemset(tdata_t, int, tsize_t);
|
||||
extern void _TIFFmemcpy(tdata_t, const tdata_t, tsize_t);
|
||||
extern int _TIFFmemcmp(const tdata_t, const tdata_t, tsize_t);
|
||||
extern void _TIFFfree(tdata_t);
|
||||
|
||||
/*
|
||||
** Stuff, related to tag handling and creating custom tags.
|
||||
*/
|
||||
extern int TIFFGetTagListCount( TIFF * );
|
||||
extern ttag_t TIFFGetTagListEntry( TIFF *, int tag_index );
|
||||
|
||||
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
||||
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
||||
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
|
||||
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
|
||||
|
||||
#define FIELD_CUSTOM 65
|
||||
|
||||
typedef struct {
|
||||
ttag_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
} TIFFFieldInfo;
|
||||
|
||||
typedef struct _TIFFTagValue {
|
||||
const TIFFFieldInfo *info;
|
||||
int count;
|
||||
void *value;
|
||||
} TIFFTagValue;
|
||||
|
||||
extern void TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], int);
|
||||
extern const TIFFFieldInfo* TIFFFindFieldInfo(TIFF*, ttag_t, TIFFDataType);
|
||||
extern const TIFFFieldInfo* TIFFFindFieldInfoByName(TIFF* , const char *,
|
||||
TIFFDataType);
|
||||
extern const TIFFFieldInfo* TIFFFieldWithTag(TIFF*, ttag_t);
|
||||
extern const TIFFFieldInfo* TIFFFieldWithName(TIFF*, const char *);
|
||||
|
||||
typedef int (*TIFFVSetMethod)(TIFF*, ttag_t, va_list);
|
||||
typedef int (*TIFFVGetMethod)(TIFF*, ttag_t, va_list);
|
||||
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
|
||||
|
||||
typedef struct {
|
||||
TIFFVSetMethod vsetfield; /* tag set routine */
|
||||
TIFFVGetMethod vgetfield; /* tag get routine */
|
||||
TIFFPrintMethod printdir; /* directory print routine */
|
||||
} TIFFTagMethods;
|
||||
|
||||
extern TIFFTagMethods *TIFFAccessTagMethods( TIFF * );
|
||||
extern void *TIFFGetClientInfo( TIFF *, const char * );
|
||||
extern void TIFFSetClientInfo( TIFF *, void *, const char * );
|
||||
|
||||
extern void TIFFCleanup(TIFF*);
|
||||
extern void TIFFClose(TIFF*);
|
||||
extern int TIFFFlush(TIFF*);
|
||||
extern int TIFFFlushData(TIFF*);
|
||||
extern int TIFFGetField(TIFF*, ttag_t, ...);
|
||||
extern int TIFFVGetField(TIFF*, ttag_t, va_list);
|
||||
extern int TIFFGetFieldDefaulted(TIFF*, ttag_t, ...);
|
||||
extern int TIFFVGetFieldDefaulted(TIFF*, ttag_t, va_list);
|
||||
extern int TIFFReadDirectory(TIFF*);
|
||||
extern int TIFFReadCustomDirectory(TIFF*, toff_t, const TIFFFieldInfo[],
|
||||
size_t);
|
||||
extern int TIFFReadEXIFDirectory(TIFF*, toff_t);
|
||||
extern tsize_t TIFFScanlineSize(TIFF*);
|
||||
extern tsize_t TIFFOldScanlineSize(TIFF*);
|
||||
extern tsize_t TIFFNewScanlineSize(TIFF*);
|
||||
extern tsize_t TIFFRasterScanlineSize(TIFF*);
|
||||
extern tsize_t TIFFStripSize(TIFF*);
|
||||
extern tsize_t TIFFRawStripSize(TIFF*, tstrip_t);
|
||||
extern tsize_t TIFFVStripSize(TIFF*, uint32);
|
||||
extern tsize_t TIFFTileRowSize(TIFF*);
|
||||
extern tsize_t TIFFTileSize(TIFF*);
|
||||
extern tsize_t TIFFVTileSize(TIFF*, uint32);
|
||||
extern uint32 TIFFDefaultStripSize(TIFF*, uint32);
|
||||
extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
|
||||
extern int TIFFFileno(TIFF*);
|
||||
extern int TIFFSetFileno(TIFF*, int);
|
||||
extern thandle_t TIFFClientdata(TIFF*);
|
||||
extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
|
||||
extern int TIFFGetMode(TIFF*);
|
||||
extern int TIFFSetMode(TIFF*, int);
|
||||
extern int TIFFIsTiled(TIFF*);
|
||||
extern int TIFFIsByteSwapped(TIFF*);
|
||||
extern int TIFFIsUpSampled(TIFF*);
|
||||
extern int TIFFIsMSB2LSB(TIFF*);
|
||||
extern int TIFFIsBigEndian(TIFF*);
|
||||
extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
|
||||
extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
|
||||
extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
|
||||
extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
|
||||
extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
|
||||
extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
|
||||
extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
|
||||
extern uint32 TIFFCurrentRow(TIFF*);
|
||||
extern tdir_t TIFFCurrentDirectory(TIFF*);
|
||||
extern tdir_t TIFFNumberOfDirectories(TIFF*);
|
||||
extern uint32 TIFFCurrentDirOffset(TIFF*);
|
||||
extern tstrip_t TIFFCurrentStrip(TIFF*);
|
||||
extern ttile_t TIFFCurrentTile(TIFF*);
|
||||
extern int TIFFReadBufferSetup(TIFF*, tdata_t, tsize_t);
|
||||
extern int TIFFWriteBufferSetup(TIFF*, tdata_t, tsize_t);
|
||||
extern int TIFFSetupStrips(TIFF *);
|
||||
extern int TIFFWriteCheck(TIFF*, int, const char *);
|
||||
extern void TIFFFreeDirectory(TIFF*);
|
||||
extern int TIFFCreateDirectory(TIFF*);
|
||||
extern int TIFFLastDirectory(TIFF*);
|
||||
extern int TIFFSetDirectory(TIFF*, tdir_t);
|
||||
extern int TIFFSetSubDirectory(TIFF*, uint32);
|
||||
extern int TIFFUnlinkDirectory(TIFF*, tdir_t);
|
||||
extern int TIFFSetField(TIFF*, ttag_t, ...);
|
||||
extern int TIFFVSetField(TIFF*, ttag_t, va_list);
|
||||
extern int TIFFWriteDirectory(TIFF *);
|
||||
extern int TIFFCheckpointDirectory(TIFF *);
|
||||
extern int TIFFRewriteDirectory(TIFF *);
|
||||
extern int TIFFReassignTagToIgnore(enum TIFFIgnoreSense, int);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
||||
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
||||
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t = 0);
|
||||
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
|
||||
int = ORIENTATION_BOTLEFT, int = 0);
|
||||
#else
|
||||
extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
||||
extern int TIFFReadScanline(TIFF*, tdata_t, uint32, tsample_t);
|
||||
extern int TIFFWriteScanline(TIFF*, tdata_t, uint32, tsample_t);
|
||||
extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
|
||||
extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
|
||||
#endif
|
||||
|
||||
extern int TIFFReadRGBAStrip(TIFF*, tstrip_t, uint32 * );
|
||||
extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
|
||||
extern int TIFFRGBAImageOK(TIFF*, char [1024]);
|
||||
extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
|
||||
extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||
extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
|
||||
extern TIFF* TIFFOpen(const char*, const char*);
|
||||
# ifdef __WIN32__
|
||||
extern TIFF* TIFFOpenW(const wchar_t*, const char*);
|
||||
# endif /* __WIN32__ */
|
||||
extern TIFF* TIFFFdOpen(int, const char*, const char*);
|
||||
extern TIFF* TIFFClientOpen(const char*, const char*,
|
||||
thandle_t,
|
||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
||||
TIFFSeekProc, TIFFCloseProc,
|
||||
TIFFSizeProc,
|
||||
TIFFMapFileProc, TIFFUnmapFileProc);
|
||||
extern const char* TIFFFileName(TIFF*);
|
||||
extern const char* TIFFSetFileName(TIFF*, const char *);
|
||||
extern void TIFFError(const char*, const char*, ...) __attribute__((format (printf,2,3)));
|
||||
extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));
|
||||
extern void TIFFWarning(const char*, const char*, ...) __attribute__((format (printf,2,3)));
|
||||
extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((format (printf,3,4)));
|
||||
extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
||||
extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
||||
extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
|
||||
extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
|
||||
extern ttile_t TIFFComputeTile(TIFF*, uint32, uint32, uint32, tsample_t);
|
||||
extern int TIFFCheckTile(TIFF*, uint32, uint32, uint32, tsample_t);
|
||||
extern ttile_t TIFFNumberOfTiles(TIFF*);
|
||||
extern tsize_t TIFFReadTile(TIFF*,
|
||||
tdata_t, uint32, uint32, uint32, tsample_t);
|
||||
extern tsize_t TIFFWriteTile(TIFF*,
|
||||
tdata_t, uint32, uint32, uint32, tsample_t);
|
||||
extern tstrip_t TIFFComputeStrip(TIFF*, uint32, tsample_t);
|
||||
extern tstrip_t TIFFNumberOfStrips(TIFF*);
|
||||
extern tsize_t TIFFReadEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFReadRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFReadEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFReadRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFWriteEncodedStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFWriteRawStrip(TIFF*, tstrip_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFWriteEncodedTile(TIFF*, ttile_t, tdata_t, tsize_t);
|
||||
extern tsize_t TIFFWriteRawTile(TIFF*, ttile_t, tdata_t, tsize_t);
|
||||
extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
|
||||
extern void TIFFSetWriteOffset(TIFF*, toff_t);
|
||||
extern void TIFFSwabShort(uint16*);
|
||||
extern void TIFFSwabLong(uint32*);
|
||||
extern void TIFFSwabDouble(double*);
|
||||
extern void TIFFSwabArrayOfShort(uint16*, unsigned long);
|
||||
extern void TIFFSwabArrayOfTriples(uint8*, unsigned long);
|
||||
extern void TIFFSwabArrayOfLong(uint32*, unsigned long);
|
||||
extern void TIFFSwabArrayOfDouble(double*, unsigned long);
|
||||
extern void TIFFReverseBits(unsigned char *, unsigned long);
|
||||
extern const unsigned char* TIFFGetBitRevTable(int);
|
||||
|
||||
#ifdef LOGLUV_PUBLIC
|
||||
#define U_NEU 0.210526316
|
||||
#define V_NEU 0.473684211
|
||||
#define UVSCALE 410.
|
||||
extern double LogL16toY(int);
|
||||
extern double LogL10toY(int);
|
||||
extern void XYZtoRGB24(float*, uint8*);
|
||||
extern int uv_decode(double*, double*, int);
|
||||
extern void LogLuv24toXYZ(uint32, float*);
|
||||
extern void LogLuv32toXYZ(uint32, float*);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
#else
|
||||
extern int LogL16fromY(double, int);
|
||||
extern int LogL10fromY(double, int);
|
||||
extern int uv_encode(double, double, int);
|
||||
extern uint32 LogLuv24fromXYZ(float*, int);
|
||||
extern uint32 LogLuv32fromXYZ(float*, int);
|
||||
#endif
|
||||
#endif /* LOGLUV_PUBLIC */
|
||||
|
||||
extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, TIFFDisplay *, float*);
|
||||
extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
|
||||
float *, float *, float *);
|
||||
extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||
uint32 *, uint32 *, uint32 *);
|
||||
|
||||
extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
||||
extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
|
||||
uint32 *, uint32 *, uint32 *);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TIFFIO_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
|
@ -0,0 +1,9 @@
|
|||
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 3.9.2\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||
/*
|
||||
* This define can be used in code that requires
|
||||
* compilation-related definitions specific to a
|
||||
* version or versions of the library. Runtime
|
||||
* version checking should be done based on the
|
||||
* string returned by TIFFGetVersion.
|
||||
*/
|
||||
#define TIFFLIB_VERSION 20091104
|
|
@ -0,0 +1 @@
|
|||
08568c709e115ac77d96705d4b5cb47c1f494514
|
1
cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id
vendored
Normal file
1
cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/armeabi/libtiff.a.REMOVED.git-id
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
8ae8c1465f02581e5f557c549ccbd31f77ac392e
|
1
cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id
vendored
Normal file
1
cocos2dx/platform/third_party/android/prebuilt/libtiff/libs/x86/libtiff.a.REMOVED.git-id
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
829ad7281999aff0543b4aca6574779ef6c48644
|
|
@ -0,0 +1 @@
|
|||
b93dbf63b6d3b716e3fa8d261ea7fda90117e4bf
|
|
@ -0,0 +1,650 @@
|
|||
/* $Id: tiff.h,v 1.67 2011-01-24 21:06:32 olivier Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFF_
|
||||
#define _TIFF_
|
||||
|
||||
#include "tiffconf.h"
|
||||
|
||||
/*
|
||||
* Tag Image File Format (TIFF)
|
||||
*
|
||||
* Based on Rev 6.0 from:
|
||||
* Developer's Desk
|
||||
* Aldus Corporation
|
||||
* 411 First Ave. South
|
||||
* Suite 200
|
||||
* Seattle, WA 98104
|
||||
* 206-622-5500
|
||||
*
|
||||
* (http://partners.adobe.com/asn/developer/PDFS/TN/TIFF6.pdf)
|
||||
*
|
||||
* For BigTIFF design notes see the following links
|
||||
* http://www.remotesensing.org/libtiff/bigtiffdesign.html
|
||||
* http://www.awaresystems.be/imaging/tiff/bigtiff.html
|
||||
*/
|
||||
|
||||
#define TIFF_VERSION_CLASSIC 42
|
||||
#define TIFF_VERSION_BIG 43
|
||||
|
||||
#define TIFF_BIGENDIAN 0x4d4d
|
||||
#define TIFF_LITTLEENDIAN 0x4949
|
||||
#define MDI_LITTLEENDIAN 0x5045
|
||||
#define MDI_BIGENDIAN 0x4550
|
||||
|
||||
/*
|
||||
* Intrinsic data types required by the file format:
|
||||
*
|
||||
* 8-bit quantities int8/uint8
|
||||
* 16-bit quantities int16/uint16
|
||||
* 32-bit quantities int32/uint32
|
||||
* 64-bit quantities int64/uint64
|
||||
* strings unsigned char*
|
||||
*/
|
||||
|
||||
typedef TIFF_INT8_T int8;
|
||||
typedef TIFF_UINT8_T uint8;
|
||||
|
||||
typedef TIFF_INT16_T int16;
|
||||
typedef TIFF_UINT16_T uint16;
|
||||
|
||||
typedef TIFF_INT32_T int32;
|
||||
typedef TIFF_UINT32_T uint32;
|
||||
|
||||
typedef TIFF_INT64_T int64;
|
||||
typedef TIFF_UINT64_T uint64;
|
||||
|
||||
/*
|
||||
* Some types as promoted in a variable argument list
|
||||
* We use uint16_vap rather then directly using int, because this way
|
||||
* we document the type we actually want to pass through, conceptually,
|
||||
* rather then confusing the issue by merely stating the type it gets
|
||||
* promoted to
|
||||
*/
|
||||
|
||||
typedef int uint16_vap;
|
||||
|
||||
/*
|
||||
* TIFF header.
|
||||
*/
|
||||
typedef struct {
|
||||
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||
uint16 tiff_version; /* TIFF version number */
|
||||
} TIFFHeaderCommon;
|
||||
typedef struct {
|
||||
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||
uint16 tiff_version; /* TIFF version number */
|
||||
uint32 tiff_diroff; /* byte offset to first directory */
|
||||
} TIFFHeaderClassic;
|
||||
typedef struct {
|
||||
uint16 tiff_magic; /* magic number (defines byte order) */
|
||||
uint16 tiff_version; /* TIFF version number */
|
||||
uint16 tiff_offsetsize; /* size of offsets, should be 8 */
|
||||
uint16 tiff_unused; /* unused word, should be 0 */
|
||||
uint64 tiff_diroff; /* byte offset to first directory */
|
||||
} TIFFHeaderBig;
|
||||
|
||||
|
||||
/*
|
||||
* NB: In the comments below,
|
||||
* - items marked with a + are obsoleted by revision 5.0,
|
||||
* - items marked with a ! are introduced in revision 6.0.
|
||||
* - items marked with a % are introduced post revision 6.0.
|
||||
* - items marked with a $ are obsoleted by revision 6.0.
|
||||
* - items marked with a & are introduced by Adobe DNG specification.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Tag data type information.
|
||||
*
|
||||
* Note: RATIONALs are the ratio of two 32-bit integer values.
|
||||
*/
|
||||
typedef enum {
|
||||
TIFF_NOTYPE = 0, /* placeholder */
|
||||
TIFF_BYTE = 1, /* 8-bit unsigned integer */
|
||||
TIFF_ASCII = 2, /* 8-bit bytes w/ last byte null */
|
||||
TIFF_SHORT = 3, /* 16-bit unsigned integer */
|
||||
TIFF_LONG = 4, /* 32-bit unsigned integer */
|
||||
TIFF_RATIONAL = 5, /* 64-bit unsigned fraction */
|
||||
TIFF_SBYTE = 6, /* !8-bit signed integer */
|
||||
TIFF_UNDEFINED = 7, /* !8-bit untyped data */
|
||||
TIFF_SSHORT = 8, /* !16-bit signed integer */
|
||||
TIFF_SLONG = 9, /* !32-bit signed integer */
|
||||
TIFF_SRATIONAL = 10, /* !64-bit signed fraction */
|
||||
TIFF_FLOAT = 11, /* !32-bit IEEE floating point */
|
||||
TIFF_DOUBLE = 12, /* !64-bit IEEE floating point */
|
||||
TIFF_IFD = 13, /* %32-bit unsigned integer (offset) */
|
||||
TIFF_LONG8 = 16, /* BigTIFF 64-bit unsigned integer */
|
||||
TIFF_SLONG8 = 17, /* BigTIFF 64-bit signed integer */
|
||||
TIFF_IFD8 = 18 /* BigTIFF 64-bit unsigned integer (offset) */
|
||||
} TIFFDataType;
|
||||
|
||||
/*
|
||||
* TIFF Tag Definitions.
|
||||
*/
|
||||
#define TIFFTAG_SUBFILETYPE 254 /* subfile data descriptor */
|
||||
#define FILETYPE_REDUCEDIMAGE 0x1 /* reduced resolution version */
|
||||
#define FILETYPE_PAGE 0x2 /* one page of many */
|
||||
#define FILETYPE_MASK 0x4 /* transparency mask */
|
||||
#define TIFFTAG_OSUBFILETYPE 255 /* +kind of data in subfile */
|
||||
#define OFILETYPE_IMAGE 1 /* full resolution image data */
|
||||
#define OFILETYPE_REDUCEDIMAGE 2 /* reduced size image data */
|
||||
#define OFILETYPE_PAGE 3 /* one page of many */
|
||||
#define TIFFTAG_IMAGEWIDTH 256 /* image width in pixels */
|
||||
#define TIFFTAG_IMAGELENGTH 257 /* image height in pixels */
|
||||
#define TIFFTAG_BITSPERSAMPLE 258 /* bits per channel (sample) */
|
||||
#define TIFFTAG_COMPRESSION 259 /* data compression technique */
|
||||
#define COMPRESSION_NONE 1 /* dump mode */
|
||||
#define COMPRESSION_CCITTRLE 2 /* CCITT modified Huffman RLE */
|
||||
#define COMPRESSION_CCITTFAX3 3 /* CCITT Group 3 fax encoding */
|
||||
#define COMPRESSION_CCITT_T4 3 /* CCITT T.4 (TIFF 6 name) */
|
||||
#define COMPRESSION_CCITTFAX4 4 /* CCITT Group 4 fax encoding */
|
||||
#define COMPRESSION_CCITT_T6 4 /* CCITT T.6 (TIFF 6 name) */
|
||||
#define COMPRESSION_LZW 5 /* Lempel-Ziv & Welch */
|
||||
#define COMPRESSION_OJPEG 6 /* !6.0 JPEG */
|
||||
#define COMPRESSION_JPEG 7 /* %JPEG DCT compression */
|
||||
#define COMPRESSION_NEXT 32766 /* NeXT 2-bit RLE */
|
||||
#define COMPRESSION_CCITTRLEW 32771 /* #1 w/ word alignment */
|
||||
#define COMPRESSION_PACKBITS 32773 /* Macintosh RLE */
|
||||
#define COMPRESSION_THUNDERSCAN 32809 /* ThunderScan RLE */
|
||||
/* codes 32895-32898 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
|
||||
#define COMPRESSION_IT8CTPAD 32895 /* IT8 CT w/padding */
|
||||
#define COMPRESSION_IT8LW 32896 /* IT8 Linework RLE */
|
||||
#define COMPRESSION_IT8MP 32897 /* IT8 Monochrome picture */
|
||||
#define COMPRESSION_IT8BL 32898 /* IT8 Binary line art */
|
||||
/* compression codes 32908-32911 are reserved for Pixar */
|
||||
#define COMPRESSION_PIXARFILM 32908 /* Pixar companded 10bit LZW */
|
||||
#define COMPRESSION_PIXARLOG 32909 /* Pixar companded 11bit ZIP */
|
||||
#define COMPRESSION_DEFLATE 32946 /* Deflate compression */
|
||||
#define COMPRESSION_ADOBE_DEFLATE 8 /* Deflate compression,
|
||||
as recognized by Adobe */
|
||||
/* compression code 32947 is reserved for Oceana Matrix <dev@oceana.com> */
|
||||
#define COMPRESSION_DCS 32947 /* Kodak DCS encoding */
|
||||
#define COMPRESSION_JBIG 34661 /* ISO JBIG */
|
||||
#define COMPRESSION_SGILOG 34676 /* SGI Log Luminance RLE */
|
||||
#define COMPRESSION_SGILOG24 34677 /* SGI Log 24-bit packed */
|
||||
#define COMPRESSION_JP2000 34712 /* Leadtools JPEG2000 */
|
||||
#define COMPRESSION_LZMA 34925 /* LZMA2 */
|
||||
#define TIFFTAG_PHOTOMETRIC 262 /* photometric interpretation */
|
||||
#define PHOTOMETRIC_MINISWHITE 0 /* min value is white */
|
||||
#define PHOTOMETRIC_MINISBLACK 1 /* min value is black */
|
||||
#define PHOTOMETRIC_RGB 2 /* RGB color model */
|
||||
#define PHOTOMETRIC_PALETTE 3 /* color map indexed */
|
||||
#define PHOTOMETRIC_MASK 4 /* $holdout mask */
|
||||
#define PHOTOMETRIC_SEPARATED 5 /* !color separations */
|
||||
#define PHOTOMETRIC_YCBCR 6 /* !CCIR 601 */
|
||||
#define PHOTOMETRIC_CIELAB 8 /* !1976 CIE L*a*b* */
|
||||
#define PHOTOMETRIC_ICCLAB 9 /* ICC L*a*b* [Adobe TIFF Technote 4] */
|
||||
#define PHOTOMETRIC_ITULAB 10 /* ITU L*a*b* */
|
||||
#define PHOTOMETRIC_LOGL 32844 /* CIE Log2(L) */
|
||||
#define PHOTOMETRIC_LOGLUV 32845 /* CIE Log2(L) (u',v') */
|
||||
#define TIFFTAG_THRESHHOLDING 263 /* +thresholding used on data */
|
||||
#define THRESHHOLD_BILEVEL 1 /* b&w art scan */
|
||||
#define THRESHHOLD_HALFTONE 2 /* or dithered scan */
|
||||
#define THRESHHOLD_ERRORDIFFUSE 3 /* usually floyd-steinberg */
|
||||
#define TIFFTAG_CELLWIDTH 264 /* +dithering matrix width */
|
||||
#define TIFFTAG_CELLLENGTH 265 /* +dithering matrix height */
|
||||
#define TIFFTAG_FILLORDER 266 /* data order within a byte */
|
||||
#define FILLORDER_MSB2LSB 1 /* most significant -> least */
|
||||
#define FILLORDER_LSB2MSB 2 /* least significant -> most */
|
||||
#define TIFFTAG_DOCUMENTNAME 269 /* name of doc. image is from */
|
||||
#define TIFFTAG_IMAGEDESCRIPTION 270 /* info about image */
|
||||
#define TIFFTAG_MAKE 271 /* scanner manufacturer name */
|
||||
#define TIFFTAG_MODEL 272 /* scanner model name/number */
|
||||
#define TIFFTAG_STRIPOFFSETS 273 /* offsets to data strips */
|
||||
#define TIFFTAG_ORIENTATION 274 /* +image orientation */
|
||||
#define ORIENTATION_TOPLEFT 1 /* row 0 top, col 0 lhs */
|
||||
#define ORIENTATION_TOPRIGHT 2 /* row 0 top, col 0 rhs */
|
||||
#define ORIENTATION_BOTRIGHT 3 /* row 0 bottom, col 0 rhs */
|
||||
#define ORIENTATION_BOTLEFT 4 /* row 0 bottom, col 0 lhs */
|
||||
#define ORIENTATION_LEFTTOP 5 /* row 0 lhs, col 0 top */
|
||||
#define ORIENTATION_RIGHTTOP 6 /* row 0 rhs, col 0 top */
|
||||
#define ORIENTATION_RIGHTBOT 7 /* row 0 rhs, col 0 bottom */
|
||||
#define ORIENTATION_LEFTBOT 8 /* row 0 lhs, col 0 bottom */
|
||||
#define TIFFTAG_SAMPLESPERPIXEL 277 /* samples per pixel */
|
||||
#define TIFFTAG_ROWSPERSTRIP 278 /* rows per strip of data */
|
||||
#define TIFFTAG_STRIPBYTECOUNTS 279 /* bytes counts for strips */
|
||||
#define TIFFTAG_MINSAMPLEVALUE 280 /* +minimum sample value */
|
||||
#define TIFFTAG_MAXSAMPLEVALUE 281 /* +maximum sample value */
|
||||
#define TIFFTAG_XRESOLUTION 282 /* pixels/resolution in x */
|
||||
#define TIFFTAG_YRESOLUTION 283 /* pixels/resolution in y */
|
||||
#define TIFFTAG_PLANARCONFIG 284 /* storage organization */
|
||||
#define PLANARCONFIG_CONTIG 1 /* single image plane */
|
||||
#define PLANARCONFIG_SEPARATE 2 /* separate planes of data */
|
||||
#define TIFFTAG_PAGENAME 285 /* page name image is from */
|
||||
#define TIFFTAG_XPOSITION 286 /* x page offset of image lhs */
|
||||
#define TIFFTAG_YPOSITION 287 /* y page offset of image lhs */
|
||||
#define TIFFTAG_FREEOFFSETS 288 /* +byte offset to free block */
|
||||
#define TIFFTAG_FREEBYTECOUNTS 289 /* +sizes of free blocks */
|
||||
#define TIFFTAG_GRAYRESPONSEUNIT 290 /* $gray scale curve accuracy */
|
||||
#define GRAYRESPONSEUNIT_10S 1 /* tenths of a unit */
|
||||
#define GRAYRESPONSEUNIT_100S 2 /* hundredths of a unit */
|
||||
#define GRAYRESPONSEUNIT_1000S 3 /* thousandths of a unit */
|
||||
#define GRAYRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
|
||||
#define GRAYRESPONSEUNIT_100000S 5 /* hundred-thousandths */
|
||||
#define TIFFTAG_GRAYRESPONSECURVE 291 /* $gray scale response curve */
|
||||
#define TIFFTAG_GROUP3OPTIONS 292 /* 32 flag bits */
|
||||
#define TIFFTAG_T4OPTIONS 292 /* TIFF 6.0 proper name alias */
|
||||
#define GROUP3OPT_2DENCODING 0x1 /* 2-dimensional coding */
|
||||
#define GROUP3OPT_UNCOMPRESSED 0x2 /* data not compressed */
|
||||
#define GROUP3OPT_FILLBITS 0x4 /* fill to byte boundary */
|
||||
#define TIFFTAG_GROUP4OPTIONS 293 /* 32 flag bits */
|
||||
#define TIFFTAG_T6OPTIONS 293 /* TIFF 6.0 proper name */
|
||||
#define GROUP4OPT_UNCOMPRESSED 0x2 /* data not compressed */
|
||||
#define TIFFTAG_RESOLUTIONUNIT 296 /* units of resolutions */
|
||||
#define RESUNIT_NONE 1 /* no meaningful units */
|
||||
#define RESUNIT_INCH 2 /* english */
|
||||
#define RESUNIT_CENTIMETER 3 /* metric */
|
||||
#define TIFFTAG_PAGENUMBER 297 /* page numbers of multi-page */
|
||||
#define TIFFTAG_COLORRESPONSEUNIT 300 /* $color curve accuracy */
|
||||
#define COLORRESPONSEUNIT_10S 1 /* tenths of a unit */
|
||||
#define COLORRESPONSEUNIT_100S 2 /* hundredths of a unit */
|
||||
#define COLORRESPONSEUNIT_1000S 3 /* thousandths of a unit */
|
||||
#define COLORRESPONSEUNIT_10000S 4 /* ten-thousandths of a unit */
|
||||
#define COLORRESPONSEUNIT_100000S 5 /* hundred-thousandths */
|
||||
#define TIFFTAG_TRANSFERFUNCTION 301 /* !colorimetry info */
|
||||
#define TIFFTAG_SOFTWARE 305 /* name & release */
|
||||
#define TIFFTAG_DATETIME 306 /* creation date and time */
|
||||
#define TIFFTAG_ARTIST 315 /* creator of image */
|
||||
#define TIFFTAG_HOSTCOMPUTER 316 /* machine where created */
|
||||
#define TIFFTAG_PREDICTOR 317 /* prediction scheme w/ LZW */
|
||||
#define PREDICTOR_NONE 1 /* no prediction scheme used */
|
||||
#define PREDICTOR_HORIZONTAL 2 /* horizontal differencing */
|
||||
#define PREDICTOR_FLOATINGPOINT 3 /* floating point predictor */
|
||||
#define TIFFTAG_WHITEPOINT 318 /* image white point */
|
||||
#define TIFFTAG_PRIMARYCHROMATICITIES 319 /* !primary chromaticities */
|
||||
#define TIFFTAG_COLORMAP 320 /* RGB map for pallette image */
|
||||
#define TIFFTAG_HALFTONEHINTS 321 /* !highlight+shadow info */
|
||||
#define TIFFTAG_TILEWIDTH 322 /* !tile width in pixels */
|
||||
#define TIFFTAG_TILELENGTH 323 /* !tile height in pixels */
|
||||
#define TIFFTAG_TILEOFFSETS 324 /* !offsets to data tiles */
|
||||
#define TIFFTAG_TILEBYTECOUNTS 325 /* !byte counts for tiles */
|
||||
#define TIFFTAG_BADFAXLINES 326 /* lines w/ wrong pixel count */
|
||||
#define TIFFTAG_CLEANFAXDATA 327 /* regenerated line info */
|
||||
#define CLEANFAXDATA_CLEAN 0 /* no errors detected */
|
||||
#define CLEANFAXDATA_REGENERATED 1 /* receiver regenerated lines */
|
||||
#define CLEANFAXDATA_UNCLEAN 2 /* uncorrected errors exist */
|
||||
#define TIFFTAG_CONSECUTIVEBADFAXLINES 328 /* max consecutive bad lines */
|
||||
#define TIFFTAG_SUBIFD 330 /* subimage descriptors */
|
||||
#define TIFFTAG_INKSET 332 /* !inks in separated image */
|
||||
#define INKSET_CMYK 1 /* !cyan-magenta-yellow-black color */
|
||||
#define INKSET_MULTIINK 2 /* !multi-ink or hi-fi color */
|
||||
#define TIFFTAG_INKNAMES 333 /* !ascii names of inks */
|
||||
#define TIFFTAG_NUMBEROFINKS 334 /* !number of inks */
|
||||
#define TIFFTAG_DOTRANGE 336 /* !0% and 100% dot codes */
|
||||
#define TIFFTAG_TARGETPRINTER 337 /* !separation target */
|
||||
#define TIFFTAG_EXTRASAMPLES 338 /* !info about extra samples */
|
||||
#define EXTRASAMPLE_UNSPECIFIED 0 /* !unspecified data */
|
||||
#define EXTRASAMPLE_ASSOCALPHA 1 /* !associated alpha data */
|
||||
#define EXTRASAMPLE_UNASSALPHA 2 /* !unassociated alpha data */
|
||||
#define TIFFTAG_SAMPLEFORMAT 339 /* !data sample format */
|
||||
#define SAMPLEFORMAT_UINT 1 /* !unsigned integer data */
|
||||
#define SAMPLEFORMAT_INT 2 /* !signed integer data */
|
||||
#define SAMPLEFORMAT_IEEEFP 3 /* !IEEE floating point data */
|
||||
#define SAMPLEFORMAT_VOID 4 /* !untyped data */
|
||||
#define SAMPLEFORMAT_COMPLEXINT 5 /* !complex signed int */
|
||||
#define SAMPLEFORMAT_COMPLEXIEEEFP 6 /* !complex ieee floating */
|
||||
#define TIFFTAG_SMINSAMPLEVALUE 340 /* !variable MinSampleValue */
|
||||
#define TIFFTAG_SMAXSAMPLEVALUE 341 /* !variable MaxSampleValue */
|
||||
#define TIFFTAG_CLIPPATH 343 /* %ClipPath
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_XCLIPPATHUNITS 344 /* %XClipPathUnits
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_YCLIPPATHUNITS 345 /* %YClipPathUnits
|
||||
[Adobe TIFF technote 2] */
|
||||
#define TIFFTAG_INDEXED 346 /* %Indexed
|
||||
[Adobe TIFF Technote 3] */
|
||||
#define TIFFTAG_JPEGTABLES 347 /* %JPEG table stream */
|
||||
#define TIFFTAG_OPIPROXY 351 /* %OPI Proxy [Adobe TIFF technote] */
|
||||
/*
|
||||
* Tags 512-521 are obsoleted by Technical Note #2 which specifies a
|
||||
* revised JPEG-in-TIFF scheme.
|
||||
*/
|
||||
#define TIFFTAG_JPEGPROC 512 /* !JPEG processing algorithm */
|
||||
#define JPEGPROC_BASELINE 1 /* !baseline sequential */
|
||||
#define JPEGPROC_LOSSLESS 14 /* !Huffman coded lossless */
|
||||
#define TIFFTAG_JPEGIFOFFSET 513 /* !pointer to SOI marker */
|
||||
#define TIFFTAG_JPEGIFBYTECOUNT 514 /* !JFIF stream length */
|
||||
#define TIFFTAG_JPEGRESTARTINTERVAL 515 /* !restart interval length */
|
||||
#define TIFFTAG_JPEGLOSSLESSPREDICTORS 517 /* !lossless proc predictor */
|
||||
#define TIFFTAG_JPEGPOINTTRANSFORM 518 /* !lossless point transform */
|
||||
#define TIFFTAG_JPEGQTABLES 519 /* !Q matrice offsets */
|
||||
#define TIFFTAG_JPEGDCTABLES 520 /* !DCT table offsets */
|
||||
#define TIFFTAG_JPEGACTABLES 521 /* !AC coefficient offsets */
|
||||
#define TIFFTAG_YCBCRCOEFFICIENTS 529 /* !RGB -> YCbCr transform */
|
||||
#define TIFFTAG_YCBCRSUBSAMPLING 530 /* !YCbCr subsampling factors */
|
||||
#define TIFFTAG_YCBCRPOSITIONING 531 /* !subsample positioning */
|
||||
#define YCBCRPOSITION_CENTERED 1 /* !as in PostScript Level 2 */
|
||||
#define YCBCRPOSITION_COSITED 2 /* !as in CCIR 601-1 */
|
||||
#define TIFFTAG_REFERENCEBLACKWHITE 532 /* !colorimetry info */
|
||||
#define TIFFTAG_XMLPACKET 700 /* %XML packet
|
||||
[Adobe XMP Specification,
|
||||
January 2004 */
|
||||
#define TIFFTAG_OPIIMAGEID 32781 /* %OPI ImageID
|
||||
[Adobe TIFF technote] */
|
||||
/* tags 32952-32956 are private tags registered to Island Graphics */
|
||||
#define TIFFTAG_REFPTS 32953 /* image reference points */
|
||||
#define TIFFTAG_REGIONTACKPOINT 32954 /* region-xform tack point */
|
||||
#define TIFFTAG_REGIONWARPCORNERS 32955 /* warp quadrilateral */
|
||||
#define TIFFTAG_REGIONAFFINE 32956 /* affine transformation mat */
|
||||
/* tags 32995-32999 are private tags registered to SGI */
|
||||
#define TIFFTAG_MATTEING 32995 /* $use ExtraSamples */
|
||||
#define TIFFTAG_DATATYPE 32996 /* $use SampleFormat */
|
||||
#define TIFFTAG_IMAGEDEPTH 32997 /* z depth of image */
|
||||
#define TIFFTAG_TILEDEPTH 32998 /* z depth/data tile */
|
||||
/* tags 33300-33309 are private tags registered to Pixar */
|
||||
/*
|
||||
* TIFFTAG_PIXAR_IMAGEFULLWIDTH and TIFFTAG_PIXAR_IMAGEFULLLENGTH
|
||||
* are set when an image has been cropped out of a larger image.
|
||||
* They reflect the size of the original uncropped image.
|
||||
* The TIFFTAG_XPOSITION and TIFFTAG_YPOSITION can be used
|
||||
* to determine the position of the smaller image in the larger one.
|
||||
*/
|
||||
#define TIFFTAG_PIXAR_IMAGEFULLWIDTH 33300 /* full image size in x */
|
||||
#define TIFFTAG_PIXAR_IMAGEFULLLENGTH 33301 /* full image size in y */
|
||||
/* Tags 33302-33306 are used to identify special image modes and data
|
||||
* used by Pixar's texture formats.
|
||||
*/
|
||||
#define TIFFTAG_PIXAR_TEXTUREFORMAT 33302 /* texture map format */
|
||||
#define TIFFTAG_PIXAR_WRAPMODES 33303 /* s & t wrap modes */
|
||||
#define TIFFTAG_PIXAR_FOVCOT 33304 /* cotan(fov) for env. maps */
|
||||
#define TIFFTAG_PIXAR_MATRIX_WORLDTOSCREEN 33305
|
||||
#define TIFFTAG_PIXAR_MATRIX_WORLDTOCAMERA 33306
|
||||
/* tag 33405 is a private tag registered to Eastman Kodak */
|
||||
#define TIFFTAG_WRITERSERIALNUMBER 33405 /* device serial number */
|
||||
/* tag 33432 is listed in the 6.0 spec w/ unknown ownership */
|
||||
#define TIFFTAG_COPYRIGHT 33432 /* copyright string */
|
||||
/* IPTC TAG from RichTIFF specifications */
|
||||
#define TIFFTAG_RICHTIFFIPTC 33723
|
||||
/* 34016-34029 are reserved for ANSI IT8 TIFF/IT <dkelly@apago.com) */
|
||||
#define TIFFTAG_IT8SITE 34016 /* site name */
|
||||
#define TIFFTAG_IT8COLORSEQUENCE 34017 /* color seq. [RGB,CMYK,etc] */
|
||||
#define TIFFTAG_IT8HEADER 34018 /* DDES Header */
|
||||
#define TIFFTAG_IT8RASTERPADDING 34019 /* raster scanline padding */
|
||||
#define TIFFTAG_IT8BITSPERRUNLENGTH 34020 /* # of bits in short run */
|
||||
#define TIFFTAG_IT8BITSPEREXTENDEDRUNLENGTH 34021/* # of bits in long run */
|
||||
#define TIFFTAG_IT8COLORTABLE 34022 /* LW colortable */
|
||||
#define TIFFTAG_IT8IMAGECOLORINDICATOR 34023 /* BP/BL image color switch */
|
||||
#define TIFFTAG_IT8BKGCOLORINDICATOR 34024 /* BP/BL bg color switch */
|
||||
#define TIFFTAG_IT8IMAGECOLORVALUE 34025 /* BP/BL image color value */
|
||||
#define TIFFTAG_IT8BKGCOLORVALUE 34026 /* BP/BL bg color value */
|
||||
#define TIFFTAG_IT8PIXELINTENSITYRANGE 34027 /* MP pixel intensity value */
|
||||
#define TIFFTAG_IT8TRANSPARENCYINDICATOR 34028 /* HC transparency switch */
|
||||
#define TIFFTAG_IT8COLORCHARACTERIZATION 34029 /* color character. table */
|
||||
#define TIFFTAG_IT8HCUSAGE 34030 /* HC usage indicator */
|
||||
#define TIFFTAG_IT8TRAPINDICATOR 34031 /* Trapping indicator
|
||||
(untrapped=0, trapped=1) */
|
||||
#define TIFFTAG_IT8CMYKEQUIVALENT 34032 /* CMYK color equivalents */
|
||||
/* tags 34232-34236 are private tags registered to Texas Instruments */
|
||||
#define TIFFTAG_FRAMECOUNT 34232 /* Sequence Frame Count */
|
||||
/* tag 34377 is private tag registered to Adobe for PhotoShop */
|
||||
#define TIFFTAG_PHOTOSHOP 34377
|
||||
/* tags 34665, 34853 and 40965 are documented in EXIF specification */
|
||||
#define TIFFTAG_EXIFIFD 34665 /* Pointer to EXIF private directory */
|
||||
/* tag 34750 is a private tag registered to Adobe? */
|
||||
#define TIFFTAG_ICCPROFILE 34675 /* ICC profile data */
|
||||
/* tag 34750 is a private tag registered to Pixel Magic */
|
||||
#define TIFFTAG_JBIGOPTIONS 34750 /* JBIG options */
|
||||
#define TIFFTAG_GPSIFD 34853 /* Pointer to GPS private directory */
|
||||
/* tags 34908-34914 are private tags registered to SGI */
|
||||
#define TIFFTAG_FAXRECVPARAMS 34908 /* encoded Class 2 ses. parms */
|
||||
#define TIFFTAG_FAXSUBADDRESS 34909 /* received SubAddr string */
|
||||
#define TIFFTAG_FAXRECVTIME 34910 /* receive time (secs) */
|
||||
#define TIFFTAG_FAXDCS 34911 /* encoded fax ses. params, Table 2/T.30 */
|
||||
/* tags 37439-37443 are registered to SGI <gregl@sgi.com> */
|
||||
#define TIFFTAG_STONITS 37439 /* Sample value to Nits */
|
||||
/* tag 34929 is a private tag registered to FedEx */
|
||||
#define TIFFTAG_FEDEX_EDR 34929 /* unknown use */
|
||||
#define TIFFTAG_INTEROPERABILITYIFD 40965 /* Pointer to Interoperability private directory */
|
||||
/* Adobe Digital Negative (DNG) format tags */
|
||||
#define TIFFTAG_DNGVERSION 50706 /* &DNG version number */
|
||||
#define TIFFTAG_DNGBACKWARDVERSION 50707 /* &DNG compatibility version */
|
||||
#define TIFFTAG_UNIQUECAMERAMODEL 50708 /* &name for the camera model */
|
||||
#define TIFFTAG_LOCALIZEDCAMERAMODEL 50709 /* &localized camera model
|
||||
name */
|
||||
#define TIFFTAG_CFAPLANECOLOR 50710 /* &CFAPattern->LinearRaw space
|
||||
mapping */
|
||||
#define TIFFTAG_CFALAYOUT 50711 /* &spatial layout of the CFA */
|
||||
#define TIFFTAG_LINEARIZATIONTABLE 50712 /* &lookup table description */
|
||||
#define TIFFTAG_BLACKLEVELREPEATDIM 50713 /* &repeat pattern size for
|
||||
the BlackLevel tag */
|
||||
#define TIFFTAG_BLACKLEVEL 50714 /* &zero light encoding level */
|
||||
#define TIFFTAG_BLACKLEVELDELTAH 50715 /* &zero light encoding level
|
||||
differences (columns) */
|
||||
#define TIFFTAG_BLACKLEVELDELTAV 50716 /* &zero light encoding level
|
||||
differences (rows) */
|
||||
#define TIFFTAG_WHITELEVEL 50717 /* &fully saturated encoding
|
||||
level */
|
||||
#define TIFFTAG_DEFAULTSCALE 50718 /* &default scale factors */
|
||||
#define TIFFTAG_DEFAULTCROPORIGIN 50719 /* &origin of the final image
|
||||
area */
|
||||
#define TIFFTAG_DEFAULTCROPSIZE 50720 /* &size of the final image
|
||||
area */
|
||||
#define TIFFTAG_COLORMATRIX1 50721 /* &XYZ->reference color space
|
||||
transformation matrix 1 */
|
||||
#define TIFFTAG_COLORMATRIX2 50722 /* &XYZ->reference color space
|
||||
transformation matrix 2 */
|
||||
#define TIFFTAG_CAMERACALIBRATION1 50723 /* &calibration matrix 1 */
|
||||
#define TIFFTAG_CAMERACALIBRATION2 50724 /* &calibration matrix 2 */
|
||||
#define TIFFTAG_REDUCTIONMATRIX1 50725 /* &dimensionality reduction
|
||||
matrix 1 */
|
||||
#define TIFFTAG_REDUCTIONMATRIX2 50726 /* &dimensionality reduction
|
||||
matrix 2 */
|
||||
#define TIFFTAG_ANALOGBALANCE 50727 /* &gain applied the stored raw
|
||||
values*/
|
||||
#define TIFFTAG_ASSHOTNEUTRAL 50728 /* &selected white balance in
|
||||
linear reference space */
|
||||
#define TIFFTAG_ASSHOTWHITEXY 50729 /* &selected white balance in
|
||||
x-y chromaticity
|
||||
coordinates */
|
||||
#define TIFFTAG_BASELINEEXPOSURE 50730 /* &how much to move the zero
|
||||
point */
|
||||
#define TIFFTAG_BASELINENOISE 50731 /* &relative noise level */
|
||||
#define TIFFTAG_BASELINESHARPNESS 50732 /* &relative amount of
|
||||
sharpening */
|
||||
#define TIFFTAG_BAYERGREENSPLIT 50733 /* &how closely the values of
|
||||
the green pixels in the
|
||||
blue/green rows track the
|
||||
values of the green pixels
|
||||
in the red/green rows */
|
||||
#define TIFFTAG_LINEARRESPONSELIMIT 50734 /* &non-linear encoding range */
|
||||
#define TIFFTAG_CAMERASERIALNUMBER 50735 /* &camera's serial number */
|
||||
#define TIFFTAG_LENSINFO 50736 /* info about the lens */
|
||||
#define TIFFTAG_CHROMABLURRADIUS 50737 /* &chroma blur radius */
|
||||
#define TIFFTAG_ANTIALIASSTRENGTH 50738 /* &relative strength of the
|
||||
camera's anti-alias filter */
|
||||
#define TIFFTAG_SHADOWSCALE 50739 /* &used by Adobe Camera Raw */
|
||||
#define TIFFTAG_DNGPRIVATEDATA 50740 /* &manufacturer's private data */
|
||||
#define TIFFTAG_MAKERNOTESAFETY 50741 /* &whether the EXIF MakerNote
|
||||
tag is safe to preserve
|
||||
along with the rest of the
|
||||
EXIF data */
|
||||
#define TIFFTAG_CALIBRATIONILLUMINANT1 50778 /* &illuminant 1 */
|
||||
#define TIFFTAG_CALIBRATIONILLUMINANT2 50779 /* &illuminant 2 */
|
||||
#define TIFFTAG_BESTQUALITYSCALE 50780 /* &best quality multiplier */
|
||||
#define TIFFTAG_RAWDATAUNIQUEID 50781 /* &unique identifier for
|
||||
the raw image data */
|
||||
#define TIFFTAG_ORIGINALRAWFILENAME 50827 /* &file name of the original
|
||||
raw file */
|
||||
#define TIFFTAG_ORIGINALRAWFILEDATA 50828 /* &contents of the original
|
||||
raw file */
|
||||
#define TIFFTAG_ACTIVEAREA 50829 /* &active (non-masked) pixels
|
||||
of the sensor */
|
||||
#define TIFFTAG_MASKEDAREAS 50830 /* &list of coordinates
|
||||
of fully masked pixels */
|
||||
#define TIFFTAG_ASSHOTICCPROFILE 50831 /* &these two tags used to */
|
||||
#define TIFFTAG_ASSHOTPREPROFILEMATRIX 50832 /* map cameras's color space
|
||||
into ICC profile space */
|
||||
#define TIFFTAG_CURRENTICCPROFILE 50833 /* & */
|
||||
#define TIFFTAG_CURRENTPREPROFILEMATRIX 50834 /* & */
|
||||
/* tag 65535 is an undefined tag used by Eastman Kodak */
|
||||
#define TIFFTAG_DCSHUESHIFTVALUES 65535 /* hue shift correction data */
|
||||
|
||||
/*
|
||||
* The following are ``pseudo tags'' that can be used to control
|
||||
* codec-specific functionality. These tags are not written to file.
|
||||
* Note that these values start at 0xffff+1 so that they'll never
|
||||
* collide with Aldus-assigned tags.
|
||||
*
|
||||
* If you want your private pseudo tags ``registered'' (i.e. added to
|
||||
* this file), please post a bug report via the tracking system at
|
||||
* http://www.remotesensing.org/libtiff/bugs.html with the appropriate
|
||||
* C definitions to add.
|
||||
*/
|
||||
#define TIFFTAG_FAXMODE 65536 /* Group 3/4 format control */
|
||||
#define FAXMODE_CLASSIC 0x0000 /* default, include RTC */
|
||||
#define FAXMODE_NORTC 0x0001 /* no RTC at end of data */
|
||||
#define FAXMODE_NOEOL 0x0002 /* no EOL code at end of row */
|
||||
#define FAXMODE_BYTEALIGN 0x0004 /* byte align row */
|
||||
#define FAXMODE_WORDALIGN 0x0008 /* word align row */
|
||||
#define FAXMODE_CLASSF FAXMODE_NORTC /* TIFF Class F */
|
||||
#define TIFFTAG_JPEGQUALITY 65537 /* Compression quality level */
|
||||
/* Note: quality level is on the IJG 0-100 scale. Default value is 75 */
|
||||
#define TIFFTAG_JPEGCOLORMODE 65538 /* Auto RGB<=>YCbCr convert? */
|
||||
#define JPEGCOLORMODE_RAW 0x0000 /* no conversion (default) */
|
||||
#define JPEGCOLORMODE_RGB 0x0001 /* do auto conversion */
|
||||
#define TIFFTAG_JPEGTABLESMODE 65539 /* What to put in JPEGTables */
|
||||
#define JPEGTABLESMODE_QUANT 0x0001 /* include quantization tbls */
|
||||
#define JPEGTABLESMODE_HUFF 0x0002 /* include Huffman tbls */
|
||||
/* Note: default is JPEGTABLESMODE_QUANT | JPEGTABLESMODE_HUFF */
|
||||
#define TIFFTAG_FAXFILLFUNC 65540 /* G3/G4 fill function */
|
||||
#define TIFFTAG_PIXARLOGDATAFMT 65549 /* PixarLogCodec I/O data sz */
|
||||
#define PIXARLOGDATAFMT_8BIT 0 /* regular u_char samples */
|
||||
#define PIXARLOGDATAFMT_8BITABGR 1 /* ABGR-order u_chars */
|
||||
#define PIXARLOGDATAFMT_11BITLOG 2 /* 11-bit log-encoded (raw) */
|
||||
#define PIXARLOGDATAFMT_12BITPICIO 3 /* as per PICIO (1.0==2048) */
|
||||
#define PIXARLOGDATAFMT_16BIT 4 /* signed short samples */
|
||||
#define PIXARLOGDATAFMT_FLOAT 5 /* IEEE float samples */
|
||||
/* 65550-65556 are allocated to Oceana Matrix <dev@oceana.com> */
|
||||
#define TIFFTAG_DCSIMAGERTYPE 65550 /* imager model & filter */
|
||||
#define DCSIMAGERMODEL_M3 0 /* M3 chip (1280 x 1024) */
|
||||
#define DCSIMAGERMODEL_M5 1 /* M5 chip (1536 x 1024) */
|
||||
#define DCSIMAGERMODEL_M6 2 /* M6 chip (3072 x 2048) */
|
||||
#define DCSIMAGERFILTER_IR 0 /* infrared filter */
|
||||
#define DCSIMAGERFILTER_MONO 1 /* monochrome filter */
|
||||
#define DCSIMAGERFILTER_CFA 2 /* color filter array */
|
||||
#define DCSIMAGERFILTER_OTHER 3 /* other filter */
|
||||
#define TIFFTAG_DCSINTERPMODE 65551 /* interpolation mode */
|
||||
#define DCSINTERPMODE_NORMAL 0x0 /* whole image, default */
|
||||
#define DCSINTERPMODE_PREVIEW 0x1 /* preview of image (384x256) */
|
||||
#define TIFFTAG_DCSBALANCEARRAY 65552 /* color balance values */
|
||||
#define TIFFTAG_DCSCORRECTMATRIX 65553 /* color correction values */
|
||||
#define TIFFTAG_DCSGAMMA 65554 /* gamma value */
|
||||
#define TIFFTAG_DCSTOESHOULDERPTS 65555 /* toe & shoulder points */
|
||||
#define TIFFTAG_DCSCALIBRATIONFD 65556 /* calibration file desc */
|
||||
/* Note: quality level is on the ZLIB 1-9 scale. Default value is -1 */
|
||||
#define TIFFTAG_ZIPQUALITY 65557 /* compression quality level */
|
||||
#define TIFFTAG_PIXARLOGQUALITY 65558 /* PixarLog uses same scale */
|
||||
/* 65559 is allocated to Oceana Matrix <dev@oceana.com> */
|
||||
#define TIFFTAG_DCSCLIPRECTANGLE 65559 /* area of image to acquire */
|
||||
#define TIFFTAG_SGILOGDATAFMT 65560 /* SGILog user data format */
|
||||
#define SGILOGDATAFMT_FLOAT 0 /* IEEE float samples */
|
||||
#define SGILOGDATAFMT_16BIT 1 /* 16-bit samples */
|
||||
#define SGILOGDATAFMT_RAW 2 /* uninterpreted data */
|
||||
#define SGILOGDATAFMT_8BIT 3 /* 8-bit RGB monitor values */
|
||||
#define TIFFTAG_SGILOGENCODE 65561 /* SGILog data encoding control*/
|
||||
#define SGILOGENCODE_NODITHER 0 /* do not dither encoded values*/
|
||||
#define SGILOGENCODE_RANDITHER 1 /* randomly dither encd values */
|
||||
#define TIFFTAG_LZMAPRESET 65562 /* LZMA2 preset (compression level) */
|
||||
#define TIFFTAG_PERSAMPLE 65563 /* interface for per sample tags */
|
||||
#define PERSAMPLE_MERGED 0 /* present as a single value */
|
||||
#define PERSAMPLE_MULTI 1 /* present as multiple values */
|
||||
|
||||
/*
|
||||
* EXIF tags
|
||||
*/
|
||||
#define EXIFTAG_EXPOSURETIME 33434 /* Exposure time */
|
||||
#define EXIFTAG_FNUMBER 33437 /* F number */
|
||||
#define EXIFTAG_EXPOSUREPROGRAM 34850 /* Exposure program */
|
||||
#define EXIFTAG_SPECTRALSENSITIVITY 34852 /* Spectral sensitivity */
|
||||
#define EXIFTAG_ISOSPEEDRATINGS 34855 /* ISO speed rating */
|
||||
#define EXIFTAG_OECF 34856 /* Optoelectric conversion
|
||||
factor */
|
||||
#define EXIFTAG_EXIFVERSION 36864 /* Exif version */
|
||||
#define EXIFTAG_DATETIMEORIGINAL 36867 /* Date and time of original
|
||||
data generation */
|
||||
#define EXIFTAG_DATETIMEDIGITIZED 36868 /* Date and time of digital
|
||||
data generation */
|
||||
#define EXIFTAG_COMPONENTSCONFIGURATION 37121 /* Meaning of each component */
|
||||
#define EXIFTAG_COMPRESSEDBITSPERPIXEL 37122 /* Image compression mode */
|
||||
#define EXIFTAG_SHUTTERSPEEDVALUE 37377 /* Shutter speed */
|
||||
#define EXIFTAG_APERTUREVALUE 37378 /* Aperture */
|
||||
#define EXIFTAG_BRIGHTNESSVALUE 37379 /* Brightness */
|
||||
#define EXIFTAG_EXPOSUREBIASVALUE 37380 /* Exposure bias */
|
||||
#define EXIFTAG_MAXAPERTUREVALUE 37381 /* Maximum lens aperture */
|
||||
#define EXIFTAG_SUBJECTDISTANCE 37382 /* Subject distance */
|
||||
#define EXIFTAG_METERINGMODE 37383 /* Metering mode */
|
||||
#define EXIFTAG_LIGHTSOURCE 37384 /* Light source */
|
||||
#define EXIFTAG_FLASH 37385 /* Flash */
|
||||
#define EXIFTAG_FOCALLENGTH 37386 /* Lens focal length */
|
||||
#define EXIFTAG_SUBJECTAREA 37396 /* Subject area */
|
||||
#define EXIFTAG_MAKERNOTE 37500 /* Manufacturer notes */
|
||||
#define EXIFTAG_USERCOMMENT 37510 /* User comments */
|
||||
#define EXIFTAG_SUBSECTIME 37520 /* DateTime subseconds */
|
||||
#define EXIFTAG_SUBSECTIMEORIGINAL 37521 /* DateTimeOriginal subseconds */
|
||||
#define EXIFTAG_SUBSECTIMEDIGITIZED 37522 /* DateTimeDigitized subseconds */
|
||||
#define EXIFTAG_FLASHPIXVERSION 40960 /* Supported Flashpix version */
|
||||
#define EXIFTAG_COLORSPACE 40961 /* Color space information */
|
||||
#define EXIFTAG_PIXELXDIMENSION 40962 /* Valid image width */
|
||||
#define EXIFTAG_PIXELYDIMENSION 40963 /* Valid image height */
|
||||
#define EXIFTAG_RELATEDSOUNDFILE 40964 /* Related audio file */
|
||||
#define EXIFTAG_FLASHENERGY 41483 /* Flash energy */
|
||||
#define EXIFTAG_SPATIALFREQUENCYRESPONSE 41484 /* Spatial frequency response */
|
||||
#define EXIFTAG_FOCALPLANEXRESOLUTION 41486 /* Focal plane X resolution */
|
||||
#define EXIFTAG_FOCALPLANEYRESOLUTION 41487 /* Focal plane Y resolution */
|
||||
#define EXIFTAG_FOCALPLANERESOLUTIONUNIT 41488 /* Focal plane resolution unit */
|
||||
#define EXIFTAG_SUBJECTLOCATION 41492 /* Subject location */
|
||||
#define EXIFTAG_EXPOSUREINDEX 41493 /* Exposure index */
|
||||
#define EXIFTAG_SENSINGMETHOD 41495 /* Sensing method */
|
||||
#define EXIFTAG_FILESOURCE 41728 /* File source */
|
||||
#define EXIFTAG_SCENETYPE 41729 /* Scene type */
|
||||
#define EXIFTAG_CFAPATTERN 41730 /* CFA pattern */
|
||||
#define EXIFTAG_CUSTOMRENDERED 41985 /* Custom image processing */
|
||||
#define EXIFTAG_EXPOSUREMODE 41986 /* Exposure mode */
|
||||
#define EXIFTAG_WHITEBALANCE 41987 /* White balance */
|
||||
#define EXIFTAG_DIGITALZOOMRATIO 41988 /* Digital zoom ratio */
|
||||
#define EXIFTAG_FOCALLENGTHIN35MMFILM 41989 /* Focal length in 35 mm film */
|
||||
#define EXIFTAG_SCENECAPTURETYPE 41990 /* Scene capture type */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_CONTRAST 41992 /* Contrast */
|
||||
#define EXIFTAG_SATURATION 41993 /* Saturation */
|
||||
#define EXIFTAG_SHARPNESS 41994 /* Sharpness */
|
||||
#define EXIFTAG_DEVICESETTINGDESCRIPTION 41995 /* Device settings description */
|
||||
#define EXIFTAG_SUBJECTDISTANCERANGE 41996 /* Subject distance range */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_GAINCONTROL 41991 /* Gain control */
|
||||
#define EXIFTAG_IMAGEUNIQUEID 42016 /* Unique image ID */
|
||||
|
||||
#endif /* _TIFF_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
|
@ -0,0 +1,160 @@
|
|||
/*
|
||||
Configuration defines for installed libtiff.
|
||||
This file maintained for backward compatibility. Do not use definitions
|
||||
from this file in your programs.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFCONF_
|
||||
#define _TIFFCONF_
|
||||
|
||||
/* Define to 1 if the system has the type `int16'. */
|
||||
/* #undef HAVE_INT16 */
|
||||
|
||||
/* Define to 1 if the system has the type `int32'. */
|
||||
/* #undef HAVE_INT32 */
|
||||
|
||||
/* Define to 1 if the system has the type `int8'. */
|
||||
/* #undef HAVE_INT8 */
|
||||
|
||||
/* The size of a `int', as computed by sizeof. */
|
||||
#define SIZEOF_INT 4
|
||||
|
||||
/* Signed 8-bit type */
|
||||
#define TIFF_INT8_T signed char
|
||||
|
||||
/* Unsigned 8-bit type */
|
||||
#define TIFF_UINT8_T unsigned char
|
||||
|
||||
/* Signed 16-bit type */
|
||||
#define TIFF_INT16_T signed short
|
||||
|
||||
/* Unsigned 16-bit type */
|
||||
#define TIFF_UINT16_T unsigned short
|
||||
|
||||
/* Signed 32-bit type formatter */
|
||||
#define TIFF_INT32_FORMAT "%d"
|
||||
|
||||
/* Signed 32-bit type */
|
||||
#define TIFF_INT32_T signed int
|
||||
|
||||
/* Unsigned 32-bit type formatter */
|
||||
#define TIFF_UINT32_FORMAT "%u"
|
||||
|
||||
/* Unsigned 32-bit type */
|
||||
#define TIFF_UINT32_T unsigned int
|
||||
|
||||
/* Signed 64-bit type formatter */
|
||||
#define TIFF_INT64_FORMAT "%I64d"
|
||||
|
||||
/* Signed 64-bit type */
|
||||
#define TIFF_INT64_T signed __int64
|
||||
|
||||
/* Unsigned 64-bit type formatter */
|
||||
#define TIFF_UINT64_FORMAT "%I64u"
|
||||
|
||||
/* Unsigned 64-bit type */
|
||||
#define TIFF_UINT64_T unsigned __int64
|
||||
|
||||
/* Signed size type */
|
||||
#if defined(_WIN64)
|
||||
#define TIFF_SSIZE_T signed __int64
|
||||
#else
|
||||
#define TIFF_SSIZE_T signed int
|
||||
#endif
|
||||
|
||||
/* Signed size type formatter */
|
||||
#if defined(_WIN64)
|
||||
#define TIFF_SSIZE_FORMAT "%I64d"
|
||||
#else
|
||||
#define TIFF_SSIZE_FORMAT "%ld"
|
||||
#endif
|
||||
|
||||
/* Pointer difference type */
|
||||
#define TIFF_PTRDIFF_T long
|
||||
|
||||
/* Compatibility stuff. */
|
||||
|
||||
/* Define as 0 or 1 according to the floating point format suported by the
|
||||
machine */
|
||||
#define HAVE_IEEEFP 1
|
||||
|
||||
/* Set the native cpu bit order (FILLORDER_LSB2MSB or FILLORDER_MSB2LSB) */
|
||||
#define HOST_FILLORDER FILLORDER_LSB2MSB
|
||||
|
||||
/* Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
||||
(Intel) */
|
||||
#define HOST_BIGENDIAN 0
|
||||
|
||||
/* Support CCITT Group 3 & 4 algorithms */
|
||||
#define CCITT_SUPPORT 1
|
||||
|
||||
/* Support JPEG compression (requires IJG JPEG library) */
|
||||
#define JPEG_SUPPORT 1
|
||||
|
||||
/* Support JBIG compression (requires JBIG-KIT library) */
|
||||
/* #undef JBIG_SUPPORT */
|
||||
|
||||
/* Support LogLuv high dynamic range encoding */
|
||||
#define LOGLUV_SUPPORT 1
|
||||
|
||||
/* Support LZW algorithm */
|
||||
#define LZW_SUPPORT 1
|
||||
|
||||
/* Support NeXT 2-bit RLE algorithm */
|
||||
#define NEXT_SUPPORT 1
|
||||
|
||||
/* Support Old JPEG compresson (read contrib/ojpeg/README first! Compilation
|
||||
fails with unpatched IJG JPEG library) */
|
||||
#define OJPEG_SUPPORT 1
|
||||
|
||||
/* Support Macintosh PackBits algorithm */
|
||||
#define PACKBITS_SUPPORT 1
|
||||
|
||||
/* Support Pixar log-format algorithm (requires Zlib) */
|
||||
#define PIXARLOG_SUPPORT 1
|
||||
|
||||
/* Support ThunderScan 4-bit RLE algorithm */
|
||||
#define THUNDER_SUPPORT 1
|
||||
|
||||
/* Support Deflate compression */
|
||||
#define ZIP_SUPPORT 1
|
||||
|
||||
/* Support strip chopping (whether or not to convert single-strip uncompressed
|
||||
images to mutiple strips of ~8Kb to reduce memory usage) */
|
||||
#define STRIPCHOP_DEFAULT TIFF_STRIPCHOP
|
||||
|
||||
/* Enable SubIFD tag (330) support */
|
||||
#define SUBIFD_SUPPORT 1
|
||||
|
||||
/* Treat extra sample as alpha (default enabled). The RGBA interface will
|
||||
treat a fourth sample with no EXTRASAMPLE_ value as being ASSOCALPHA. Many
|
||||
packages produce RGBA files but don't mark the alpha properly. */
|
||||
#define DEFAULT_EXTRASAMPLE_AS_ALPHA 1
|
||||
|
||||
/* Pick up YCbCr subsampling info from the JPEG data stream to support files
|
||||
lacking the tag (default enabled). */
|
||||
#define CHECK_JPEG_YCBCR_SUBSAMPLING 1
|
||||
|
||||
/* Support MS MDI magic number files as TIFF */
|
||||
#define MDI_SUPPORT 1
|
||||
|
||||
/*
|
||||
* Feature support definitions.
|
||||
* XXX: These macros are obsoleted. Don't use them in your apps!
|
||||
* Macros stays here for backward compatibility and should be always defined.
|
||||
*/
|
||||
#define COLORIMETRY_SUPPORT
|
||||
#define YCBCR_SUPPORT
|
||||
#define CMYK_SUPPORT
|
||||
#define ICC_SUPPORT
|
||||
#define PHOTOSHOP_SUPPORT
|
||||
#define IPTC_SUPPORT
|
||||
|
||||
#endif /* _TIFFCONF_ */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
|
@ -0,0 +1,553 @@
|
|||
/* $Id: tiffio.h,v 1.89 2012-02-18 16:20:26 bfriesen Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988-1997 Sam Leffler
|
||||
* Copyright (c) 1991-1997 Silicon Graphics, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and
|
||||
* its documentation for any purpose is hereby granted without fee, provided
|
||||
* that (i) the above copyright notices and this permission notice appear in
|
||||
* all copies of the software and related documentation, and (ii) the names of
|
||||
* Sam Leffler and Silicon Graphics may not be used in any advertising or
|
||||
* publicity relating to the software without the specific, prior written
|
||||
* permission of Sam Leffler and Silicon Graphics.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
* WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*
|
||||
* IN NO EVENT SHALL SAM LEFFLER OR SILICON GRAPHICS BE LIABLE FOR
|
||||
* ANY SPECIAL, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND,
|
||||
* OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
* WHETHER OR NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF
|
||||
* LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||
* OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _TIFFIO_
|
||||
#define _TIFFIO_
|
||||
|
||||
/*
|
||||
* TIFF I/O Library Definitions.
|
||||
*/
|
||||
#include "tiff.h"
|
||||
#include "tiffvers.h"
|
||||
|
||||
#if defined(LIBTIFF_EXPORTS)
|
||||
#define TIFF_DLL __declspec(dllexport)
|
||||
#else /* use a DLL library */
|
||||
#define TIFF_DLL __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* TIFF is defined as an incomplete type to hide the
|
||||
* library's internal data structures from clients.
|
||||
*/
|
||||
typedef struct tiff TIFF;
|
||||
|
||||
/*
|
||||
* The following typedefs define the intrinsic size of
|
||||
* data types used in the *exported* interfaces. These
|
||||
* definitions depend on the proper definition of types
|
||||
* in tiff.h. Note also that the varargs interface used
|
||||
* to pass tag types and values uses the types defined in
|
||||
* tiff.h directly.
|
||||
*
|
||||
* NB: ttag_t is unsigned int and not unsigned short because
|
||||
* ANSI C requires that the type before the ellipsis be a
|
||||
* promoted type (i.e. one of int, unsigned int, pointer,
|
||||
* or double) and because we defined pseudo-tags that are
|
||||
* outside the range of legal Aldus-assigned tags.
|
||||
* NB: tsize_t is int32 and not uint32 because some functions
|
||||
* return -1.
|
||||
* NB: toff_t is not off_t for many reasons; TIFFs max out at
|
||||
* 32-bit file offsets, and BigTIFF maxes out at 64-bit
|
||||
* offsets being the most important, and to ensure use of
|
||||
* a consistently unsigned type across architectures.
|
||||
* Prior to libtiff 4.0, this was an unsigned 32 bit type.
|
||||
*/
|
||||
/*
|
||||
* this is the machine addressing size type, only it's signed, so make it
|
||||
* int32 on 32bit machines, int64 on 64bit machines
|
||||
*/
|
||||
typedef TIFF_SSIZE_T tmsize_t;
|
||||
typedef uint64 toff_t; /* file offset */
|
||||
/* the following are deprecated and should be replaced by their defining
|
||||
counterparts */
|
||||
typedef uint32 ttag_t; /* directory tag */
|
||||
typedef uint16 tdir_t; /* directory index */
|
||||
typedef uint16 tsample_t; /* sample number */
|
||||
typedef uint32 tstrile_t; /* strip or tile number */
|
||||
typedef tstrile_t tstrip_t; /* strip number */
|
||||
typedef tstrile_t ttile_t; /* tile number */
|
||||
typedef tmsize_t tsize_t; /* i/o size in bytes */
|
||||
typedef void* tdata_t; /* image data ref */
|
||||
|
||||
#if !defined(__WIN32__) && (defined(_WIN32) || defined(WIN32))
|
||||
#define __WIN32__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* On windows you should define USE_WIN32_FILEIO if you are using tif_win32.c
|
||||
* or AVOID_WIN32_FILEIO if you are using something else (like tif_unix.c).
|
||||
*
|
||||
* By default tif_unix.c is assumed.
|
||||
*/
|
||||
|
||||
#if defined(_WINDOWS) || defined(__WIN32__) || defined(_Windows)
|
||||
# if !defined(__CYGWIN) && !defined(AVOID_WIN32_FILEIO) && !defined(USE_WIN32_FILEIO)
|
||||
# define AVOID_WIN32_FILEIO
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(USE_WIN32_FILEIO)
|
||||
# define VC_EXTRALEAN
|
||||
# include <windows.h>
|
||||
# ifdef __WIN32__
|
||||
DECLARE_HANDLE(thandle_t); /* Win32 file handle */
|
||||
# else
|
||||
typedef HFILE thandle_t; /* client data handle */
|
||||
# endif /* __WIN32__ */
|
||||
#else
|
||||
typedef void* thandle_t; /* client data handle */
|
||||
#endif /* USE_WIN32_FILEIO */
|
||||
|
||||
/*
|
||||
* Flags to pass to TIFFPrintDirectory to control
|
||||
* printing of data structures that are potentially
|
||||
* very large. Bit-or these flags to enable printing
|
||||
* multiple items.
|
||||
*/
|
||||
#define TIFFPRINT_NONE 0x0 /* no extra info */
|
||||
#define TIFFPRINT_STRIPS 0x1 /* strips/tiles info */
|
||||
#define TIFFPRINT_CURVES 0x2 /* color/gray response curves */
|
||||
#define TIFFPRINT_COLORMAP 0x4 /* colormap */
|
||||
#define TIFFPRINT_JPEGQTABLES 0x100 /* JPEG Q matrices */
|
||||
#define TIFFPRINT_JPEGACTABLES 0x200 /* JPEG AC tables */
|
||||
#define TIFFPRINT_JPEGDCTABLES 0x200 /* JPEG DC tables */
|
||||
|
||||
/*
|
||||
* Colour conversion stuff
|
||||
*/
|
||||
|
||||
/* reference white */
|
||||
#define D65_X0 (95.0470F)
|
||||
#define D65_Y0 (100.0F)
|
||||
#define D65_Z0 (108.8827F)
|
||||
|
||||
#define D50_X0 (96.4250F)
|
||||
#define D50_Y0 (100.0F)
|
||||
#define D50_Z0 (82.4680F)
|
||||
|
||||
/* Structure for holding information about a display device. */
|
||||
|
||||
typedef unsigned char TIFFRGBValue; /* 8-bit samples */
|
||||
|
||||
typedef struct {
|
||||
float d_mat[3][3]; /* XYZ -> luminance matrix */
|
||||
float d_YCR; /* Light o/p for reference white */
|
||||
float d_YCG;
|
||||
float d_YCB;
|
||||
uint32 d_Vrwr; /* Pixel values for ref. white */
|
||||
uint32 d_Vrwg;
|
||||
uint32 d_Vrwb;
|
||||
float d_Y0R; /* Residual light for black pixel */
|
||||
float d_Y0G;
|
||||
float d_Y0B;
|
||||
float d_gammaR; /* Gamma values for the three guns */
|
||||
float d_gammaG;
|
||||
float d_gammaB;
|
||||
} TIFFDisplay;
|
||||
|
||||
typedef struct { /* YCbCr->RGB support */
|
||||
TIFFRGBValue* clamptab; /* range clamping table */
|
||||
int* Cr_r_tab;
|
||||
int* Cb_b_tab;
|
||||
int32* Cr_g_tab;
|
||||
int32* Cb_g_tab;
|
||||
int32* Y_tab;
|
||||
} TIFFYCbCrToRGB;
|
||||
|
||||
typedef struct { /* CIE Lab 1976->RGB support */
|
||||
int range; /* Size of conversion table */
|
||||
#define CIELABTORGB_TABLE_RANGE 1500
|
||||
float rstep, gstep, bstep;
|
||||
float X0, Y0, Z0; /* Reference white point */
|
||||
TIFFDisplay display;
|
||||
float Yr2r[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yr to r */
|
||||
float Yg2g[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yg to g */
|
||||
float Yb2b[CIELABTORGB_TABLE_RANGE + 1]; /* Conversion of Yb to b */
|
||||
} TIFFCIELabToRGB;
|
||||
|
||||
/*
|
||||
* RGBA-style image support.
|
||||
*/
|
||||
typedef struct _TIFFRGBAImage TIFFRGBAImage;
|
||||
/*
|
||||
* The image reading and conversion routines invoke
|
||||
* ``put routines'' to copy/image/whatever tiles of
|
||||
* raw image data. A default set of routines are
|
||||
* provided to convert/copy raw image data to 8-bit
|
||||
* packed ABGR format rasters. Applications can supply
|
||||
* alternate routines that unpack the data into a
|
||||
* different format or, for example, unpack the data
|
||||
* and draw the unpacked raster on the display.
|
||||
*/
|
||||
typedef void (*tileContigRoutine)
|
||||
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*);
|
||||
typedef void (*tileSeparateRoutine)
|
||||
(TIFFRGBAImage*, uint32*, uint32, uint32, uint32, uint32, int32, int32,
|
||||
unsigned char*, unsigned char*, unsigned char*, unsigned char*);
|
||||
/*
|
||||
* RGBA-reader state.
|
||||
*/
|
||||
struct _TIFFRGBAImage {
|
||||
TIFF* tif; /* image handle */
|
||||
int stoponerr; /* stop on read error */
|
||||
int isContig; /* data is packed/separate */
|
||||
int alpha; /* type of alpha data present */
|
||||
uint32 width; /* image width */
|
||||
uint32 height; /* image height */
|
||||
uint16 bitspersample; /* image bits/sample */
|
||||
uint16 samplesperpixel; /* image samples/pixel */
|
||||
uint16 orientation; /* image orientation */
|
||||
uint16 req_orientation; /* requested orientation */
|
||||
uint16 photometric; /* image photometric interp */
|
||||
uint16* redcmap; /* colormap pallete */
|
||||
uint16* greencmap;
|
||||
uint16* bluecmap;
|
||||
/* get image data routine */
|
||||
int (*get)(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||
/* put decoded strip/tile */
|
||||
union {
|
||||
void (*any)(TIFFRGBAImage*);
|
||||
tileContigRoutine contig;
|
||||
tileSeparateRoutine separate;
|
||||
} put;
|
||||
TIFFRGBValue* Map; /* sample mapping array */
|
||||
uint32** BWmap; /* black&white map */
|
||||
uint32** PALmap; /* palette image map */
|
||||
TIFFYCbCrToRGB* ycbcr; /* YCbCr conversion state */
|
||||
TIFFCIELabToRGB* cielab; /* CIE L*a*b conversion state */
|
||||
|
||||
uint8* UaToAa; /* Unassociated alpha to associated alpha convertion LUT */
|
||||
uint8* Bitdepth16To8; /* LUT for conversion from 16bit to 8bit values */
|
||||
|
||||
int row_offset;
|
||||
int col_offset;
|
||||
};
|
||||
|
||||
/*
|
||||
* Macros for extracting components from the
|
||||
* packed ABGR form returned by TIFFReadRGBAImage.
|
||||
*/
|
||||
#define TIFFGetR(abgr) ((abgr) & 0xff)
|
||||
#define TIFFGetG(abgr) (((abgr) >> 8) & 0xff)
|
||||
#define TIFFGetB(abgr) (((abgr) >> 16) & 0xff)
|
||||
#define TIFFGetA(abgr) (((abgr) >> 24) & 0xff)
|
||||
|
||||
/*
|
||||
* A CODEC is a software package that implements decoding,
|
||||
* encoding, or decoding+encoding of a compression algorithm.
|
||||
* The library provides a collection of builtin codecs.
|
||||
* More codecs may be registered through calls to the library
|
||||
* and/or the builtin implementations may be overridden.
|
||||
*/
|
||||
typedef int (*TIFFInitMethod)(TIFF*, int);
|
||||
typedef struct {
|
||||
char* name;
|
||||
uint16 scheme;
|
||||
TIFFInitMethod init;
|
||||
} TIFFCodec;
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/* share internal LogLuv conversion routines? */
|
||||
#ifndef LOGLUV_PUBLIC
|
||||
#define LOGLUV_PUBLIC 1
|
||||
#endif
|
||||
|
||||
#if !defined(__GNUC__) && !defined(__attribute__)
|
||||
# define __attribute__(x) /*nothing*/
|
||||
#endif
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
typedef void (*TIFFErrorHandler)(const char*, const char*, va_list);
|
||||
typedef void (*TIFFErrorHandlerExt)(thandle_t, const char*, const char*, va_list);
|
||||
typedef tmsize_t (*TIFFReadWriteProc)(thandle_t, void*, tmsize_t);
|
||||
typedef toff_t (*TIFFSeekProc)(thandle_t, toff_t, int);
|
||||
typedef int (*TIFFCloseProc)(thandle_t);
|
||||
typedef toff_t (*TIFFSizeProc)(thandle_t);
|
||||
typedef int (*TIFFMapFileProc)(thandle_t, void** base, toff_t* size);
|
||||
typedef void (*TIFFUnmapFileProc)(thandle_t, void* base, toff_t size);
|
||||
typedef void (*TIFFExtendProc)(TIFF*);
|
||||
|
||||
TIFF_DLL extern const char* TIFFGetVersion(void);
|
||||
|
||||
TIFF_DLL extern const TIFFCodec* TIFFFindCODEC(uint16);
|
||||
TIFF_DLL extern TIFFCodec* TIFFRegisterCODEC(uint16, const char*, TIFFInitMethod);
|
||||
TIFF_DLL extern void TIFFUnRegisterCODEC(TIFFCodec*);
|
||||
TIFF_DLL extern int TIFFIsCODECConfigured(uint16);
|
||||
TIFF_DLL extern TIFFCodec* TIFFGetConfiguredCODECs(void);
|
||||
|
||||
/*
|
||||
* Auxiliary functions.
|
||||
*/
|
||||
|
||||
TIFF_DLL extern void* _TIFFmalloc(tmsize_t s);
|
||||
TIFF_DLL extern void* _TIFFrealloc(void* p, tmsize_t s);
|
||||
TIFF_DLL extern void _TIFFmemset(void* p, int v, tmsize_t c);
|
||||
TIFF_DLL extern void _TIFFmemcpy(void* d, const void* s, tmsize_t c);
|
||||
TIFF_DLL extern int _TIFFmemcmp(const void* p1, const void* p2, tmsize_t c);
|
||||
TIFF_DLL extern void _TIFFfree(void* p);
|
||||
|
||||
/*
|
||||
** Stuff, related to tag handling and creating custom tags.
|
||||
*/
|
||||
TIFF_DLL extern int TIFFGetTagListCount( TIFF * );
|
||||
TIFF_DLL extern uint32 TIFFGetTagListEntry( TIFF *, int tag_index );
|
||||
|
||||
#define TIFF_ANY TIFF_NOTYPE /* for field descriptor searching */
|
||||
#define TIFF_VARIABLE -1 /* marker for variable length tags */
|
||||
#define TIFF_SPP -2 /* marker for SamplesPerPixel tags */
|
||||
#define TIFF_VARIABLE2 -3 /* marker for uint32 var-length tags */
|
||||
|
||||
#define FIELD_CUSTOM 65
|
||||
|
||||
typedef struct _TIFFField TIFFField;
|
||||
typedef struct _TIFFFieldArray TIFFFieldArray;
|
||||
|
||||
TIFF_DLL extern const TIFFField* TIFFFindField(TIFF *, uint32, TIFFDataType);
|
||||
TIFF_DLL extern const TIFFField* TIFFFieldWithTag(TIFF*, uint32);
|
||||
TIFF_DLL extern const TIFFField* TIFFFieldWithName(TIFF*, const char *);
|
||||
|
||||
typedef int (*TIFFVSetMethod)(TIFF*, uint32, va_list);
|
||||
typedef int (*TIFFVGetMethod)(TIFF*, uint32, va_list);
|
||||
typedef void (*TIFFPrintMethod)(TIFF*, FILE*, long);
|
||||
|
||||
typedef struct {
|
||||
TIFFVSetMethod vsetfield; /* tag set routine */
|
||||
TIFFVGetMethod vgetfield; /* tag get routine */
|
||||
TIFFPrintMethod printdir; /* directory print routine */
|
||||
} TIFFTagMethods;
|
||||
|
||||
TIFF_DLL extern TIFFTagMethods *TIFFAccessTagMethods(TIFF *);
|
||||
TIFF_DLL extern void *TIFFGetClientInfo(TIFF *, const char *);
|
||||
TIFF_DLL extern void TIFFSetClientInfo(TIFF *, void *, const char *);
|
||||
|
||||
TIFF_DLL extern void TIFFCleanup(TIFF* tif);
|
||||
TIFF_DLL extern void TIFFClose(TIFF* tif);
|
||||
TIFF_DLL extern int TIFFFlush(TIFF* tif);
|
||||
TIFF_DLL extern int TIFFFlushData(TIFF* tif);
|
||||
TIFF_DLL extern int TIFFGetField(TIFF* tif, uint32 tag, ...);
|
||||
TIFF_DLL extern int TIFFVGetField(TIFF* tif, uint32 tag, va_list ap);
|
||||
TIFF_DLL extern int TIFFGetFieldDefaulted(TIFF* tif, uint32 tag, ...);
|
||||
TIFF_DLL extern int TIFFVGetFieldDefaulted(TIFF* tif, uint32 tag, va_list ap);
|
||||
TIFF_DLL extern int TIFFReadDirectory(TIFF* tif);
|
||||
TIFF_DLL extern int TIFFReadCustomDirectory(TIFF* tif, toff_t diroff, const TIFFFieldArray* infoarray);
|
||||
TIFF_DLL extern int TIFFReadEXIFDirectory(TIFF* tif, toff_t diroff);
|
||||
TIFF_DLL extern uint64 TIFFScanlineSize64(TIFF* tif);
|
||||
TIFF_DLL extern tmsize_t TIFFScanlineSize(TIFF* tif);
|
||||
TIFF_DLL extern uint64 TIFFRasterScanlineSize64(TIFF* tif);
|
||||
TIFF_DLL extern tmsize_t TIFFRasterScanlineSize(TIFF* tif);
|
||||
TIFF_DLL extern uint64 TIFFStripSize64(TIFF* tif);
|
||||
TIFF_DLL extern tmsize_t TIFFStripSize(TIFF* tif);
|
||||
TIFF_DLL extern uint64 TIFFRawStripSize64(TIFF* tif, uint32 strip);
|
||||
TIFF_DLL extern tmsize_t TIFFRawStripSize(TIFF* tif, uint32 strip);
|
||||
TIFF_DLL extern uint64 TIFFVStripSize64(TIFF* tif, uint32 nrows);
|
||||
TIFF_DLL extern tmsize_t TIFFVStripSize(TIFF* tif, uint32 nrows);
|
||||
TIFF_DLL extern uint64 TIFFTileRowSize64(TIFF* tif);
|
||||
TIFF_DLL extern tmsize_t TIFFTileRowSize(TIFF* tif);
|
||||
TIFF_DLL extern uint64 TIFFTileSize64(TIFF* tif);
|
||||
TIFF_DLL extern tmsize_t TIFFTileSize(TIFF* tif);
|
||||
TIFF_DLL extern uint64 TIFFVTileSize64(TIFF* tif, uint32 nrows);
|
||||
TIFF_DLL extern tmsize_t TIFFVTileSize(TIFF* tif, uint32 nrows);
|
||||
TIFF_DLL extern uint32 TIFFDefaultStripSize(TIFF* tif, uint32 request);
|
||||
TIFF_DLL extern void TIFFDefaultTileSize(TIFF*, uint32*, uint32*);
|
||||
TIFF_DLL extern int TIFFFileno(TIFF*);
|
||||
TIFF_DLL extern int TIFFSetFileno(TIFF*, int);
|
||||
TIFF_DLL extern thandle_t TIFFClientdata(TIFF*);
|
||||
TIFF_DLL extern thandle_t TIFFSetClientdata(TIFF*, thandle_t);
|
||||
TIFF_DLL extern int TIFFGetMode(TIFF*);
|
||||
TIFF_DLL extern int TIFFSetMode(TIFF*, int);
|
||||
TIFF_DLL extern int TIFFIsTiled(TIFF*);
|
||||
TIFF_DLL extern int TIFFIsByteSwapped(TIFF*);
|
||||
TIFF_DLL extern int TIFFIsUpSampled(TIFF*);
|
||||
TIFF_DLL extern int TIFFIsMSB2LSB(TIFF*);
|
||||
TIFF_DLL extern int TIFFIsBigEndian(TIFF*);
|
||||
TIFF_DLL extern TIFFReadWriteProc TIFFGetReadProc(TIFF*);
|
||||
TIFF_DLL extern TIFFReadWriteProc TIFFGetWriteProc(TIFF*);
|
||||
TIFF_DLL extern TIFFSeekProc TIFFGetSeekProc(TIFF*);
|
||||
TIFF_DLL extern TIFFCloseProc TIFFGetCloseProc(TIFF*);
|
||||
TIFF_DLL extern TIFFSizeProc TIFFGetSizeProc(TIFF*);
|
||||
TIFF_DLL extern TIFFMapFileProc TIFFGetMapFileProc(TIFF*);
|
||||
TIFF_DLL extern TIFFUnmapFileProc TIFFGetUnmapFileProc(TIFF*);
|
||||
TIFF_DLL extern uint32 TIFFCurrentRow(TIFF*);
|
||||
TIFF_DLL extern uint16 TIFFCurrentDirectory(TIFF*);
|
||||
TIFF_DLL extern uint16 TIFFNumberOfDirectories(TIFF*);
|
||||
TIFF_DLL extern uint64 TIFFCurrentDirOffset(TIFF*);
|
||||
TIFF_DLL extern uint32 TIFFCurrentStrip(TIFF*);
|
||||
TIFF_DLL extern uint32 TIFFCurrentTile(TIFF* tif);
|
||||
TIFF_DLL extern int TIFFReadBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||
TIFF_DLL extern int TIFFWriteBufferSetup(TIFF* tif, void* bp, tmsize_t size);
|
||||
TIFF_DLL extern int TIFFSetupStrips(TIFF *);
|
||||
TIFF_DLL extern int TIFFWriteCheck(TIFF*, int, const char *);
|
||||
TIFF_DLL extern void TIFFFreeDirectory(TIFF*);
|
||||
TIFF_DLL extern int TIFFCreateDirectory(TIFF*);
|
||||
TIFF_DLL extern int TIFFLastDirectory(TIFF*);
|
||||
TIFF_DLL extern int TIFFSetDirectory(TIFF*, uint16);
|
||||
TIFF_DLL extern int TIFFSetSubDirectory(TIFF*, uint64);
|
||||
TIFF_DLL extern int TIFFUnlinkDirectory(TIFF*, uint16);
|
||||
TIFF_DLL extern int TIFFSetField(TIFF*, uint32, ...);
|
||||
TIFF_DLL extern int TIFFVSetField(TIFF*, uint32, va_list);
|
||||
TIFF_DLL extern int TIFFUnsetField(TIFF*, uint32);
|
||||
TIFF_DLL extern int TIFFWriteDirectory(TIFF *);
|
||||
TIFF_DLL extern int TIFFCheckpointDirectory(TIFF *);
|
||||
TIFF_DLL extern int TIFFRewriteDirectory(TIFF *);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
TIFF_DLL extern void TIFFPrintDirectory(TIFF*, FILE*, long = 0);
|
||||
TIFF_DLL extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
|
||||
TIFF_DLL extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample = 0);
|
||||
TIFF_DLL extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int = 0);
|
||||
TIFF_DLL extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*,
|
||||
int = ORIENTATION_BOTLEFT, int = 0);
|
||||
#else
|
||||
TIFF_DLL extern void TIFFPrintDirectory(TIFF*, FILE*, long);
|
||||
TIFF_DLL extern int TIFFReadScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
|
||||
TIFF_DLL extern int TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample);
|
||||
TIFF_DLL extern int TIFFReadRGBAImage(TIFF*, uint32, uint32, uint32*, int);
|
||||
TIFF_DLL extern int TIFFReadRGBAImageOriented(TIFF*, uint32, uint32, uint32*, int, int);
|
||||
#endif
|
||||
|
||||
TIFF_DLL extern int TIFFReadRGBAStrip(TIFF*, uint32, uint32 * );
|
||||
TIFF_DLL extern int TIFFReadRGBATile(TIFF*, uint32, uint32, uint32 * );
|
||||
TIFF_DLL extern int TIFFRGBAImageOK(TIFF*, char [1024]);
|
||||
TIFF_DLL extern int TIFFRGBAImageBegin(TIFFRGBAImage*, TIFF*, int, char [1024]);
|
||||
TIFF_DLL extern int TIFFRGBAImageGet(TIFFRGBAImage*, uint32*, uint32, uint32);
|
||||
TIFF_DLL extern void TIFFRGBAImageEnd(TIFFRGBAImage*);
|
||||
TIFF_DLL extern TIFF* TIFFOpen(const char*, const char*);
|
||||
# ifdef __WIN32__
|
||||
TIFF_DLL extern TIFF* TIFFOpenW(const wchar_t*, const char*);
|
||||
# endif /* __WIN32__ */
|
||||
TIFF_DLL extern TIFF* TIFFFdOpen(int, const char*, const char*);
|
||||
TIFF_DLL extern TIFF* TIFFClientOpen(const char*, const char*,
|
||||
thandle_t,
|
||||
TIFFReadWriteProc, TIFFReadWriteProc,
|
||||
TIFFSeekProc, TIFFCloseProc,
|
||||
TIFFSizeProc,
|
||||
TIFFMapFileProc, TIFFUnmapFileProc);
|
||||
TIFF_DLL extern const char* TIFFFileName(TIFF*);
|
||||
TIFF_DLL extern const char* TIFFSetFileName(TIFF*, const char *);
|
||||
TIFF_DLL extern void TIFFError(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3)));
|
||||
TIFF_DLL extern void TIFFErrorExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4)));
|
||||
TIFF_DLL extern void TIFFWarning(const char*, const char*, ...) __attribute__((__format__ (__printf__,2,3)));
|
||||
TIFF_DLL extern void TIFFWarningExt(thandle_t, const char*, const char*, ...) __attribute__((__format__ (__printf__,3,4)));
|
||||
TIFF_DLL extern TIFFErrorHandler TIFFSetErrorHandler(TIFFErrorHandler);
|
||||
TIFF_DLL extern TIFFErrorHandlerExt TIFFSetErrorHandlerExt(TIFFErrorHandlerExt);
|
||||
TIFF_DLL extern TIFFErrorHandler TIFFSetWarningHandler(TIFFErrorHandler);
|
||||
TIFF_DLL extern TIFFErrorHandlerExt TIFFSetWarningHandlerExt(TIFFErrorHandlerExt);
|
||||
TIFF_DLL extern TIFFExtendProc TIFFSetTagExtender(TIFFExtendProc);
|
||||
TIFF_DLL extern uint32 TIFFComputeTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||
TIFF_DLL extern int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||
TIFF_DLL extern uint32 TIFFNumberOfTiles(TIFF*);
|
||||
TIFF_DLL extern tmsize_t TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||
TIFF_DLL extern tmsize_t TIFFWriteTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s);
|
||||
TIFF_DLL extern uint32 TIFFComputeStrip(TIFF*, uint32, uint16);
|
||||
TIFF_DLL extern uint32 TIFFNumberOfStrips(TIFF*);
|
||||
TIFF_DLL extern tmsize_t TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
|
||||
TIFF_DLL extern tmsize_t TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size);
|
||||
TIFF_DLL extern tmsize_t TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
|
||||
TIFF_DLL extern tmsize_t TIFFReadRawTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size);
|
||||
TIFF_DLL extern tmsize_t TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
|
||||
TIFF_DLL extern tmsize_t TIFFWriteRawStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc);
|
||||
TIFF_DLL extern tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
|
||||
TIFF_DLL extern tmsize_t TIFFWriteRawTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc);
|
||||
TIFF_DLL extern int TIFFDataWidth(TIFFDataType); /* table of tag datatype widths */
|
||||
TIFF_DLL extern void TIFFSetWriteOffset(TIFF* tif, toff_t off);
|
||||
TIFF_DLL extern void TIFFSwabShort(uint16*);
|
||||
TIFF_DLL extern void TIFFSwabLong(uint32*);
|
||||
TIFF_DLL extern void TIFFSwabLong8(uint64*);
|
||||
TIFF_DLL extern void TIFFSwabFloat(float*);
|
||||
TIFF_DLL extern void TIFFSwabDouble(double*);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfShort(uint16* wp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfTriples(uint8* tp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfLong(uint32* lp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfLong8(uint64* lp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfFloat(float* fp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFSwabArrayOfDouble(double* dp, tmsize_t n);
|
||||
TIFF_DLL extern void TIFFReverseBits(uint8* cp, tmsize_t n);
|
||||
TIFF_DLL extern const unsigned char* TIFFGetBitRevTable(int);
|
||||
|
||||
#ifdef LOGLUV_PUBLIC
|
||||
#define U_NEU 0.210526316
|
||||
#define V_NEU 0.473684211
|
||||
#define UVSCALE 410.
|
||||
TIFF_DLL extern double LogL16toY(int);
|
||||
TIFF_DLL extern double LogL10toY(int);
|
||||
TIFF_DLL extern void XYZtoRGB24(float*, uint8*);
|
||||
TIFF_DLL extern int uv_decode(double*, double*, int);
|
||||
TIFF_DLL extern void LogLuv24toXYZ(uint32, float*);
|
||||
TIFF_DLL extern void LogLuv32toXYZ(uint32, float*);
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
TIFF_DLL extern int LogL16fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
TIFF_DLL extern int LogL10fromY(double, int = SGILOGENCODE_NODITHER);
|
||||
TIFF_DLL extern int uv_encode(double, double, int = SGILOGENCODE_NODITHER);
|
||||
TIFF_DLL extern uint32 LogLuv24fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
TIFF_DLL extern uint32 LogLuv32fromXYZ(float*, int = SGILOGENCODE_NODITHER);
|
||||
#else
|
||||
TIFF_DLL extern int LogL16fromY(double, int);
|
||||
TIFF_DLL extern int LogL10fromY(double, int);
|
||||
TIFF_DLL extern int uv_encode(double, double, int);
|
||||
TIFF_DLL extern uint32 LogLuv24fromXYZ(float*, int);
|
||||
TIFF_DLL extern uint32 LogLuv32fromXYZ(float*, int);
|
||||
#endif
|
||||
#endif /* LOGLUV_PUBLIC */
|
||||
|
||||
TIFF_DLL extern int TIFFCIELabToRGBInit(TIFFCIELabToRGB*, const TIFFDisplay *, float*);
|
||||
TIFF_DLL extern void TIFFCIELabToXYZ(TIFFCIELabToRGB *, uint32, int32, int32,
|
||||
float *, float *, float *);
|
||||
TIFF_DLL extern void TIFFXYZToRGB(TIFFCIELabToRGB *, float, float, float,
|
||||
uint32 *, uint32 *, uint32 *);
|
||||
|
||||
TIFF_DLL extern int TIFFYCbCrToRGBInit(TIFFYCbCrToRGB*, float*, float*);
|
||||
TIFF_DLL extern void TIFFYCbCrtoRGB(TIFFYCbCrToRGB *, uint32, int32, int32,
|
||||
uint32 *, uint32 *, uint32 *);
|
||||
|
||||
/****************************************************************************
|
||||
* O B S O L E T E D I N T E R F A C E S
|
||||
*
|
||||
* Don't use this stuff in your applications, it may be removed in the future
|
||||
* libtiff versions.
|
||||
****************************************************************************/
|
||||
typedef struct {
|
||||
ttag_t field_tag; /* field's tag */
|
||||
short field_readcount; /* read count/TIFF_VARIABLE/TIFF_SPP */
|
||||
short field_writecount; /* write count/TIFF_VARIABLE */
|
||||
TIFFDataType field_type; /* type of associated data */
|
||||
unsigned short field_bit; /* bit in fieldsset bit vector */
|
||||
unsigned char field_oktochange; /* if true, can change while writing */
|
||||
unsigned char field_passcount; /* if true, pass dir count on set */
|
||||
char *field_name; /* ASCII name */
|
||||
} TIFFFieldInfo;
|
||||
|
||||
TIFF_DLL extern int TIFFMergeFieldInfo(TIFF*, const TIFFFieldInfo[], uint32);
|
||||
|
||||
#if defined(c_plusplus) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TIFFIO_ */
|
||||
|
||||
/* vim: set ts=8 sts=8 sw=8 noet: */
|
||||
/*
|
||||
* Local Variables:
|
||||
* mode: c
|
||||
* c-basic-offset: 8
|
||||
* fill-column: 78
|
||||
* End:
|
||||
*/
|
|
@ -0,0 +1,9 @@
|
|||
#define TIFFLIB_VERSION_STR "LIBTIFF, Version 4.0.1\nCopyright (c) 1988-1996 Sam Leffler\nCopyright (c) 1991-1996 Silicon Graphics, Inc."
|
||||
/*
|
||||
* This define can be used in code that requires
|
||||
* compilation-related definitions specific to a
|
||||
* version or versions of the library. Runtime
|
||||
* version checking should be done based on the
|
||||
* string returned by TIFFGetVersion.
|
||||
*/
|
||||
#define TIFFLIB_VERSION 20120218
|
|
@ -191,6 +191,7 @@ CCEGLView::CCEGLView()
|
|||
|
||||
CCEGLView::~CCEGLView()
|
||||
{
|
||||
CC_SAFE_DELETE(m_pEGL);
|
||||
}
|
||||
|
||||
bool CCEGLView::Create(LPCTSTR pTitle, int w, int h)
|
||||
|
@ -239,8 +240,6 @@ bool CCEGLView::Create(LPCTSTR pTitle, int w, int h)
|
|||
|
||||
resize(w, h);
|
||||
|
||||
CCEGLViewProtocol::setFrameSize(w, h);
|
||||
|
||||
// init egl
|
||||
m_pEGL = CCEGL::create(this);
|
||||
|
||||
|
@ -463,7 +462,8 @@ void CCEGLView::resize(int width, int height)
|
|||
|
||||
void CCEGLView::setFrameSize(float width, float height)
|
||||
{
|
||||
Create((LPCTSTR)m_szViewName, width, height);
|
||||
Create((LPCTSTR)m_szViewName, (int)width, (int)height);
|
||||
CCEGLViewProtocol::setFrameSize(width, height);
|
||||
}
|
||||
|
||||
void CCEGLView::centerWindow()
|
||||
|
|
|
@ -145,7 +145,7 @@ public:
|
|||
return bRet;
|
||||
}
|
||||
|
||||
SIZE sizeWithText(const char * pszText, int nLen, DWORD dwFmt, LONG nWidthLimit)
|
||||
SIZE sizeWithText(const wchar_t * pszText, int nLen, DWORD dwFmt, LONG nWidthLimit)
|
||||
{
|
||||
SIZE tRet = {0};
|
||||
do
|
||||
|
@ -166,7 +166,7 @@ public:
|
|||
HGDIOBJ hOld = SelectObject(m_hDC, m_hFont);
|
||||
|
||||
// measure text size
|
||||
DrawTextA(m_hDC, pszText, nLen, &rc, dwCalcFmt);
|
||||
DrawTextW(m_hDC, pszText, nLen, &rc, dwCalcFmt);
|
||||
SelectObject(m_hDC, hOld);
|
||||
|
||||
tRet.cx = rc.right;
|
||||
|
@ -221,7 +221,15 @@ public:
|
|||
}
|
||||
|
||||
int nLen = strlen(pszText);
|
||||
SIZE newSize = sizeWithText(pszText, nLen, dwFmt, tSize.cx);
|
||||
// utf-8 to utf-16
|
||||
int nBufLen = nLen + 1;
|
||||
pwszBuffer = new wchar_t[nBufLen];
|
||||
CC_BREAK_IF(! pwszBuffer);
|
||||
|
||||
memset(pwszBuffer, 0, sizeof(wchar_t)*nBufLen);
|
||||
nLen = MultiByteToWideChar(CP_UTF8, 0, pszText, nLen, pwszBuffer, nBufLen);
|
||||
|
||||
SIZE newSize = sizeWithText(pwszBuffer, nLen, dwFmt, tSize.cx);
|
||||
|
||||
RECT rcText = {0};
|
||||
// if content width is 0, use text size as content size
|
||||
|
@ -287,12 +295,6 @@ public:
|
|||
SetBkMode(m_hDC, TRANSPARENT);
|
||||
SetTextColor(m_hDC, RGB(255, 255, 255)); // white color
|
||||
|
||||
// utf-8 to utf-16
|
||||
int nBufLen = nLen + 1;
|
||||
pwszBuffer = new wchar_t[nBufLen];
|
||||
CC_BREAK_IF(! pwszBuffer);
|
||||
nLen = MultiByteToWideChar(CP_UTF8, 0, pszText, nLen, pwszBuffer, nBufLen);
|
||||
|
||||
// draw text
|
||||
nRet = DrawTextW(m_hDC, pwszBuffer, nLen, &rcText, dwFmt);
|
||||
//DrawTextA(m_hDC, pszText, nLen, &rcText, dwFmt);
|
||||
|
|
|
@ -24,9 +24,7 @@ THE SOFTWARE.
|
|||
|
||||
#include "CCStdC.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
int CC_DLL gettimeofday(struct timeval * val, struct timezone *)
|
||||
int gettimeofday(struct timeval * val, struct timezone *)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
|
@ -38,22 +36,4 @@ int CC_DLL gettimeofday(struct timeval * val, struct timezone *)
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_BADA)
|
||||
|
||||
using namespace Osp::System;
|
||||
|
||||
int CC_DLL gettimeofday(struct timeval * val, struct timezone *)
|
||||
{
|
||||
if (val)
|
||||
{
|
||||
long long curTick = 0;
|
||||
SystemTime::GetTicks(curTick);
|
||||
unsigned int ms = curTick;
|
||||
val->tv_sec = ms / 1000;
|
||||
val->tv_usec = (ms % 1000) * 1000;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#endif // CC_PLATFORM_WIN32
|
|
@ -26,24 +26,19 @@ THE SOFTWARE.
|
|||
#define __CC_STD_C_H__
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
|
||||
#include <float.h>
|
||||
|
||||
// for math.h on win32 platform
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#if ! defined(_USE_MATH_DEFINES)
|
||||
#define _USE_MATH_DEFINES // make M_PI can be use
|
||||
#endif
|
||||
#if !defined(_USE_MATH_DEFINES)
|
||||
#define _USE_MATH_DEFINES // make M_PI can be use
|
||||
#endif
|
||||
|
||||
#if ! defined(isnan)
|
||||
#define isnan _isnan
|
||||
#endif
|
||||
|
||||
#endif // CC_PLATFORM_WIN32
|
||||
#if !defined(isnan)
|
||||
#define isnan _isnan
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
@ -51,7 +46,6 @@ THE SOFTWARE.
|
|||
#include <time.h>
|
||||
|
||||
// for MIN MAX and sys/time.h on win32 platform
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
|
||||
|
||||
#define MIN min
|
||||
#define MAX max
|
||||
|
@ -67,78 +61,5 @@ struct timezone
|
|||
|
||||
int CC_DLL gettimeofday(struct timeval *, struct timezone *);
|
||||
|
||||
#endif // CC_PLATFORM_WIN32
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX || CC_TARGET_PLATFORM == CC_PLATFORM_QNX)
|
||||
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif // MIN
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) < (y)) ? (y) : (x))
|
||||
#endif // MAX
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
|
||||
|
||||
// some function linux do not have
|
||||
#define tanf tan
|
||||
#define sqrtf sqrt
|
||||
#define cosf cos
|
||||
#define sinf sin
|
||||
|
||||
#endif
|
||||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
|
||||
|
||||
#include <s3e.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif // MIN
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) < (y)) ? (y) : (x))
|
||||
#endif // MAX
|
||||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_BADA)
|
||||
|
||||
#include <FSysSystemTime.h>
|
||||
|
||||
struct timeval
|
||||
{
|
||||
long tv_sec; // seconds
|
||||
long tv_usec; // microSeconds
|
||||
};
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest;
|
||||
int tz_dsttime;
|
||||
};
|
||||
|
||||
|
||||
int CC_DLL gettimeofday(struct timeval *, struct timezone *);
|
||||
|
||||
#ifndef MIN
|
||||
#define MIN(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif // MIN
|
||||
|
||||
#ifndef MAX
|
||||
#define MAX(x,y) (((x) < (y)) ? (y) : (x))
|
||||
#endif // MAX
|
||||
|
||||
#ifndef UINT_MAX
|
||||
#define UINT_MAX 0xffffffff /* maximum unsigned int value */
|
||||
#endif // UINT_MAX
|
||||
|
||||
#endif // CC_TARGET_PLATFORM == CC_PLATFORM_BADA
|
||||
|
||||
#endif // __CC_STD_C_H__
|
||||
|
|
@ -42,7 +42,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support"
|
||||
AdditionalIncludeDirectories="..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libtiff;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
@ -65,7 +65,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libEGL.lib libGLESv2.lib libxml2.lib libzlib.lib libpng.lib libjpeg.lib libiconv.lib pthreadVCE2.lib"
|
||||
AdditionalDependencies="libEGL.lib libGLESv2.lib libxml2.lib libzlib.lib libpng.lib libjpeg.lib libtiff.lib libiconv.lib pthreadVCE2.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
|
@ -124,7 +124,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support"
|
||||
AdditionalIncludeDirectories="..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libtiff;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
|
@ -145,7 +145,7 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libEGL.lib libGLESv2.lib libxml2.lib libzlib.lib libpng.lib libjpeg.lib libiconv.lib pthreadVCE2.lib"
|
||||
AdditionalDependencies="libEGL.lib libGLESv2.lib libxml2.lib libzlib.lib libpng.lib libjpeg.lib libtiff.lib libiconv.lib pthreadVCE2.lib"
|
||||
OutputFile="$(OutDir)\$(ProjectName).dll"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
|
@ -663,14 +663,6 @@
|
|||
RelativePath="..\platform\CCSAXParser.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCStdC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCStdC.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\CCThread.cpp"
|
||||
>
|
||||
|
@ -734,6 +726,14 @@
|
|||
RelativePath="..\platform\win32\CCPlatformDefine.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\win32\CCStdC.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\platform\win32\CCStdC.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
|
|
@ -57,7 +57,7 @@
|
|||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libtiff;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
|
@ -74,11 +74,13 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libEGL.lib;libGLESv2.lib;libxml2.lib;libzlib.lib;libpng.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libEGL.lib;libGLESv2.lib;libxml2.lib;libzlib.lib;libpng.lib;libtiff.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;%(AdditionalDependencies);%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries> ;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<IgnoreAllDefaultLibraries>
|
||||
</IgnoreAllDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<ImportLibrary>$(TargetDir)$(TargetName).lib</ImportLibrary>
|
||||
|
@ -95,7 +97,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
</Command>
|
||||
</PreBuildEvent>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<AdditionalIncludeDirectories>..;..\platform;..\platform\win32;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libtiff;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\pthread;..\platform\third_party\win32\OGLES;..\include;..\kazmath\include;..\actions;..\base_nodes;..\cocoa;..\effects;..\extensions;..\keypad_dispatcher;..\label_nodes;..\layers_scenes_transitions_nodes;..\menu_nodes;..\misc_nodes;..\particle_nodes;..\script_support;..\shaders;..\sprite_nodes;..\text_input_node;..\textures;..\tileMap_parallax_nodes;..\touch_dispatcher;..\support;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
|
@ -110,10 +112,11 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libEGL.lib;libglesv2.lib;libxml2.lib;libzlib.lib;libpng.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>libEGL.lib;libGLESv2.lib;libxml2.lib;libzlib.lib;libpng.lib;libtiff.lib;libjpeg.lib;libiconv.lib;pthreadVCE2.lib;;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(ProjectName).dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries> ;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<IgnoreSpecificDefaultLibraries>
|
||||
</IgnoreSpecificDefaultLibraries>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
|
@ -212,7 +215,6 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
<ClCompile Include="..\particle_nodes\CCParticleSystemQuad.cpp" />
|
||||
<ClCompile Include="..\platform\CCEGLViewProtocol.cpp" />
|
||||
<ClCompile Include="..\platform\CCSAXParser.cpp" />
|
||||
<ClCompile Include="..\platform\CCStdC.cpp" />
|
||||
<ClCompile Include="..\platform\CCThread.cpp" />
|
||||
<ClCompile Include="..\platform\platform.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCAccelerometer.cpp" />
|
||||
|
@ -221,6 +223,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
<ClCompile Include="..\platform\win32\CCEGLView.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCFileUtils.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCImage.cpp" />
|
||||
<ClCompile Include="..\platform\win32\CCStdC.cpp" />
|
||||
<ClCompile Include="..\script_support\CCScriptSupport.cpp" />
|
||||
<ClCompile Include="..\shaders\CCGLProgram.cpp" />
|
||||
<ClCompile Include="..\shaders\ccGLStateCache.cpp" />
|
||||
|
@ -363,7 +366,6 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
<ClInclude Include="..\platform\CCPlatformConfig.h" />
|
||||
<ClInclude Include="..\platform\CCPlatformMacros.h" />
|
||||
<ClInclude Include="..\platform\CCSAXParser.h" />
|
||||
<ClInclude Include="..\platform\CCStdC.h" />
|
||||
<ClInclude Include="..\platform\CCThread.h" />
|
||||
<ClInclude Include="..\platform\platform.h" />
|
||||
<ClInclude Include="..\platform\win32\CCAccelerometer.h" />
|
||||
|
@ -371,6 +373,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$
|
|||
<ClInclude Include="..\platform\win32\CCEGLView.h" />
|
||||
<ClInclude Include="..\platform\win32\CCGL.h" />
|
||||
<ClInclude Include="..\platform\win32\CCPlatformDefine.h" />
|
||||
<ClInclude Include="..\platform\win32\CCStdC.h" />
|
||||
<ClInclude Include="..\script_support\CCScriptSupport.h" />
|
||||
<ClInclude Include="..\shaders\CCGLProgram.h" />
|
||||
<ClInclude Include="..\shaders\ccGLStateCache.h" />
|
||||
|
|
|
@ -345,9 +345,6 @@
|
|||
<ClCompile Include="..\platform\CCSAXParser.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCStdC.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\CCThread.cpp">
|
||||
<Filter>platform</Filter>
|
||||
</ClCompile>
|
||||
|
@ -489,6 +486,9 @@
|
|||
<ClCompile Include="..\extensions\CCBReader\CCBReader_v2.cpp">
|
||||
<Filter>extensions\CCBReader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\platform\win32\CCStdC.cpp">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\effects\CCGrabber.h">
|
||||
|
@ -791,9 +791,6 @@
|
|||
<ClInclude Include="..\platform\CCSAXParser.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCStdC.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\CCThread.h">
|
||||
<Filter>platform</Filter>
|
||||
</ClInclude>
|
||||
|
@ -985,5 +982,8 @@
|
|||
<ClInclude Include="..\extensions\CCBReader\CCBCustomClass.h">
|
||||
<Filter>extensions\CCBReader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\platform\win32\CCStdC.h">
|
||||
<Filter>platform\win32</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -163,10 +163,10 @@ void ccGLEnable( ccGLServerState flags )
|
|||
{
|
||||
#if CC_ENABLE_GL_STATE_CACHE
|
||||
|
||||
bool enabled = false;
|
||||
int enabled = 0;
|
||||
|
||||
/* GL_BLEND */
|
||||
if( (enabled=(flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) {
|
||||
if( (enabled = (flags & CC_GL_BLEND)) != (s_eGLServerState & CC_GL_BLEND) ) {
|
||||
if( enabled ) {
|
||||
glEnable( GL_BLEND );
|
||||
s_eGLServerState |= CC_GL_BLEND;
|
||||
|
|
|
@ -64,14 +64,18 @@ do {
|
|||
} while(0)
|
||||
#endif
|
||||
|
||||
/* uint32_t next definded will conflict with other libraries and an "error C2872: 'uint32_t' : ambiguous symbol" will appear.
|
||||
so we replace all uint32_t with 'unsigned int'.
|
||||
*/
|
||||
/* a number of the hash function use uint32_t which isn't defined on win32 */
|
||||
#ifdef _MSC_VER
|
||||
typedef unsigned int uint32_t;
|
||||
#else
|
||||
#ifndef __QNX__
|
||||
#include <inttypes.h> /* uint32_t */
|
||||
#endif /* __QNX__ */
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
// #ifdef _MSC_VER
|
||||
// typedef unsigned int uint32_t;
|
||||
// #else
|
||||
// #ifndef __QNX__
|
||||
// #include <inttypes.h> /* uint32_t */
|
||||
// #endif /* __QNX__ */
|
||||
// #endif /* _MSC_VER */
|
||||
|
||||
#define UTHASH_VERSION 1.9.3
|
||||
|
||||
|
@ -124,10 +128,10 @@ do {
|
|||
#define HASH_BLOOM_BITTEST(bv,idx) (bv[(idx)/8] & (1U << ((idx)%8)))
|
||||
|
||||
#define HASH_BLOOM_ADD(tbl,hashv) \
|
||||
HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))
|
||||
HASH_BLOOM_BITSET((tbl)->bloom_bv, (hashv & (unsigned int)((1ULL << (tbl)->bloom_nbits) - 1)))
|
||||
|
||||
#define HASH_BLOOM_TEST(tbl,hashv) \
|
||||
HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (uint32_t)((1ULL << (tbl)->bloom_nbits) - 1)))
|
||||
HASH_BLOOM_BITTEST((tbl)->bloom_bv, (hashv & (unsigned int)((1ULL << (tbl)->bloom_nbits) - 1)))
|
||||
|
||||
#else
|
||||
#define HASH_BLOOM_MAKE(tbl)
|
||||
|
@ -444,13 +448,13 @@ do {
|
|||
#endif
|
||||
|
||||
#if !defined (get16bits)
|
||||
#define get16bits(d) ((((uint32_t)(((const uint8_t *)(d))[1])) << 8) \
|
||||
+(uint32_t)(((const uint8_t *)(d))[0]) )
|
||||
#define get16bits(d) ((((unsigned int)(((const uint8_t *)(d))[1])) << 8) \
|
||||
+(unsigned int)(((const uint8_t *)(d))[0]) )
|
||||
#endif
|
||||
#define HASH_SFH(key,keylen,num_bkts,hashv,bkt) \
|
||||
do { \
|
||||
char *_sfh_key=(char*)(key); \
|
||||
uint32_t _sfh_tmp, _sfh_len = keylen; \
|
||||
unsigned int _sfh_tmp, _sfh_len = keylen; \
|
||||
\
|
||||
int _sfh_rem = _sfh_len & 3; \
|
||||
_sfh_len >>= 2; \
|
||||
|
@ -515,10 +519,10 @@ do {
|
|||
const int _mur_r = 24; \
|
||||
hashv = 0xcafebabe ^ keylen; \
|
||||
char *_mur_key = (char *)(key); \
|
||||
uint32_t _mur_tmp, _mur_len = keylen; \
|
||||
unsigned int _mur_tmp, _mur_len = keylen; \
|
||||
\
|
||||
for (;_mur_len >= 4; _mur_len-=4) { \
|
||||
_mur_tmp = *(uint32_t *)_mur_key; \
|
||||
_mur_tmp = *(unsigned int *)_mur_key; \
|
||||
_mur_tmp *= _mur_m; \
|
||||
_mur_tmp ^= _mur_tmp >> _mur_r; \
|
||||
_mur_tmp *= _mur_m; \
|
||||
|
@ -549,7 +553,7 @@ do {
|
|||
const int _mur_r = 24; \
|
||||
hashv = 0xcafebabe ^ (keylen); \
|
||||
char *_mur_key = (char *)(key); \
|
||||
uint32_t _mur_len = keylen; \
|
||||
unsigned int _mur_len = keylen; \
|
||||
int _mur_align = (int)_mur_key & 3; \
|
||||
\
|
||||
if (_mur_align && (_mur_len >= 4)) { \
|
||||
|
@ -960,9 +964,9 @@ typedef struct UT_hash_table {
|
|||
* the hash will still work, albeit no longer in constant time. */
|
||||
unsigned ineff_expands, noexpand;
|
||||
|
||||
uint32_t signature; /* used only to find hash tables in external analysis */
|
||||
unsigned int signature; /* used only to find hash tables in external analysis */
|
||||
#ifdef HASH_BLOOM
|
||||
uint32_t bloom_sig; /* used only to test bloom exists in external analysis */
|
||||
unsigned int bloom_sig; /* used only to test bloom exists in external analysis */
|
||||
uint8_t *bloom_bv;
|
||||
char bloom_nbits;
|
||||
#endif
|
||||
|
|
|
@ -563,7 +563,7 @@ void CCTextureAtlas::fillWithEmptyQuadsFromIndex(unsigned int index, unsigned in
|
|||
memset(&quad, 0, sizeof(quad));
|
||||
|
||||
unsigned int to = index + amount;
|
||||
for (int i = index ; i < to ; i++)
|
||||
for (unsigned int i = index ; i < to ; i++)
|
||||
{
|
||||
m_pQuads[i] = quad;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@ THE SOFTWARE.
|
|||
#include "CCThread.h"
|
||||
#include "semaphore.h"
|
||||
#include "CCString.h"
|
||||
#include <errno.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
@ -64,14 +65,30 @@ typedef struct _ImageInfo
|
|||
|
||||
static pthread_t s_loadingThread;
|
||||
|
||||
static pthread_mutex_t s_asyncStructQueueMutex;
|
||||
static pthread_mutex_t s_asyncStructQueueMutex;
|
||||
static pthread_mutex_t s_ImageInfoMutex;
|
||||
|
||||
static sem_t s_sem;
|
||||
static bool need_quit;
|
||||
static sem_t* s_pSem = NULL;
|
||||
static unsigned long s_nAsyncRefCount = 0;
|
||||
|
||||
static std::queue<AsyncStruct*> *s_pAsyncStructQueue;
|
||||
static std::queue<ImageInfo*> *s_pImageQueue;
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS
|
||||
#define CC_ASYNC_TEXTURE_CACHE_USE_NAMED_SEMAPHORE 1
|
||||
#else
|
||||
#define CC_ASYNC_TEXTURE_CACHE_USE_NAMED_SEMAPHORE 0
|
||||
#endif
|
||||
|
||||
|
||||
#if CC_ASYNC_TEXTURE_CACHE_USE_NAMED_SEMAPHORE
|
||||
#define CC_ASYNC_TEXTURE_CACHE_SEMAPHORE "ccAsync"
|
||||
#else
|
||||
static sem_t s_sem;
|
||||
#endif
|
||||
|
||||
|
||||
static bool need_quit = false;
|
||||
|
||||
static std::queue<AsyncStruct*>* s_pAsyncStructQueue = NULL;
|
||||
static std::queue<ImageInfo*>* s_pImageQueue = NULL;
|
||||
|
||||
static CCImage::EImageFormat computeImageFormatType(string& filename)
|
||||
{
|
||||
|
@ -85,7 +102,11 @@ static CCImage::EImageFormat computeImageFormatType(string& filename)
|
|||
{
|
||||
ret = CCImage::kFmtPng;
|
||||
}
|
||||
|
||||
else if ((std::string::npos != filename.find(".tiff")) || (std::string::npos != filename.find(".TIFF")))
|
||||
{
|
||||
ret = CCImage::kFmtTiff;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -100,7 +121,12 @@ static void* loadImage(void* data)
|
|||
while (true)
|
||||
{
|
||||
// wait for rendering thread to ask for loading if s_pAsyncStructQueue is empty
|
||||
sem_wait(&s_sem);
|
||||
int semWaitRet = sem_wait(s_pSem);
|
||||
if( semWaitRet < 0 )
|
||||
{
|
||||
CCLOG( "CCTextureCache async thread semaphore error: %s\n", strerror( errno ) );
|
||||
break;
|
||||
}
|
||||
|
||||
std::queue<AsyncStruct*> *pQueue = s_pAsyncStructQueue;
|
||||
|
||||
|
@ -108,10 +134,10 @@ static void* loadImage(void* data)
|
|||
if (pQueue->empty())
|
||||
{
|
||||
pthread_mutex_unlock(&s_asyncStructQueueMutex);
|
||||
if (need_quit)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
if (need_quit)
|
||||
break;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -153,19 +179,33 @@ static void* loadImage(void* data)
|
|||
pthread_mutex_unlock(&s_ImageInfoMutex);
|
||||
}
|
||||
|
||||
if( s_pSem != NULL )
|
||||
{
|
||||
#if CC_ASYNC_TEXTURE_CACHE_USE_NAMED_SEMAPHORE
|
||||
sem_unlink(CC_ASYNC_TEXTURE_CACHE_SEMAPHORE);
|
||||
sem_close(s_pSem);
|
||||
#else
|
||||
sem_destroy(s_pSem);
|
||||
#endif
|
||||
s_pSem = NULL;
|
||||
delete s_pAsyncStructQueue;
|
||||
delete s_pImageQueue;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// implementation CCTextureCache
|
||||
|
||||
// TextureCache - Alloc, Init & Dealloc
|
||||
static CCTextureCache *g_sharedTextureCache;
|
||||
static CCTextureCache *g_sharedTextureCache = NULL;
|
||||
|
||||
CCTextureCache * CCTextureCache::sharedTextureCache()
|
||||
{
|
||||
if (!g_sharedTextureCache)
|
||||
{
|
||||
g_sharedTextureCache = new CCTextureCache();
|
||||
|
||||
}
|
||||
return g_sharedTextureCache;
|
||||
}
|
||||
|
||||
|
@ -180,7 +220,11 @@ CCTextureCache::~CCTextureCache()
|
|||
{
|
||||
CCLOGINFO("cocos2d: deallocing CCTextureCache.");
|
||||
need_quit = true;
|
||||
sem_post(&s_sem);
|
||||
if (s_pSem != NULL)
|
||||
{
|
||||
sem_post(s_pSem);
|
||||
}
|
||||
|
||||
CC_SAFE_RELEASE(m_pTextures);
|
||||
}
|
||||
|
||||
|
@ -189,7 +233,6 @@ void CCTextureCache::purgeSharedTextureCache()
|
|||
CC_SAFE_RELEASE_NULL(g_sharedTextureCache);
|
||||
}
|
||||
|
||||
|
||||
const char* CCTextureCache::description()
|
||||
{
|
||||
return CCString::stringWithFormat("<CCTextureCache | Number of textures = %u>", m_pTextures->count())->getCString();
|
||||
|
@ -231,27 +274,46 @@ void CCTextureCache::addImageAsync(const char *path, CCObject *target, SEL_CallF
|
|||
return;
|
||||
}
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->retain();
|
||||
}
|
||||
|
||||
// lazy init
|
||||
static bool firstRun = true;
|
||||
if (firstRun)
|
||||
if (s_pSem == NULL)
|
||||
{
|
||||
#if CC_ASYNC_TEXTURE_CACHE_USE_NAMED_SEMAPHORE
|
||||
s_pSem = sem_open(CC_ASYNC_TEXTURE_CACHE_SEMAPHORE, O_CREAT, 0644, 0);
|
||||
if( s_pSem == SEM_FAILED )
|
||||
{
|
||||
CCLOG( "CCTextureCache async thread semaphore init error: %s\n", strerror( errno ) );
|
||||
s_pSem = NULL;
|
||||
return;
|
||||
}
|
||||
#else
|
||||
int semInitRet = sem_init(&s_sem, 0, 0);
|
||||
if( semInitRet < 0 )
|
||||
{
|
||||
CCLOG( "CCTextureCache async thread semaphore init error: %s\n", strerror( errno ) );
|
||||
return;
|
||||
}
|
||||
s_pSem = &s_sem;
|
||||
#endif
|
||||
s_pAsyncStructQueue = new queue<AsyncStruct*>();
|
||||
s_pImageQueue = new queue<ImageInfo*>();
|
||||
|
||||
|
||||
pthread_mutex_init(&s_asyncStructQueueMutex, NULL);
|
||||
sem_init(&s_sem, 0, 0);
|
||||
pthread_mutex_init(&s_ImageInfoMutex, NULL);
|
||||
pthread_create(&s_loadingThread, NULL, loadImage, NULL);
|
||||
|
||||
CCDirector::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this, 0, false);
|
||||
|
||||
need_quit = false;
|
||||
firstRun = false;
|
||||
}
|
||||
|
||||
if (0 == s_nAsyncRefCount)
|
||||
{
|
||||
CCDirector::sharedDirector()->getScheduler()->scheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this, 0, false);
|
||||
}
|
||||
|
||||
++s_nAsyncRefCount;
|
||||
|
||||
if (target)
|
||||
{
|
||||
target->retain();
|
||||
}
|
||||
|
||||
// generate async struct
|
||||
|
@ -265,7 +327,7 @@ void CCTextureCache::addImageAsync(const char *path, CCObject *target, SEL_CallF
|
|||
s_pAsyncStructQueue->push(data);
|
||||
pthread_mutex_unlock(&s_asyncStructQueueMutex);
|
||||
|
||||
sem_post(&s_sem);
|
||||
sem_post(s_pSem);
|
||||
}
|
||||
|
||||
void CCTextureCache::addImageAsyncCallBack(ccTime dt)
|
||||
|
@ -300,15 +362,8 @@ void CCTextureCache::addImageAsyncCallBack(ccTime dt)
|
|||
#endif
|
||||
|
||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||
// cache the texture file name
|
||||
if (pImageInfo->imageType == CCImage::kFmtJpg)
|
||||
{
|
||||
VolatileTexture::addImageTexture(texture, filename, CCImage::kFmtJpg);
|
||||
}
|
||||
else
|
||||
{
|
||||
VolatileTexture::addImageTexture(texture, filename, CCImage::kFmtPng);
|
||||
}
|
||||
// cache the texture file name
|
||||
VolatileTexture::addImageTexture(texture, filename, pImageInfo->imageType);
|
||||
#endif
|
||||
|
||||
// cache the texture
|
||||
|
@ -321,9 +376,15 @@ void CCTextureCache::addImageAsyncCallBack(ccTime dt)
|
|||
target->release();
|
||||
}
|
||||
|
||||
delete pImage;
|
||||
pImage->release();
|
||||
delete pAsyncStruct;
|
||||
delete pImageInfo;
|
||||
|
||||
--s_nAsyncRefCount;
|
||||
if (0 == s_nAsyncRefCount)
|
||||
{
|
||||
CCDirector::sharedDirector()->getScheduler()->unscheduleSelector(schedule_selector(CCTextureCache::addImageAsyncCallBack), this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,42 +422,27 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
|||
{
|
||||
texture = this->addPVRImage(fullpath.c_str());
|
||||
}
|
||||
// Issue #886: TEMPORARY FIX FOR TRANSPARENT JPEGS IN IOS4
|
||||
else if (std::string::npos != lowerCase.find(".jpg") || std::string::npos != lowerCase.find(".jpeg"))
|
||||
{
|
||||
CCImage image;
|
||||
CCFileData data(fullpath.c_str(), "rb");
|
||||
unsigned long nSize = data.getSize();
|
||||
unsigned char* pBuffer = data.getBuffer();
|
||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtJpg));
|
||||
|
||||
texture = new CCTexture2D();
|
||||
texture->initWithImage(&image, resolution);
|
||||
|
||||
if( texture )
|
||||
{
|
||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||
// cache the texture file name
|
||||
VolatileTexture::addImageTexture(texture, fullpath.c_str(), CCImage::kFmtJpg);
|
||||
#endif
|
||||
|
||||
m_pTextures->setObject(texture, pathKey.c_str());
|
||||
// autorelease prevents possible crash in multithreaded environments
|
||||
texture->autorelease();
|
||||
}
|
||||
else
|
||||
{
|
||||
CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// prevents overloading the autorelease pool
|
||||
CCImage::EImageFormat eImageFormat = CCImage::kFmtUnKnown;
|
||||
if (std::string::npos != lowerCase.find(".png"))
|
||||
{
|
||||
eImageFormat = CCImage::kFmtPng;
|
||||
}
|
||||
else if (std::string::npos != lowerCase.find(".jpg") || std::string::npos != lowerCase.find(".jpeg"))
|
||||
{
|
||||
eImageFormat = CCImage::kFmtJpg;
|
||||
}
|
||||
else if (std::string::npos != lowerCase.find(".tif") || std::string::npos != lowerCase.find(".tiff"))
|
||||
{
|
||||
eImageFormat = CCImage::kFmtTiff;
|
||||
}
|
||||
|
||||
CCImage image;
|
||||
CCFileData data(fullpath.c_str(), "rb");
|
||||
unsigned long nSize = data.getSize();
|
||||
unsigned char* pBuffer = data.getBuffer();
|
||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, CCImage::kFmtPng));
|
||||
CC_BREAK_IF(! image.initWithImageData((void*)pBuffer, nSize, eImageFormat));
|
||||
|
||||
texture = new CCTexture2D();
|
||||
texture->initWithImage(&image, resolution);
|
||||
|
@ -405,7 +451,7 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
|||
{
|
||||
#if CC_ENABLE_CACHE_TEXTTURE_DATA
|
||||
// cache the texture file name
|
||||
VolatileTexture::addImageTexture(texture, fullpath.c_str(), CCImage::kFmtPng);
|
||||
VolatileTexture::addImageTexture(texture, fullpath.c_str(), eImageFormat);
|
||||
#endif
|
||||
|
||||
m_pTextures->setObject(texture, pathKey.c_str());
|
||||
|
@ -417,7 +463,6 @@ CCTexture2D * CCTextureCache::addImage(const char * path)
|
|||
CCLOG("cocos2d: Couldn't add image:%s in CCTextureCache", path);
|
||||
}
|
||||
}
|
||||
|
||||
} while (0);
|
||||
}
|
||||
|
||||
|
@ -679,7 +724,7 @@ VolatileTexture::VolatileTexture(CCTexture2D *t)
|
|||
VolatileTexture::~VolatileTexture()
|
||||
{
|
||||
textures.remove(this);
|
||||
CC_SAFE_FREE(uiImage);
|
||||
CC_SAFE_RELEASE(uiImage);
|
||||
}
|
||||
|
||||
void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName, CCImage::EImageFormat format)
|
||||
|
@ -700,7 +745,7 @@ void VolatileTexture::addImageTexture(CCTexture2D *tt, const char* imageFileName
|
|||
void VolatileTexture::addCCImage(CCTexture2D *tt, CCImage *image)
|
||||
{
|
||||
VolatileTexture *vt = findVolotileTexture(tt);
|
||||
|
||||
image->retain();
|
||||
vt->uiImage = image;
|
||||
vt->m_eCashedImageType = kImage;
|
||||
}
|
||||
|
|
|
@ -244,7 +244,7 @@ bool CCTexturePVR::unpackPVRData(unsigned char* data, unsigned int len)
|
|||
It means that image is compressed as flipped. We don't
|
||||
support automatic flipping.
|
||||
*/
|
||||
bool flipped = (bool)(flags & kPVRTextureFlagVerticalFlip);
|
||||
bool flipped = (flags & kPVRTextureFlagVerticalFlip) ? true : false;
|
||||
if ( flipped )
|
||||
{
|
||||
CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool");
|
||||
|
|
|
@ -40,7 +40,7 @@ public:
|
|||
CCPoint locationInView() { return m_point; }
|
||||
CCPoint previousLocationInView() { return m_prevPoint; }
|
||||
|
||||
void SetTouchInfo(int id, float x, float y)
|
||||
void setTouchInfo(int id, float x, float y)
|
||||
{
|
||||
m_nId = id;
|
||||
m_prevPoint = m_point;
|
||||
|
|
|
@ -40,8 +40,6 @@ void CCTouchHandler::setDelegate(CCTouchDelegate *pDelegate)
|
|||
dynamic_cast<CCObject*>(pDelegate)->retain();
|
||||
}
|
||||
|
||||
dynamic_cast<CCObject*>(pDelegate)->retain();
|
||||
|
||||
if (m_pDelegate)
|
||||
{
|
||||
dynamic_cast<CCObject*>(m_pDelegate)->release();
|
||||
|
|
|
@ -99,8 +99,7 @@ check_path(){
|
|||
create_android_project(){
|
||||
echo "Input package path. For example: org.cocos2dx.example"
|
||||
read PACKAGE_PATH
|
||||
echo "Now cocos2d-x supports Android 2.1-update1, 2.2, 2.3 & 3.0"
|
||||
echo "Other versions have not tested."
|
||||
echo "Now cocos2d-x supports Android 2.2 or upper version"
|
||||
$ANDROID_SDK_ROOT_LOCAL/tools/android list targets
|
||||
echo "input target id:"
|
||||
read TARGET_ID
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
# TestJS
|
||||
|
||||
Simple iOS (and soon Android) example of cocos2d-x game running javascript bindings
|
||||
|
||||
*NOTE* This is a WIP and the bindings are not yet complete! What's working:
|
||||
|
||||
CCPoint CCSize _ccGridSize CCRect CCDirector CCNode CCSprite CCScene CCSpriteFrameCache
|
||||
CCSpriteFrame CCAction CCAnimate CCAnimation CCRepeatForever CCLayer CCTouch
|
||||
CCSet CCMoveBy CCMoveTo CCRotateTo CCRotateBy CCRenderTexture CCMenu CCMenuItem
|
||||
CCMenuItemLabel CCMenuItemSprite CCMenuItemImage CCLabelTTF CCSequence
|
||||
CCActionInterval CCFiniteTimeAction CCFileUtils
|
||||
CCEaseBackInOut CCEaseBackOut CCEaseElasticIn CCEaseElastic CCEaseElasticOut CCEaseElasticInOut
|
||||
CCEaseBounceIn CCEaseBounce CCEaseBounceInOut CCEaseBackIn CCEaseBounceOut CCEaseIn CCEaseOut
|
||||
CCEaseExponentialIn CCEaseInOut CCEaseExponentialOut CCEaseExponentialInOut CCEaseSineIn
|
||||
CCEaseSineOut CCEaseSineInOut CCActionEase CCEaseRateAction CCParticleSystem CCParticleSystemQuad
|
||||
CCParticleSystemPoint CCDelayTime CCTexture2D CCTextureCache CCSpriteBatchNode CCTextureAtlas
|
||||
CCParallaxNode CCTintTo CCTintBy CCLayerColor CCBlink CCSpeed CCWaves3D CCGridAction CCGrid3DAction
|
||||
CCTransitionScene CCTransitionSceneOriented CCTransitionRotoZoom CCTransitionFadeDown
|
||||
CCTransitionJumpZoom CCTransitionMoveInL CCTransitionMoveInR CCTransitionMoveInT CCTransitionMoveInB
|
||||
CCTransitionSlideInL CCTransitionSlideInR CCTransitionSlideInB CCTransitionSlideInT CCTransitionShrinkGrow
|
||||
CCTransitionFlipX CCTransitionFlipY CCTransitionFlipAngular CCTransitionZoomFlipX CCTransitionZoomFlipY
|
||||
CCTransitionZoomFlipAngular CCTransitionFade CCTransitionCrossFade CCTransitionTurnOffTiles
|
||||
CCTransitionSplitCols CCTransitionSplitRows CCTransitionFadeTR CCTransitionFadeBL CCTransitionFadeUp
|
||||
CCFadeOutBLTiles CCProgressFromTo CCFadeOutUpTiles CCAnimationCache CCPlace CCLabelBMFont CCReverseTime
|
||||
CCFadeOutTRTiles CCCamera CCProgressTo CCWavesTiles3D CCMotionStreak CCTransitionRadialCCW CCFadeOutDownTiles
|
||||
CCTurnOffTiles CCDeccelAmplitude CCProgressTimer CCActionInstant CCReuseGrid CCStopGrid CCTwirl
|
||||
CCShakyTiles3D CCTransitionRadialCW CCAtlasNode CCWaves CCShow CCOrbitCamera CCShatteredTiles3D CCHide
|
||||
CCToggleVisibility CCActionCamera CCShuffleTiles CCLayerGradient CCFlipX CCRepeat CCFlipY CCBezierBy
|
||||
CCPageTurn3D CCLens3D CCRipple3D CCApplication CCFlipX3D CCJumpTo CCTransitionPageTurn CCFlipY3D
|
||||
CCLiquid CCTiledGrid3DAction CCJumpBy CCFollow CCSkewBy CCAccelDeccelAmplitude CCLabelAtlas CCAccelAmplitude
|
||||
CCSkewTo CCShaky3D CCSplitCols CCFadeOut CCTileMapAtlas CCFadeTo CCJumpTiles3D CCFadeIn CCSplitRows
|
||||
CCScaleBy CCScaleTo CCBezierTo CCTMXTiledMap CCTMXLayer CCApplication CCUserDefault
|
||||
|
||||
This is just a proof of concept and there are plans around this in order to make a more js-friendly API, right now
|
||||
the bindings were created automatically and the final idea is not to use them as they are but to create a higher
|
||||
level wrapper.
|
||||
|
||||
You can follow the progress of the js-bindings in the current [development fork](https://github.com/funkaster/cocos2d-x/tree/js-bindings).
|
||||
|
||||
For a sneak peak, you can take a look at what's in the JS directory.
|
||||
|
||||
## How to Build
|
||||
|
||||
### Before hitting the "Build" button
|
||||
|
||||
In debug mode, (when there's a `#define DEBUG` somewhere), the javascript code will be read from somewhere else and not from the JS directory
|
||||
in the app bundle. To make sure this works, modify the absolute path in `ScriptingCore.cpp`:
|
||||
|
||||
```c++
|
||||
void ScriptingCore::runScript(const char *path)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
std::string dpath("/Users/rabarca/Desktop/testjs/testjs/"); // <~ this is what you want to modify!
|
||||
dpath += path;
|
||||
const char *realPath = dpath.c_str();
|
||||
#else
|
||||
const char *realPath = CCFileUtils::fullPathFromRelativePath(path);
|
||||
#endif
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Basically, the dpath string should point to wherever the JS directory is located. This affects every script
|
||||
run through the `runScript` function from `ScriptingCore`. If you don't want that behaviour, then just set
|
||||
the dpath string to `""`. It also allows for the "reload script" button to work on the demo:
|
||||
|
||||
![screenshot 1](http://dl.dropbox.com/u/29043245/testjs1.png)
|
||||
|
||||
If you set the dpath string to `""` (empty string, the default setting) then the reload button will try to
|
||||
reload the script from inside the bundle.
|
||||
|
||||
In the test scenes the buttons represent:
|
||||
|
||||
* top left: will reload the current script
|
||||
* left arrow: previous test scene in the script
|
||||
* center button: will reload the current scene
|
||||
* right arrow: next test scene in the script
|
||||
|
||||
The current test script can be changed in the AppDelegate (or by modifying the source and then hitting reload script):
|
||||
|
||||
```c++
|
||||
# AppDelegate.cpp
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
...
|
||||
// run the main script
|
||||
ScriptingCore::getInstance().runScript("JS/1to1/test_actions.js");
|
||||
// ScriptingCore::getInstance().runScript("JS/1to1/test_layer.js");
|
||||
|
||||
return true;
|
||||
}
|
||||
```
|
||||
|
||||
Change the script name there and relaunch the simulator.
|
||||
|
||||
### iOS
|
||||
|
||||
Just open the xcode project and run. It's using the latest spidermonkey and js-bindings for cocos2d-x
|
||||
|
||||
### Android
|
||||
|
||||
Instructions to be added here
|
|
@ -0,0 +1,269 @@
|
|||
//
|
||||
// ScriptingCore.cpp
|
||||
// testmonkey
|
||||
//
|
||||
// Created by Rolando Abarca on 3/14/12.
|
||||
// Copyright (c) 2012 Zynga Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include "cocos2d.h"
|
||||
#include "ScriptingCore.h"
|
||||
#include "cocos2d_generated.hpp"
|
||||
#include "cocos_denshion_generated.hpp"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
|
||||
static JSClass global_class = {
|
||||
"global", JSCLASS_GLOBAL_FLAGS,
|
||||
JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
|
||||
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub, JS_FinalizeStub,
|
||||
JSCLASS_NO_OPTIONAL_MEMBERS
|
||||
};
|
||||
|
||||
ScriptingCore::ScriptingCore()
|
||||
{
|
||||
this->rt = JS_NewRuntime(8 * 1024 * 1024);
|
||||
this->cx = JS_NewContext(rt, 8192);
|
||||
JS_SetOptions(this->cx, JSOPTION_VAROBJFIX);
|
||||
JS_SetVersion(this->cx, JSVERSION_LATEST);
|
||||
JS_SetErrorReporter(this->cx, ScriptingCore::reportError);
|
||||
global = JS_NewCompartmentAndGlobalObject(cx, &global_class, NULL);
|
||||
if (!JS_InitStandardClasses(cx, global)) {
|
||||
CCLog("js error");
|
||||
}
|
||||
// create the cocos namespace
|
||||
JSObject *cocos = JS_NewObject(cx, NULL, NULL, NULL);
|
||||
jsval cocosVal = OBJECT_TO_JSVAL(cocos);
|
||||
JS_SetProperty(cx, global, "cocos", &cocosVal);
|
||||
|
||||
// register the internal classes
|
||||
S_CCPoint::jsCreateClass(this->cx, cocos, "Point");
|
||||
S_CCSize::jsCreateClass(this->cx, cocos, "Size");
|
||||
S_CCRect::jsCreateClass(this->cx, cocos, "Rect");
|
||||
S__ccGridSize::jsCreateClass(this->cx, cocos, "GridSize");
|
||||
S_CCSet::jsCreateClass(this->cx, cocos, "Set");
|
||||
S_CCTouch::jsCreateClass(this->cx, cocos, "Touch");
|
||||
S_CCDirector::jsCreateClass(this->cx, cocos, "Director");
|
||||
S_CCNode::jsCreateClass(this->cx, cocos, "Node");
|
||||
S_CCTextureAtlas::jsCreateClass(this->cx, cocos, "TextureAtlas");
|
||||
S_CCSpriteBatchNode::jsCreateClass(this->cx, cocos, "SpriteBatchNode");
|
||||
S_CCScene::jsCreateClass(this->cx, cocos, "Scene");
|
||||
S_CCLayer::jsCreateClass(this->cx, cocos, "Layer");
|
||||
S_CCSprite::jsCreateClass(this->cx, cocos, "Sprite");
|
||||
S_CCRenderTexture::jsCreateClass(this->cx, cocos, "RenderTexture");
|
||||
S_CCMenu::jsCreateClass(this->cx, cocos, "Menu");
|
||||
S_CCMenuItem::jsCreateClass(this->cx, cocos, "MenuItem");
|
||||
S_CCMenuItemLabel::jsCreateClass(this->cx, cocos, "MenuItemLabel");
|
||||
S_CCMenuItemSprite::jsCreateClass(this->cx, cocos, "MenuItemSprite");
|
||||
S_CCMenuItemImage::jsCreateClass(this->cx, cocos, "MenuItemImage");
|
||||
S_CCSpriteFrame::jsCreateClass(this->cx, cocos, "SpriteFrame");
|
||||
S_CCSpriteFrameCache::jsCreateClass(this->cx, cocos, "SpriteFrameCache");
|
||||
S_CCAnimation::jsCreateClass(this->cx, cocos, "Animation");
|
||||
S_CCAction::jsCreateClass(this->cx, cocos, "Action");
|
||||
S_CCActionInterval::jsCreateClass(this->cx, cocos, "ActionInterval");
|
||||
S_CCFiniteTimeAction::jsCreateClass(this->cx, cocos, "FiniteTimeAction");
|
||||
S_CCActionInstant::jsCreateClass(this->cx, cocos, "ActionInstant");
|
||||
S_CCDelayTime::jsCreateClass(this->cx, cocos, "DelayTime");
|
||||
S_CCAnimate::jsCreateClass(this->cx, cocos, "Animate");
|
||||
S_CCMoveTo::jsCreateClass(this->cx, cocos, "MoveTo");
|
||||
S_CCMoveBy::jsCreateClass(this->cx, cocos, "MoveBy");
|
||||
S_CCRotateBy::jsCreateClass(this->cx, cocos, "RotateBy");
|
||||
S_CCRotateTo::jsCreateClass(this->cx, cocos, "RotateTo");
|
||||
S_CCActionEase::jsCreateClass(this->cx, cocos, "ActionEase");
|
||||
S_CCEaseRateAction::jsCreateClass(this->cx, cocos, "EaseRateAction");
|
||||
S_CCEaseIn::jsCreateClass(this->cx, cocos, "EaseIn");
|
||||
S_CCEaseOut::jsCreateClass(this->cx, cocos, "EaseOut");
|
||||
S_CCEaseInOut::jsCreateClass(this->cx, cocos, "EaseInOut");
|
||||
S_CCEaseBackInOut::jsCreateClass(this->cx, cocos, "EaseBackInOut");
|
||||
S_CCEaseBackOut::jsCreateClass(this->cx, cocos, "EaseBackOut");
|
||||
S_CCEaseElasticIn::jsCreateClass(this->cx, cocos, "EaseElasticIn");
|
||||
S_CCEaseElastic::jsCreateClass(this->cx, cocos, "EaseElastic");
|
||||
S_CCEaseElasticOut::jsCreateClass(this->cx, cocos, "EaseElasticOut");
|
||||
S_CCEaseElasticInOut::jsCreateClass(this->cx, cocos, "EaseElasticInOut");
|
||||
S_CCEaseBounce::jsCreateClass(this->cx, cocos, "EaseBounce");
|
||||
S_CCEaseBounceIn::jsCreateClass(this->cx, cocos, "EaseBounceIn");
|
||||
S_CCEaseBounceInOut::jsCreateClass(this->cx, cocos, "EaseBounceInOut");
|
||||
S_CCEaseBackIn::jsCreateClass(this->cx, cocos, "EaseBackIn");
|
||||
S_CCEaseBounceOut::jsCreateClass(this->cx, cocos, "EaseBounceOut");
|
||||
S_CCEaseExponentialIn::jsCreateClass(this->cx, cocos, "EaseExponentialIn");
|
||||
S_CCEaseExponentialOut::jsCreateClass(this->cx, cocos, "EaseExponentialOut");
|
||||
S_CCEaseExponentialInOut::jsCreateClass(this->cx, cocos, "EaseExponentialInOut");
|
||||
S_CCEaseSineIn::jsCreateClass(this->cx, cocos, "EaseSineIn");
|
||||
S_CCEaseSineOut::jsCreateClass(this->cx, cocos, "EaseSineOut");
|
||||
S_CCEaseSineInOut::jsCreateClass(this->cx, cocos, "EaseSineInOut");
|
||||
S_CCRepeatForever::jsCreateClass(this->cx, cocos, "RepeatForever");
|
||||
S_CCSequence::jsCreateClass(this->cx, cocos, "Sequence");
|
||||
S_CCLabelTTF::jsCreateClass(this->cx, cocos, "LabelTTF");
|
||||
S_CCParticleSystem::jsCreateClass(this->cx, cocos, "ParticleSystem");
|
||||
S_CCFileUtils::jsCreateClass(this->cx, cocos, "FileUtils");
|
||||
S_CCTexture2D::jsCreateClass(this->cx, cocos, "Texture2D");
|
||||
S_CCTextureCache::jsCreateClass(this->cx, cocos, "TextureCache");
|
||||
S_CCParallaxNode::jsCreateClass(this->cx, cocos, "ParallaxNode");
|
||||
S_CCTintBy::jsCreateClass(this->cx, cocos, "TintBy");
|
||||
S_CCTintTo::jsCreateClass(this->cx, cocos, "TintTo");
|
||||
S_CCLayerColor::jsCreateClass(this->cx, cocos, "LayerColor");
|
||||
S_CCBlink::jsCreateClass(this->cx, cocos, "Blink");
|
||||
S_CCSpeed::jsCreateClass(this->cx, cocos, "Speed");
|
||||
S_CCGridAction::jsCreateClass(this->cx, cocos, "GridAction");
|
||||
S_CCGrid3DAction::jsCreateClass(this->cx, cocos, "Grid3DAction");
|
||||
S_CCWaves3D::jsCreateClass(this->cx, cocos, "Waves3D");
|
||||
S_CCTransitionScene::jsCreateClass(this->cx, cocos, "TransitionScene");
|
||||
S_CCTransitionSceneOriented::jsCreateClass(this->cx, cocos, "TransitionSceneOriented");
|
||||
S_CCTransitionRotoZoom::jsCreateClass(this->cx, cocos, "TransitionRotoZoom");
|
||||
S_CCTransitionFadeDown::jsCreateClass(this->cx, cocos, "TransitionFadeDown");
|
||||
S_CCTransitionJumpZoom::jsCreateClass(this->cx, cocos, "TransitionJumpZoom");
|
||||
S_CCTransitionMoveInL::jsCreateClass(this->cx, cocos, "TransitionMoveInL");
|
||||
S_CCTransitionMoveInR::jsCreateClass(this->cx, cocos, "TransitionMoveInR");
|
||||
S_CCTransitionMoveInT::jsCreateClass(this->cx, cocos, "TransitionMoveInT");
|
||||
S_CCTransitionMoveInB::jsCreateClass(this->cx, cocos, "TransitionMoveInB");
|
||||
S_CCTransitionSlideInL::jsCreateClass(this->cx, cocos, "TransitionSlideInL");
|
||||
S_CCTransitionSlideInR::jsCreateClass(this->cx, cocos, "TransitionSlideInR");
|
||||
S_CCTransitionSlideInB::jsCreateClass(this->cx, cocos, "TransitionSlideInB");
|
||||
S_CCTransitionSlideInT::jsCreateClass(this->cx, cocos, "TransitionSlideInT");
|
||||
S_CCTransitionShrinkGrow::jsCreateClass(this->cx, cocos, "TransitionShrinkGrow");
|
||||
S_CCTransitionFlipX::jsCreateClass(this->cx, cocos, "TransitionFlipX");
|
||||
S_CCTransitionFlipY::jsCreateClass(this->cx, cocos, "TransitionFlipY");
|
||||
S_CCTransitionFlipAngular::jsCreateClass(this->cx, cocos, "TransitionFlipAngular");
|
||||
S_CCTransitionZoomFlipX::jsCreateClass(this->cx, cocos, "TransitionZoomFlipX");
|
||||
S_CCTransitionZoomFlipY::jsCreateClass(this->cx, cocos, "TransitionZoomFlipY");
|
||||
S_CCTransitionZoomFlipAngular::jsCreateClass(this->cx, cocos, "TransitionZoomFlipAngular");
|
||||
S_CCTransitionFade::jsCreateClass(this->cx, cocos, "TransitionFade");
|
||||
S_CCTransitionCrossFade::jsCreateClass(this->cx, cocos, "TransitionCrossFade");
|
||||
S_CCTransitionTurnOffTiles::jsCreateClass(this->cx, cocos, "TransitionTurnOffTiles");
|
||||
S_CCTransitionSplitCols::jsCreateClass(this->cx, cocos, "TransitionSplitCols");
|
||||
S_CCTransitionSplitRows::jsCreateClass(this->cx, cocos, "TransitionSplitRows");
|
||||
S_CCTransitionFadeTR::jsCreateClass(this->cx, cocos, "TransitionFadeTR");
|
||||
S_CCTransitionFadeBL::jsCreateClass(this->cx, cocos, "TransitionFadeBL");
|
||||
S_CCTransitionFadeUp::jsCreateClass(this->cx, cocos, "TransitionFadeUp");
|
||||
S_CCFadeOutBLTiles::jsCreateClass(this->cx, cocos, "FadeOutBLTiles");
|
||||
S_CCProgressFromTo::jsCreateClass(this->cx, cocos, "ProgressFromTo");
|
||||
S_CCFadeOutUpTiles::jsCreateClass(this->cx, cocos, "FadeOutUpTiles");
|
||||
S_CCAnimationCache::jsCreateClass(this->cx, cocos, "AnimationCache");
|
||||
S_CCPlace::jsCreateClass(this->cx, cocos, "Place");
|
||||
S_CCLabelBMFont::jsCreateClass(this->cx, cocos, "LabelBMFont");
|
||||
S_CCReverseTime::jsCreateClass(this->cx, cocos, "ReverseTime");
|
||||
S_CCFadeOutTRTiles::jsCreateClass(this->cx, cocos, "FadeOutTRTiles");
|
||||
S_CCCamera::jsCreateClass(this->cx, cocos, "Camera");
|
||||
S_CCProgressTo::jsCreateClass(this->cx, cocos, "ProgressTo");
|
||||
S_CCWavesTiles3D::jsCreateClass(this->cx, cocos, "WavesTiles3D");
|
||||
S_CCMotionStreak::jsCreateClass(this->cx, cocos, "MotionStreak");
|
||||
S_CCTransitionProgressRadialCCW::jsCreateClass(this->cx, cocos, "TransitionRadialProgressCCW");
|
||||
S_CCFadeOutDownTiles::jsCreateClass(this->cx, cocos, "FadeOutDownTiles");
|
||||
S_CCTurnOffTiles::jsCreateClass(this->cx, cocos, "TurnOffTiles");
|
||||
S_CCDeccelAmplitude::jsCreateClass(this->cx, cocos, "DeccelAmplitude");
|
||||
S_CCProgressTimer::jsCreateClass(this->cx, cocos, "ProgressTimer");
|
||||
S_CCReuseGrid::jsCreateClass(this->cx, cocos, "ReuseGrid");
|
||||
S_CCStopGrid::jsCreateClass(this->cx, cocos, "StopGrid");
|
||||
S_CCTwirl::jsCreateClass(this->cx, cocos, "Twirl");
|
||||
S_CCShakyTiles3D::jsCreateClass(this->cx, cocos, "ShakyTiles3D");
|
||||
S_CCTransitionProgressRadialCW::jsCreateClass(this->cx, cocos, "TransitionProgressRadialCW");
|
||||
S_CCAtlasNode::jsCreateClass(this->cx, cocos, "AtlasNode");
|
||||
S_CCWaves::jsCreateClass(this->cx, cocos, "Waves");
|
||||
S_CCShow::jsCreateClass(this->cx, cocos, "Show");
|
||||
S_CCOrbitCamera::jsCreateClass(this->cx, cocos, "OrbitCamera");
|
||||
S_CCShatteredTiles3D::jsCreateClass(this->cx, cocos, "ShatteredTiles3D");
|
||||
S_CCHide::jsCreateClass(this->cx, cocos, "Hide");
|
||||
S_CCToggleVisibility::jsCreateClass(this->cx, cocos, "ToggleVisibility");
|
||||
S_CCActionCamera::jsCreateClass(this->cx, cocos, "ActionCamera");
|
||||
S_CCShuffleTiles::jsCreateClass(this->cx, cocos, "ShuffleTiles");
|
||||
S_CCLayerGradient::jsCreateClass(this->cx, cocos, "LayerGradient");
|
||||
S_CCFlipX::jsCreateClass(this->cx, cocos, "FlipX");
|
||||
S_CCRepeat::jsCreateClass(this->cx, cocos, "Repeat");
|
||||
S_CCFlipY::jsCreateClass(this->cx, cocos, "FlipY");
|
||||
S_CCBezierBy::jsCreateClass(this->cx, cocos, "BezierBy");
|
||||
S_CCPageTurn3D::jsCreateClass(this->cx, cocos, "PageTurn3D");
|
||||
S_CCLens3D::jsCreateClass(this->cx, cocos, "Lens3D");
|
||||
S_CCRipple3D::jsCreateClass(this->cx, cocos, "Ripple3D");
|
||||
S_CCApplication::jsCreateClass(this->cx, cocos, "Application");
|
||||
S_CCFlipX3D::jsCreateClass(this->cx, cocos, "FlipX3D");
|
||||
S_CCJumpTo::jsCreateClass(this->cx, cocos, "JumpTo");
|
||||
S_CCTransitionPageTurn::jsCreateClass(this->cx, cocos, "TransitionPageTurn");
|
||||
S_CCFlipY3D::jsCreateClass(this->cx, cocos, "FlipY3D");
|
||||
S_CCLiquid::jsCreateClass(this->cx, cocos, "Liquid");
|
||||
S_CCTiledGrid3DAction::jsCreateClass(this->cx, cocos, "TiledGrid3DAction");
|
||||
S_CCJumpBy::jsCreateClass(this->cx, cocos, "JumpBy");
|
||||
S_CCFollow::jsCreateClass(this->cx, cocos, "Follow");
|
||||
S_CCSkewBy::jsCreateClass(this->cx, cocos, "SkewBy");
|
||||
S_CCAccelDeccelAmplitude::jsCreateClass(this->cx, cocos, "AccelDeccelAmplitude");
|
||||
S_CCLabelAtlas::jsCreateClass(this->cx, cocos, "LabelAtlas");
|
||||
S_CCAccelAmplitude::jsCreateClass(this->cx, cocos, "AccelAmplitude");
|
||||
S_CCSkewTo::jsCreateClass(this->cx, cocos, "SkewTo");
|
||||
S_CCShaky3D::jsCreateClass(this->cx, cocos, "Shaky3D");
|
||||
S_CCSplitCols::jsCreateClass(this->cx, cocos, "SplitCols");
|
||||
S_CCFadeOut::jsCreateClass(this->cx, cocos, "FadeOut");
|
||||
S_CCTileMapAtlas::jsCreateClass(this->cx, cocos, "TileMapAtlas");
|
||||
S_CCFadeTo::jsCreateClass(this->cx, cocos, "FadeTo");
|
||||
S_CCJumpTiles3D::jsCreateClass(this->cx, cocos, "JumpTiles3D");
|
||||
S_CCFadeIn::jsCreateClass(this->cx, cocos, "FadeIn");
|
||||
S_CCSplitRows::jsCreateClass(this->cx, cocos, "SplitRows");
|
||||
S_CCScaleBy::jsCreateClass(this->cx, cocos, "ScaleBy");
|
||||
S_CCScaleTo::jsCreateClass(this->cx, cocos, "ScaleTo");
|
||||
S_CCBezierTo::jsCreateClass(this->cx, cocos, "BezierTo");
|
||||
S_CCTMXTiledMap::jsCreateClass(this->cx, cocos, "TMXTiledMap");
|
||||
S_CCTMXLayer::jsCreateClass(this->cx, cocos, "TMXLayer");
|
||||
|
||||
S_SimpleAudioEngine::jsCreateClass(this->cx, cocos, "SimpleAudioEngine");
|
||||
|
||||
// register some global functions
|
||||
JS_DefineFunction(this->cx, global, "require", ScriptingCore::executeScript, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(this->cx, cocos, "log", ScriptingCore::log, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(this->cx, cocos, "executeScript", ScriptingCore::executeScript, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(this->cx, cocos, "addGCRootObject", ScriptingCore::addRootJS, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(this->cx, cocos, "removeGCRootObject", ScriptingCore::removeRootJS, 1, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
JS_DefineFunction(this->cx, cocos, "forceGC", ScriptingCore::forceGC, 0, JSPROP_READONLY | JSPROP_PERMANENT);
|
||||
}
|
||||
|
||||
bool ScriptingCore::evalString(const char *string, jsval *outVal)
|
||||
{
|
||||
jsval rval;
|
||||
JSString *str;
|
||||
JSBool ok;
|
||||
const char *filename = "noname";
|
||||
uint32_t lineno = 0;
|
||||
if (outVal == NULL) {
|
||||
outVal = &rval;
|
||||
}
|
||||
ok = JS_EvaluateScript(cx, global, string, strlen(string), filename, lineno, outVal);
|
||||
if (ok == JS_FALSE) {
|
||||
CCLog("error evaluating script:\n%s", string);
|
||||
}
|
||||
str = JS_ValueToString(cx, rval);
|
||||
return ok;
|
||||
}
|
||||
|
||||
void ScriptingCore::runScript(const char *path)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
/**
|
||||
* dpath should point to the parent directory of the "JS" folder. If this is
|
||||
* set to "" (as it is now) then it will take the scripts from the app bundle.
|
||||
* By setting the absolute path you can iterate the development only by
|
||||
* modifying those scripts and reloading from the simulator (no recompiling/
|
||||
* relaunching)
|
||||
*/
|
||||
// std::string dpath("/Users/rabarca/Desktop/testjs/testjs/");
|
||||
std::string dpath("");
|
||||
dpath += path;
|
||||
const char *realPath = CCFileUtils::fullPathFromRelativePath(dpath.c_str());
|
||||
#else
|
||||
const char *realPath = CCFileUtils::fullPathFromRelativePath(path);
|
||||
#endif
|
||||
const char* content = CCString::stringWithContentsOfFile(realPath)->getCString();
|
||||
if (content && strlen(content) > 0) {
|
||||
JSBool ok;
|
||||
jsval rval;
|
||||
ok = JS_EvaluateScript(this->cx, this->global, (char *)content, strlen(content), path, 1, &rval);
|
||||
if (ok == JS_FALSE) {
|
||||
CCLog("error evaluating script:\n%s", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScriptingCore::~ScriptingCore()
|
||||
{
|
||||
JS_DestroyContext(cx);
|
||||
JS_DestroyRuntime(rt);
|
||||
JS_ShutDown();
|
||||
}
|
|
@ -0,0 +1,142 @@
|
|||
//
|
||||
// ScriptingCore.h
|
||||
// testmonkey
|
||||
//
|
||||
// Created by Rolando Abarca on 3/14/12.
|
||||
// Copyright (c) 2012 Zynga Inc. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef cocos2dx_ScriptingCore_h
|
||||
#define cocos2dx_ScriptingCore_h
|
||||
|
||||
#include "jsapi.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
class ScriptingCore
|
||||
{
|
||||
JSRuntime *rt;
|
||||
JSContext *cx;
|
||||
JSObject *global;
|
||||
|
||||
ScriptingCore();
|
||||
public:
|
||||
~ScriptingCore();
|
||||
|
||||
static ScriptingCore & getInstance() {
|
||||
static ScriptingCore instance;
|
||||
return instance;
|
||||
};
|
||||
|
||||
/**
|
||||
* will eval the specified string
|
||||
* @param string The string with the javascript code to be evaluated
|
||||
* @param outVal The jsval that will hold the return value of the evaluation.
|
||||
* Can be NULL.
|
||||
*/
|
||||
bool evalString(const char *string, jsval *outVal);
|
||||
|
||||
/**
|
||||
* will run the specified string
|
||||
* @param string The path of the script to be run
|
||||
*/
|
||||
void runScript(const char *path);
|
||||
|
||||
/**
|
||||
* @return the global context
|
||||
*/
|
||||
JSContext* getGlobalContext() {
|
||||
return cx;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param cx
|
||||
* @param message
|
||||
* @param report
|
||||
*/
|
||||
static void reportError(JSContext *cx, const char *message, JSErrorReport *report)
|
||||
{
|
||||
fprintf(stderr, "%s:%u:%s\n",
|
||||
report->filename ? report->filename : "<no filename=\"filename\">",
|
||||
(unsigned int) report->lineno,
|
||||
message);
|
||||
};
|
||||
|
||||
/**
|
||||
* Log something using CCLog
|
||||
* @param cx
|
||||
* @param argc
|
||||
* @param vp
|
||||
*/
|
||||
static JSBool log(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc > 0) {
|
||||
JSString *string = NULL;
|
||||
JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &string);
|
||||
if (string) {
|
||||
char *cstr = JS_EncodeString(cx, string);
|
||||
cocos2d::CCLog(cstr);
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
};
|
||||
|
||||
/**
|
||||
* run a script from script :)
|
||||
*/
|
||||
static JSBool executeScript(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 1) {
|
||||
JSString *string;
|
||||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &string) == JS_TRUE) {
|
||||
ScriptingCore::getInstance().runScript(JS_EncodeString(cx, string));
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
};
|
||||
|
||||
/**
|
||||
* Register an object as a member of the GC's root set, preventing
|
||||
* them from being GC'ed
|
||||
*/
|
||||
static JSBool addRootJS(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 1) {
|
||||
JSObject *o = NULL;
|
||||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "o", &o) == JS_TRUE) {
|
||||
if (JS_AddObjectRoot(cx, &o) == JS_FALSE) {
|
||||
cocos2d::CCLog("something went wrong when setting an object to the root");
|
||||
}
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
};
|
||||
|
||||
/**
|
||||
* removes an object from the GC's root, allowing them to be GC'ed if no
|
||||
* longer referenced.
|
||||
*/
|
||||
static JSBool removeRootJS(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
if (argc == 1) {
|
||||
JSObject *o = NULL;
|
||||
if (JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "o", &o) == JS_TRUE) {
|
||||
JS_RemoveObjectRoot(cx, &o);
|
||||
}
|
||||
}
|
||||
return JS_TRUE;
|
||||
};
|
||||
|
||||
/**
|
||||
* Force a cycle of GC
|
||||
* @param cx
|
||||
* @param argc
|
||||
* @param vp
|
||||
*/
|
||||
static JSBool forceGC(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
JS_GC(cx);
|
||||
return JS_TRUE;
|
||||
};
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
2d4adf9bb3276c7884f16637eb15bd5090ad7ca2
|
|
@ -0,0 +1 @@
|
|||
f15b1b846b94b2d2b69438899124884963fd9f09
|
|
@ -0,0 +1,379 @@
|
|||
#include "cocos2d_generated.hpp"
|
||||
|
||||
JSBool S_CCNode::jsaddChild(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCNode* self = NULL; JSGET_PTRSHELL(S_CCNode, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc >= 1) {
|
||||
JSObject *arg0;
|
||||
int zorder = 0;
|
||||
int tag = 0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "o/ii", &arg0, &zorder, &tag);
|
||||
CCNode* narg0; JSGET_PTRSHELL(CCNode, narg0, arg0);
|
||||
// call the proper method
|
||||
if (argc == 1) {
|
||||
self->addChild(narg0);
|
||||
} else if (argc == 2) {
|
||||
self->addChild(narg0, zorder);
|
||||
} else {
|
||||
self->addChild(narg0, zorder, tag);
|
||||
}
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCMenuItemSprite::jsinitWithNormalSprite(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCMenuItemSprite* self = NULL; JSGET_PTRSHELL(S_CCMenuItemSprite, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc >= 2) {
|
||||
JSObject *arg0;
|
||||
JSObject *arg1;
|
||||
JSObject *arg2 = NULL;
|
||||
JS_ConvertArguments(cx, 5, JS_ARGV(cx, vp), "oo/o", &arg0, &arg1, &arg2);
|
||||
CCNode* narg0; JSGET_PTRSHELL(CCNode, narg0, arg0);
|
||||
CCNode* narg1; JSGET_PTRSHELL(CCNode, narg1, arg1);
|
||||
CCNode* narg2 = NULL; if (argc == 3) JSGET_PTRSHELL(CCNode, narg2, arg2);
|
||||
bool ret = self->initWithNormalSprite(narg0, narg1, narg2, self, menu_selector(S_CCMenuItemSprite::menuAction));
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCMenuItemImage::jsinitWithNormalImage(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCMenuItemImage* self = NULL; JSGET_PTRSHELL(S_CCMenuItemImage, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc >= 2) {
|
||||
JSString *arg0;
|
||||
JSString *arg1;
|
||||
JSString *arg2 = NULL;
|
||||
JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "SS/S", &arg0, &arg1, &arg2);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
char *narg1 = JS_EncodeString(cx, arg1);
|
||||
char *narg2 = (arg2) ? JS_EncodeString(cx, arg2) : NULL;
|
||||
bool ret = self->initWithNormalImage(narg0, narg1, narg2, self, menu_selector(S_CCMenuItemImage::menuAction));
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCSequence::jsactions(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
// just like CCSequence::actions
|
||||
if (argc > 0) {
|
||||
jsval* argv = JS_ARGV(cx, vp);
|
||||
// get first element
|
||||
S_CCSequence* prev;
|
||||
JSGET_PTRSHELL(S_CCSequence, prev, JSVAL_TO_OBJECT(argv[0]));
|
||||
for (int i=1; i < argc; i++) {
|
||||
CCFiniteTimeAction *next; JSGET_PTRSHELL(CCFiniteTimeAction, next, JSVAL_TO_OBJECT(argv[i]));
|
||||
prev = (S_CCSequence *)CCSequence::actionOneTwo(prev, next);
|
||||
}
|
||||
// wrap prev in an action
|
||||
// temporary because it's just a wrapper for an autoreleased object
|
||||
// or worst case, it's an already binded object (if it's just one item in the array)
|
||||
pointerShell_t* pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = prev;
|
||||
JSObject* out = JS_NewObject(cx, S_CCSequence::jsClass, S_CCSequence::jsObject, NULL);
|
||||
prev->jsObject = out;
|
||||
JS_SetPrivate(out, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(out));
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_ReportError(cx, "must call with at least one element");
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSBool S_CCParticleSystem::jsparticleWithFile(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 1) {
|
||||
JSString *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "S", &arg0);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
CCParticleSystem* ret = CCParticleSystemQuad::particleWithFile(narg0);
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
do {
|
||||
JSObject *tmp = JS_NewObject(cx, S_CCParticleSystem::jsClass, S_CCParticleSystem::jsObject, NULL);
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = (void *)ret;
|
||||
JS_SetPrivate(tmp, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
} while (0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCFileUtils::jsgetFileData(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSString *arg1;
|
||||
unsigned long len;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "SS", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
char *narg1 = JS_EncodeString(cx, arg1);
|
||||
unsigned char *ret = CCFileUtils::getFileData(narg0, narg1, &len);
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSString *str = JS_NewStringCopyN(cx, (const char *)ret, len);
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCFileUtils::jsfullPathFromRelativePath(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 1) {
|
||||
JSString *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "S", &arg0);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
const char *ret = CCFileUtils::fullPathFromRelativePath(narg0);
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSString *str = JS_NewStringCopyN(cx, ret, strlen(ret));
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCFileUtils::jsfullPathFromRelativeFile(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSString *arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "SS", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
char *narg1 = JS_EncodeString(cx, arg1);
|
||||
const char *ret = CCFileUtils::fullPathFromRelativeFile(narg0, narg1);
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSString *str = JS_NewStringCopyN(cx, ret, strlen(ret));
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(str));
|
||||
return JS_TRUE;
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCLabelTTF::jslabelWithString(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 5) {
|
||||
JSString *arg0;
|
||||
JSObject *arg1;
|
||||
int arg2;
|
||||
JSString *arg3;
|
||||
double arg4;
|
||||
JS_ConvertArguments(cx, 5, JS_ARGV(cx, vp), "SoiSd", &arg0, &arg1, &arg2, &arg3, &arg4);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
CCSize* narg1; JSGET_PTRSHELL(CCSize, narg1, arg1);
|
||||
char *narg3 = JS_EncodeString(cx, arg3);
|
||||
CCLabelTTF *ret = CCLabelTTF::labelWithString(narg0, *narg1, (CCTextAlignment)arg2, narg3, arg4);
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
do {
|
||||
JSObject *tmp = JS_NewObject(cx, S_CCLabelTTF::jsClass, S_CCLabelTTF::jsObject, NULL);
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = (void *)ret;
|
||||
JS_SetPrivate(tmp, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
} while (0);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCLabelTTF::jsinitWithString(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCLabelTTF* self = NULL; JSGET_PTRSHELL(S_CCLabelTTF, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 5) {
|
||||
JSString *arg0;
|
||||
JSObject *arg1;
|
||||
int arg2;
|
||||
JSString *arg3;
|
||||
double arg4;
|
||||
JS_ConvertArguments(cx, 5, JS_ARGV(cx, vp), "SoiSd", &arg0, &arg1, &arg2, &arg3, &arg4);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
CCSize* narg1; JSGET_PTRSHELL(CCSize, narg1, arg1);
|
||||
char *narg3 = JS_EncodeString(cx, arg3);
|
||||
bool ret = self->initWithString(narg0, *narg1, (CCTextAlignment)arg2, narg3, arg4);
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCMenuItem::jsinit(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCMenuItem* self = NULL; JSGET_PTRSHELL(S_CCMenuItem, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
bool ret = self->initWithTarget(self, menu_selector(S_CCMenuItem::menuAction));
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCRenderTexture::jsrenderTextureWithWidthAndHeight(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 2) {
|
||||
int arg0;
|
||||
int arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "ii", &arg0, &arg1);
|
||||
CCRenderTexture* ret = CCRenderTexture::renderTextureWithWidthAndHeight(arg0, arg1);
|
||||
do {
|
||||
JSObject *tmp = JS_NewObject(cx, S_CCRenderTexture::jsClass, S_CCRenderTexture::jsObject, NULL);
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = (void *)ret;
|
||||
JS_SetPrivate(tmp, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
} while (0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCRenderTexture::jsinitWithWidthAndHeight(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCRenderTexture* self = NULL; JSGET_PTRSHELL(S_CCRenderTexture, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 2) {
|
||||
int arg0;
|
||||
int arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "ii", &arg0, &arg1);
|
||||
bool ret = self->initWithWidthAndHeight(arg0, arg1, kCCTexture2DPixelFormat_RGBA8888);
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCMenuItemLabel::jsitemWithLabel(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCRenderTexture* self = NULL; JSGET_PTRSHELL(S_CCRenderTexture, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSObject *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "o", &arg0);
|
||||
CCNode* narg0; JSGET_PTRSHELL(CCNode, narg0, arg0);
|
||||
CCMenuItemLabel *ret = CCMenuItemLabel::itemWithLabel(narg0, self, menu_selector(S_CCMenuItemLabel::menuAction));
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
do {
|
||||
JSObject *tmp = JS_NewObject(cx, S_CCMenuItemLabel::jsClass, S_CCMenuItemLabel::jsObject, NULL);
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = (void *)ret;
|
||||
JS_SetPrivate(tmp, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
} while(0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCMenuItemLabel::jsinitWithLabel(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCMenuItemLabel* self = NULL; JSGET_PTRSHELL(S_CCMenuItemLabel, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSObject *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "o", &arg0);
|
||||
CCNode* narg0; JSGET_PTRSHELL(CCNode, narg0, arg0);
|
||||
bool ret = self->initWithLabel(narg0, self, menu_selector(S_CCMenuItemLabel::menuAction));
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCApplication::jsgetCurrentLanguage(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
CCApplication* self = NULL; JSGET_PTRSHELL(CCApplication, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
jsval result; JS_NewNumberValue(cx, self->getCurrentLanguage(), &result);
|
||||
JS_SET_RVAL(cx, vp, result);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCUserDefault::jsgetStringForKey(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCUserDefault* self = NULL; JSGET_PTRSHELL(S_CCUserDefault, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSString *arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "SS", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
std::string narg1(JS_EncodeString(cx, arg1));
|
||||
std::string ret = self->getStringForKey(narg0, narg1);
|
||||
JSString *jsret = JS_NewStringCopyZ(cx, ret.c_str());
|
||||
JS_SET_RVAL(cx, vp, STRING_TO_JSVAL(jsret));
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_CCUserDefault::jssetStringForKey(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_CCUserDefault* self = NULL; JSGET_PTRSHELL(S_CCUserDefault, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSString *arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "SS", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
std::string narg1(JS_EncodeString(cx, arg1));
|
||||
self->setStringForKey(narg0, narg1);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
|
@ -0,0 +1,392 @@
|
|||
#include "cocos_denshion_generated.hpp"
|
||||
|
||||
JSClass* S_SimpleAudioEngine::jsClass = NULL;
|
||||
JSObject* S_SimpleAudioEngine::jsObject = NULL;
|
||||
|
||||
JSBool S_SimpleAudioEngine::jsConstructor(JSContext *cx, uint32_t argc, jsval *vp)
|
||||
{
|
||||
return JS_FALSE;
|
||||
};
|
||||
|
||||
void S_SimpleAudioEngine::jsFinalize(JSContext *cx, JSObject *obj)
|
||||
{
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_GetPrivate(obj);
|
||||
if (pt) {
|
||||
if (!(pt->flags & kPointerTemporary) && pt->data) delete (S_SimpleAudioEngine *)pt->data;
|
||||
JS_free(cx, pt);
|
||||
}
|
||||
}
|
||||
|
||||
JSBool S_SimpleAudioEngine::jsPropertyGet(JSContext *cx, JSObject *obj, jsid _id, jsval *val)
|
||||
{
|
||||
int32_t propId = JSID_TO_INT(_id);
|
||||
S_SimpleAudioEngine *cobj; JSGET_PTRSHELL(S_SimpleAudioEngine, cobj, obj);
|
||||
if (!cobj) return JS_FALSE;
|
||||
switch(propId) {
|
||||
case kBackgroundMusicVolume:
|
||||
do { jsval tmp; JS_NewNumberValue(cx, cobj->getBackgroundMusicVolume(), &tmp); JS_SET_RVAL(cx, val, tmp); } while (0);
|
||||
break;
|
||||
case kEffectsVolume:
|
||||
do { jsval tmp; JS_NewNumberValue(cx, cobj->getEffectsVolume(), &tmp); JS_SET_RVAL(cx, val, tmp); } while (0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
JSBool S_SimpleAudioEngine::jsPropertySet(JSContext *cx, JSObject *obj, jsid _id, JSBool strict, jsval *val)
|
||||
{
|
||||
int32_t propId = JSID_TO_INT(_id);
|
||||
S_SimpleAudioEngine *cobj; JSGET_PTRSHELL(S_SimpleAudioEngine, cobj, obj);
|
||||
if (!cobj) return JS_FALSE;
|
||||
switch(propId) {
|
||||
case kBackgroundMusicVolume:
|
||||
do { double tmp; JS_ValueToNumber(cx, *val, &tmp); cobj->setBackgroundMusicVolume(tmp); } while (0);
|
||||
break;
|
||||
case kEffectsVolume:
|
||||
do { double tmp; JS_ValueToNumber(cx, *val, &tmp); cobj->setEffectsVolume(tmp); } while (0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
void S_SimpleAudioEngine::jsCreateClass(JSContext *cx, JSObject *globalObj, const char *name)
|
||||
{
|
||||
jsClass = (JSClass *)calloc(1, sizeof(JSClass));
|
||||
jsClass->name = name;
|
||||
jsClass->addProperty = JS_PropertyStub;
|
||||
jsClass->delProperty = JS_PropertyStub;
|
||||
jsClass->getProperty = JS_PropertyStub;
|
||||
jsClass->setProperty = JS_StrictPropertyStub;
|
||||
jsClass->enumerate = JS_EnumerateStub;
|
||||
jsClass->resolve = JS_ResolveStub;
|
||||
jsClass->convert = JS_ConvertStub;
|
||||
jsClass->finalize = jsFinalize;
|
||||
jsClass->flags = JSCLASS_HAS_PRIVATE;
|
||||
static JSPropertySpec properties[] = {
|
||||
{"backgroundMusicVolume", kBackgroundMusicVolume, JSPROP_PERMANENT | JSPROP_SHARED, S_SimpleAudioEngine::jsPropertyGet, S_SimpleAudioEngine::jsPropertySet},
|
||||
{"effectsVolume", kEffectsVolume, JSPROP_PERMANENT | JSPROP_SHARED, S_SimpleAudioEngine::jsPropertyGet, S_SimpleAudioEngine::jsPropertySet},
|
||||
{0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static JSFunctionSpec funcs[] = {
|
||||
JS_FN("preloadBackgroundMusic", S_SimpleAudioEngine::jspreloadBackgroundMusic, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("playBackgroundMusic", S_SimpleAudioEngine::jsplayBackgroundMusic, 2, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("stopBackgroundMusic", S_SimpleAudioEngine::jsstopBackgroundMusic, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("pauseBackgroundMusic", S_SimpleAudioEngine::jspauseBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("resumeBackgroundMusic", S_SimpleAudioEngine::jsresumeBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("rewindBackgroundMusic", S_SimpleAudioEngine::jsrewindBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("willPlayBackgroundMusic", S_SimpleAudioEngine::jswillPlayBackgroundMusic, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("isBackgroundMusicPlaying", S_SimpleAudioEngine::jsisBackgroundMusicPlaying, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("playEffect", S_SimpleAudioEngine::jsplayEffect, 2, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("pauseEffect", S_SimpleAudioEngine::jspauseEffect, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("pauseAllEffects", S_SimpleAudioEngine::jspauseAllEffects, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("resumeEffect", S_SimpleAudioEngine::jsresumeEffect, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("resumeAllEffects", S_SimpleAudioEngine::jsresumeAllEffects, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("stopEffect", S_SimpleAudioEngine::jsstopEffect, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("stopAllEffects", S_SimpleAudioEngine::jsstopAllEffects, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("preloadEffect", S_SimpleAudioEngine::jspreloadEffect, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("unloadEffect", S_SimpleAudioEngine::jsunloadEffect, 1, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
static JSFunctionSpec st_funcs[] = {
|
||||
JS_FN("sharedEngine", S_SimpleAudioEngine::jssharedEngine, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FN("end", S_SimpleAudioEngine::jsend, 0, JSPROP_PERMANENT | JSPROP_SHARED),
|
||||
JS_FS_END
|
||||
};
|
||||
|
||||
jsObject = JS_InitClass(cx,globalObj,NULL,jsClass,S_SimpleAudioEngine::jsConstructor,0,properties,funcs,NULL,st_funcs);
|
||||
}
|
||||
|
||||
JSBool S_SimpleAudioEngine::jssharedEngine(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
SimpleAudioEngine* ret = SimpleAudioEngine::sharedEngine();
|
||||
if (ret == NULL) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
do {
|
||||
JSObject *tmp = JS_NewObject(cx, S_SimpleAudioEngine::jsClass, S_SimpleAudioEngine::jsObject, NULL);
|
||||
pointerShell_t *pt = (pointerShell_t *)JS_malloc(cx, sizeof(pointerShell_t));
|
||||
pt->flags = kPointerTemporary;
|
||||
pt->data = (void *)ret;
|
||||
JS_SetPrivate(tmp, pt);
|
||||
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
|
||||
} while (0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsend(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
SimpleAudioEngine::end();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jspreloadBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSString *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "S", &arg0);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
self->preloadBackgroundMusic(narg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsplayBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSBool arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
self->playBackgroundMusic(narg0, arg1);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsstopBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSBool arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "b", &arg0);
|
||||
self->stopBackgroundMusic(arg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jspauseBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->pauseBackgroundMusic();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsresumeBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->resumeBackgroundMusic();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsrewindBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->rewindBackgroundMusic();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jswillPlayBackgroundMusic(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
bool ret = self->willPlayBackgroundMusic();
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsisBackgroundMusicPlaying(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
bool ret = self->isBackgroundMusicPlaying();
|
||||
JS_SET_RVAL(cx, vp, BOOLEAN_TO_JSVAL(ret));
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsplayEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 2) {
|
||||
JSString *arg0;
|
||||
JSBool arg1;
|
||||
JS_ConvertArguments(cx, 2, JS_ARGV(cx, vp), "Sb", &arg0, &arg1);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
unsigned int ret = self->playEffect(narg0, arg1);
|
||||
do { jsval tmp; JS_NewNumberValue(cx, ret, &tmp); JS_SET_RVAL(cx, vp, tmp); } while (0);
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jspauseEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
unsigned int arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "i", &arg0);
|
||||
self->pauseEffect(arg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jspauseAllEffects(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->pauseAllEffects();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsresumeEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
unsigned int arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "i", &arg0);
|
||||
self->resumeEffect(arg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsresumeAllEffects(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->resumeAllEffects();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsstopEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
unsigned int arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "i", &arg0);
|
||||
self->stopEffect(arg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsstopAllEffects(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 0) {
|
||||
JS_ConvertArguments(cx, 0, JS_ARGV(cx, vp), "");
|
||||
self->stopAllEffects();
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jspreloadEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSString *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "S", &arg0);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
self->preloadEffect(narg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JSBool S_SimpleAudioEngine::jsunloadEffect(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||
JSObject* obj = (JSObject *)JS_THIS_OBJECT(cx, vp);
|
||||
S_SimpleAudioEngine* self = NULL; JSGET_PTRSHELL(S_SimpleAudioEngine, self, obj);
|
||||
if (self == NULL) return JS_FALSE;
|
||||
if (argc == 1) {
|
||||
JSString *arg0;
|
||||
JS_ConvertArguments(cx, 1, JS_ARGV(cx, vp), "S", &arg0);
|
||||
char *narg0 = JS_EncodeString(cx, arg0);
|
||||
self->unloadEffect(narg0);
|
||||
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
JS_SET_RVAL(cx, vp, JSVAL_TRUE);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue