Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss4118_physical_performance_improve

This commit is contained in:
boyu0 2014-02-27 20:04:04 +08:00
Родитель b63641c7a5 e117687a92
Коммит 8c536589df
1686 изменённых файлов: 224 добавлений и 321908 удалений

Просмотреть файл

@ -1,8 +1,6 @@
language: cpp
env:
matrix:
- GEN_COCOS_FILES=YES
- GEN_JSB=YES
- PLATFORM=linux DEBUG=1 CC_COMPILER=gcc CXX_COMPILER=g++
- PLATFORM=linux DEBUG=1 CC_COMPILER=clang CXX_COMPILER=clang++
# Since switching to C++11 only the ARM version of the nactive client

Просмотреть файл

@ -15,6 +15,7 @@ cocos2d-x-3.0rc0 Feb.?? 2014
[NEW] Language: Added Dutch support.
[NEW] Sprite: Added auto-culling support
[FIX] Renderer: Expand textureID bit from 18bits to 32bits. Resolves probably crash on Linux / Android.
[FIX] Potential crash by switching repeatly between HttpClientTest, WebSocketTest, SocketIOTest.
[FIX] Can not use Node::setPhysicsBody to reset a physics body.
[FIX] Improves physical performance.

Просмотреть файл

@ -37,8 +37,6 @@ if(WIN32 OR APPLE)
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" OFF)
option(BUILD_LIBS_JS "Build javascript libraries" OFF)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
@ -48,16 +46,12 @@ option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_TestCpp "Only build TestCpp sample" ON)
option(BUILD_TestJs "Only build TestJavascript sample" OFF)
option(BUILD_TestLua "Only build TestLua sample" OFF)
else()#temp
option(USE_CHIPMUNK "Use chipmunk for physics library" ON)
option(USE_BOX2D "Use box2d for physics library" OFF)
option(DEBUG_MODE "Debug or release?" ON)
option(BUILD_LIBS_LUA "Build lua libraries" ON)
option(BUILD_LIBS_JS "Build javascript libraries" ON)
option(BUILD_GUI "Build GUI library" ON)
option(BUILD_NETWORK "Build network library" ON)
option(BUILD_STORAGE "Build storage library" ON)
@ -67,8 +61,6 @@ option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
option(BUILD_EDITOR_COCOSBUILDER "Build editor support for cocosbuilder" ON)
option(BUILD_TestCpp "Only build TestCpp sample" ON)
option(BUILD_TestJs "Only build TestJavascript sample" ON)
option(BUILD_TestLua "Only build TestLua sample" ON)
endif()#temp
@ -165,7 +157,6 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/external/glfw3/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/include/${PLATFORM_FOLDER}
${CMAKE_CURRENT_SOURCE_DIR}/external/spidermonkey/include/${PLATFORM_FOLDER}
)
if(WIN32)
@ -215,7 +206,6 @@ else()
${CMAKE_CURRENT_SOURCE_DIR}/external/png/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/freetype2/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/websockets/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/spidermonkey/prebuilt/${PLATFORM_FOLDER}/${ARCH_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/external/${PLATFORM_FOLDER}-specific/fmod/prebuilt/${ARCH_DIR}
)
@ -283,34 +273,10 @@ if(BUILD_EDITOR_COCOSTUDIO)
add_subdirectory(cocos/editor-support/cocostudio)
endif(BUILD_EDITOR_COCOSTUDIO)
## Scripting
if(BUILD_LIBS_LUA)
# lua
add_subdirectory(external/lua/lua)
# tolua
add_subdirectory(external/lua/tolua)
# luabinding
add_subdirectory(cocos/scripting/lua)
endif(BUILD_LIBS_LUA)
if(BUILD_LIBS_JS)
# jsbinding
add_subdirectory(cocos/scripting/javascript)
endif(BUILD_LIBS_JS)
# build tests
if(BUILD_TestCpp)
add_subdirectory(tests/test-cpp)
add_subdirectory(tests)
endif(BUILD_TestCpp)
if(BUILD_TestJs)
add_subdirectory(tests/test-javascript)
endif(BUILD_TestJs)
if(BUILD_TestLua)
add_subdirectory(tests/test-lua)
endif(BUILD_TestLua)

Просмотреть файл

@ -8,8 +8,8 @@ import shutil
from optparse import OptionParser
CPP_SAMPLES = ['testcpp']
LUA_SAMPLES = ['testlua']
JSB_SAMPLES = ['testjavascript']
LUA_SAMPLES = []
JSB_SAMPLES = []
ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JSB_SAMPLES
def get_num_of_cpu():
@ -204,7 +204,7 @@ def build_samples(target,ndk_build_param,android_platform,build_mode):
app_android_root = ''
for target in build_targets:
if target == 'testcpp':
app_android_root = os.path.join(cocos_root, 'tests/test-cpp/proj.android')
app_android_root = os.path.join(cocos_root, 'tests/proj.android')
elif target == 'testlua':
app_android_root = os.path.join(cocos_root, 'tests/test-lua/proj.android')
elif target == 'testjavascript':

Просмотреть файл

@ -1,6 +1,6 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2012
# Visual Studio Express 2012 for Windows Desktop
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libAudio", "..\cocos\audio\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
@ -11,7 +11,7 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "..\external\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libExtensions", "..\extensions\proj.win32\libExtensions.vcxproj", "{21B2C324-891F-48EA-AD1A-5AE13DE12E28}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "..\tests\test-cpp\proj.win32\TestCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "..\tests\proj.win32\TestCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosBuilder", "..\cocos\editor-support\cocosbuilder\proj.win32\libCocosBuilder.vcxproj", "{811C0DAB-7B96-4BD3-A154-B7572B58E4AB}"
EndProject
@ -23,34 +23,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libNetwork", "..\cocos\netw
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBinding", "..\cocos\scripting\javascript\bindings\proj.win32\libJSBinding.vcxproj", "{39379840-825A-45A0-B363-C09FFEF864BD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "..\tests\test-javascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libLocalStorage", "..\cocos\storage\local-storage\proj.win32\libLocalStorage.vcxproj", "{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "..\cocos\scripting\lua\bindings\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "..\tests\test-lua\proj.win32\TestLua.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForBuilder", "..\cocos\scripting\javascript\bindings\cocosbuilder\libJSBindingForBuilder.vcxproj", "{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForStudio", "..\cocos\scripting\javascript\bindings\cocostudio\libJSBindingForStudio.vcxproj", "{79D34511-E54E-410A-8BBA-EF175AD6C695}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForNetwork", "..\cocos\scripting\javascript\bindings\network\libJSBindingForNetwork.vcxproj", "{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForExtension", "..\cocos\scripting\javascript\bindings\extension\libJSBindingForExtension.vcxproj", "{625F7391-9A91-48A1-8CFC-79508C822637}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libJSBinding", "libJSBinding", "{10F98A57-B9A1-47DA-9FBA-12D328E72ED1}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForChipmunk", "..\cocos\scripting\javascript\bindings\chipmunk\libJSBindingForChipmunk.vcxproj", "{21070E58-EEC6-4E16-8B4F-6D083DF55790}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForLocalStorage", "..\cocos\scripting\javascript\bindings\localstorage\libJSBindingForLocalStorage.vcxproj", "{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForGui", "..\cocos\scripting\javascript\bindings\gui\libJSBindingForGui.vcxproj", "{9A844C88-97E8-4E2D-B09A-E138C67D338B}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libJSBindingForSpine", "..\cocos\scripting\javascript\bindings\spine\libJSBindingForSpine.vcxproj", "{E78CDC6B-F37D-48D2-AD91-1DB549497E32}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
@ -65,10 +39,6 @@ Global
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32
{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}.Debug|Win32.ActiveCfg = Debug|Win32
{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
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32
@ -105,101 +75,14 @@ Global
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32
{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32
{6D37505F-A890-441D-BD3F-A61E2C0469CE}.Debug|Win32.ActiveCfg = Debug|Win32
{6D37505F-A890-441D-BD3F-A61E2C0469CE}.Debug|Win32.Build.0 = Debug|Win32
{6D37505F-A890-441D-BD3F-A61E2C0469CE}.Release|Win32.ActiveCfg = Release|Win32
{6D37505F-A890-441D-BD3F-A61E2C0469CE}.Release|Win32.Build.0 = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.ActiveCfg = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.Build.0 = Debug|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.ActiveCfg = Release|Win32
{39379840-825A-45A0-B363-C09FFEF864BD}.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
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.ActiveCfg = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Debug|Win32.Build.0 = Debug|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.ActiveCfg = Release|Win32
{632A8F38-D0F0-4D22-86B3-D69F5E6BF63A}.Release|Win32.Build.0 = Release|Win32
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Debug|Win32.ActiveCfg = Debug|Win32
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Debug|Win32.Build.0 = Debug|Win32
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Release|Win32.ActiveCfg = Release|Win32
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Release|Win32.Build.0 = Release|Win32
{9A17D9A4-4B11-4E32-94F6-895FF4909EC5}.Debug|Win32.ActiveCfg = Debug|Win32
{9A17D9A4-4B11-4E32-94F6-895FF4909EC5}.Debug|Win32.Build.0 = Debug|Win32
{9A17D9A4-4B11-4E32-94F6-895FF4909EC5}.Release|Win32.ActiveCfg = Release|Win32
{9A17D9A4-4B11-4E32-94F6-895FF4909EC5}.Release|Win32.Build.0 = Release|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Debug|Win32.ActiveCfg = Debug|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Debug|Win32.Build.0 = Debug|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Release|Win32.ActiveCfg = Release|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Release|Win32.Build.0 = Release|Win32
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Debug|Win32.ActiveCfg = Debug|Win32
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Debug|Win32.Build.0 = Debug|Win32
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Release|Win32.ActiveCfg = Release|Win32
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Release|Win32.Build.0 = Release|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.ActiveCfg = Debug|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Debug|Win32.Build.0 = Debug|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.ActiveCfg = Release|Win32
{DDC3E27F-004D-4DD4-9DD3-931A013D2159}.Release|Win32.Build.0 = Release|Win32
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.ActiveCfg = Debug|Win32
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Debug|Win32.Build.0 = Debug|Win32
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.ActiveCfg = Release|Win32
{13E55395-94A2-4CD9-BFC2-1A051F80C17D}.Release|Win32.Build.0 = Release|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.ActiveCfg = Debug|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32
{E0E282F4-8487-452C-BFAB-CB960EB4D22F}.Debug|Win32.ActiveCfg = Debug|Win32
{E0E282F4-8487-452C-BFAB-CB960EB4D22F}.Debug|Win32.Build.0 = Debug|Win32
{E0E282F4-8487-452C-BFAB-CB960EB4D22F}.Release|Win32.ActiveCfg = Release|Win32
{E0E282F4-8487-452C-BFAB-CB960EB4D22F}.Release|Win32.Build.0 = Release|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Debug|Win32.ActiveCfg = Debug|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Debug|Win32.Build.0 = Debug|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Release|Win32.ActiveCfg = Release|Win32
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}.Release|Win32.Build.0 = Release|Win32
{79D34511-E54E-410A-8BBA-EF175AD6C695}.Debug|Win32.ActiveCfg = Debug|Win32
{79D34511-E54E-410A-8BBA-EF175AD6C695}.Debug|Win32.Build.0 = Debug|Win32
{79D34511-E54E-410A-8BBA-EF175AD6C695}.Release|Win32.ActiveCfg = Release|Win32
{79D34511-E54E-410A-8BBA-EF175AD6C695}.Release|Win32.Build.0 = Release|Win32
{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}.Debug|Win32.ActiveCfg = Debug|Win32
{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}.Debug|Win32.Build.0 = Debug|Win32
{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}.Release|Win32.ActiveCfg = Release|Win32
{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}.Release|Win32.Build.0 = Release|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Debug|Win32.ActiveCfg = Debug|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Debug|Win32.Build.0 = Debug|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Release|Win32.ActiveCfg = Release|Win32
{625F7391-9A91-48A1-8CFC-79508C822637}.Release|Win32.Build.0 = Release|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Debug|Win32.ActiveCfg = Debug|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Debug|Win32.Build.0 = Debug|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Release|Win32.ActiveCfg = Release|Win32
{21070E58-EEC6-4E16-8B4F-6D083DF55790}.Release|Win32.Build.0 = Release|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Debug|Win32.ActiveCfg = Debug|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Debug|Win32.Build.0 = Debug|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Release|Win32.ActiveCfg = Release|Win32
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}.Release|Win32.Build.0 = Release|Win32
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Debug|Win32.ActiveCfg = Debug|Win32
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Debug|Win32.Build.0 = Debug|Win32
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Release|Win32.ActiveCfg = Release|Win32
{9A844C88-97E8-4E2D-B09A-E138C67D338B}.Release|Win32.Build.0 = Release|Win32
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Debug|Win32.ActiveCfg = Debug|Win32
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Debug|Win32.Build.0 = Debug|Win32
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Release|Win32.ActiveCfg = Release|Win32
{E78CDC6B-F37D-48D2-AD91-1DB549497E32}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{79D34511-E54E-410A-8BBA-EF175AD6C695} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{3BEC13F5-E227-4D80-BC77-1C857F83BCFC} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{625F7391-9A91-48A1-8CFC-79508C822637} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{39379840-825A-45A0-B363-C09FFEF864BD} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{21070E58-EEC6-4E16-8B4F-6D083DF55790} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{9A844C88-97E8-4E2D-B09A-E138C67D338B} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
{E78CDC6B-F37D-48D2-AD91-1DB549497E32} = {10F98A57-B9A1-47DA-9FBA-12D328E72ED1}
EndGlobalSection
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
EndGlobalSection

Просмотреть файл

@ -1 +1 @@
96ebe58c64783ed2e976ff504db835a397475f00
3e5af93e674100c3fcff441051ba5d9d6f3be7bb

Просмотреть файл

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A03F31E81781479B006731B9"
BuildableName = "libjsbindings Mac.a"
BlueprintName = "jsbindings Mac"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A07A4FB5178387750073F6A7"
BuildableName = "libjsbindings iOS.a"
BlueprintName = "jsbindings iOS"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A6FB50417854BC200CDF010"
BuildableName = "libluabindings Mac.a"
BlueprintName = "luabindings Mac"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A119716178526AA00D62A44"
BuildableName = "libluabindings iOS.a"
BlueprintName = "luabindings iOS"
ReferencedContainer = "container:cocos2d_libs.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1 +1 @@
2b6e0f0359921c6f1328c545b48ff94e6575e332
9da17496043155938cbd8973b01514f220e7192b

Просмотреть файл

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A035A5441782290400987F6C"
BuildableName = "Test JavaScript Mac.app"
BlueprintName = "Test JavaScript Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A035A5441782290400987F6C"
BuildableName = "Test JavaScript Mac.app"
BlueprintName = "Test JavaScript Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A035A5441782290400987F6C"
BuildableName = "Test JavaScript Mac.app"
BlueprintName = "Test JavaScript Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A035A5441782290400987F6C"
BuildableName = "Test JavaScript Mac.app"
BlueprintName = "Test JavaScript Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A01E16C01784C06E00B0CA4A"
BuildableName = "Test JavaScript iOS.app"
BlueprintName = "Test JavaScript iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A01E16C01784C06E00B0CA4A"
BuildableName = "Test JavaScript iOS.app"
BlueprintName = "Test JavaScript iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A01E16C01784C06E00B0CA4A"
BuildableName = "Test JavaScript iOS.app"
BlueprintName = "Test JavaScript iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A01E16C01784C06E00B0CA4A"
BuildableName = "Test JavaScript iOS.app"
BlueprintName = "Test JavaScript iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A6FB7821785614200CDF010"
BuildableName = "Test lua Mac.app"
BlueprintName = "Test lua Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A6FB7821785614200CDF010"
BuildableName = "Test lua Mac.app"
BlueprintName = "Test lua Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A6FB7821785614200CDF010"
BuildableName = "Test lua Mac.app"
BlueprintName = "Test lua Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A6FB7821785614200CDF010"
BuildableName = "Test lua Mac.app"
BlueprintName = "Test lua Mac"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -1,86 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0500"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A11982D178538E400D62A44"
BuildableName = "Test lua iOS.app"
BlueprintName = "Test lua iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A11982D178538E400D62A44"
BuildableName = "Test lua iOS.app"
BlueprintName = "Test lua iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A11982D178538E400D62A44"
BuildableName = "Test lua iOS.app"
BlueprintName = "Test lua iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1A11982D178538E400D62A44"
BuildableName = "Test lua iOS.app"
BlueprintName = "Test lua iOS"
ReferencedContainer = "container:cocos2d_tests.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -187,9 +187,12 @@ float Node::getSkewX() const
return _skewX;
}
void Node::setSkewX(float newSkewX)
void Node::setSkewX(float skewX)
{
_skewX = newSkewX;
if (_skewX == skewX)
return;
_skewX = skewX;
_transformDirty = _inverseDirty = true;
}
@ -198,10 +201,12 @@ float Node::getSkewY() const
return _skewY;
}
void Node::setSkewY(float newSkewY)
void Node::setSkewY(float skewY)
{
_skewY = newSkewY;
if (_skewY == skewY)
return;
_skewY = skewY;
_transformDirty = _inverseDirty = true;
}
@ -215,6 +220,9 @@ void Node::_setLocalZOrder(int z)
void Node::setLocalZOrder(int z)
{
if (_localZOrder == z)
return;
_localZOrder = z;
if (_parent)
{
@ -241,15 +249,18 @@ float Node::getRotation() const
}
/// rotation setter
void Node::setRotation(float newRotation)
void Node::setRotation(float rotation)
{
_rotationZ_X = _rotationZ_Y = newRotation;
if (_rotationZ_X == rotation)
return;
_rotationZ_X = _rotationZ_Y = rotation;
_transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody)
{
_physicsBody->setRotation(newRotation);
_physicsBody->setRotation(rotation);
}
#endif
}
@ -261,6 +272,11 @@ float Node::getRotationSkewX() const
void Node::setRotation3D(const Vertex3F& rotation)
{
if (_rotationX == rotation.x &&
_rotationY == rotation.y &&
_rotationZ_X == rotation.z)
return;
_transformDirty = _inverseDirty = true;
_rotationX = rotation.x;
@ -285,9 +301,12 @@ Vertex3F Node::getRotation3D() const
return Vertex3F(_rotationX,_rotationY,_rotationZ_X);
}
void Node::setRotationSkewX(float fRotationX)
void Node::setRotationSkewX(float rotationX)
{
_rotationZ_X = fRotationX;
if (_rotationZ_X == rotationX)
return;
_rotationZ_X = rotationX;
_transformDirty = _inverseDirty = true;
}
@ -298,6 +317,9 @@ float Node::getRotationSkewY() const
void Node::setRotationSkewY(float rotationY)
{
if (_rotationZ_Y == rotationY)
return;
_rotationZ_Y = rotationY;
_transformDirty = _inverseDirty = true;
}
@ -312,6 +334,9 @@ float Node::getScale(void) const
/// scale setter
void Node::setScale(float scale)
{
if (_scaleX == scale)
return;
_scaleX = _scaleY = scale;
_transformDirty = _inverseDirty = true;
}
@ -325,15 +350,21 @@ float Node::getScaleX() const
/// scale setter
void Node::setScale(float scaleX,float scaleY)
{
if (_scaleX == scaleX && _scaleY == scaleY)
return;
_scaleX = scaleX;
_scaleY = scaleY;
_transformDirty = _inverseDirty = true;
}
/// scaleX setter
void Node::setScaleX(float newScaleX)
void Node::setScaleX(float scaleX)
{
_scaleX = newScaleX;
if (_scaleX == scaleX)
return;
_scaleX = scaleX;
_transformDirty = _inverseDirty = true;
}
@ -344,9 +375,12 @@ float Node::getScaleY() const
}
/// scaleY setter
void Node::setScaleZ(float newScaleZ)
void Node::setScaleZ(float scaleZ)
{
_scaleZ = newScaleZ;
if (_scaleZ == scaleZ)
return;
_scaleZ = scaleZ;
_transformDirty = _inverseDirty = true;
}
@ -357,9 +391,12 @@ float Node::getScaleZ() const
}
/// scaleY setter
void Node::setScaleY(float newScaleY)
void Node::setScaleY(float scaleY)
{
_scaleY = newScaleY;
if (_scaleY == scaleY)
return;
_scaleY = scaleY;
_transformDirty = _inverseDirty = true;
}
@ -371,15 +408,18 @@ const Point& Node::getPosition() const
}
/// position setter
void Node::setPosition(const Point& newPosition)
void Node::setPosition(const Point& position)
{
_position = newPosition;
if (_position.equals(position))
return;
_position = position;
_transformDirty = _inverseDirty = true;
#if CC_USE_PHYSICS
if (_physicsBody)
{
_physicsBody->setPosition(newPosition);
_physicsBody->setPosition(position);
}
#endif
}
@ -437,6 +477,9 @@ float Node::getPositionZ() const
void Node::setPositionZ(float positionZ)
{
if (_positionZ == positionZ)
return;
_transformDirty = _inverseDirty = true;
_positionZ = positionZ;
@ -590,6 +633,7 @@ Scene* Node::getScene()
{
if(!_parent)
return nullptr;
return _parent->getScene();
}

Просмотреть файл

@ -92,13 +92,13 @@ void QuadCommand::generateMaterialID()
//
// Temporal hack (later, these 32-bits should be packed in 24-bits
//
// +---------------------+-------------------+----------------------+
// | Shader ID (10 bits) | Blend ID (4 bits) | Texture ID (18 bits) |
// +---------------------+-------------------+----------------------+
// +---------------------+-------------------+----------------------------------------+
// | Shader ID (10 bits) | Blend ID (4 bits) | empty (18bits) | Texture ID (32 bits) |
// +---------------------+-------------------+----------------------------------------+
_materialID = (uint32_t)_shader->getProgram() << 22
| (uint32_t)blendID << 18
| (uint32_t)_textureID << 0;
_materialID = (uint64_t)_shader->getProgram() << 54
| (uint64_t)blendID << 50
| (uint64_t)_textureID << 0;
}
void QuadCommand::useMaterial() const

Просмотреть файл

@ -50,7 +50,7 @@ public:
inline bool isTranslucent() const { return true; }
void generateMaterialID();
inline uint32_t getMaterialID() const { return _materialID; }
inline uint64_t getMaterialID() const { return _materialID; }
inline GLuint getTextureID() const { return _textureID; }
@ -65,7 +65,7 @@ public:
inline const kmMat4& getModelView() const { return _mv; }
protected:
uint32_t _materialID;
uint64_t _materialID;
//Maternal
GLuint _textureID;

Просмотреть файл

@ -118,7 +118,7 @@ protected:
std::stack<RenderStackElement> _renderStack;
std::vector<RenderQueue> _renderGroups;
uint32_t _lastMaterialID;
uint64_t _lastMaterialID;
std::vector<QuadCommand*> _batchedQuadCommands;

@ -1 +0,0 @@
Subproject commit 2bc68906a3abdf279e32134de85a153b4868e060

Просмотреть файл

@ -1,58 +0,0 @@
set(JSBINDING_SRC
../auto-generated/js-bindings/jsb_cocos2dx_auto.cpp
../auto-generated/js-bindings/jsb_cocos2dx_gui_auto.cpp
../auto-generated/js-bindings/jsb_cocos2dx_builder_auto.cpp
../auto-generated/js-bindings/jsb_cocos2dx_spine_auto.cpp
../auto-generated/js-bindings/jsb_cocos2dx_extension_auto.cpp
../auto-generated/js-bindings/jsb_cocos2dx_studio_auto.cpp
bindings/ScriptingCore.cpp
bindings/cocos2d_specifics.cpp
bindings/js_bindings_core.cpp
bindings/js_bindings_opengl.cpp
bindings/js_manual_conversions.cpp
bindings/jsb_opengl_functions.cpp
bindings/jsb_opengl_manual.cpp
bindings/jsb_opengl_registration.cpp
bindings/chipmunk/js_bindings_chipmunk_auto_classes.cpp
bindings/chipmunk/js_bindings_chipmunk_functions.cpp
bindings/chipmunk/js_bindings_chipmunk_manual.cpp
bindings/chipmunk/js_bindings_chipmunk_registration.cpp
bindings/cocosbuilder/js_bindings_ccbreader.cpp
bindings/cocostudio/jsb_cocos2dx_studio_manual.cpp
bindings/extension/jsb_cocos2dx_extension_manual.cpp
bindings/gui/jsb_cocos2dx_gui_manual.cpp
bindings/localstorage/js_bindings_system_functions.cpp
bindings/localstorage/js_bindings_system_registration.cpp
bindings/network/XMLHTTPRequest.cpp
bindings/network/jsb_websocket.cpp
bindings/spine/jsb_cocos2dx_spine_manual.cpp
)
include_directories(
../auto-generated/js-bindings
bindings
../../../cocos/
../../../cocos/storage
../../../cocos/editor-support/cocosbuilder
../../../cocos/editor-support/cocostudio
../../../cocos/editor-support/spine
../../../cocos/gui
../../../external/spidermonkey/include/linux/${ARCH_DIR}
)
add_library(jsbinding STATIC
${JSBINDING_SRC}
)
target_link_libraries(jsbinding
js_static
spine
)
set_target_properties(jsbinding
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
)

Просмотреть файл

@ -1,44 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocos_jsb_static
LOCAL_MODULE_FILENAME := libcocos2dxjsb
LOCAL_SRC_FILES := ScriptingCore.cpp \
cocos2d_specifics.cpp \
js_manual_conversions.cpp \
js_bindings_core.cpp \
js_bindings_opengl.cpp \
jsb_opengl_functions.cpp \
jsb_opengl_manual.cpp \
jsb_opengl_registration.cpp \
../../auto-generated/js-bindings/jsb_cocos2dx_auto.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../audio/include \
$(LOCAL_PATH)/../../../storage \
$(LOCAL_PATH)/../../auto-generated/js-bindings \
$(LOCAL_PATH)/../../../../extensions \
$(LOCAL_PATH)/../../../editor-support/spine \
$(LOCAL_PATH)/../../../editor-support
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../auto-generated/js-bindings \
$(LOCAL_PATH)/../../../audio/include
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
LOCAL_WHOLE_STATIC_LIBRARIES += spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,2d)
$(call import-module,audio/android)

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,227 +0,0 @@
//
// ScriptingCore.h
// testmonkey
//
// Created by Rolando Abarca on 3/14/12.
// Copyright (c) 2012 Zynga Inc. All rights reserved.
//
#ifndef __SCRIPTING_CORE_H__
#define __SCRIPTING_CORE_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#include "cocos2d.h"
#include "js_bindings_config.h"
#include "js_bindings_core.h"
#include "spidermonkey_specifics.h"
#include "js_manual_conversions.h"
#include <assert.h>
#include <memory>
void js_log(const char *format, ...);
typedef void (*sc_register_sth)(JSContext* cx, JSObject* global);
void registerDefaultClasses(JSContext* cx, JSObject* global);
class SimpleRunLoop : public cocos2d::Ref
{
public:
void update(float d);
};
class ScriptingCore : public cocos2d::ScriptEngineProtocol
{
JSRuntime *_rt;
JSContext *_cx;
JSObject *_global;
JSObject *_debugGlobal;
SimpleRunLoop* _runLoop;
ScriptingCore();
public:
~ScriptingCore();
static ScriptingCore *getInstance() {
static ScriptingCore* pInstance = NULL;
if (pInstance == NULL) {
pInstance = new ScriptingCore();
}
return pInstance;
};
virtual cocos2d::ccScriptType getScriptType() { return cocos2d::kScriptTypeJavascript; };
/**
@brief Remove Object from lua state
@param object to remove
*/
virtual void removeScriptObjectByObject(cocos2d::Ref* obj);
/**
@brief Execute script code contained in the given string.
@param codes holding the valid script code that should be executed.
@return 0 if the string is excuted correctly.
@return other if the string is excuted wrongly.
*/
virtual int executeString(const char* codes) { return 0; }
void pauseSchedulesAndActions(js_proxy_t* p);
void resumeSchedulesAndActions(js_proxy_t* p);
void cleanupSchedulesAndActions(js_proxy_t* p);
/**
@brief Execute a script file.
@param filename String object holding the filename of the script file that is to be executed
*/
virtual int executeScriptFile(const char* filename) { return 0; }
/**
@brief Execute a scripted global function.
@brief The function should not take any parameters and should return an integer.
@param functionName String object holding the name of the function, in the global script environment, that is to be executed.
@return The integer value returned from the script function.
*/
virtual int executeGlobalFunction(const char* functionName) { return 0; }
virtual int sendEvent(cocos2d::ScriptEvent* message) override;
virtual bool parseConfig(ConfigType type, const std::string& str) override;
virtual bool handleAssert(const char *msg) { return false; }
bool executeFunctionWithObjectData(cocos2d::Node *self, const char *name, JSObject *obj);
bool executeFunctionWithOwner(jsval owner, const char *name, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
void executeJSFunctionWithThisObj(jsval thisObj, jsval callback, uint32_t argc = 0, jsval* vp = NULL, jsval* retVal = NULL);
/**
* 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, const char *filename = NULL, JSContext* cx = NULL, JSObject* global = NULL);
/**
* will compile the specified string
* @param string The path of the script to be run
*/
void compileScript(const char *path, JSObject* global = NULL, JSContext* cx = NULL);
/**
* will run the specified string
* @param string The path of the script to be run
*/
bool runScript(const char *path, JSObject* global = NULL, JSContext* cx = NULL);
/**
* initialize everything
*/
void start();
/**
* cleanup everything
*/
void cleanup();
/**
* cleanup everything then initialize everything
*/
void reset();
/**
* will add the register_sth callback to the list of functions that need to be called
* after the creation of the context
*/
void addRegisterCallback(sc_register_sth callback);
/**
* Will create a new context. If one is already there, it will destroy the old context
* and create a new one.
*/
void createGlobalContext();
static void removeAllRoots(JSContext *cx);
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
cocos2d::Touch *pTouch, JSObject *obj, jsval &retval);
int executeCustomTouchEvent(cocos2d::EventTouch::EventCode eventType,
cocos2d::Touch *pTouch, JSObject *obj);
int executeCustomTouchesEvent(cocos2d::EventTouch::EventCode eventType,
const std::vector<cocos2d::Touch*>& touches, JSObject *obj);
/**
* @return the global context
*/
JSContext* getGlobalContext() {
return _cx;
};
/**
* @param cx
* @param message
* @param report
*/
static void reportError(JSContext *cx, const char *message, JSErrorReport *report);
/**
* Log something using CCLog
* @param cx
* @param argc
* @param vp
*/
static bool log(JSContext *cx, uint32_t argc, jsval *vp);
bool setReservedSpot(uint32_t i, JSObject *obj, jsval value);
/**
* run a script from script :)
*/
static bool executeScript(JSContext *cx, uint32_t argc, jsval *vp);
/**
* Force a cycle of GC
* @param cx
* @param argc
* @param vp
*/
static bool forceGC(JSContext *cx, uint32_t argc, jsval *vp);
static bool dumpRoot(JSContext *cx, uint32_t argc, jsval *vp);
static bool addRootJS(JSContext *cx, uint32_t argc, jsval *vp);
static bool removeRootJS(JSContext *cx, uint32_t argc, jsval *vp);
/**
* enable the debug environment
*/
void debugProcessInput(const std::string& str);
void enableDebugger();
JSObject* getDebugGlobal() { return _debugGlobal; }
JSObject* getGlobalObject() { return _global; }
private:
void string_report(jsval val);
int handleTouchesEvent(void* data);
int handleTouchEvent(void* data);
int handleNodeEvent(void* data);
int handleMenuClickedEvent(void* data);
int handleAccelerometerEvent(void* data);
int handleKeypadEvent(void* data);
};
JSObject* NewGlobalObject(JSContext* cx, bool debug = false);
bool jsb_set_reserved_slot(JSObject *obj, uint32_t idx, jsval value);
bool jsb_get_reserved_slot(JSObject *obj, uint32_t idx, jsval& ret);
js_proxy_t* jsb_new_proxy(void* nativeObj, JSObject* jsObj);
js_proxy_t* jsb_get_native_proxy(void* nativeObj);
js_proxy_t* jsb_get_js_proxy(JSObject* jsObj);
void jsb_remove_proxy(js_proxy_t* nativeProxy, js_proxy_t* jsProxy);
#endif /* __SCRIPTING_CORE_H__ */

Просмотреть файл

@ -1,33 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_chipmunk_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbchipmunk
LOCAL_SRC_FILES := js_bindings_chipmunk_manual.cpp \
js_bindings_chipmunk_functions.cpp \
js_bindings_chipmunk_auto_classes.cpp \
js_bindings_chipmunk_registration.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../..
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,extensions)
$(call import-module,chipmunk)

Просмотреть файл

@ -1 +0,0 @@
69a76886ff5f4a52af8ac6d91c439cf31fddad06

Просмотреть файл

@ -1,66 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c chipmunk_jsb.ini" on 2012-11-07
* Script version: v0.3
*/
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_CHIPMUNK
#include "js_bindings_chipmunk_manual.h"
extern JSObject *JSB_cpConstraint_object;
extern JSClass *JSB_cpConstraint_class;
void JSB_cpConstraint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpGrooveJoint_object;
extern JSClass *JSB_cpGrooveJoint_class;
void JSB_cpGrooveJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpSimpleMotor_object;
extern JSClass *JSB_cpSimpleMotor_class;
void JSB_cpSimpleMotor_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpPivotJoint_object;
extern JSClass *JSB_cpPivotJoint_class;
void JSB_cpPivotJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpPinJoint_object;
extern JSClass *JSB_cpPinJoint_class;
void JSB_cpPinJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpSlideJoint_object;
extern JSClass *JSB_cpSlideJoint_class;
void JSB_cpSlideJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpGearJoint_object;
extern JSClass *JSB_cpGearJoint_class;
void JSB_cpGearJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpDampedRotarySpring_object;
extern JSClass *JSB_cpDampedRotarySpring_class;
void JSB_cpDampedRotarySpring_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpDampedSpring_object;
extern JSClass *JSB_cpDampedSpring_class;
void JSB_cpDampedSpring_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpRatchetJoint_object;
extern JSClass *JSB_cpRatchetJoint_class;
void JSB_cpRatchetJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpRotaryLimitJoint_object;
extern JSClass *JSB_cpRotaryLimitJoint_class;
void JSB_cpRotaryLimitJoint_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpArbiter_object;
extern JSClass *JSB_cpArbiter_class;
void JSB_cpArbiter_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpSpace_object;
extern JSClass *JSB_cpSpace_class;
void JSB_cpSpace_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpBody_object;
extern JSClass *JSB_cpBody_class;
void JSB_cpBody_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpShape_object;
extern JSClass *JSB_cpShape_class;
void JSB_cpShape_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpCircleShape_object;
extern JSClass *JSB_cpCircleShape_class;
void JSB_cpCircleShape_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpSegmentShape_object;
extern JSClass *JSB_cpSegmentShape_class;
void JSB_cpSegmentShape_createClass(JSContext *cx, JSObject* globalObj, const char* name );
extern JSObject *JSB_cpPolyShape_object;
extern JSClass *JSB_cpPolyShape_class;
void JSB_cpPolyShape_createClass(JSContext *cx, JSObject* globalObj, const char* name );
#endif // JSB_INCLUDE_CHIPMUNK

Просмотреть файл

@ -1,29 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c chipmunk_jsb.ini" on 2012-11-07
* Script version: v0.3
*/
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_CHIPMUNK
JSB_cpConstraint_createClass(cx, chipmunk, "Constraint");
JSB_cpGrooveJoint_createClass(cx, chipmunk, "GrooveJoint");
JSB_cpSimpleMotor_createClass(cx, chipmunk, "SimpleMotor");
JSB_cpPivotJoint_createClass(cx, chipmunk, "PivotJoint");
JSB_cpPinJoint_createClass(cx, chipmunk, "PinJoint");
JSB_cpSlideJoint_createClass(cx, chipmunk, "SlideJoint");
JSB_cpGearJoint_createClass(cx, chipmunk, "GearJoint");
JSB_cpDampedRotarySpring_createClass(cx, chipmunk, "DampedRotarySpring");
JSB_cpDampedSpring_createClass(cx, chipmunk, "DampedSpring");
JSB_cpRatchetJoint_createClass(cx, chipmunk, "RatchetJoint");
JSB_cpRotaryLimitJoint_createClass(cx, chipmunk, "RotaryLimitJoint");
JSB_cpArbiter_createClass(cx, chipmunk, "Arbiter");
JSB_cpSpace_createClass(cx, chipmunk, "Space");
JSB_cpBody_createClass(cx, chipmunk, "Body");
JSB_cpShape_createClass(cx, chipmunk, "Shape");
JSB_cpCircleShape_createClass(cx, chipmunk, "CircleShape");
JSB_cpSegmentShape_createClass(cx, chipmunk, "SegmentShape");
JSB_cpPolyShape_createClass(cx, chipmunk, "PolyShape");
#endif // JSB_INCLUDE_CHIPMUNK

Просмотреть файл

@ -1 +0,0 @@
e4d9556ecc7430330bd9f65eef6dcb095b2b36fc

Просмотреть файл

@ -1,292 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c chipmunk_jsb.ini" on 2012-11-07
* Script version: v0.3
*/
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_CHIPMUNK
#include "js_bindings_chipmunk_manual.h"
#ifdef __cplusplus
extern "C" {
#endif
bool JSB_cpArbiterGetCount(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetDepth(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetElasticity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetFriction(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetNormal(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterIgnore(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterIsFirstContact(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterSetElasticity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterSetFriction(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterSetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterTotalImpulse(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterTotalImpulseWithFriction(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterTotalKE(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpAreaForCircle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpAreaForSegment(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBArea(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBClampVect(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBContainsBB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBContainsVect(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBExpand(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBIntersects(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBIntersectsSegment(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBMerge(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBMergedArea(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBNewForCircle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBSegmentQuery(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBBWrapVect(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyActivate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyActivateStatic(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyApplyForce(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyApplyImpulse(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyDestroy(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyFree(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetAngVel(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetForce(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetMass(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetMoment(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetPos(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetRot(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetSpace(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetTorque(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetVel(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetVelAtLocalPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetVelAtWorldPoint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetVelLimit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyInit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyInitStatic(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyIsRogue(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyIsSleeping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyIsStatic(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyKineticEnergy(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyLocal2World(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyNewStatic(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyResetForces(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetAngVel(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetAngVelLimit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetForce(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetMass(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetMoment(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetPos(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetTorque(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetVel(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetVelLimit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySleep(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySleepWithGroup(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyUpdatePosition(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyUpdateVelocity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyWorld2Local(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBoxShapeNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBoxShapeNew2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpCircleShapeGetOffset(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpCircleShapeGetRadius(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpCircleShapeNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintActivateBodies(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintDestroy(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintFree(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetA(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetErrorBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetImpulse(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetMaxBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetMaxForce(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintGetSpace(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintSetErrorBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintSetMaxBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpConstraintSetMaxForce(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringGetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringGetRestAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringGetStiffness(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringSetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringSetRestAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedRotarySpringSetStiffness(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringGetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringGetRestLength(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringGetStiffness(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringSetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringSetRestLength(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpDampedSpringSetStiffness(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGearJointGetPhase(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGearJointGetRatio(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGearJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGearJointSetPhase(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGearJointSetRatio(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointGetGrooveA(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointGetGrooveB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointSetGrooveA(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpGrooveJointSetGrooveB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpInitChipmunk(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpMomentForBox(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpMomentForBox2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpMomentForCircle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpMomentForSegment(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointGetDist(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPinJointSetDist(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointNew2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPivotJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPolyShapeGetNumVerts(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpPolyShapeGetVert(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointGetAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointGetPhase(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointGetRatchet(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointSetAngle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointSetPhase(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRatchetJointSetRatchet(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpResetShapeIdCounter(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRotaryLimitJointGetMax(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRotaryLimitJointGetMin(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRotaryLimitJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRotaryLimitJointSetMax(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRotaryLimitJointSetMin(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeGetA(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeGetB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeGetNormal(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeGetRadius(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSegmentShapeSetNeighbors(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeCacheBB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeDestroy(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeFree(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetBB(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetCollisionType(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetElasticity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetFriction(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetGroup(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetLayers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetSensor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetSpace(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeGetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapePointQuery(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetCollisionType(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetElasticity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetFriction(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetGroup(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetLayers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetSensor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeSetSurfaceVelocity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpShapeUpdate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSimpleMotorGetRate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSimpleMotorNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSimpleMotorSetRate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointGetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointGetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointGetMax(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointGetMin(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointSetAnchr1(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointSetAnchr2(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointSetMax(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSlideJointSetMin(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceActivateShapesTouchingShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceAddBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceAddConstraint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceAddShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceAddStaticShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceContainsBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceContainsConstraint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceContainsShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceDestroy(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceFree(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetCollisionBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetCurrentTimeStep(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetEnableContactGraph(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetGravity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetIterations(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceGetStaticBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceInit(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceIsLocked(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceNew(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpacePointQueryFirst(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceReindexShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceReindexShapesForBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceReindexStatic(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceRemoveBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceRemoveConstraint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceRemoveShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceRemoveStaticShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetCollisionBias(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetCollisionPersistence(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetCollisionSlop(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetDamping(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetEnableContactGraph(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetGravity(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetIdleSpeedThreshold(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetIterations(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceSetSleepTimeThreshold(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceStep(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceUseSpatialHash(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpfabs(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpfclamp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpfclamp01(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpflerp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpflerpconst(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpfmax(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpfmin(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvadd(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvclamp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvcross(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvdist(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvdistsq(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvdot(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpveql(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvforangle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvlength(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvlengthsq(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvlerp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvlerpconst(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvmult(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvnear(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvneg(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvnormalize(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvnormalize_safe(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvperp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvproject(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvrotate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvrperp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvslerp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvslerpconst(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvsub(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvtoangle(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpvunrotate(JSContext *cx, uint32_t argc, jsval *vp);
#ifdef __cplusplus
}
#endif
#endif // JSB_INCLUDE_CHIPMUNK

Просмотреть файл

@ -1,285 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c chipmunk_jsb.ini" on 2012-10-18
* Script version: v0.3
*/
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_CHIPMUNK
#include "js_bindings_chipmunk_manual.h"
JS_DefineFunction(cx, chipmunk, "arbiterGetCount", JSB_cpArbiterGetCount, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetDepth", JSB_cpArbiterGetDepth, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetElasticity", JSB_cpArbiterGetElasticity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetFriction", JSB_cpArbiterGetFriction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetNormal", JSB_cpArbiterGetNormal, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetPoint", JSB_cpArbiterGetPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetSurfaceVelocity", JSB_cpArbiterGetSurfaceVelocity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterIgnore", JSB_cpArbiterIgnore, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterIsFirstContact", JSB_cpArbiterIsFirstContact, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterSetElasticity", JSB_cpArbiterSetElasticity, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterSetFriction", JSB_cpArbiterSetFriction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterSetSurfaceVelocity", JSB_cpArbiterSetSurfaceVelocity, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterTotalImpulse", JSB_cpArbiterTotalImpulse, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterTotalImpulseWithFriction", JSB_cpArbiterTotalImpulseWithFriction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterTotalKE", JSB_cpArbiterTotalKE, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "areaForCircle", JSB_cpAreaForCircle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "areaForSegment", JSB_cpAreaForSegment, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBArea", JSB_cpBBArea, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBClampVect", JSB_cpBBClampVect, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBContainsBB", JSB_cpBBContainsBB, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBContainsVect", JSB_cpBBContainsVect, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBExpand", JSB_cpBBExpand, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBIntersects", JSB_cpBBIntersects, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBIntersectsSegment", JSB_cpBBIntersectsSegment, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBMerge", JSB_cpBBMerge, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBMergedArea", JSB_cpBBMergedArea, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBNew", JSB_cpBBNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBNewForCircle", JSB_cpBBNewForCircle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBSegmentQuery", JSB_cpBBSegmentQuery, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bBWrapVect", JSB_cpBBWrapVect, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyActivate", JSB_cpBodyActivate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyActivateStatic", JSB_cpBodyActivateStatic, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyApplyForce", JSB_cpBodyApplyForce, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyApplyImpulse", JSB_cpBodyApplyImpulse, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyDestroy", JSB_cpBodyDestroy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyFree", JSB_cpBodyFree, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetAngVel", JSB_cpBodyGetAngVel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetAngVelLimit", JSB_cpBodyGetAngVelLimit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetAngle", JSB_cpBodyGetAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetForce", JSB_cpBodyGetForce, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetMass", JSB_cpBodyGetMass, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetMoment", JSB_cpBodyGetMoment, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetPos", JSB_cpBodyGetPos, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetRot", JSB_cpBodyGetRot, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetSpace", JSB_cpBodyGetSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetTorque", JSB_cpBodyGetTorque, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetVel", JSB_cpBodyGetVel, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetVelAtLocalPoint", JSB_cpBodyGetVelAtLocalPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetVelAtWorldPoint", JSB_cpBodyGetVelAtWorldPoint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetVelLimit", JSB_cpBodyGetVelLimit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyInit", JSB_cpBodyInit, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyInitStatic", JSB_cpBodyInitStatic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyIsRogue", JSB_cpBodyIsRogue, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyIsSleeping", JSB_cpBodyIsSleeping, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyIsStatic", JSB_cpBodyIsStatic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyKineticEnergy", JSB_cpBodyKineticEnergy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyLocal2World", JSB_cpBodyLocal2World, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyNew", JSB_cpBodyNew, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyNewStatic", JSB_cpBodyNewStatic, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyResetForces", JSB_cpBodyResetForces, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetAngVel", JSB_cpBodySetAngVel, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetAngVelLimit", JSB_cpBodySetAngVelLimit, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetAngle", JSB_cpBodySetAngle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetForce", JSB_cpBodySetForce, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetMass", JSB_cpBodySetMass, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetMoment", JSB_cpBodySetMoment, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetPos", JSB_cpBodySetPos, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetTorque", JSB_cpBodySetTorque, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetVel", JSB_cpBodySetVel, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetVelLimit", JSB_cpBodySetVelLimit, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySleep", JSB_cpBodySleep, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySleepWithGroup", JSB_cpBodySleepWithGroup, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyUpdatePosition", JSB_cpBodyUpdatePosition, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyUpdateVelocity", JSB_cpBodyUpdateVelocity, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyWorld2Local", JSB_cpBodyWorld2Local, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "boxShapeNew", JSB_cpBoxShapeNew, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "boxShapeNew2", JSB_cpBoxShapeNew2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "circleShapeGetOffset", JSB_cpCircleShapeGetOffset, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "circleShapeGetRadius", JSB_cpCircleShapeGetRadius, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "circleShapeNew", JSB_cpCircleShapeNew, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintActivateBodies", JSB_cpConstraintActivateBodies, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintDestroy", JSB_cpConstraintDestroy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintFree", JSB_cpConstraintFree, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetA", JSB_cpConstraintGetA, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetB", JSB_cpConstraintGetB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetErrorBias", JSB_cpConstraintGetErrorBias, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetImpulse", JSB_cpConstraintGetImpulse, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetMaxBias", JSB_cpConstraintGetMaxBias, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetMaxForce", JSB_cpConstraintGetMaxForce, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintGetSpace", JSB_cpConstraintGetSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintSetErrorBias", JSB_cpConstraintSetErrorBias, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintSetMaxBias", JSB_cpConstraintSetMaxBias, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "constraintSetMaxForce", JSB_cpConstraintSetMaxForce, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringGetDamping", JSB_cpDampedRotarySpringGetDamping, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringGetRestAngle", JSB_cpDampedRotarySpringGetRestAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringGetStiffness", JSB_cpDampedRotarySpringGetStiffness, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringNew", JSB_cpDampedRotarySpringNew, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringSetDamping", JSB_cpDampedRotarySpringSetDamping, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringSetRestAngle", JSB_cpDampedRotarySpringSetRestAngle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedRotarySpringSetStiffness", JSB_cpDampedRotarySpringSetStiffness, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringGetAnchr1", JSB_cpDampedSpringGetAnchr1, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringGetAnchr2", JSB_cpDampedSpringGetAnchr2, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringGetDamping", JSB_cpDampedSpringGetDamping, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringGetRestLength", JSB_cpDampedSpringGetRestLength, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringGetStiffness", JSB_cpDampedSpringGetStiffness, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringNew", JSB_cpDampedSpringNew, 7, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringSetAnchr1", JSB_cpDampedSpringSetAnchr1, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringSetAnchr2", JSB_cpDampedSpringSetAnchr2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringSetDamping", JSB_cpDampedSpringSetDamping, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringSetRestLength", JSB_cpDampedSpringSetRestLength, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "dampedSpringSetStiffness", JSB_cpDampedSpringSetStiffness, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "gearJointGetPhase", JSB_cpGearJointGetPhase, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "gearJointGetRatio", JSB_cpGearJointGetRatio, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "gearJointNew", JSB_cpGearJointNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "gearJointSetPhase", JSB_cpGearJointSetPhase, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "gearJointSetRatio", JSB_cpGearJointSetRatio, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointGetAnchr2", JSB_cpGrooveJointGetAnchr2, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointGetGrooveA", JSB_cpGrooveJointGetGrooveA, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointGetGrooveB", JSB_cpGrooveJointGetGrooveB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointNew", JSB_cpGrooveJointNew, 5, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointSetAnchr2", JSB_cpGrooveJointSetAnchr2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointSetGrooveA", JSB_cpGrooveJointSetGrooveA, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "grooveJointSetGrooveB", JSB_cpGrooveJointSetGrooveB, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "initChipmunk", JSB_cpInitChipmunk, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "momentForBox", JSB_cpMomentForBox, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "momentForBox2", JSB_cpMomentForBox2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "momentForCircle", JSB_cpMomentForCircle, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "momentForSegment", JSB_cpMomentForSegment, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointGetAnchr1", JSB_cpPinJointGetAnchr1, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointGetAnchr2", JSB_cpPinJointGetAnchr2, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointGetDist", JSB_cpPinJointGetDist, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointNew", JSB_cpPinJointNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointSetAnchr1", JSB_cpPinJointSetAnchr1, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointSetAnchr2", JSB_cpPinJointSetAnchr2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pinJointSetDist", JSB_cpPinJointSetDist, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointGetAnchr1", JSB_cpPivotJointGetAnchr1, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointGetAnchr2", JSB_cpPivotJointGetAnchr2, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointNew", JSB_cpPivotJointNew, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointNew2", JSB_cpPivotJointNew2, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointSetAnchr1", JSB_cpPivotJointSetAnchr1, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "pivotJointSetAnchr2", JSB_cpPivotJointSetAnchr2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "polyShapeGetNumVerts", JSB_cpPolyShapeGetNumVerts, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "polyShapeGetVert", JSB_cpPolyShapeGetVert, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointGetAngle", JSB_cpRatchetJointGetAngle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointGetPhase", JSB_cpRatchetJointGetPhase, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointGetRatchet", JSB_cpRatchetJointGetRatchet, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointNew", JSB_cpRatchetJointNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointSetAngle", JSB_cpRatchetJointSetAngle, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointSetPhase", JSB_cpRatchetJointSetPhase, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "ratchetJointSetRatchet", JSB_cpRatchetJointSetRatchet, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "resetShapeIdCounter", JSB_cpResetShapeIdCounter, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "rotaryLimitJointGetMax", JSB_cpRotaryLimitJointGetMax, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "rotaryLimitJointGetMin", JSB_cpRotaryLimitJointGetMin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "rotaryLimitJointNew", JSB_cpRotaryLimitJointNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "rotaryLimitJointSetMax", JSB_cpRotaryLimitJointSetMax, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "rotaryLimitJointSetMin", JSB_cpRotaryLimitJointSetMin, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeGetA", JSB_cpSegmentShapeGetA, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeGetB", JSB_cpSegmentShapeGetB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeGetNormal", JSB_cpSegmentShapeGetNormal, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeGetRadius", JSB_cpSegmentShapeGetRadius, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeNew", JSB_cpSegmentShapeNew, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "segmentShapeSetNeighbors", JSB_cpSegmentShapeSetNeighbors, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeCacheBB", JSB_cpShapeCacheBB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeDestroy", JSB_cpShapeDestroy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeFree", JSB_cpShapeFree, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetBB", JSB_cpShapeGetBB, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetBody", JSB_cpShapeGetBody, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetCollisionType", JSB_cpShapeGetCollisionType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetElasticity", JSB_cpShapeGetElasticity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetFriction", JSB_cpShapeGetFriction, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetGroup", JSB_cpShapeGetGroup, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetLayers", JSB_cpShapeGetLayers, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetSensor", JSB_cpShapeGetSensor, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetSpace", JSB_cpShapeGetSpace, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeGetSurfaceVelocity", JSB_cpShapeGetSurfaceVelocity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapePointQuery", JSB_cpShapePointQuery, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetBody", JSB_cpShapeSetBody, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetCollisionType", JSB_cpShapeSetCollisionType, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetElasticity", JSB_cpShapeSetElasticity, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetFriction", JSB_cpShapeSetFriction, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetGroup", JSB_cpShapeSetGroup, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetLayers", JSB_cpShapeSetLayers, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetSensor", JSB_cpShapeSetSensor, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeSetSurfaceVelocity", JSB_cpShapeSetSurfaceVelocity, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "shapeUpdate", JSB_cpShapeUpdate, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "simpleMotorGetRate", JSB_cpSimpleMotorGetRate, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "simpleMotorNew", JSB_cpSimpleMotorNew, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "simpleMotorSetRate", JSB_cpSimpleMotorSetRate, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointGetAnchr1", JSB_cpSlideJointGetAnchr1, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointGetAnchr2", JSB_cpSlideJointGetAnchr2, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointGetMax", JSB_cpSlideJointGetMax, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointGetMin", JSB_cpSlideJointGetMin, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointNew", JSB_cpSlideJointNew, 6, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointSetAnchr1", JSB_cpSlideJointSetAnchr1, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointSetAnchr2", JSB_cpSlideJointSetAnchr2, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointSetMax", JSB_cpSlideJointSetMax, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "slideJointSetMin", JSB_cpSlideJointSetMin, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceActivateShapesTouchingShape", JSB_cpSpaceActivateShapesTouchingShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceAddBody", JSB_cpSpaceAddBody, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceAddConstraint", JSB_cpSpaceAddConstraint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceAddShape", JSB_cpSpaceAddShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceAddStaticShape", JSB_cpSpaceAddStaticShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceContainsBody", JSB_cpSpaceContainsBody, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceContainsConstraint", JSB_cpSpaceContainsConstraint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceContainsShape", JSB_cpSpaceContainsShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceDestroy", JSB_cpSpaceDestroy, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceFree", JSB_cpSpaceFree, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetCollisionBias", JSB_cpSpaceGetCollisionBias, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetCollisionPersistence", JSB_cpSpaceGetCollisionPersistence, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetCollisionSlop", JSB_cpSpaceGetCollisionSlop, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetCurrentTimeStep", JSB_cpSpaceGetCurrentTimeStep, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetDamping", JSB_cpSpaceGetDamping, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetEnableContactGraph", JSB_cpSpaceGetEnableContactGraph, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetGravity", JSB_cpSpaceGetGravity, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetIdleSpeedThreshold", JSB_cpSpaceGetIdleSpeedThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetIterations", JSB_cpSpaceGetIterations, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetSleepTimeThreshold", JSB_cpSpaceGetSleepTimeThreshold, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceGetStaticBody", JSB_cpSpaceGetStaticBody, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceInit", JSB_cpSpaceInit, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceIsLocked", JSB_cpSpaceIsLocked, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceNew", JSB_cpSpaceNew, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spacePointQueryFirst", JSB_cpSpacePointQueryFirst, 4, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceReindexShape", JSB_cpSpaceReindexShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceReindexShapesForBody", JSB_cpSpaceReindexShapesForBody, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceReindexStatic", JSB_cpSpaceReindexStatic, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceRemoveBody", JSB_cpSpaceRemoveBody, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceRemoveConstraint", JSB_cpSpaceRemoveConstraint, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceRemoveShape", JSB_cpSpaceRemoveShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceRemoveStaticShape", JSB_cpSpaceRemoveStaticShape, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetCollisionBias", JSB_cpSpaceSetCollisionBias, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetCollisionPersistence", JSB_cpSpaceSetCollisionPersistence, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetCollisionSlop", JSB_cpSpaceSetCollisionSlop, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetDamping", JSB_cpSpaceSetDamping, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetEnableContactGraph", JSB_cpSpaceSetEnableContactGraph, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetGravity", JSB_cpSpaceSetGravity, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetIdleSpeedThreshold", JSB_cpSpaceSetIdleSpeedThreshold, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetIterations", JSB_cpSpaceSetIterations, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceSetSleepTimeThreshold", JSB_cpSpaceSetSleepTimeThreshold, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceStep", JSB_cpSpaceStep, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceUseSpatialHash", JSB_cpSpaceUseSpatialHash, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "fabs", JSB_cpfabs, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "fclamp", JSB_cpfclamp, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "fclamp01", JSB_cpfclamp01, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "flerp", JSB_cpflerp, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "flerpconst", JSB_cpflerpconst, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "fmax", JSB_cpfmax, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "fmin", JSB_cpfmin, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vadd", JSB_cpvadd, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vclamp", JSB_cpvclamp, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vcross", JSB_cpvcross, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vdist", JSB_cpvdist, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vdistsq", JSB_cpvdistsq, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vdot", JSB_cpvdot, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "veql", JSB_cpveql, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vforangle", JSB_cpvforangle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vlength", JSB_cpvlength, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vlengthsq", JSB_cpvlengthsq, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vlerp", JSB_cpvlerp, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vlerpconst", JSB_cpvlerpconst, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vmult", JSB_cpvmult, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vnear", JSB_cpvnear, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vneg", JSB_cpvneg, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vnormalize", JSB_cpvnormalize, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vnormalize_safe", JSB_cpvnormalize_safe, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vperp", JSB_cpvperp, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vproject", JSB_cpvproject, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vrotate", JSB_cpvrotate, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vrperp", JSB_cpvrperp, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vslerp", JSB_cpvslerp, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vslerpconst", JSB_cpvslerpconst, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vsub", JSB_cpvsub, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vtoangle", JSB_cpvtoangle, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "vunrotate", JSB_cpvunrotate, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
#endif // JSB_INCLUDE_CHIPMUNK

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,101 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __js_bindings_chipmunk_manual
#define __js_bindings_chipmunk_manual
#include "jsapi.h"
#include "js_bindings_config.h"
#include "js_manual_conversions.h"
#include "ScriptingCore.h"
#ifdef JSB_INCLUDE_CHIPMUNK
#include "chipmunk.h"
#include "js_bindings_chipmunk_auto_classes.h"
// Free Functions
bool JSB_cpSpaceAddCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpaceRemoveCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetBodies(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiterGetShapes(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodyGetUserData(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBodySetUserData(JSContext *cx, uint32_t argc, jsval *vp);
// poly related
bool JSB_cpAreaForPoly(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpMomentForPoly(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpCentroidForPoly(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpRecenterPoly(JSContext *cx, uint32_t argc, jsval *vp);
// "Methods" from the OO API
bool JSB_cpSpace_addCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_removeCollisionHandler(JSContext *cx, uint32_t argc, jsval *vp);
// manually wrapped for rooting/unrooting purposes
bool JSB_cpSpace_addBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_addConstraint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_addShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_addStaticShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_removeBody(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_removeConstraint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_removeShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpSpace_removeStaticShape(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiter_getBodies(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpArbiter_getShapes(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBody_constructor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBody_getUserData(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_cpBody_setUserData(JSContext *cx, uint32_t argc, jsval *vp);
// convertions
jsval cpBB_to_jsval(JSContext *cx, cpBB bb );
bool jsval_to_cpBB( JSContext *cx, jsval vp, cpBB *ret );
bool jsval_to_array_of_cpvect( JSContext *cx, jsval vp, cpVect**verts, int *numVerts);
// requires cocos2d
#define cpVect_to_jsval CGPoint_to_jsval
#define jsval_to_cpVect jsval_to_CGPoint
// Object Oriented Chipmunk
void JSB_cpBase_createClass(JSContext* cx, JSObject* globalObj, const char * name );
extern JSObject* JSB_cpBase_object;
extern JSClass* JSB_cpBase_class;
extern void register_CCPhysicsSprite(JSContext *cx, JSObject *obj);
extern void register_CCPhysicsDebugNode(JSContext *cx, JSObject *obj);
// Manual constructor / destructors
bool JSB_cpPolyShape_constructor(JSContext *cx, uint32_t argc, jsval *vp);
void JSB_cpSpace_finalize(JSFreeOp *fop, JSObject *obj);
#endif // JSB_INCLUDE_CHIPMUNK
#endif // __js_bindings_chipmunk_manual

Просмотреть файл

@ -1,69 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 JSB_INCLUDE_CHIPMUNK
#define JSB_INCLUDE_CHIPMUNK
#endif
#include "js_bindings_config.h"
#include "ScriptingCore.h"
// chipmunk
#include "js_bindings_chipmunk_auto_classes.h"
#include "js_bindings_chipmunk_functions.h"
#include "js_bindings_chipmunk_manual.h"
void jsb_register_chipmunk(JSContext* cx, JSObject *object)
{
//
// Chipmunk
//
JSObject *chipmunk = JS_NewObject(cx, NULL, NULL, NULL);
JS::RootedValue chipmunkVal(cx);
chipmunkVal = OBJECT_TO_JSVAL(chipmunk);
JS_SetProperty(cx, object, "cp", chipmunkVal);
JSB_cpBase_createClass(cx, chipmunk, "Base"); // manual base class registration
#include "js_bindings_chipmunk_auto_classes_registration.h"
#include "js_bindings_chipmunk_functions_registration.h"
// manual
JS_DefineFunction(cx, chipmunk, "spaceAddCollisionHandler", JSB_cpSpaceAddCollisionHandler, 8, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "spaceRemoveCollisionHandler", JSB_cpSpaceRemoveCollisionHandler, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetBodies", JSB_cpArbiterGetBodies, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "arbiterGetShapes", JSB_cpArbiterGetShapes, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodyGetUserData", JSB_cpBodyGetUserData, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "bodySetUserData", JSB_cpBodySetUserData, 2, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "areaForPoly", JSB_cpAreaForPoly, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "momentForPoly", JSB_cpMomentForPoly, 3, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "centroidForPoly", JSB_cpCentroidForPoly, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(cx, chipmunk, "recenterPoly", JSB_cpRecenterPoly, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE );
register_CCPhysicsSprite(cx, object);
register_CCPhysicsDebugNode(cx, object);
}

Просмотреть файл

@ -1,31 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __JSB_CHIPMUNK_REGISTRATION
#define __JSB_CHIPMUNK_REGISTRATION
void jsb_register_chipmunk( JSContext *globalC, JSObject *globalO);
#endif // __JSB_CHIPMUNK_REGISTRATION

Просмотреть файл

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="js_bindings_chipmunk_auto_classes.h" />
<ClInclude Include="js_bindings_chipmunk_auto_classes_registration.h" />
<ClInclude Include="js_bindings_chipmunk_functions.h" />
<ClInclude Include="js_bindings_chipmunk_functions_registration.h" />
<ClInclude Include="js_bindings_chipmunk_manual.h" />
<ClInclude Include="js_bindings_chipmunk_registration.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="js_bindings_chipmunk_auto_classes.cpp" />
<ClCompile Include="js_bindings_chipmunk_functions.cpp" />
<ClCompile Include="js_bindings_chipmunk_manual.cpp" />
<ClCompile Include="js_bindings_chipmunk_registration.cpp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{21070E58-EEC6-4E16-8B4F-6D083DF55790}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForChipmunk</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,47 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="js_bindings_chipmunk_auto_classes_registration.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_chipmunk_functions.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_chipmunk_functions_registration.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_chipmunk_manual.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_chipmunk_registration.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_chipmunk_auto_classes.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="js_bindings_chipmunk_functions.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="js_bindings_chipmunk_manual.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="js_bindings_chipmunk_registration.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="js_bindings_chipmunk_auto_classes.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1 +0,0 @@
60e98a17932dbac3428a8901c0d798e5a1ae557f

Просмотреть файл

@ -1,243 +0,0 @@
#ifndef __JS_COCOS2D_X_SPECIFICS_H__
#define __JS_COCOS2D_X_SPECIFICS_H__
#include "ScriptingCore.h"
#include "platform/CCSAXParser.h"
class JSScheduleWrapper;
// JSScheduleWrapper* --> Array* since one js function may correspond to many targets.
// To debug this, you could refer to JSScheduleWrapper::dump function.
// It will prove that i'm right. :)
typedef struct jsScheduleFunc_proxy {
JSObject* jsfuncObj;
cocos2d::Array* targets;
UT_hash_handle hh;
} schedFunc_proxy_t;
typedef struct jsScheduleTarget_proxy {
JSObject* jsTargetObj;
cocos2d::Array* targets;
UT_hash_handle hh;
} schedTarget_proxy_t;
typedef struct jsCallFuncTarget_proxy {
void * ptr;
cocos2d::Array *obj;
UT_hash_handle hh;
} callfuncTarget_proxy_t;
extern schedFunc_proxy_t *_schedFunc_target_ht;
extern schedTarget_proxy_t *_schedObj_target_ht;
extern callfuncTarget_proxy_t *_callfuncTarget_native_ht;
/**
* You don't need to manage the returned pointer. They live for the whole life of
* the app.
*/
template <class T>
inline js_type_class_t *js_get_type_from_native(T* native_obj) {
bool found = false;
std::string typeName = typeid(*native_obj).name();
auto typeProxyIter = _js_global_type_map.find(typeName);
if (typeProxyIter == _js_global_type_map.end())
{
typeName = typeid(T).name();
typeProxyIter = _js_global_type_map.find(typeName);
if (typeProxyIter != _js_global_type_map.end())
{
found = true;
}
}
else
{
found = true;
}
return found ? typeProxyIter->second : nullptr;
}
/**
* The returned pointer should be deleted using jsb_remove_proxy. Most of the
* time you do that in the C++ destructor.
*/
template<class T>
inline js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj) {
js_proxy_t *proxy;
HASH_FIND_PTR(_native_js_global_ht, &native_obj, proxy);
if (!proxy) {
js_type_class_t *typeProxy = js_get_type_from_native<T>(native_obj);
// Return NULL if can't find its type rather than making an assert.
// assert(typeProxy);
if (!typeProxy) {
CCLOGINFO("Could not find the type of native object.");
return NULL;
}
JSObject* js_obj = JS_NewObject(cx, typeProxy->jsclass, typeProxy->proto, typeProxy->parentProto);
proxy = jsb_new_proxy(native_obj, js_obj);
#ifdef DEBUG
JS_AddNamedObjectRoot(cx, &proxy->obj, typeid(*native_obj).name());
#else
JS_AddObjectRoot(cx, &proxy->obj);
#endif
return proxy;
} else {
return proxy;
}
return NULL;
}
jsval anonEvaluate(JSContext *cx, JSObject *thisObj, const char* string);
void register_cocos2dx_js_extensions(JSContext* cx, JSObject* obj);
class JSCallbackWrapper: public cocos2d::Ref {
public:
JSCallbackWrapper();
virtual ~JSCallbackWrapper();
void setJSCallbackFunc(jsval obj);
void setJSCallbackThis(jsval thisObj);
void setJSExtraData(jsval data);
const jsval& getJSCallbackFunc() const;
const jsval& getJSCallbackThis() const;
const jsval& getJSExtraData() const;
protected:
jsval _jsCallback;
jsval _jsThisObj;
jsval _extraData;
};
class JSScheduleWrapper: public JSCallbackWrapper {
public:
JSScheduleWrapper() : _pTarget(NULL), _pPureJSTarget(NULL), _priority(0), _isUpdateSchedule(false) {}
virtual ~JSScheduleWrapper();
static void setTargetForSchedule(jsval sched, JSScheduleWrapper *target);
static cocos2d::Array * getTargetForSchedule(jsval sched);
static void setTargetForJSObject(JSObject* jsTargetObj, JSScheduleWrapper *target);
static cocos2d::Array * getTargetForJSObject(JSObject* jsTargetObj);
// Remove all targets.
static void removeAllTargets();
// Remove all targets for priority.
static void removeAllTargetsForMinPriority(int minPriority);
// Remove all targets by js object from hash table(_schedFunc_target_ht and _schedObj_target_ht).
static void removeAllTargetsForJSObject(JSObject* jsTargetObj);
// Remove the target by js object and the wrapper for native schedule.
static void removeTargetForJSObject(JSObject* jsTargetObj, JSScheduleWrapper* target);
static void dump();
void pause();
void scheduleFunc(float dt);
void update(float dt);
Ref* getTarget();
void setTarget(Ref* pTarget);
void setPureJSTarget(JSObject* jstarget);
JSObject* getPureJSTarget();
void setPriority(int priority);
int getPriority();
void setUpdateSchedule(bool isUpdateSchedule);
bool isUpdateSchedule();
protected:
Ref* _pTarget;
JSObject* _pPureJSTarget;
int _priority;
bool _isUpdateSchedule;
};
class JSTouchDelegate: public cocos2d::Ref
{
public:
JSTouchDelegate();
~JSTouchDelegate();
// Set the touch delegate to map by using the key (pJSObj).
static void setDelegateForJSObject(JSObject* pJSObj, JSTouchDelegate* pDelegate);
// Get the touch delegate by the key (pJSObj).
static JSTouchDelegate* getDelegateForJSObject(JSObject* pJSObj);
// Remove the delegate by the key (pJSObj).
static void removeDelegateForJSObject(JSObject* pJSObj);
void setJSObject(JSObject *obj);
void registerStandardDelegate(int priority);
void registerTargetedDelegate(int priority, bool swallowsTouches);
// unregister touch delegate.
// Normally, developer should invoke cc.unregisterTouchDelegate() in when the scene exits.
// So this function need to be binded.
void unregisterTouchDelegate();
bool onTouchBegan(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchMoved(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchEnded(cocos2d::Touch *touch, cocos2d::Event *event);
void onTouchCancelled(cocos2d::Touch *touch, cocos2d::Event *event);
// optional
void onTouchesBegan(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesEnded(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
void onTouchesCancelled(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event *event);
private:
JSObject* _obj;
typedef std::unordered_map<JSObject*, JSTouchDelegate*> TouchDelegateMap;
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
static TouchDelegateMap sTouchDelegateMap;
bool _needUnroot;
cocos2d::EventListenerTouchOneByOne* _touchListenerOneByOne;
cocos2d::EventListenerTouchAllAtOnce* _touchListenerAllAtOnce;
};
class CC_DLL __JSSAXDelegator: public cocos2d::SAXDelegator
{
public:
static __JSSAXDelegator* getInstance() {
static __JSSAXDelegator* pInstance = NULL;
if (pInstance == NULL) {
pInstance = new __JSSAXDelegator();
}
return pInstance;
};
~__JSSAXDelegator();
cocos2d::SAXParser* getParser();
std::string parse(const std::string& path);
bool preloadPlist(const std::string& path) {
return true;
}
std::string getList(const std::string& path) {
return path;
}
// implement pure virtual methods of SAXDelegator
void startElement(void *ctx, const char *name, const char **atts);
void endElement(void *ctx, const char *name);
void textHandler(void *ctx, const char *ch, int len);
private:
cocos2d::SAXParser _parser;
JSObject* _obj;
std::string _result;
bool _isStoringCharacters;
std::string _currentValue;
};
#endif

Просмотреть файл

@ -1,29 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_builder_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbbuilder
LOCAL_SRC_FILES := js_bindings_ccbreader.cpp \
../../../auto-generated/js-bindings/jsb_cocos2dx_builder_auto.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../editor-support/cocosbuilder
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocosbuilder_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,editor-support/cocosbuilder)

Просмотреть файл

@ -1,25 +0,0 @@
#ifndef __JS_COCOSBUILDER_SPECIFICS_H__
#define __JS_COCOSBUILDER_SPECIFICS_H__
#include "../cocos2d_specifics.hpp"
class JSCCBAnimationWrapper: public JSCallbackWrapper {
public:
JSCCBAnimationWrapper() {}
virtual ~JSCCBAnimationWrapper() {}
void animationCompleteCallback() {
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
jsval retval = JSVAL_NULL;
if(!JSVAL_IS_VOID(_jsCallback) && !JSVAL_IS_VOID(_jsThisObj)) {
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS_CallFunctionValue(cx, JSVAL_TO_OBJECT(_jsThisObj), _jsCallback, 0, NULL, &retval);
}
}
};
#endif

Просмотреть файл

@ -1,322 +0,0 @@
//
// js_bindings_ccbreader.cpp
// watermelon
//
// Created by Rohan Kuruvilla on 14/08/2012.
//
//
#include "js_bindings_ccbreader.h"
#include "ScriptingCore.h"
#include "js_bindings_config.h"
USING_NS_CC;
USING_NS_CC_EXT;
using namespace cocosbuilder;
static void removeSelector(std::string &str) {
size_t found;
found = str.find(":");
while (found!=std::string::npos){
str.replace(found, found+1, "");
found = str.find(":");
}
}
SEL_MenuHandler CCBScriptCallbackProxy::onResolveCCBCCMenuItemSelector(cocos2d::Ref * pTarget,
const char * pSelectorName) {
this->callBackProp = pSelectorName;
removeSelector(this->callBackProp);
return menu_selector(CCBScriptCallbackProxy::menuItemCallback);
}
Control::Handler CCBScriptCallbackProxy::onResolveCCBCCControlSelector(Ref * pTarget,
const char * pSelectorName) {
this->callBackProp = pSelectorName;
removeSelector(this->callBackProp);
return cccontrol_selector(CCBScriptCallbackProxy::controlCallback);
}
bool CCBScriptCallbackProxy::onAssignCCBMemberVariable(Ref * pTarget,
const char * pMemberVariableName,
Node * pNode) {
return true;
}
void CCBScriptCallbackProxy::onNodeLoaded(Node * pNode,
NodeLoader * pNodeLoader) {}
CCBSelectorResolver * CCBScriptCallbackProxy::createNew() {
CCBScriptCallbackProxy * ret = new CCBScriptCallbackProxy();
ret->setJSOwner(this->owner);
return dynamic_cast<CCBSelectorResolver *>(ret);
}
void CCBScriptCallbackProxy::menuItemCallback(Ref *pSender) {
ScriptingCore::getInstance()->executeFunctionWithOwner(owner, callBackProp.c_str() );
}
void CCBScriptCallbackProxy::controlCallback(Ref *pSender, Control::EventType event) {
ScriptingCore::getInstance()->executeFunctionWithOwner(owner, callBackProp.c_str() );
}
void CCBScriptCallbackProxy::setCallbackProperty(const char *prop) {
callBackProp = prop;
}
void CCBScriptCallbackProxy::setJSOwner(jsval ownr) {
owner = ownr;
}
jsval CCBScriptCallbackProxy::getJSOwner() {
return owner;
}
bool js_cocos2dx_CCBAnimationManager_animationCompleteCallback(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc >= 1) {
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocosbuilder::CCBAnimationManager *node = (cocosbuilder::CCBAnimationManager *)(proxy ? proxy->ptr : NULL);
JSCCBAnimationWrapper *tmpCobj = new JSCCBAnimationWrapper();
tmpCobj->autorelease();
tmpCobj->setJSCallbackThis(argv[0]);
if(argc >= 2) {
tmpCobj->setJSCallbackFunc(argv[1]);
}
node->setAnimationCompletedCallback(tmpCobj, callfunc_selector(JSCCBAnimationWrapper::animationCompleteCallback));
JS_SetReservedSlot(proxy->obj, 0, argv[0]);
JS_SetReservedSlot(proxy->obj, 1, argv[1]);
return true;
}
return false;
}
bool js_cocos2dx_CCBReader_readNodeGraphFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
bool ok = true;
JSObject *obj;
cocosbuilder::CCBReader* cobj;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, cobj)
if (argc == 2) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
cocos2d::Ref* arg1;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
proxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Ref*)(proxy ? proxy->ptr : NULL);
} while (0);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Node* ret = cobj->readNodeGraphFromFile(arg0, arg1);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Node>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Node* ret = cobj->readNodeGraphFromFile(arg0);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Node>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
if (argc == 3) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
cocos2d::Ref* arg1;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
proxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Ref*)(proxy ? proxy->ptr : NULL);
} while (0);
cocos2d::Size arg2;
ok &= jsval_to_ccsize(cx, argv[2], &arg2);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Node* ret = cobj->readNodeGraphFromFile(arg0, arg1, arg2);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Node>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
return false;
}
bool js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
bool ok = true;
JSObject *obj;
cocosbuilder::CCBReader* cobj;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cobj = (cocosbuilder::CCBReader *)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, cobj)
if (argc == 2) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
cocos2d::Ref* arg1;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
proxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Ref*)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, arg1)
} while (0);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Scene* ret = cobj->createSceneWithNodeGraphFromFile(arg0, arg1);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Scene>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
if (argc == 1) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Scene* ret = cobj->createSceneWithNodeGraphFromFile(arg0);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Scene>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
if (argc == 3) {
const char* arg0;
std::string arg0_tmp; ok &= jsval_to_std_string(cx, argv[0], &arg0_tmp); arg0 = arg0_tmp.c_str();
cocos2d::Ref* arg1;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[1]);
proxy = jsb_get_js_proxy(tmpObj);
arg1 = (cocos2d::Ref*)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, arg1)
} while (0);
cocos2d::Size arg2;
ok &= jsval_to_ccsize(cx, argv[2], &arg2);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
cocos2d::Scene* ret = cobj->createSceneWithNodeGraphFromFile(arg0, arg1, arg2);
jsval jsret; do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::Scene>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
return false;
}
bool js_CocosBuilder_create(JSContext *cx, uint32_t argc, jsval *vp)
{
NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::getInstance();
ccNodeLoaderLibrary->registerNodeLoader("", JSLayerLoader::loader());
CCBReader * ret = new CCBReader(ccNodeLoaderLibrary);
ret->autorelease();
jsval jsret;
if (ret) {
js_proxy_t *proxy = jsb_get_native_proxy(ret);
if (proxy) {
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
// create a new js obj of that class
proxy = js_get_or_create_proxy<CCBReader>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
}
} else {
jsret = JSVAL_NULL;
}
JS_SET_RVAL(cx, vp, jsret);
return true;
}
extern JSObject* jsb_cocosbuilder_CCBReader_prototype;
extern JSObject* jsb_cocosbuilder_CCBAnimationManager_prototype;
void register_CCBuilderReader(JSContext *cx, JSObject *obj) {
JS::RootedValue nsval(cx);
JS::RootedObject ns(cx);
JS_GetProperty(cx, obj, "cc", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, obj, "cc", nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
obj = ns;
JSObject *tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, obj, "(function () { return cc._Reader; })()"));
JS_DefineFunction(cx, tmpObj, "create", js_CocosBuilder_create, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, tmpObj, "loadScene", js_cocos2dx_CCBReader_createSceneWithNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocosbuilder_CCBReader_prototype, "load", js_cocos2dx_CCBReader_readNodeGraphFromFile, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocosbuilder_CCBAnimationManager_prototype, "setCompletedAnimationCallback", js_cocos2dx_CCBAnimationManager_animationCompleteCallback, 2, JSPROP_READONLY | JSPROP_PERMANENT);
}

Просмотреть файл

@ -1,59 +0,0 @@
//
// js_bindings_ccbreader.h
// watermelon
//
// Created by Rohan Kuruvilla on 14/08/2012.
//
//
#ifndef __JS_BINDINGS_CCBREADER_H__
#define __JS_BINDINGS_CCBREADER_H__
#include "cocosbuilder_specifics.hpp"
#include "cocosbuilder/CocosBuilder.h"
class CCBScriptCallbackProxy: public cocos2d::Layer
, public cocosbuilder::CCBSelectorResolver
, public cocosbuilder::CCBMemberVariableAssigner {
std::string callBackProp;
jsval owner;
public:
CCBScriptCallbackProxy () {}
virtual ~CCBScriptCallbackProxy() {}
CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(CCBScriptCallbackProxy, create);
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::Ref * pTarget,
const char * pSelectorName);
virtual cocos2d::extension::Control::Handler onResolveCCBCCControlSelector(cocos2d::Ref * pTarget,
const char * pSelectorName);
virtual bool onAssignCCBMemberVariable(cocos2d::Ref * pTarget, const char * pMemberVariableName,
cocos2d::Node * pNode);
virtual void onNodeLoaded(cocos2d::Node * pNode,
cocosbuilder::NodeLoader * pNodeLoader);
virtual CCBSelectorResolver * createNew();
void menuItemCallback(Ref *pSender);
void controlCallback(Ref *pSender, cocos2d::extension::Control::EventType event);
void setCallbackProperty(const char *prop);
void setJSOwner(jsval ownr);
jsval getJSOwner();
};
class JSLayerLoader : public cocosbuilder::LayerLoader {
public:
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(JSLayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCBScriptCallbackProxy);
};
void register_CCBuilderReader(JSContext *cx, JSObject *global);
bool js_CocosBuilder_Run(JSContext *cx, uint32_t argc, jsval *vp);
#endif /* __JS_BINDINGS_CCBREADER_H__ */

Просмотреть файл

@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto.cpp" />
<ClCompile Include="js_bindings_ccbreader.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto.hpp" />
<ClInclude Include="cocosbuilder_specifics.hpp" />
<ClInclude Include="js_bindings_ccbreader.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto_api.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F9DA0FC1-651B-457B-962E-A4D61CEBF5FD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForBuilder</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocosbuilder;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="js_bindings_ccbreader.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto.hpp">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="cocosbuilder_specifics.hpp">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_ccbreader.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_builder_auto_api.js">
<Filter>generated</Filter>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,30 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_studio_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbstudio
LOCAL_SRC_FILES := jsb_cocos2dx_studio_manual.cpp \
../../../auto-generated/js-bindings/jsb_cocos2dx_studio_auto.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../extensions \
$(LOCAL_PATH)/../../../../editor-support/cocostudio
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocostudio_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,editor-support/cocostudio)

Просмотреть файл

@ -1,277 +0,0 @@
//
// jsb_cocos2dx_studio_manual.h
//
// Created by LinWenhai on 20/10/13.
//
//
#include "jsb_cocos2dx_studio_manual.h"
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
#include "cocostudio/CocoStudio.h"
class JSArmatureWrapper: public JSCallbackWrapper {
public:
JSArmatureWrapper();
virtual ~JSArmatureWrapper();
virtual void setJSCallbackThis(jsval thisObj);
void movementCallbackFunc(cocostudio::Armature *armature, cocostudio::MovementEventType movementType, const std::string& movementID);
void frameCallbackFunc(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex);
void addArmatureFileInfoAsyncCallbackFunc(float percent);
private:
bool m_bNeedUnroot;
};
JSArmatureWrapper::JSArmatureWrapper()
: m_bNeedUnroot(false)
{
}
JSArmatureWrapper::~JSArmatureWrapper()
{
if (m_bNeedUnroot)
{
JSObject *thisObj = JSVAL_TO_OBJECT(_jsThisObj);
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &thisObj);
}
}
void JSArmatureWrapper::setJSCallbackThis(jsval _jsThisObj)
{
JSCallbackWrapper::setJSCallbackThis(_jsThisObj);
JSObject *thisObj = JSVAL_TO_OBJECT(_jsThisObj);
js_proxy *p = jsb_get_js_proxy(thisObj);
if (!p)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddObjectRoot(cx, &thisObj);
m_bNeedUnroot = true;
}
}
void JSArmatureWrapper::movementCallbackFunc(cocostudio::Armature *armature, cocostudio::MovementEventType movementType, const std::string& movementID)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject *thisObj = JSVAL_IS_VOID(_jsThisObj) ? NULL : JSVAL_TO_OBJECT(_jsThisObj);
js_proxy_t *proxy = js_get_or_create_proxy(cx, armature);
jsval retval;
if (_jsCallback != JSVAL_VOID)
{
int movementEventType = (int)movementType;
jsval movementVal = INT_TO_JSVAL(movementEventType);
jsval idVal = std_string_to_jsval(cx, movementID);
jsval valArr[3];
valArr[0] = OBJECT_TO_JSVAL(proxy->obj);
valArr[1] = movementVal;
valArr[2] = idVal;
JS_AddValueRoot(cx, valArr);
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS_CallFunctionValue(cx, thisObj, _jsCallback, 3, valArr, &retval);
JS_RemoveValueRoot(cx, valArr);
}
}
void JSArmatureWrapper::addArmatureFileInfoAsyncCallbackFunc(float percent)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject *thisObj = JSVAL_IS_VOID(_jsThisObj) ? NULL : JSVAL_TO_OBJECT(_jsThisObj);
jsval retval;
if (_jsCallback != JSVAL_VOID)
{
jsval percentVal = DOUBLE_TO_JSVAL(percent);
JS_AddValueRoot(cx, &percentVal);
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS_CallFunctionValue(cx, thisObj, _jsCallback, 1, &percentVal, &retval);
JS_RemoveValueRoot(cx, &percentVal);
}
}
void JSArmatureWrapper::frameCallbackFunc(cocostudio::Bone *bone, const std::string& evt, int originFrameIndex, int currentFrameIndex)
{
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject *thisObj = JSVAL_IS_VOID(_jsThisObj) ? NULL : JSVAL_TO_OBJECT(_jsThisObj);
js_proxy_t *proxy = js_get_or_create_proxy(cx, bone);
jsval retval;
if (_jsCallback != JSVAL_VOID)
{
jsval nameVal = std_string_to_jsval(cx, evt);
jsval originIndexVal = INT_TO_JSVAL(originFrameIndex);
jsval currentIndexVal = INT_TO_JSVAL(currentFrameIndex);
jsval valArr[4];
valArr[0] = OBJECT_TO_JSVAL(proxy->obj);
valArr[1] = nameVal;
valArr[2] = originIndexVal;
valArr[3] = currentIndexVal;
JS_AddValueRoot(cx, valArr);
JS_CallFunctionValue(cx, thisObj, _jsCallback, 4, valArr, &retval);
JS_RemoveValueRoot(cx, valArr);
}
}
static bool js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSArmatureWrapper *tmpObj = new JSArmatureWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->setMovementEventCallFunc(CC_CALLBACK_0(JSArmatureWrapper::movementCallbackFunc, tmpObj, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocostudio::ArmatureAnimation* cobj = (cocostudio::ArmatureAnimation *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSArmatureWrapper *tmpObj = new JSArmatureWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->setFrameEventCallFunc(CC_CALLBACK_0(JSArmatureWrapper::frameCallbackFunc, tmpObj, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool jsb_Animation_addArmatureFileInfoAsyncCallFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocostudio::ArmatureDataManager* cobj = (cocostudio::ArmatureDataManager *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 3) {
jsval *argv = JS_ARGV(cx, vp);
JSArmatureWrapper *tmpObj = new JSArmatureWrapper();
tmpObj->autorelease();
tmpObj->setJSCallbackFunc(argv[1]);
tmpObj->setJSCallbackThis(argv[2]);
std::string ret;
jsval_to_std_string(cx, argv[0], &ret);
cobj->addArmatureFileInfoAsync(ret.c_str(), tmpObj, schedule_selector(JSArmatureWrapper::addArmatureFileInfoAsyncCallbackFunc));
return true;
}
if(argc == 5){
jsval *argv = JS_ARGV(cx, vp);
JSArmatureWrapper *tmpObj = new JSArmatureWrapper();
tmpObj->autorelease();
tmpObj->setJSCallbackFunc(argv[3]);
tmpObj->setJSCallbackThis(argv[4]);
std::string imagePath;
jsval_to_std_string(cx ,argv[0] , &imagePath);
std::string plistPath;
jsval_to_std_string(cx ,argv[1] , &plistPath);
std::string configFilePath;
jsval_to_std_string(cx ,argv[2] , &configFilePath);
cobj->addArmatureFileInfoAsync(imagePath.c_str(), plistPath.c_str(), configFilePath.c_str(), tmpObj, schedule_selector(JSArmatureWrapper::addArmatureFileInfoAsyncCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
bool js_cocos2dx_studio_ColliderBody_getCalculatedVertexList(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocostudio::ColliderBody* cobj = (cocostudio::ColliderBody *)(proxy ? proxy->ptr : nullptr);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 0) {
const std::vector<cocos2d::Point>& ret = cobj->getCalculatedVertexList();
JS::RootedObject jsretArr(cx, JS_NewArrayObject(cx, 0, nullptr));
jsval jsret;
//CCObject* obj;
int i = 0;
for(const auto& point : ret)
{
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
if (!tmp) break;
bool ok = JS_DefineProperty(cx, tmp, "x", DOUBLE_TO_JSVAL(point.x), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
JS_DefineProperty(cx, tmp, "y", DOUBLE_TO_JSVAL(point.y), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS::RootedValue jsTmp(cx, OBJECT_TO_JSVAL(tmp));
if(!ok || !JS_SetElement(cx, jsretArr, i, &jsTmp))
{
break;
}
++i;
}
jsret = OBJECT_TO_JSVAL(jsretArr);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
extern JSObject* jsb_cocostudio_ArmatureAnimation_prototype;
extern JSObject* jsb_cocostudio_ArmatureDataManager_prototype;
extern JSObject* jsb_cocostudio_ColliderBody_prototype;
void register_all_cocos2dx_studio_manual(JSContext* cx, JSObject* global)
{
JS_DefineFunction(cx, jsb_cocostudio_ColliderBody_prototype, "getCalculatedVertexList", js_cocos2dx_studio_ColliderBody_getCalculatedVertexList, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocostudio_ArmatureAnimation_prototype, "setMovementEventCallFunc", js_cocos2dx_ArmatureAnimation_setMovementEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocostudio_ArmatureAnimation_prototype, "setFrameEventCallFunc", js_cocos2dx_ArmatureAnimation_setFrameEventCallFunc, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocostudio_ArmatureDataManager_prototype, "addArmatureFileInfoAsync", jsb_Animation_addArmatureFileInfoAsyncCallFunc, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
}

Просмотреть файл

@ -1,16 +0,0 @@
//
// jsb_cocos2dx_studio_manual.h
//
// Created by LinWenhai on 20/10/13.
//
//
#ifndef __jsb_cocos2dx_studio_manual__
#define __jsb_cocos2dx_studio_manual__
#include "jsapi.h"
#include "jsfriendapi.h"
void register_all_cocos2dx_studio_manual(JSContext* cx, JSObject* global);
#endif /* defined(__jsb_cocos2dx_studio_manual__) */

Просмотреть файл

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto.cpp" />
<ClCompile Include="jsb_cocos2dx_studio_manual.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto.hpp" />
<ClInclude Include="jsb_cocos2dx_studio_manual.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto_api.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{79D34511-E54E-410A-8BBA-EF175AD6C695}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForStudio</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="jsb_cocos2dx_studio_manual.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto.hpp">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="jsb_cocos2dx_studio_manual.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_studio_auto_api.js">
<Filter>generated</Filter>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,30 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_extension_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbextension
LOCAL_SRC_FILES := jsb_cocos2dx_extension_manual.cpp \
../../../auto-generated/js-bindings/jsb_cocos2dx_extension_auto.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../extensions
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_extension_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,extensions)

Просмотреть файл

@ -1,800 +0,0 @@
//
// jsb_cocos2d_extension_manual.cpp
//
// Created by James Chen on 3/11/13.
//
//
#include "jsb_cocos2dx_extension_manual.h"
#include "extensions/cocos-ext.h"
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
USING_NS_CC;
USING_NS_CC_EXT;
class JSB_ScrollViewDelegate
: public Ref
, public ScrollViewDelegate
{
public:
JSB_ScrollViewDelegate()
: _JSDelegate(NULL)
, _needUnroot(false)
{}
virtual ~JSB_ScrollViewDelegate()
{
if (_needUnroot)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &_JSDelegate);
}
}
virtual void scrollViewDidScroll(ScrollView* view) override
{
js_proxy_t * p = jsb_get_native_proxy(view);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "scrollViewDidScroll", 1, &arg, NULL);
}
virtual void scrollViewDidZoom(ScrollView* view) override
{
js_proxy_t * p = jsb_get_native_proxy(view);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "scrollViewDidZoom", 1, &arg, NULL);
}
void setJSDelegate(JSObject* pJSDelegate)
{
_JSDelegate = pJSDelegate;
// Check whether the js delegate is a pure js object.
js_proxy_t* p = jsb_get_js_proxy(_JSDelegate);
if (!p)
{
_needUnroot = true;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_JSDelegate, "TableViewDelegate");
}
}
private:
JSObject* _JSDelegate;
bool _needUnroot;
};
static bool js_cocos2dx_CCScrollView_setDelegate(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::ScrollView* cobj = (cocos2d::extension::ScrollView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 1)
{
// save the delegate
JSObject *jsDelegate = JSVAL_TO_OBJECT(argv[0]);
JSB_ScrollViewDelegate* nativeDelegate = new JSB_ScrollViewDelegate();
nativeDelegate->setJSDelegate(jsDelegate);
cobj->setUserObject(nativeDelegate);
cobj->setDelegate(nativeDelegate);
nativeDelegate->release();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
#define KEY_TABLEVIEW_DATA_SOURCE "TableViewDataSource"
#define KEY_TABLEVIEW_DELEGATE "TableViewDelegate"
class JSB_TableViewDelegate
: public Ref
, public TableViewDelegate
{
public:
JSB_TableViewDelegate()
: _JSDelegate(NULL)
, _needUnroot(false)
{}
virtual ~JSB_TableViewDelegate()
{
if (_needUnroot)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &_JSDelegate);
}
}
virtual void scrollViewDidScroll(ScrollView* view) override
{
callJSDelegate(view, "scrollViewDidScroll");
}
virtual void scrollViewDidZoom(ScrollView* view) override
{
callJSDelegate(view, "scrollViewDidZoom");
}
virtual void tableCellTouched(TableView* table, TableViewCell* cell) override
{
callJSDelegate(table, cell, "tableCellTouched");
}
virtual void tableCellHighlight(TableView* table, TableViewCell* cell) override
{
callJSDelegate(table, cell, "tableCellHighlight");
}
virtual void tableCellUnhighlight(TableView* table, TableViewCell* cell) override
{
callJSDelegate(table, cell, "tableCellUnhighlight");
}
virtual void tableCellWillRecycle(TableView* table, TableViewCell* cell) override
{
callJSDelegate(table, cell, "tableCellWillRecycle");
}
void setJSDelegate(JSObject* pJSDelegate)
{
_JSDelegate = pJSDelegate;
// Check whether the js delegate is a pure js object.
js_proxy_t* p = jsb_get_js_proxy(_JSDelegate);
if (!p)
{
_needUnroot = true;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_JSDelegate, "TableViewDelegate");
}
}
private:
void callJSDelegate(ScrollView* view, std::string jsFunctionName)
{
js_proxy_t * p = jsb_get_native_proxy(view);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), jsFunctionName.c_str(), 1, &arg, NULL);
}
void callJSDelegate(TableView* table, TableViewCell* cell, std::string jsFunctionName)
{
js_proxy_t * p = jsb_get_native_proxy(table);
if (!p) return;
js_proxy_t * pCellProxy = jsb_get_native_proxy(cell);
if (!pCellProxy) return;
jsval args[2];
args[0] = OBJECT_TO_JSVAL(p->obj);
args[1] = OBJECT_TO_JSVAL(pCellProxy->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), jsFunctionName.c_str(), 2, args, NULL);
}
JSObject* _JSDelegate;
bool _needUnroot;
};
static bool js_cocos2dx_CCTableView_setDelegate(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 1)
{
// save the delegate
JSObject *jsDelegate = JSVAL_TO_OBJECT(argv[0]);
JSB_TableViewDelegate* nativeDelegate = new JSB_TableViewDelegate();
nativeDelegate->setJSDelegate(jsDelegate);
Dictionary* userDict = static_cast<Dictionary*>(cobj->getUserObject());
if (NULL == userDict)
{
userDict = new Dictionary();
cobj->setUserObject(userDict);
userDict->release();
}
userDict->setObject(nativeDelegate, KEY_TABLEVIEW_DELEGATE);
cobj->setDelegate(nativeDelegate);
nativeDelegate->release();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
class JSB_TableViewDataSource
: public Ref
, public TableViewDataSource
{
public:
JSB_TableViewDataSource()
: _JSTableViewDataSource(NULL)
, _needUnroot(false)
{}
virtual ~JSB_TableViewDataSource()
{
if (_needUnroot)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &_JSTableViewDataSource);
}
}
virtual Size tableCellSizeForIndex(TableView *table, ssize_t idx) override
{
jsval ret;
bool ok = callJSDelegate(table, idx, "tableCellSizeForIndex", ret);
if (!ok)
{
ok = callJSDelegate(table, "cellSizeForTable", ret);
}
if (ok)
{
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
Size size;
bool isSucceed = jsval_to_ccsize(cx, ret, &size);
if (isSucceed) return size;
}
return Size::ZERO;
}
virtual TableViewCell* tableCellAtIndex(TableView *table, ssize_t idx) override
{
jsval ret;
bool ok = callJSDelegate(table, idx, "tableCellAtIndex", ret);
if (ok)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
cocos2d::extension::TableViewCell* arg0;
do {
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(ret);
proxy = jsb_get_js_proxy(tmpObj);
arg0 = (cocos2d::extension::TableViewCell*)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( arg0, cx, NULL, "Invalid Native Object");
} while (0);
return arg0;
}
return NULL;
}
virtual ssize_t numberOfCellsInTableView(TableView *table) override
{
jsval ret;
bool ok = callJSDelegate(table, "numberOfCellsInTableView", ret);
if (ok)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
ssize_t count = 0;
bool isSucceed = jsval_to_ssize(cx, ret, &count);
if (isSucceed) return count;
}
return 0;
}
void setTableViewDataSource(JSObject* pJSSource)
{
_JSTableViewDataSource = pJSSource;
// Check whether the js delegate is a pure js object.
js_proxy_t* p = jsb_get_js_proxy(_JSTableViewDataSource);
if (!p)
{
_needUnroot = true;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_JSTableViewDataSource, "TableViewDataSource");
}
}
private:
bool callJSDelegate(TableView* table, std::string jsFunctionName, jsval& retVal)
{
js_proxy_t * p = jsb_get_native_proxy(table);
if (!p) return false;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
bool hasAction;
JS::RootedValue temp_retval(cx);
jsval dataVal = OBJECT_TO_JSVAL(p->obj);
JSObject* obj = _JSTableViewDataSource;
JSAutoCompartment ac(cx, obj);
if (JS_HasProperty(cx, obj, jsFunctionName.c_str(), &hasAction) && hasAction)
{
if(!JS_GetProperty(cx, obj, jsFunctionName.c_str(), &temp_retval))
{
return false;
}
if(temp_retval == JSVAL_VOID)
{
return false;
}
JS_CallFunctionName(cx, obj, jsFunctionName.c_str(),
1, &dataVal, &retVal);
return true;
}
return false;
}
bool callJSDelegate(TableView* table, ssize_t idx, std::string jsFunctionName, jsval& retVal)
{
js_proxy_t * p = jsb_get_native_proxy(table);
if (!p) return false;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
bool hasAction;
JS::RootedValue temp_retval(cx);
jsval dataVal[2];
dataVal[0] = OBJECT_TO_JSVAL(p->obj);
dataVal[1] = ssize_to_jsval(cx,idx);
JSObject* obj = _JSTableViewDataSource;
JSAutoCompartment ac(cx, obj);
if (JS_HasProperty(cx, obj, jsFunctionName.c_str(), &hasAction) && hasAction)
{
if(!JS_GetProperty(cx, obj, jsFunctionName.c_str(), &temp_retval))
{
return false;
}
if(temp_retval == JSVAL_VOID)
{
return false;
}
bool ret = JS_CallFunctionName(cx, obj, jsFunctionName.c_str(),
2, dataVal, &retVal);
return ret == true ? true : false;
}
return false;
}
private:
JSObject* _JSTableViewDataSource;
bool _needUnroot;
};
static bool js_cocos2dx_CCTableView_setDataSource(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::TableView* cobj = (cocos2d::extension::TableView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 1)
{
JSB_TableViewDataSource* pNativeSource = new JSB_TableViewDataSource();
pNativeSource->setTableViewDataSource(JSVAL_TO_OBJECT(argv[0]));
Dictionary* userDict = static_cast<Dictionary*>(cobj->getUserObject());
if (NULL == userDict)
{
userDict = new Dictionary();
cobj->setUserObject(userDict);
userDict->release();
}
userDict->setObject(pNativeSource, KEY_TABLEVIEW_DATA_SOURCE);
cobj->setDataSource(pNativeSource);
pNativeSource->release();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments");
return false;
}
static bool js_cocos2dx_CCTableView_create(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
bool ok = true;
if (argc == 3 || argc == 2)
{
JSB_TableViewDataSource* pNativeSource = new JSB_TableViewDataSource();
pNativeSource->setTableViewDataSource(JSVAL_TO_OBJECT(argv[0]));
cocos2d::Size arg1;
ok &= jsval_to_ccsize(cx, argv[1], &arg1);
cocos2d::extension::TableView* ret = NULL;
ret = new TableView();
ret->autorelease();
ret->setDataSource(pNativeSource);
jsval jsret;
do {
if (ret)
{
js_proxy_t *proxy = js_get_or_create_proxy<cocos2d::extension::TableView>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
}
else
{
jsret = JSVAL_NULL;
}
} while (0);
if (argc == 2)
{
ret->initWithViewSize(arg1);
}
else
{
cocos2d::Node* arg2;
do
{
js_proxy_t *proxy;
JSObject *tmpObj = JSVAL_TO_OBJECT(argv[2]);
proxy = jsb_get_js_proxy(tmpObj);
arg2 = (cocos2d::Node*)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( arg2, cx, false, "Invalid Native Object");
} while (0);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
ret->initWithViewSize(arg1, arg2);
}
ret->reloadData();
Dictionary* userDict = new Dictionary();
userDict->setObject(pNativeSource, KEY_TABLEVIEW_DATA_SOURCE);
ret->setUserObject(userDict);
userDict->release();
pNativeSource->release();
JS_SET_RVAL(cx, vp, jsret);
return true;
}
JS_ReportError(cx, "wrong number of arguments");
return false;
}
class JSB_EditBoxDelegate
: public Ref
, public EditBoxDelegate
{
public:
JSB_EditBoxDelegate()
: _JSDelegate(NULL)
, _needUnroot(false)
{}
virtual ~JSB_EditBoxDelegate()
{
if (_needUnroot)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &_JSDelegate);
}
}
virtual void editBoxEditingDidBegin(EditBox* editBox) override
{
js_proxy_t * p = jsb_get_native_proxy(editBox);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "editBoxEditingDidBegin", 1, &arg, NULL);
}
virtual void editBoxEditingDidEnd(EditBox* editBox) override
{
js_proxy_t * p = jsb_get_native_proxy(editBox);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "editBoxEditingDidEnd", 1, &arg, NULL);
}
virtual void editBoxTextChanged(EditBox* editBox, const std::string& text) override
{
js_proxy_t * p = jsb_get_native_proxy(editBox);
if (!p) return;
jsval dataVal[2];
dataVal[0] = OBJECT_TO_JSVAL(p->obj);
std::string arg1 = text;
dataVal[1] = std_string_to_jsval(ScriptingCore::getInstance()->getGlobalContext(), arg1);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "editBoxTextChanged", 2, dataVal, NULL);
}
virtual void editBoxReturn(EditBox* editBox) override
{
js_proxy_t * p = jsb_get_native_proxy(editBox);
if (!p) return;
jsval arg = OBJECT_TO_JSVAL(p->obj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "editBoxReturn", 1, &arg, NULL);
}
void setJSDelegate(JSObject* pJSDelegate)
{
_JSDelegate = pJSDelegate;
// Check whether the js delegate is a pure js object.
js_proxy_t* p = jsb_get_js_proxy(_JSDelegate);
if (!p)
{
_needUnroot = true;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_JSDelegate, "TableViewDelegate");
}
}
private:
JSObject* _JSDelegate;
bool _needUnroot;
};
static bool js_cocos2dx_CCEditBox_setDelegate(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::EditBox* cobj = (cocos2d::extension::EditBox *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 1)
{
// save the delegate
JSObject *jsDelegate = JSVAL_TO_OBJECT(argv[0]);
JSB_EditBoxDelegate* nativeDelegate = new JSB_EditBoxDelegate();
nativeDelegate->setJSDelegate(jsDelegate);
cobj->setUserObject(nativeDelegate);
cobj->setDelegate(nativeDelegate);
nativeDelegate->release();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 1);
return false;
}
class JSB_ControlButtonTarget : public Ref
{
public:
JSB_ControlButtonTarget()
: _jsFunc(nullptr),
_type(Control::EventType::TOUCH_DOWN),
_jsTarget(nullptr),
_needUnroot(false)
{}
virtual ~JSB_ControlButtonTarget()
{
CCLOGINFO("In the destruction of JSB_ControlButtonTarget ...");
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
if (_needUnroot)
{
JS_RemoveObjectRoot(cx, &_jsTarget);
}
JS_RemoveObjectRoot(cx, &_jsFunc);
for (auto iter = _jsNativeTargetMap.begin(); iter != _jsNativeTargetMap.end(); ++iter)
{
if (this == iter->second)
{
_jsNativeTargetMap.erase(iter);
break;
}
}
}
virtual void onEvent(Ref *controlButton, Control::EventType event)
{
js_proxy_t * p;
JS_GET_PROXY(p, controlButton);
if (!p)
{
log("Failed to get proxy for control button");
return;
}
jsval dataVal[2];
dataVal[0] = OBJECT_TO_JSVAL(p->obj);
int arg1 = (int)event;
dataVal[1] = INT_TO_JSVAL(arg1);
jsval jsRet;
ScriptingCore::getInstance()->executeJSFunctionWithThisObj(OBJECT_TO_JSVAL(_jsTarget), OBJECT_TO_JSVAL(_jsFunc), 2, dataVal, &jsRet);
}
void setJSTarget(JSObject* pJSTarget)
{
_jsTarget = pJSTarget;
js_proxy_t* p = jsb_get_js_proxy(_jsTarget);
if (!p)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_jsTarget, "JSB_ControlButtonTarget, target");
_needUnroot = true;
}
}
void setJSAction(JSObject* jsFunc)
{
_jsFunc = jsFunc;
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddNamedObjectRoot(cx, &_jsFunc, "JSB_ControlButtonTarget, func");
}
void setEventType(Control::EventType type)
{
_type = type;
}
public:
static std::multimap<JSObject*, JSB_ControlButtonTarget*> _jsNativeTargetMap;
JSObject* _jsFunc;
Control::EventType _type;
private:
JSObject* _jsTarget;
bool _needUnroot;
};
std::multimap<JSObject*, JSB_ControlButtonTarget*> JSB_ControlButtonTarget::_jsNativeTargetMap;
static bool js_cocos2dx_CCControl_addTargetWithActionForControlEvents(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::Control* cobj = (cocos2d::extension::Control *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
bool ok = true;
if (argc == 3)
{
JSObject* jsDelegate = JSVAL_TO_OBJECT(argv[0]);
JSObject* jsFunc = JSVAL_TO_OBJECT(argv[1]);
Control::EventType arg2;
ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
JSB_PRECONDITION2(ok, cx, false, "Error processing control event");
// Check whether the target already exists.
auto range = JSB_ControlButtonTarget::_jsNativeTargetMap.equal_range(jsDelegate);
for (auto it = range.first; it != range.second; ++it)
{
if (it->second->_jsFunc == jsFunc && arg2 == it->second->_type)
{
// Return true directly.
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
}
// save the delegate
JSB_ControlButtonTarget* nativeDelegate = new JSB_ControlButtonTarget();
nativeDelegate->setJSTarget(jsDelegate);
nativeDelegate->setJSAction(jsFunc);
nativeDelegate->setEventType(arg2);
Array* nativeDelegateArray = static_cast<Array*>(cobj->getUserObject());
if (nullptr == nativeDelegateArray)
{
nativeDelegateArray = new Array();
nativeDelegateArray->init();
cobj->setUserObject(nativeDelegateArray); // The reference of nativeDelegateArray is added to 2
nativeDelegateArray->release(); // Release nativeDelegateArray to make the reference to 1
}
nativeDelegateArray->addObject(nativeDelegate); // The reference of nativeDelegate is added to 2
nativeDelegate->release(); // Release nativeDelegate to make the reference to 1
cobj->addTargetWithActionForControlEvents(nativeDelegate, cccontrol_selector(JSB_ControlButtonTarget::onEvent), arg2);
JSB_ControlButtonTarget::_jsNativeTargetMap.insert(std::make_pair(jsDelegate, nativeDelegate));
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
static bool js_cocos2dx_CCControl_removeTargetWithActionForControlEvents(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
cocos2d::extension::Control* cobj = (cocos2d::extension::Control *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
bool ok = true;
if (argc == 3)
{
Control::EventType arg2;
ok &= jsval_to_int32(cx, argv[2], (int32_t *)&arg2);
JSB_PRECONDITION2(ok, cx, false, "Error processing control event");
obj = JSVAL_TO_OBJECT(argv[0]);
JSObject* jsFunc = JSVAL_TO_OBJECT(argv[1]);
JSB_ControlButtonTarget* nativeTargetToRemoved = nullptr;
auto range = JSB_ControlButtonTarget::_jsNativeTargetMap.equal_range(obj);
for (auto it = range.first; it != range.second; ++it)
{
if (it->second->_jsFunc == jsFunc && arg2 == it->second->_type)
{
nativeTargetToRemoved = it->second;
JSB_ControlButtonTarget::_jsNativeTargetMap.erase(it);
break;
}
}
cobj->removeTargetWithActionForControlEvents(nativeTargetToRemoved, cccontrol_selector(JSB_ControlButtonTarget::onEvent), arg2);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
extern JSObject* jsb_cocos2d_extension_ScrollView_prototype;
extern JSObject* jsb_cocos2d_extension_TableView_prototype;
extern JSObject* jsb_cocos2d_extension_EditBox_prototype;
extern JSObject* jsb_cocos2d_extension_Control_prototype;
void register_all_cocos2dx_extension_manual(JSContext* cx, JSObject* global)
{
JS_DefineFunction(cx, jsb_cocos2d_extension_ScrollView_prototype, "setDelegate", js_cocos2dx_CCScrollView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_extension_TableView_prototype, "setDelegate", js_cocos2dx_CCTableView_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_extension_TableView_prototype, "setDataSource", js_cocos2dx_CCTableView_setDataSource, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_extension_EditBox_prototype, "setDelegate", js_cocos2dx_CCEditBox_setDelegate, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_extension_Control_prototype, "addTargetWithActionForControlEvents", js_cocos2dx_CCControl_addTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_extension_Control_prototype, "removeTargetWithActionForControlEvents", js_cocos2dx_CCControl_removeTargetWithActionForControlEvents, 3, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JSObject *tmpObj = JSVAL_TO_OBJECT(anonEvaluate(cx, global, "(function () { return cc.TableView; })()"));
JS_DefineFunction(cx, tmpObj, "create", js_cocos2dx_CCTableView_create, 3, JSPROP_READONLY | JSPROP_PERMANENT);
}

Просмотреть файл

@ -1,16 +0,0 @@
//
// jsb_cocos2d_extension_manual.h
//
// Created by James Chen on 3/11/13.
//
//
#ifndef __jsb_cocos2dx_extension_manual__
#define __jsb_cocos2dx_extension_manual__
#include "jsapi.h"
#include "jsfriendapi.h"
void register_all_cocos2dx_extension_manual(JSContext* cx, JSObject* global);
#endif /* defined(__jsb_cocos2dx_extension_manual__) */

Просмотреть файл

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto.cpp" />
<ClCompile Include="jsb_cocos2dx_extension_manual.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto.hpp" />
<ClInclude Include="jsb_cocos2dx_extension_manual.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto_api.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{625F7391-9A91-48A1-8CFC-79508C822637}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForExtension</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\network;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\network;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="jsb_cocos2dx_extension_manual.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto.hpp">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="jsb_cocos2dx_extension_manual.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_extension_auto_api.js">
<Filter>generated</Filter>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,30 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_gui_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbgui
LOCAL_SRC_FILES := jsb_cocos2dx_gui_manual.cpp \
../../../auto-generated/js-bindings/jsb_cocos2dx_gui_auto.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../extensions \
$(LOCAL_PATH)/../../../../gui
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_gui_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,gui)

Просмотреть файл

@ -1,319 +0,0 @@
//
// jsb_cocos2dx_ui_manual.h
//
// Created by LinWenhai on 17/11/13.
//
//
#include "jsb_cocos2dx_gui_manual.h"
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
#include "gui/CocosGUI.h"
using namespace cocos2d;
using namespace cocos2d::ui;
class JSStudioEventListenerWrapper: public JSCallbackWrapper {
public:
JSStudioEventListenerWrapper();
virtual ~JSStudioEventListenerWrapper();
virtual void setJSCallbackThis(jsval thisObj);
virtual void eventCallbackFunc(Ref*,int);
private:
bool m_bNeedUnroot;
};
JSStudioEventListenerWrapper::JSStudioEventListenerWrapper()
: m_bNeedUnroot(false)
{
}
JSStudioEventListenerWrapper::~JSStudioEventListenerWrapper()
{
if (m_bNeedUnroot)
{
JSObject *thisObj = JSVAL_TO_OBJECT(_jsThisObj);
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS_RemoveObjectRoot(cx, &thisObj);
}
}
void JSStudioEventListenerWrapper::setJSCallbackThis(jsval jsThisObj)
{
JSCallbackWrapper::setJSCallbackThis(jsThisObj);
JSObject *thisObj = JSVAL_TO_OBJECT(jsThisObj);
js_proxy *p = jsb_get_js_proxy(thisObj);
if (!p)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JS_AddObjectRoot(cx, &thisObj);
m_bNeedUnroot = true;
}
}
void JSStudioEventListenerWrapper::eventCallbackFunc(Ref* sender,int eventType)
{
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject *thisObj = JSVAL_IS_VOID(_jsThisObj) ? NULL : JSVAL_TO_OBJECT(_jsThisObj);
js_proxy_t *proxy = js_get_or_create_proxy(cx, sender);
jsval retval;
if (_jsCallback != JSVAL_VOID)
{
jsval touchVal = INT_TO_JSVAL(eventType);
jsval valArr[2];
valArr[0] = OBJECT_TO_JSVAL(proxy->obj);
valArr[1] = touchVal;
JS_AddValueRoot(cx, valArr);
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS_CallFunctionValue(cx, thisObj, _jsCallback, 2, valArr, &retval);
JS_RemoveValueRoot(cx, valArr);
}
}
static bool js_cocos2dx_UIWidget_addTouchEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::Widget* cobj = (ui::Widget *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addTouchEventListener(tmpObj, toucheventselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_UICheckBox_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::CheckBox* cobj = (ui::CheckBox *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addEventListenerCheckBox(tmpObj, checkboxselectedeventselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_UISlider_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::Slider* cobj = (ui::Slider *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addEventListenerSlider(tmpObj, sliderpercentchangedselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_UITextField_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::TextField* cobj = (ui::TextField *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addEventListenerTextField(tmpObj, textfieldeventselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_UIPageView_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::PageView* cobj = (ui::PageView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addEventListenerPageView(tmpObj, pagevieweventselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_UIListView_addEventListener(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::ListView* cobj = (ui::ListView *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 2) {
jsval *argv = JS_ARGV(cx, vp);
JSStudioEventListenerWrapper *tmpObj = new JSStudioEventListenerWrapper();
cobj->setUserObject(tmpObj);
tmpObj->release();
tmpObj->setJSCallbackFunc(argv[0]);
tmpObj->setJSCallbackThis(argv[1]);
cobj->addEventListenerListView(tmpObj, listvieweventselector(JSStudioEventListenerWrapper::eventCallbackFunc));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_LayoutParameter_setMargin(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::LayoutParameter* cobj = (ui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 1) {
JS::CallArgs argv = CallArgsFromVp(argc, vp);
JS::RootedObject tmp(cx);
JS::RootedValue jsleft(cx), jstop(cx),jsright(cx),jsbottom(cx);
double left, top,right,bottom;
bool ok = argv[0].isObject() &&
JS_ValueToObject(cx, argv[0], &tmp) &&
JS_GetProperty(cx, tmp, "left", &jsleft) &&
JS_GetProperty(cx, tmp, "top", &jstop) &&
JS_GetProperty(cx, tmp, "right", &jsright) &&
JS_GetProperty(cx, tmp, "bottom", &jsbottom);
left = jsleft.toNumber();
top = jstop.toNumber();
right = jsright.toNumber();
bottom = jsbottom.toNumber();
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
cobj->setMargin(ui::Margin(left,top,right,bottom));
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
static bool js_cocos2dx_LayoutParameter_getMargin(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
ui::LayoutParameter* cobj = (ui::LayoutParameter *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (argc == 0) {
JSObject *tmp = JS_NewObject(cx, NULL, NULL, NULL);
if (!tmp) return false;
ui::Margin margin = cobj->getMargin();
bool ok = JS_DefineProperty(cx, tmp, "left", DOUBLE_TO_JSVAL(margin.left), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
JS_DefineProperty(cx, tmp, "top", DOUBLE_TO_JSVAL(margin.top), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
JS_DefineProperty(cx, tmp, "right", DOUBLE_TO_JSVAL(margin.right), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) &&
JS_DefineProperty(cx, tmp, "bottom", DOUBLE_TO_JSVAL(margin.bottom), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT);
if (ok)
{
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(tmp));
}
else
{
return false;
}
return true;
}
JS_ReportError(cx, "Invalid number of arguments");
return false;
}
extern JSObject* jsb_cocos2d_ui_Widget_prototype;
extern JSObject* jsb_cocos2d_ui_CheckBox_prototype;
extern JSObject* jsb_cocos2d_ui_Slider_prototype;
extern JSObject* jsb_cocos2d_ui_TextField_prototype;
extern JSObject* jsb_cocos2d_ui_LayoutParameter_prototype;
extern JSObject* jsb_cocos2d_ui_PageView_prototype;
extern JSObject* jsb_cocos2d_ui_ListView_prototype;
void register_all_cocos2dx_ui_manual(JSContext* cx, JSObject* global)
{
JS_DefineFunction(cx, jsb_cocos2d_ui_Widget_prototype, "addTouchEventListener", js_cocos2dx_UIWidget_addTouchEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_CheckBox_prototype, "addEventListenerCheckBox", js_cocos2dx_UICheckBox_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_Slider_prototype, "addEventListenerSlider", js_cocos2dx_UISlider_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_TextField_prototype, "addEventListenerTextField", js_cocos2dx_UITextField_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_PageView_prototype, "addEventListenerPageView", js_cocos2dx_UIPageView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_ListView_prototype, "addEventListenerListView", js_cocos2dx_UIListView_addEventListener, 2, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_LayoutParameter_prototype, "setMargin", js_cocos2dx_LayoutParameter_setMargin, 1, JSPROP_ENUMERATE | JSPROP_PERMANENT);
JS_DefineFunction(cx, jsb_cocos2d_ui_LayoutParameter_prototype, "getMargin", js_cocos2dx_LayoutParameter_getMargin, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT);
}

Просмотреть файл

@ -1,16 +0,0 @@
//
// jsb_cocos2dx_gui_manual.h
//
// Created by LinWenhai on 17/11/13.
//
//
#ifndef __jsb_cocos2dx_gui_manual__
#define __jsb_cocos2dx_gui_manual__
#include "jsapi.h"
#include "jsfriendapi.h"
void register_all_cocos2dx_ui_manual(JSContext* cx, JSObject* global);
#endif /* defined(__jsb_cocos2dx_gui_manual__) */

Просмотреть файл

@ -1,118 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto.cpp" />
<ClCompile Include="jsb_cocos2dx_gui_manual.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto.hpp" />
<ClInclude Include="jsb_cocos2dx_gui_manual.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto_api.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{9A844C88-97E8-4E2D-B09A-E138C67D338B}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForGui</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\editor-support\cocostudio;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto.cpp">
<Filter>generated</Filter>
</ClCompile>
<ClCompile Include="jsb_cocos2dx_gui_manual.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto.hpp">
<Filter>generated</Filter>
</ClInclude>
<ClInclude Include="jsb_cocos2dx_gui_manual.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_gui_auto_api.js">
<Filter>generated</Filter>
</None>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,154 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __JS_BINDINGS_CONFIG_H
#define __JS_BINDINGS_CONFIG_H
/** @def JSB_ASSERT_ON_FAIL
Whether or not to assert when the arguments or conversions are incorrect.
It is recommened to turn it off in Release mode.
*/
#ifndef JSB_ASSERT_ON_FAIL
#define JSB_ASSERT_ON_FAIL 0
#endif
#if JSB_ASSERT_ON_FAIL
#define JSB_PRECONDITION( condition, error_msg) do { NSCAssert( condition, [NSString stringWithUTF8String:error_msg] ); } while(0)
#define JSB_PRECONDITION2( condition, context, ret_value, error_msg) do { NSCAssert( condition, [NSString stringWithUTF8String:error_msg] ); } while(0)
#define ASSERT( condition, error_msg) do { NSCAssert( condition, [NSString stringWithUTF8String:error_msg] ); } while(0)
#else
#define JSB_PRECONDITION( condition, ...) do { \
if( ! (condition) ) { \
cocos2d::log("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
JSContext* globalContext = ScriptingCore::getInstance()->getGlobalContext(); \
if( ! JS_IsExceptionPending( globalContext ) ) { \
JS_ReportError( globalContext, __VA_ARGS__ ); \
} \
return false; \
} \
} while(0)
#define JSB_PRECONDITION2( condition, context, ret_value, ...) do { \
if( ! (condition) ) { \
cocos2d::log("jsb: ERROR: File %s: Line: %d, Function: %s", __FILE__, __LINE__, __FUNCTION__ ); \
cocos2d::log(__VA_ARGS__); \
if( ! JS_IsExceptionPending( context ) ) { \
JS_ReportError( context, __VA_ARGS__ ); \
} \
return ret_value; \
} \
} while(0)
#define ASSERT( condition, error_msg) do { \
if( ! (condition) ) { \
CCLOG("jsb: ERROR in %s: %s\n", __FUNCTION__, error_msg); \
return false; \
} \
} while(0)
#endif
#define JSB_PRECONDITION3( condition, context, ret_value, ...) do { \
if( ! (condition) ) return (ret_value); \
} while(0)
/** @def JSB_REPRESENT_LONGLONG_AS_STR
When JSB_REPRESENT_LONGLONG_AS_STR is defined, the long long will be represented as JS strings.
Otherwise they will be represented as an array of two intengers.
It is needed to to use an special representation since there are no 64-bit integers in JS.
Representing the long long as string could be a bit slower, but it is easier to debug from JS.
Enabled by default.
*/
#ifndef JSB_REPRESENT_LONGLONG_AS_STR
#define JSB_REPRESENT_LONGLONG_AS_STR 1
#endif // JSB_REPRESENT_LONGLONG_AS_STR
/** @def JSB_INCLUDE_CHIPMUNK
Whether or not it should include JS bindings for Chipmunk
*/
#ifndef JSB_INCLUDE_CHIPMUNK
#define JSB_INCLUDE_CHIPMUNK 1
#endif // JSB_INCLUDE_CHIPMUNK
/** @def JSB_INCLUDE_COCOSBUILDERREADER
Whether or not it should include JS bindings for CocosBuilder Reader
*/
#ifndef JSB_INCLUDE_COCOSBUILDERREADER
#define JSB_INCLUDE_COCOSBUILDERREADER 1
#endif // JSB_INCLUDE_COCOSBUILDERREADER
/** @def JSB_INCLUDE_COCOSDENSHION
Whether or not it should include bindings for CocosDenshion (sound engine)
*/
#ifndef JSB_INCLUDE_COCOSDENSHION
#define JSB_INCLUDE_COCOSDENSHION 1
#endif // JSB_INCLUDE_COCOSDENSHION
#if JSB_ENABLE_DEBUGGER
#define JSB_ENSURE_AUTOCOMPARTMENT(cx, obj) \
JSAutoCompartment ac(cx, obj)
#else
#define JSB_ENSURE_AUTOCOMPARTMENT(cx, obj)
#endif
#define JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET \
JSAutoCompartment __jsb_ac(ScriptingCore::getInstance()->getGlobalContext(), ScriptingCore::getInstance()->getGlobalObject());
/**
* @def JSB_DEBUGGER_PORT
* The port number, where the client will be listening on
*/
#define JSB_DEBUGGER_PORT 5086
/** @def JSB_INCLUDE_SYSTEM
Whether or not it should include bindings for system components like LocalStorage
*/
#ifndef JSB_INCLUDE_SYSTEM
#define JSB_INCLUDE_SYSTEM 1
#endif // JSB_INCLUDE_SYSTEM
/** @def JSB_INCLUDE_OPENGL
Whether or not it should include bindings for WebGL / OpenGL ES 2.0
*/
#ifndef JSB_INCLUDE_OPENGL
#define JSB_INCLUDE_OPENGL 1
#endif // JSB_INCLUDE_OPENGL
/** @def JSB_INCLUDE_XMLHTTP
Whether or not it should include bindings for XmlHttpRequest
*/
#ifndef JSB_INCLUDE_XMLHTTP
#define JSB_INCLUDE_XMLHTTP 1
#endif // JSB_INCLUDE_XMLHTTP
#ifndef JSB_MAX_STACK_QUOTA
#define JSB_MAX_STACK_QUOTA 500000
#endif // JSB_MAX_STACK_QUOTA
#endif // __JS_BINDINGS_CONFIG_H

Просмотреть файл

@ -1,165 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 "js_bindings_config.h"
#include "js_bindings_core.h"
// cocos2d + chipmunk registration files
#include "chipmunk/js_bindings_chipmunk_registration.h"
#include "cocos2d.h"
//#pragma mark - Hash
typedef struct _hashJSObject
{
JSObject *jsObject;
void *proxy;
UT_hash_handle hh;
} tHashJSObject;
static tHashJSObject *hash = NULL;
static tHashJSObject *reverse_hash = NULL;
//#pragma mark JSBCore - Helper free functions
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);
};
// Hash of JSObject -> proxy
void* jsb_get_proxy_for_jsobject(JSObject *obj)
{
tHashJSObject *element = NULL;
HASH_FIND_PTR(hash, &obj, element);
if( element )
return element->proxy;
return NULL;
}
void jsb_set_proxy_for_jsobject(void *proxy, JSObject *obj)
{
CCASSERT( !jsb_get_proxy_for_jsobject(obj), "Already added. abort");
// printf("Setting proxy for: %p - %p (%s)\n", obj, proxy, [[proxy description] UTF8String] );
tHashJSObject *element = (tHashJSObject*) malloc( sizeof( *element ) );
// XXX: Do not retain it here.
// [proxy retain];
element->proxy = proxy;
element->jsObject = obj;
HASH_ADD_PTR( hash, jsObject, element );
}
void jsb_del_proxy_for_jsobject(JSObject *obj)
{
tHashJSObject *element = NULL;
HASH_FIND_PTR(hash, &obj, element);
if( element ) {
HASH_DEL(hash, element);
free(element);
}
}
//#pragma mark Proxy -> JSObject
// Reverse hash: Proxy -> JSObject
JSObject* jsb_get_jsobject_for_proxy(void *proxy)
{
tHashJSObject *element = NULL;
HASH_FIND_PTR(reverse_hash, &proxy, element);
if( element )
return element->jsObject;
return NULL;
}
void jsb_set_jsobject_for_proxy(JSObject *jsobj, void* proxy)
{
CCASSERT( !jsb_get_jsobject_for_proxy(proxy), "Already added. abort");
tHashJSObject *element = (tHashJSObject*) malloc( sizeof( *element ) );
element->proxy = proxy;
element->jsObject = jsobj;
HASH_ADD_PTR( reverse_hash, proxy, element );
}
void jsb_del_jsobject_for_proxy(void* proxy)
{
tHashJSObject *element = NULL;
HASH_FIND_PTR(reverse_hash, &proxy, element);
if( element ) {
HASH_DEL(reverse_hash, element);
free(element);
}
}
//#pragma mark
//#pragma mark "C" proxy functions
struct jsb_c_proxy_s* jsb_get_c_proxy_for_jsobject( JSObject *jsobj )
{
struct jsb_c_proxy_s *proxy = (struct jsb_c_proxy_s *) JS_GetPrivate(jsobj);
return proxy;
}
void jsb_del_c_proxy_for_jsobject( JSObject *jsobj )
{
struct jsb_c_proxy_s *proxy = (struct jsb_c_proxy_s *) JS_GetPrivate(jsobj);
CCASSERT(proxy, "Invalid proxy for JSObject");
JS_SetPrivate(jsobj, NULL);
free(proxy);
}
void jsb_set_c_proxy_for_jsobject( JSObject *jsobj, void *handle, unsigned long flags)
{
struct jsb_c_proxy_s *proxy = (struct jsb_c_proxy_s*) malloc(sizeof(*proxy));
CCASSERT(proxy, "No memory for proxy");
proxy->handle = handle;
proxy->flags = flags;
proxy->jsobj = jsobj;
JS_SetPrivate(jsobj, proxy);
}
//#pragma mark Do Nothing - Callbacks
bool JSB_do_nothing(JSContext *cx, uint32_t argc, jsval *vp)
{
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}

Просмотреть файл

@ -1,77 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __JS_BINDINGS_CORE_H__
#define __JS_BINDINGS_CORE_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
JSB_C_FLAG_CALL_FREE = 0,
JSB_C_FLAG_DO_NOT_CALL_FREE =1,
};
// structure used by "Object Oriented Functions".
// handle is a pointer to the native object
// flags: flags for the object
struct jsb_c_proxy_s {
unsigned long flags; // Should it be removed at "destructor" time, or not ?
void *handle; // native object, like cpSpace, cpBody, etc.
JSObject *jsobj; // JS Object. Needed for rooting / unrooting
};
// Functions for setting / removing / getting the proxy used by the "C" Object Oriented API. Think of Chipmunk classes
struct jsb_c_proxy_s* jsb_get_c_proxy_for_jsobject( JSObject *jsobj );
void jsb_del_c_proxy_for_jsobject( JSObject *jsobj );
void jsb_set_c_proxy_for_jsobject( JSObject *jsobj, void *handle, unsigned long flags);
// JSObject -> proxy
/** gets a proxy for a given JSObject */
void* jsb_get_proxy_for_jsobject(JSObject *jsobj);
/** sets a proxy for a given JSObject */
void jsb_set_proxy_for_jsobject(void* proxy, JSObject *jsobj);
/** dels a proxy for a given JSObject */
void jsb_del_proxy_for_jsobject(JSObject *jsobj);
// reverse: proxy -> JSObject
/** gets a JSObject for a given proxy */
JSObject* jsb_get_jsobject_for_proxy(void *proxy);
/** sets a JSObject for a given proxy */
void jsb_set_jsobject_for_proxy(JSObject *jsobj, void* proxy);
/** delts a JSObject for a given proxy */
void jsb_del_jsobject_for_proxy(void* proxy);
// needed for callbacks. It does nothing.
bool JSB_do_nothing(JSContext *cx, uint32_t argc, jsval *vp);
#ifdef __cplusplus
}
#endif
#endif /* __JS_BINDINGS_CORE_H__ */

Просмотреть файл

@ -1,146 +0,0 @@
#include "js_bindings_opengl.h"
void GLNode::draw() {
js_proxy_t* proxy = NULL;
JSContext *cx = ScriptingCore::getInstance()->getGlobalContext();
proxy = js_get_or_create_proxy<cocos2d::Node>(cx, this);
if( proxy ) {
JSObject *jsObj = proxy->obj;
if (jsObj) {
bool found;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JS_HasProperty(cx, jsObj, "draw", &found);
if (found == true) {
JS::RootedValue rval(cx);
JS::RootedValue fval(cx);
jsval *argv = NULL; unsigned argc=0;
JS_GetProperty(cx, jsObj, "draw", &fval);
JS_CallFunctionValue(cx, jsObj, fval, argc, argv, rval.address());
}
}
}
}
JSClass *js_cocos2dx_GLNode_class;
JSObject *js_cocos2dx_GLNode_prototype;
bool js_cocos2dx_GLNode_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
if (argc == 0) {
GLNode* cobj = new GLNode();
cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj);
if (_ccobj) {
_ccobj->autorelease();
}
TypeTest<GLNode> t;
js_type_class_t *typeClass = nullptr;
std::string typeName = t.s_name();
auto typeMapIter = _js_global_type_map.find(typeName);
CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!");
typeClass = typeMapIter->second;
CCASSERT(typeClass, "The value is null.");
JSObject *obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto);
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
// link the native object with the javascript object
js_proxy_t *p = jsb_new_proxy(cobj, obj);
JS_AddNamedObjectRoot(cx, &p->obj, "cocos2d::GLNode");
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
void js_cocos2dx_GLNode_finalize(JSFreeOp *fop, JSObject *obj) {
}
static bool js_cocos2dx_GLNode_ctor(JSContext *cx, uint32_t argc, jsval *vp)
{
JSObject *obj = JS_THIS_OBJECT(cx, vp);
GLNode *nobj = new GLNode();
js_proxy_t* p = jsb_new_proxy(nobj, obj);
nobj->autorelease();
JS_AddNamedObjectRoot(cx, &p->obj, "GLNode");
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool js_cocos2dx_GLNode_create(JSContext *cx, uint32_t argc, jsval *vp)
{
GLNode* ret = new GLNode();
jsval jsret;
do {
if (ret) {
js_proxy_t *proxy = js_get_or_create_proxy<GLNode>(cx, ret);
jsret = OBJECT_TO_JSVAL(proxy->obj);
} else {
jsret = JSVAL_NULL;
}
} while (0);
JS_SET_RVAL(cx, vp, jsret);
return true;
}
extern JSObject* jsb_cocos2d_Node_prototype;
void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global) {
js_cocos2dx_GLNode_class = (JSClass *)calloc(1, sizeof(JSClass));
js_cocos2dx_GLNode_class->name = "GLNode";
js_cocos2dx_GLNode_class->addProperty = JS_PropertyStub;
js_cocos2dx_GLNode_class->delProperty = JS_DeletePropertyStub;
js_cocos2dx_GLNode_class->getProperty = JS_PropertyStub;
js_cocos2dx_GLNode_class->setProperty = JS_StrictPropertyStub;
js_cocos2dx_GLNode_class->enumerate = JS_EnumerateStub;
js_cocos2dx_GLNode_class->resolve = JS_ResolveStub;
js_cocos2dx_GLNode_class->convert = JS_ConvertStub;
js_cocos2dx_GLNode_class->finalize = js_cocos2dx_GLNode_finalize;
js_cocos2dx_GLNode_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
{0, 0, 0, 0, 0}
};
static JSFunctionSpec funcs[] = {
JS_FN("ctor", js_cocos2dx_GLNode_ctor, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
static JSFunctionSpec st_funcs[] = {
JS_FN("create", js_cocos2dx_GLNode_create, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
js_cocos2dx_GLNode_prototype = JS_InitClass(
cx, global,
jsb_cocos2d_Node_prototype,
js_cocos2dx_GLNode_class,
js_cocos2dx_GLNode_constructor, 0, // constructor
properties,
funcs,
NULL, // no static properties
st_funcs);
// make the class enumerable in the registered namespace
// bool found;
// JS_SetPropertyAttributes(cx, global, "GLNode", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
// add the proto and JSClass to the type->js info hash table
TypeTest<GLNode> t;
js_type_class_t *p;
std::string typeName = t.s_name();
if (_js_global_type_map.find(typeName) == _js_global_type_map.end())
{
p = (js_type_class_t *)malloc(sizeof(js_type_class_t));
p->jsclass = js_cocos2dx_GLNode_class;
p->proto = js_cocos2dx_GLNode_prototype;
p->parentProto = jsb_cocos2d_Node_prototype;
_js_global_type_map.insert(std::make_pair(typeName, p));
}
}

Просмотреть файл

@ -1,9 +0,0 @@
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
class GLNode : public cocos2d::Node {
public:
void draw();
};
void js_register_cocos2dx_GLNode(JSContext *cx, JSObject *global);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,304 +0,0 @@
//
// Created by Rohan Kuruvilla
// Copyright (c) 2012 Zynga Inc. All rights reserved.
//
#ifndef __JS_MANUAL_CONVERSIONS_H__
#define __JS_MANUAL_CONVERSIONS_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#include "js_bindings_core.h"
#include "js_bindings_config.h"
#include "cocos2d.h"
#include "spidermonkey_specifics.h"
#include "chipmunk.h"
// just a simple utility to avoid mem leaking when using JSString
class JSStringWrapper
{
public:
JSStringWrapper();
JSStringWrapper(JSString* str, JSContext* cx = NULL);
JSStringWrapper(jsval val, JSContext* cx = NULL);
~JSStringWrapper();
void set(jsval val, JSContext* cx);
void set(JSString* str, JSContext* cx);
const char* get();
private:
const char* _buffer;
private:
CC_DISALLOW_COPY_AND_ASSIGN(JSStringWrapper);
};
// wraps a function and "this" object
class JSFunctionWrapper
{
public:
JSFunctionWrapper(JSContext* cx, JSObject *jsthis, jsval fval);
~JSFunctionWrapper();
bool invoke(unsigned int argc, jsval *argv, jsval &rval);
private:
JSContext *_cx;
JSObject *_jsthis;
jsval _fval;
private:
CC_DISALLOW_COPY_AND_ASSIGN(JSFunctionWrapper);
};
bool jsval_to_opaque( JSContext *cx, jsval vp, void **out );
bool jsval_to_int( JSContext *cx, jsval vp, int *out);
bool jsval_to_uint( JSContext *cx, jsval vp, unsigned int *out);
bool jsval_to_c_class( JSContext *cx, jsval vp, void **out_native, struct jsb_c_proxy_s **out_proxy);
/** converts a jsval (JS string) into a char */
bool jsval_to_charptr( JSContext *cx, jsval vp, const char **out);
jsval opaque_to_jsval( JSContext *cx, void* opaque);
jsval c_class_to_jsval( JSContext *cx, void* handle, JSObject* object, JSClass *klass, const char* class_name);
/* Converts a char ptr into a jsval (using JS string) */
jsval charptr_to_jsval( JSContext *cx, const char *str);
bool JSB_jsval_typedarray_to_dataptr( JSContext *cx, jsval vp, GLsizei *count, void **data, JSArrayBufferViewType t);
bool JSB_get_arraybufferview_dataptr( JSContext *cx, jsval vp, GLsizei *count, GLvoid **data );
// some utility functions
// to native
bool jsval_to_ushort( JSContext *cx, jsval vp, unsigned short *ret );
bool jsval_to_int32( JSContext *cx, jsval vp, int32_t *ret );
bool jsval_to_uint32( JSContext *cx, jsval vp, uint32_t *ret );
bool jsval_to_uint16( JSContext *cx, jsval vp, uint16_t *ret );
bool jsval_to_long( JSContext *cx, jsval vp, long *out);
bool jsval_to_ulong( JSContext *cx, jsval vp, unsigned long *out);
bool jsval_to_long_long(JSContext *cx, jsval v, long long* ret);
bool jsval_to_std_string(JSContext *cx, jsval v, std::string* ret);
bool jsval_to_ccpoint(JSContext *cx, jsval v, cocos2d::Point* ret);
bool jsval_to_ccrect(JSContext *cx, jsval v, cocos2d::Rect* ret);
bool jsval_to_ccsize(JSContext *cx, jsval v, cocos2d::Size* ret);
bool jsval_to_cccolor4b(JSContext *cx, jsval v, cocos2d::Color4B* ret);
bool jsval_to_cccolor4f(JSContext *cx, jsval v, cocos2d::Color4F* ret);
bool jsval_to_cccolor3b(JSContext *cx, jsval v, cocos2d::Color3B* ret);
bool jsval_to_ccarray_of_CCPoint(JSContext* cx, jsval v, cocos2d::Point **points, int *numPoints);
bool jsval_to_ccarray(JSContext* cx, jsval v, cocos2d::__Array** ret);
bool jsval_to_ccdictionary(JSContext* cx, jsval v, cocos2d::__Dictionary** ret);
bool jsval_to_ccacceleration(JSContext* cx,jsval v, cocos2d::Acceleration* ret);
bool jsvals_variadic_to_ccarray( JSContext *cx, jsval *vp, int argc, cocos2d::__Array** ret);
// forward declaration
js_proxy_t* jsb_get_js_proxy(JSObject* jsObj);
template <class T>
bool jsvals_variadic_to_ccvector( JSContext *cx, jsval *vp, int argc, cocos2d::Vector<T>* ret)
{
bool ok = true;
for (int i = 0; i < argc; i++)
{
js_proxy_t* p;
JSObject* obj = JSVAL_TO_OBJECT(*vp);
p = jsb_get_js_proxy(obj);
CCASSERT(p, "Native object not found!");
if (p) {
ret->pushBack((T)p->ptr);
}
// next
vp++;
}
JSB_PRECONDITION3(ok, cx, false, "Error processing arguments");
return ok;
}
bool jsvals_variadic_to_ccvaluevector( JSContext *cx, jsval *vp, int argc, cocos2d::ValueVector* ret);
bool jsval_to_ccaffinetransform(JSContext* cx, jsval v, cocos2d::AffineTransform* ret);
bool jsval_to_FontDefinition( JSContext *cx, jsval vp, cocos2d::FontDefinition* ret );
template <class T>
bool jsval_to_ccvector(JSContext* cx, jsval v, cocos2d::Vector<T>* ret)
{
JS::RootedObject jsobj(cx);
JS::RootedValue jsval(cx, v);
bool ok = jsval.isObject() && JS_ValueToObject( cx, jsval, &jsobj );
JSB_PRECONDITION3( ok, cx, false, "Error converting value to object");
JSB_PRECONDITION3( jsobj && JS_IsArrayObject( cx, jsobj), cx, false, "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, jsobj, &len);
for (uint32_t i=0; i < len; i++)
{
JS::RootedValue value(cx);
if (JS_GetElement(cx, jsobj, i, &value))
{
CCASSERT(value.isObject(), "the element in Vector isn't a native object.");
js_proxy_t *proxy;
JSObject *tmp = JSVAL_TO_OBJECT(value);
proxy = jsb_get_js_proxy(tmp);
T cobj = (T)(proxy ? proxy->ptr : nullptr);
if (cobj)
{
ret->pushBack(cobj);
}
}
}
return true;
}
bool jsval_to_ccvalue(JSContext* cx, jsval v, cocos2d::Value* ret);
bool jsval_to_ccvaluemap(JSContext* cx, jsval v, cocos2d::ValueMap* ret);
bool jsval_to_ccvaluemapintkey(JSContext* cx, jsval v, cocos2d::ValueMapIntKey* ret);
bool jsval_to_ccvaluevector(JSContext* cx, jsval v, cocos2d::ValueVector* ret);
bool jsval_to_ssize( JSContext *cx, jsval vp, ssize_t* ret);
bool jsval_to_std_vector_string( JSContext *cx, jsval vp, std::vector<std::string>* ret);
bool jsval_to_std_vector_int( JSContext *cx, jsval vp, std::vector<int>* ret);
template <class T>
bool jsval_to_ccmap_string_key(JSContext *cx, jsval v, cocos2d::Map<std::string, T>* ret)
{
if (JSVAL_IS_NULL(v) || JSVAL_IS_VOID(v))
{
return true;
}
JSObject* tmp = JSVAL_TO_OBJECT(v);
if (!tmp) {
CCLOG("%s", "jsval_to_ccvaluemap: the jsval is not an object.");
return false;
}
JSObject* it = JS_NewPropertyIterator(cx, tmp);
while (true)
{
jsid idp;
jsval key;
if (! JS_NextProperty(cx, it, &idp) || ! JS_IdToValue(cx, idp, &key)) {
return false; // error
}
if (key == JSVAL_VOID) {
break; // end of iteration
}
if (!JSVAL_IS_STRING(key)) {
continue; // ignore integer properties
}
JSStringWrapper keyWrapper(JSVAL_TO_STRING(key), cx);
JS::RootedValue value(cx);
JS_GetPropertyById(cx, tmp, idp, &value);
if (value.isObject())
{
js_proxy_t *proxy = nullptr;
JSObject* jsobj = JSVAL_TO_OBJECT(value);
proxy = jsb_get_js_proxy(jsobj);
CCASSERT(proxy, "Native object should be added!");
T cobj = (T)(proxy ? proxy->ptr : nullptr);
ret->insert(keyWrapper.get(), cobj);
}
else
{
CCASSERT(false, "not supported type");
}
}
return true;
}
// from native
jsval int32_to_jsval( JSContext *cx, int32_t l);
jsval uint32_to_jsval( JSContext *cx, uint32_t number );
jsval ushort_to_jsval( JSContext *cx, unsigned short number );
jsval long_to_jsval( JSContext *cx, long number );
jsval ulong_to_jsval(JSContext* cx, unsigned long v);
jsval long_long_to_jsval(JSContext* cx, long long v);
jsval std_string_to_jsval(JSContext* cx, const std::string& v);
jsval c_string_to_jsval(JSContext* cx, const char* v, size_t length = -1);
jsval ccpoint_to_jsval(JSContext* cx, const cocos2d::Point& v);
jsval ccrect_to_jsval(JSContext* cx, const cocos2d::Rect& v);
jsval ccsize_to_jsval(JSContext* cx, const cocos2d::Size& v);
jsval cccolor4b_to_jsval(JSContext* cx, const cocos2d::Color4B& v);
jsval cccolor4f_to_jsval(JSContext* cx, const cocos2d::Color4F& v);
jsval cccolor3b_to_jsval(JSContext* cx, const cocos2d::Color3B& v);
jsval ccdictionary_to_jsval(JSContext* cx, cocos2d::__Dictionary *dict);
jsval ccarray_to_jsval(JSContext* cx, cocos2d::__Array *arr);
jsval ccacceleration_to_jsval(JSContext* cx, const cocos2d::Acceleration& v);
jsval ccaffinetransform_to_jsval(JSContext* cx, const cocos2d::AffineTransform& t);
jsval FontDefinition_to_jsval(JSContext* cx, const cocos2d::FontDefinition& t);
bool jsval_to_CGPoint( JSContext *cx, jsval vp, cpVect *out );
jsval CGPoint_to_jsval( JSContext *cx, cpVect p );
#define cpVect_to_jsval CGPoint_to_jsval
#define jsval_to_cpVect jsval_to_CGPoint
template<class T>
js_proxy_t *js_get_or_create_proxy(JSContext *cx, T *native_obj);
template <class T>
jsval ccvector_to_jsval(JSContext* cx, const cocos2d::Vector<T>& v)
{
JSObject *jsretArr = JS_NewArrayObject(cx, 0, NULL);
int i = 0;
for (const auto& obj : v)
{
JS::RootedValue arrElement(cx);
//First, check whether object is associated with js object.
js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj);
if (jsproxy) {
arrElement = OBJECT_TO_JSVAL(jsproxy->obj);
}
if (!JS_SetElement(cx, jsretArr, i, &arrElement)) {
break;
}
++i;
}
return OBJECT_TO_JSVAL(jsretArr);
}
template <class T>
jsval ccmap_string_key_to_jsval(JSContext* cx, const cocos2d::Map<std::string, T>& v)
{
JSObject* jsRet = JS_NewObject(cx, NULL, NULL, NULL);
for (auto iter = v.begin(); iter != v.end(); ++iter)
{
JS::RootedValue element(cx);
std::string key = iter->first;
T obj = iter->second;
//First, check whether object is associated with js object.
js_proxy_t* jsproxy = js_get_or_create_proxy(cx, obj);
if (jsproxy) {
element = OBJECT_TO_JSVAL(jsproxy->obj);
}
if (!key.empty())
{
JS_SetProperty(cx, jsRet, key.c_str(), element);
}
}
return OBJECT_TO_JSVAL(jsRet);
}
jsval ccvalue_to_jsval(JSContext* cx, const cocos2d::Value& v);
jsval ccvaluemap_to_jsval(JSContext* cx, const cocos2d::ValueMap& v);
jsval ccvaluemapintkey_to_jsval(JSContext* cx, const cocos2d::ValueMapIntKey& v);
jsval ccvaluevector_to_jsval(JSContext* cx, const cocos2d::ValueVector& v);
jsval ssize_to_jsval(JSContext *cx, ssize_t v);
#endif /* __JS_MANUAL_CONVERSIONS_H__ */

Просмотреть файл

@ -1,117 +0,0 @@
#ifndef __XMLHTTPHELPER_H__
#define __XMLHTTPHELPER_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#include <typeinfo>
#include <string>
#include <memory>
//#pragma mark - Helpful Macros
#define JS_BINDED_CLASS_GLUE(klass) \
static JSClass js_class; \
static JSObject* js_proto; \
static JSObject* js_parent; \
static void _js_register(JSContext* cx, JSObject* global);
#define JS_BINDED_CLASS_GLUE_IMPL(klass) \
JSClass klass::js_class = {}; \
JSObject* klass::js_proto = NULL; \
JSObject* klass::js_parent = NULL; \
#define JS_BINDED_FUNC(klass, name) \
bool name(JSContext *cx, unsigned argc, jsval *vp)
#define JS_BINDED_CONSTRUCTOR(klass) \
static bool _js_constructor(JSContext *cx, unsigned argc, jsval *vp)
#define JS_BINDED_CONSTRUCTOR_IMPL(klass) \
bool klass::_js_constructor(JSContext *cx, unsigned argc, jsval *vp)
#define JS_BINDED_FUNC_IMPL(klass, name) \
static bool klass##_func_##name(JSContext *cx, unsigned argc, jsval *vp) { \
JSObject* thisObj = JS_THIS_OBJECT(cx, vp); \
klass* obj = (klass*)JS_GetPrivate(thisObj); \
if (obj) { \
return obj->name(cx, argc, vp); \
} \
JS_ReportError(cx, "Invalid object call for function %s", #name); \
return false; \
} \
bool klass::name(JSContext *cx, unsigned argc, jsval *vp)
#define JS_WRAP_OBJECT_IN_VAL(klass, cobj, out) \
do { \
JSObject *obj = JS_NewObject(cx, &klass::js_class, klass::js_proto, klass::js_parent); \
if (obj) { \
JS_SetPrivate(obj, cobj); \
out = OBJECT_TO_JSVAL(obj); \
} \
} while(0) \
#define JS_BINDED_FUNC_FOR_DEF(klass, name) \
JS_FN(#name, klass##_func_##name, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT)
#define JS_BINDED_PROP_GET(klass, propName) \
bool _js_get_##propName(JSContext *cx, JS::HandleId id, JS::MutableHandleValue vp)
#define JS_BINDED_PROP_GET_IMPL(klass, propName) \
static bool _js_get_##klass##_##propName(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp) { \
klass* cobj = (klass*)JS_GetPrivate(obj); \
if (cobj) { \
return cobj->_js_get_##propName(cx, id, vp); \
} \
JS_ReportError(cx, "Invalid getter call for property %s", #propName); \
return false; \
} \
bool klass::_js_get_##propName(JSContext *cx, JS::HandleId id, JS::MutableHandleValue vp)
#define JS_BINDED_PROP_SET(klass, propName) \
bool _js_set_##propName(JSContext *cx, JS::HandleId id, bool strict, JS::MutableHandleValue vp)
#define JS_BINDED_PROP_SET_IMPL(klass, propName) \
static bool _js_set_##klass##_##propName(JSContext *cx, JS::HandleObject obj, JS::HandleId id, bool strict, JS::MutableHandleValue vp) { \
klass* cobj = (klass*)JS_GetPrivate(obj); \
if (cobj) { \
return cobj->_js_set_##propName(cx, id, strict, vp); \
} \
JS_ReportError(cx, "Invalid setter call for property %s", #propName); \
return false; \
} \
bool klass::_js_set_##propName(JSContext *cx, JS::HandleId id, bool strict, JS::MutableHandleValue vp)
#define JS_BINDED_PROP_ACCESSOR(klass, propName) \
JS_BINDED_PROP_GET(klass, propName); \
JS_BINDED_PROP_SET(klass, propName);
#define JS_BINDED_PROP_DEF_GETTER(klass, propName) \
{#propName, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, JSOP_WRAPPER(_js_get_##klass##_##propName), NULL}
#define JS_BINDED_PROP_DEF_ACCESSOR(klass, propName) \
{#propName, 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, JSOP_WRAPPER(_js_get_##klass##_##propName), JSOP_WRAPPER(_js_set_##klass##_##propName)}
#define JS_CREATE_UINT_WRAPPED(valOut, propName, val) \
do { \
JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL); \
jsval propVal = UINT_TO_JSVAL(val); \
JS_SetProperty(cx, jsobj, "__" propName, &propVal); \
valOut = OBJECT_TO_JSVAL(jsobj); \
} while(0)
#define JS_GET_UINT_WRAPPED(inVal, propName, out) \
do { \
if (inVal.isObject()) {\
JSObject* jsobj = JSVAL_TO_OBJECT(inVal); \
jsval outVal; \
JS_GetProperty(cx, jsobj, "__" propName, &outVal); \
JS_ValueToECMAUint32(cx, outVal, &out); \
} else { \
int32_t tmp; \
JS_ValueToInt32(cx, inVal, &tmp); \
out = (uint32_t)tmp; \
} \
} while (0)
#endif /* __XMLHTTPHELPER_H__ */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,144 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_jsb.py -c opengl_jsb.ini" on 2013-03-05
* Script version: v0.6
*/
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_OPENGL
#include "jsb_opengl_manual.h"
extern "C" {
bool JSB_glActiveTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glAttachShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBindAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBindBuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBindFramebuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBindRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBindTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBlendColor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBlendEquation(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBlendEquationSeparate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBlendFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBlendFuncSeparate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBufferData(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glBufferSubData(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCheckFramebufferStatus(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glClear(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glClearColor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glClearDepthf(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glClearStencil(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glColorMask(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCompileShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCompressedTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCompressedTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCopyTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCopyTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCreateProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCreateShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glCullFace(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteBuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteFramebuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDeleteTextures(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDepthFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDepthMask(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDepthRangef(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDetachShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDisable(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDisableVertexAttribArray(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDrawArrays(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glDrawElements(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glEnable(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glEnableVertexAttribArray(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glFinish(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glFlush(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glFramebufferRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glFramebufferTexture2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glFrontFace(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGenBuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGenFramebuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGenRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGenTextures(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGenerateMipmap(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetActiveAttrib(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetActiveUniform(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetAttachedShaders(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetAttribLocation(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetError(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetProgramInfoLog(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetProgramiv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetShaderInfoLog(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetShaderSource(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetShaderiv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetTexParameterfv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetUniformLocation(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glGetUniformfv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glHint(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsBuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsEnabled(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsFramebuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsRenderbuffer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsShader(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glIsTexture(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glLineWidth(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glLinkProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glPixelStorei(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glPolygonOffset(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glReadPixels(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glReleaseShaderCompiler(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glRenderbufferStorage(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glSampleCoverage(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glScissor(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glShaderSource(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilFunc(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilFuncSeparate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilMask(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilMaskSeparate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilOp(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glStencilOpSeparate(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glTexImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glTexParameterf(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glTexParameteri(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glTexSubImage2D(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform1f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform1fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform1i(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform1iv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform2f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform2fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform2i(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform2iv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform3f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform3fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform3i(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform3iv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform4f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform4fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform4i(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniform4iv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniformMatrix2fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniformMatrix3fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUniformMatrix4fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glUseProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glValidateProgram(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib1f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib1fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib2f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib2fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib3f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib3fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib4f(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttrib4fv(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glVertexAttribPointer(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_glViewport(JSContext *cx, uint32_t argc, jsval *vp);
}
#endif // JSB_INCLUDE_OPENGL

Просмотреть файл

@ -1,530 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2013 Zynga Inc.
*
* 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 "js_bindings_config.h"
#ifdef JSB_INCLUDE_OPENGL
#include "jsb_opengl_manual.h"
#include "js_manual_conversions.h"
#include "js_bindings_core.h"
#include "jsb_opengl_functions.h"
// Helper functions that link "glGenXXXs" (OpenGL ES 2.0 spec), with "gl.createXXX" (WebGL spec)
bool JSB_glGenTextures(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
GLuint texture;
glGenTextures(1, &texture);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(texture));
return true;
}
bool JSB_glGenBuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
GLuint buffer;
glGenBuffers(1, &buffer);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(buffer));
return true;
}
bool JSB_glGenRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
GLuint renderbuffers;
glGenRenderbuffers(1, &renderbuffers);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(renderbuffers));
return true;
}
bool JSB_glGenFramebuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
GLuint framebuffers;
glGenFramebuffers(1, &framebuffers);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(framebuffers));
return true;
}
bool JSB_glDeleteTextures(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
glDeleteTextures(1, &arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool JSB_glDeleteBuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
glDeleteBuffers(1, &arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool JSB_glDeleteRenderbuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
glDeleteRenderbuffers(1, &arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool JSB_glDeleteFramebuffers(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
glDeleteFramebuffers(1, &arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool JSB_glShaderSource(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0; const char *arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_charptr(cx, *argvp++, &arg1);
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
glShaderSource(arg0, 1, &arg1, NULL);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
bool JSB_glGetShaderiv(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLint ret;
glGetShaderiv(arg0, arg1, &ret);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(ret));
return true;
}
bool JSB_glGetProgramiv(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLint ret;
glGetProgramiv(arg0, arg1, &ret);
JS_SET_RVAL(cx, vp, INT_TO_JSVAL(ret));
return true;
}
bool JSB_glGetProgramInfoLog(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetProgramiv(arg0, GL_INFO_LOG_LENGTH, &length);
GLchar* src = new GLchar[length];
glGetProgramInfoLog(arg0, length, NULL, src);
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
CC_SAFE_DELETE_ARRAY(src);
return true;
}
// DOMString? getShaderInfoLog(WebGLShader? shader);
bool JSB_glGetShaderInfoLog(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetShaderiv(arg0, GL_INFO_LOG_LENGTH, &length);
GLchar* src = new GLchar[length];
glGetShaderInfoLog(arg0, length, NULL, src);
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
CC_SAFE_DELETE_ARRAY(src);
return true;
}
// DOMString? getShaderSource(WebGLShader? shader);
bool JSB_glGetShaderSource(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetShaderiv(arg0, GL_SHADER_SOURCE_LENGTH, &length);
GLchar* src = new GLchar[length];
glGetShaderSource(arg0, length, NULL, src);
JS_SET_RVAL(cx, vp, charptr_to_jsval(cx, src));
CC_SAFE_DELETE_ARRAY(src);
return true;
}
// interface WebGLActiveInfo {
// readonly attribute GLint size;
// readonly attribute GLenum type;
// readonly attribute DOMString name;
// WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
bool JSB_glGetActiveAttrib(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetProgramiv(arg0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &length);
GLchar* buffer = new GLchar[length];
GLint size = -1;
GLenum type = -1;
glGetActiveAttrib(arg0, arg1, length, NULL, &size, &type, buffer);
jsval retval = JSVAL_VOID;
JSObject *object = JS_NewObject(cx, NULL, NULL, NULL );
JSB_PRECONDITION2(ok, cx, false, "Error creating JS Object");
if (!JS_DefineProperty(cx, object, "size", INT_TO_JSVAL(size), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
!JS_DefineProperty(cx, object, "type", INT_TO_JSVAL(type), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
!JS_DefineProperty(cx, object, "name", charptr_to_jsval(cx, buffer), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) )
return false;
retval = OBJECT_TO_JSVAL(object);
JS_SET_RVAL(cx, vp, retval);
CC_SAFE_DELETE_ARRAY(buffer);
return true;
}
// interface WebGLActiveInfo {
// readonly attribute GLint size;
// readonly attribute GLenum type;
// readonly attribute DOMString name;
// };
// WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
bool JSB_glGetActiveUniform(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetProgramiv(arg0, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &length);
GLchar* buffer = new GLchar[length];
GLint size = -1;
GLenum type = -1;
glGetActiveUniform(arg0, arg1, length, NULL, &size, &type, buffer);
jsval retval = JSVAL_VOID;
JSObject *object = JS_NewObject(cx, NULL, NULL, NULL );
JSB_PRECONDITION2(ok, cx, false, "Error creating JS Object");
if (!JS_DefineProperty(cx, object, "size", INT_TO_JSVAL(size), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
!JS_DefineProperty(cx, object, "type", INT_TO_JSVAL(type), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) ||
!JS_DefineProperty(cx, object, "name", charptr_to_jsval(cx, buffer), NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT) )
return false;
retval = OBJECT_TO_JSVAL(object);
JS_SET_RVAL(cx, vp, retval);
CC_SAFE_DELETE_ARRAY(buffer);
return true;
}
// sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
bool JSB_glGetAttachedShaders(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
GLsizei length;
glGetProgramiv(arg0, GL_ATTACHED_SHADERS, &length);
GLuint* buffer = new GLuint[length];
memset(buffer, 0, length * sizeof(GLuint));
//Fix bug 2448, it seems that glGetAttachedShaders will crash if we send NULL to the third parameter (eg Windows), same as in lua binding
GLsizei realShaderCount = 0;
glGetAttachedShaders(arg0, length, &realShaderCount, buffer);
JSObject *jsobj = JS_NewArrayObject(cx, length, NULL);
JSB_PRECONDITION2(jsobj, cx, false, "Error creating JS Object");
for( int i=0; i<length; i++) {
JS::RootedValue e(cx, INT_TO_JSVAL(buffer[i]));
JS_SetElement(cx, jsobj, i, &e );
}
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsobj));
CC_SAFE_DELETE_ARRAY(buffer);
return true;
}
// sequence<DOMString>? getSupportedExtensions();
bool JSB_glGetSupportedExtensions(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 0, cx, false, "Invalid number of arguments" );
const GLubyte *extensions = glGetString(GL_EXTENSIONS);
JSObject *jsobj = JS_NewArrayObject(cx, 0, NULL);
JSB_PRECONDITION2(jsobj, cx, false, "Error creating JS Object");
// copy, to be able to add '\0'
size_t len = strlen((char*)extensions);
GLubyte* copy = new GLubyte[len+1];
strncpy((char*)copy, (const char*)extensions, len );
int start_extension=0;
int element=0;
for( int i=0; i<len+1; i++) {
if( copy[i]==' ' || copy[i]==',' || i==len ) {
copy[i] = 0;
JS::RootedValue str(cx, charptr_to_jsval(cx, (const char*)&copy[start_extension]));
JS_SetElement(cx, jsobj, element++, &str );
start_extension = i+1;
i++;
}
}
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(jsobj));
CC_SAFE_DELETE_ARRAY(copy);
return true;
}
// any getTexParameter(GLenum target, GLenum pname);
bool JSB_glGetTexParameterfv(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "JSB_glGetTexParameterfv: Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "JSB_glGetTexParameterfv: Error processing arguments");
GLfloat param;
glGetTexParameterfv(arg0, arg1, &param);
JS_SET_RVAL(cx, vp, DOUBLE_TO_JSVAL(param));
return true;
}
// any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
bool JSB_glGetUniformfv(JSContext *cx, uint32_t argc, jsval *vp)
{
JSB_PRECONDITION2( argc == 2, cx, false, "JSB_glGetUniformfv: Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
uint32_t arg0, arg1;
ok &= jsval_to_uint( cx, *argvp++, &arg0 );
ok &= jsval_to_uint( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "JSB_glGetUniformfv: Error processing arguments");
GLsizei length;
glGetProgramiv(arg0, GL_ACTIVE_UNIFORM_MAX_LENGTH, &length);
GLchar* namebuffer = new GLchar[length+1];
GLint size = -1;
GLenum type = -1;
glGetActiveUniform(arg0, arg1, length, NULL, &size, &type, namebuffer);
CC_SAFE_DELETE_ARRAY(namebuffer);
int usize = 0;
int utype = 0;
switch(type) {
// float
case GL_FLOAT:
usize = 1;
utype = GL_FLOAT;
break;
case GL_FLOAT_MAT2:
usize = 2 * 2;
utype = GL_FLOAT;
break;
case GL_FLOAT_MAT3:
usize = 3 * 3;
utype = GL_FLOAT;
break;
case GL_FLOAT_MAT4:
usize = 4 * 4;
utype = GL_FLOAT;
break;
case GL_FLOAT_VEC2:
usize = 2;
utype = GL_FLOAT;
break;
case GL_FLOAT_VEC3:
usize = 3;
utype = GL_FLOAT;
break;
case GL_FLOAT_VEC4:
usize = 4;
utype = GL_FLOAT;
break;
// int
case GL_INT:
usize = 1;
utype = GL_INT;
break;
case GL_INT_VEC2:
usize = 1;
utype = GL_INT;
break;
case GL_INT_VEC3:
usize = 1;
utype = GL_INT;
break;
case GL_INT_VEC4:
usize = 1;
utype = GL_INT;
break;
default:
JSB_PRECONDITION2(false, cx, false, "JSB_glGetUniformfv: Uniform Type not supported");
}
JSObject *typedArray = NULL;
if( utype == GL_FLOAT) {
// FIXME: glew on windows will cause array overflow after invoking glGetUniformfv.
// It seems that glGetUniformfv re-assign the memeroy with a wrong size which is 4x than we pass in.
// For temporary solution, we allocate 4x array.
GLfloat* param = new GLfloat[usize*4];
glGetUniformfv(arg0, arg1, param);
typedArray = JS_NewFloat32Array(cx, usize);
float *buffer = (float*)JS_GetArrayBufferViewData(typedArray);
memcpy( buffer, param, sizeof(float) * usize);
CC_SAFE_DELETE_ARRAY(param);
} else if( utype == GL_INT ) {
// FIXME: glew on windows will cause array overflow after invoking glGetUniformfv.
// It seems that glGetUniformfv re-assign the memeroy with a wrong size which is 4x than we pass in.
// For temporary solution, we allocate 4x array.
GLint* param = new GLint[usize*4];
glGetUniformiv(arg0, arg1, param);
typedArray = JS_NewInt32Array(cx, usize);
GLint *buffer = (GLint*)JS_GetArrayBufferViewData(typedArray);
memcpy( buffer, param, sizeof(GLint) * usize);
CC_SAFE_DELETE_ARRAY(param);
}
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(typedArray));
return true;
}
#endif // JSB_INCLUDE_OPENGL

Просмотреть файл

@ -1,52 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __jsb_opengl_manual
#define __jsb_opengl_manual
#include "js_bindings_config.h"
#ifdef JSB_INCLUDE_OPENGL
//#include <Availability.h>
#include "jsapi.h"
#include "jsfriendapi.h"
#ifdef __IPHONE_OS_VERSION_MAX_ALLOWED
#elif defined(__MAC_OS_X_VERSION_MAX_ALLOWED)
// compatible with iOS
#define glClearDepthf glClearDepth
#define glDepthRangef glDepthRange
#define glReleaseShaderCompiler()
#endif // __MAC_OS_X_VERSION_MAX_ALLOWED
// forward declaration of new functions
bool JSB_glGetSupportedExtensions(JSContext *cx, uint32_t argc, jsval *vp);
#endif // JSB_INCLUDE_OPENGL
#endif // __jsb_opengl_manual

Просмотреть файл

@ -1,190 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 "js_bindings_config.h"
#include "js_bindings_core.h"
#include "jsfriendapi.h"
#include "jsb_opengl_manual.h"
#include "js_bindings_opengl.h"
//#include "jsb_opengl_functions_registration.h"
// system
#include "jsb_opengl_functions.h"
void JSB_register_opengl(JSContext *_cx, JSObject *object)
{
//
// gl
//
JSObject *opengl = JS_NewObject(_cx, NULL, NULL, NULL);
JS::RootedValue openglVal(_cx);
openglVal = OBJECT_TO_JSVAL(opengl);
JS_SetProperty(_cx, object, "gl", openglVal);
JS::RootedValue nsval(_cx);
JS::RootedObject ccns(_cx);
JS_GetProperty(_cx, object, "cc", &nsval);
if (nsval == JSVAL_VOID) {
ccns = JS_NewObject(_cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ccns);
JS_SetProperty(_cx, object, "cc", nsval);
} else {
JS_ValueToObject(_cx, nsval, &ccns);
}
js_register_cocos2dx_GLNode(_cx, ccns);
// New WebGL functions, not present on OpenGL ES 2.0
JS_DefineFunction(_cx, opengl, "getSupportedExtensions", JSB_glGetSupportedExtensions, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "activeTexture", JSB_glActiveTexture, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_attachShader", JSB_glAttachShader, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_bindAttribLocation", JSB_glBindAttribLocation, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_bindBuffer", JSB_glBindBuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_bindFramebuffer", JSB_glBindFramebuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_bindRenderbuffer", JSB_glBindRenderbuffer, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_bindTexture", JSB_glBindTexture, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "blendColor", JSB_glBlendColor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "blendEquation", JSB_glBlendEquation, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "blendEquationSeparate", JSB_glBlendEquationSeparate, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "blendFunc", JSB_glBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "blendFuncSeparate", JSB_glBlendFuncSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "bufferData", JSB_glBufferData, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "bufferSubData", JSB_glBufferSubData, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "checkFramebufferStatus", JSB_glCheckFramebufferStatus, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "clear", JSB_glClear, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "clearColor", JSB_glClearColor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "clearDepthf", JSB_glClearDepthf, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "clearStencil", JSB_glClearStencil, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "colorMask", JSB_glColorMask, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_compileShader", JSB_glCompileShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "compressedTexImage2D", JSB_glCompressedTexImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "compressedTexSubImage2D", JSB_glCompressedTexSubImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "copyTexImage2D", JSB_glCopyTexImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "copyTexSubImage2D", JSB_glCopyTexSubImage2D, 8, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createProgram", JSB_glCreateProgram, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createShader", JSB_glCreateShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "cullFace", JSB_glCullFace, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteBuffer", JSB_glDeleteBuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteFramebuffer", JSB_glDeleteFramebuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteProgram", JSB_glDeleteProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteRenderbuffer", JSB_glDeleteRenderbuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteShader", JSB_glDeleteShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_deleteTexture", JSB_glDeleteTextures, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "depthFunc", JSB_glDepthFunc, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "depthMask", JSB_glDepthMask, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "depthRangef", JSB_glDepthRangef, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "detachShader", JSB_glDetachShader, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "disable", JSB_glDisable, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "disableVertexAttribArray", JSB_glDisableVertexAttribArray, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "drawArrays", JSB_glDrawArrays, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "drawElements", JSB_glDrawElements, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "enable", JSB_glEnable, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "enableVertexAttribArray", JSB_glEnableVertexAttribArray, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "finish", JSB_glFinish, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "flush", JSB_glFlush, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "framebufferRenderbuffer", JSB_glFramebufferRenderbuffer, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "framebufferTexture2D", JSB_glFramebufferTexture2D, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "frontFace", JSB_glFrontFace, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createBuffer", JSB_glGenBuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createFramebuffer", JSB_glGenFramebuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createRenderbuffer", JSB_glGenRenderbuffers, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_createTexture", JSB_glGenTextures, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "generateMipmap", JSB_glGenerateMipmap, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getActiveAttrib", JSB_glGetActiveAttrib, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getActiveUniform", JSB_glGetActiveUniform, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getAttachedShaders", JSB_glGetAttachedShaders, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getAttribLocation", JSB_glGetAttribLocation, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "getError", JSB_glGetError, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getProgramInfoLog", JSB_glGetProgramInfoLog, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getProgramParameter", JSB_glGetProgramiv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getShaderInfoLog", JSB_glGetShaderInfoLog, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getShaderSource", JSB_glGetShaderSource, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getShaderParameter", JSB_glGetShaderiv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "getTexParameter", JSB_glGetTexParameterfv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getUniformLocation", JSB_glGetUniformLocation, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_getUniform", JSB_glGetUniformfv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "hint", JSB_glHint, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isBuffer", JSB_glIsBuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isEnabled", JSB_glIsEnabled, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isFramebuffer", JSB_glIsFramebuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isProgram", JSB_glIsProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isRenderbuffer", JSB_glIsRenderbuffer, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isShader", JSB_glIsShader, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "isTexture", JSB_glIsTexture, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "lineWidth", JSB_glLineWidth, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_linkProgram", JSB_glLinkProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "pixelStorei", JSB_glPixelStorei, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "polygonOffset", JSB_glPolygonOffset, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "readPixels", JSB_glReadPixels, 7, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "releaseShaderCompiler", JSB_glReleaseShaderCompiler, 0, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "renderbufferStorage", JSB_glRenderbufferStorage, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "sampleCoverage", JSB_glSampleCoverage, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "scissor", JSB_glScissor, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_shaderSource", JSB_glShaderSource, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilFunc", JSB_glStencilFunc, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilFuncSeparate", JSB_glStencilFuncSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilMask", JSB_glStencilMask, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilMaskSeparate", JSB_glStencilMaskSeparate, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilOp", JSB_glStencilOp, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "stencilOpSeparate", JSB_glStencilOpSeparate, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_texImage2D", JSB_glTexImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "texParameterf", JSB_glTexParameterf, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "texParameteri", JSB_glTexParameteri, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_texSubImage2D", JSB_glTexSubImage2D, 9, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform1f", JSB_glUniform1f, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform1fv", JSB_glUniform1fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform1i", JSB_glUniform1i, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform1iv", JSB_glUniform1iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform2f", JSB_glUniform2f, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform2fv", JSB_glUniform2fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform2i", JSB_glUniform2i, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform2iv", JSB_glUniform2iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform3f", JSB_glUniform3f, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform3fv", JSB_glUniform3fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform3i", JSB_glUniform3i, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform3iv", JSB_glUniform3iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform4f", JSB_glUniform4f, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform4fv", JSB_glUniform4fv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform4i", JSB_glUniform4i, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniform4iv", JSB_glUniform4iv, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniformMatrix2fv", JSB_glUniformMatrix2fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniformMatrix3fv", JSB_glUniformMatrix3fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "uniformMatrix4fv", JSB_glUniformMatrix4fv, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_useProgram", JSB_glUseProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "_validateProgram", JSB_glValidateProgram, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib1f", JSB_glVertexAttrib1f, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib1fv", JSB_glVertexAttrib1fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib2f", JSB_glVertexAttrib2f, 3, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib2fv", JSB_glVertexAttrib2fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib3f", JSB_glVertexAttrib3f, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib3fv", JSB_glVertexAttrib3fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib4f", JSB_glVertexAttrib4f, 5, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttrib4fv", JSB_glVertexAttrib4fv, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "vertexAttribPointer", JSB_glVertexAttribPointer, 6, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, opengl, "viewport", JSB_glViewport, 4, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
}

Просмотреть файл

@ -1,32 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __JSB_OPENGL_REGISTRATION
#define __JSB_OPENGL_REGISTRATION
#include "jsb_opengl_functions.h"
void JSB_register_opengl( JSContext *globalC, JSObject *globalO);
#endif // __JSB_OPENGL_REGISTRATION

Просмотреть файл

@ -1,29 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_localstorage_static
LOCAL_MODULE_FILENAME := libcocos2dxjsblocalstorage
LOCAL_SRC_FILES := js_bindings_system_functions.cpp \
js_bindings_system_registration.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/../../../../../extensions
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_localstorage_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,storage/local-storage)

Просмотреть файл

@ -1,69 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c system_jsb.ini" on 2012-12-17
* Script version: v0.5
*/
#include "js_bindings_system_functions.h"
#include "js_bindings_config.h"
#include "js_bindings_core.h"
#include "js_manual_conversions.h"
#include "ScriptingCore.h"
#include "local-storage/LocalStorage.h"
USING_NS_CC;
// Arguments: char*
// Ret value: const char*
bool JSB_localStorageGetItem(JSContext *cx, uint32_t argc, jsval *vp) {
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
std::string ret_val;
ret_val = localStorageGetItem(arg0);
jsval ret_jsval = std_string_to_jsval(cx, ret_val);
JS_SET_RVAL(cx, vp, ret_jsval );
return true;
}
// Arguments: char*
// Ret value: void
bool JSB_localStorageRemoveItem(JSContext *cx, uint32_t argc, jsval *vp) {
JSB_PRECONDITION2( argc == 1, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
std::string arg0;
ok &= jsval_to_std_string( cx, *argvp++, &arg0 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
localStorageRemoveItem(arg0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
// Arguments: char*, char*
// Ret value: void
bool JSB_localStorageSetItem(JSContext *cx, uint32_t argc, jsval *vp) {
JSB_PRECONDITION2( argc == 2, cx, false, "Invalid number of arguments" );
jsval *argvp = JS_ARGV(cx,vp);
bool ok = true;
std::string arg0; std::string arg1;
ok &= jsval_to_std_string( cx, *argvp++, &arg0 );
ok &= jsval_to_std_string( cx, *argvp++, &arg1 );
JSB_PRECONDITION2(ok, cx, false, "Error processing arguments");
localStorageSetItem(arg0 , arg1);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
//#endif // JSB_INCLUDE_SYSTEM

Просмотреть файл

@ -1,21 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c system_jsb.ini" on 2012-12-17
* Script version: v0.5
*/
#include "js_bindings_config.h"
#include "jsapi.h"
#ifdef __cplusplus
extern "C" {
#endif
bool JSB_localStorageGetItem(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_localStorageRemoveItem(JSContext *cx, uint32_t argc, jsval *vp);
bool JSB_localStorageSetItem(JSContext *cx, uint32_t argc, jsval *vp);
#ifdef __cplusplus
}
#endif
//#endif // JSB_INCLUDE_SYSTEM

Просмотреть файл

@ -1,15 +0,0 @@
/*
* AUTOGENERATED FILE. DO NOT EDIT IT
* Generated by "generate_js_bindings.py -c system_jsb.ini" on 2012-12-17
* Script version: v0.5
*/
#include "../js_bindings_config.h"
//#ifdef JSB_INCLUDE_SYSTEM
//#include "LocalStorage.h"
JS_DefineFunction(_cx, system, "getItem", JSB_localStorageGetItem, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, system, "removeItem", JSB_localStorageRemoveItem, 1, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
JS_DefineFunction(_cx, system, "setItem", JSB_localStorageSetItem, 2, JSPROP_READONLY | JSPROP_PERMANENT | JSPROP_ENUMERATE );
//#endif // JSB_INCLUDE_SYSTEM

Просмотреть файл

@ -1,64 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 "js_bindings_config.h"
#include "js_bindings_core.h"
#include "local-storage/LocalStorage.h"
#include "cocos2d.h"
// system
#include "js_bindings_system_functions.h"
void jsb_register_system( JSContext *_cx, JSObject *object)
{
//
// sys
//
JSObject *sys = JS_NewObject(_cx, NULL, NULL, NULL);
JS::RootedValue systemVal(_cx);
systemVal = OBJECT_TO_JSVAL(sys);
JS_SetProperty(_cx, object, "sys", systemVal);
// sys.localStorage
JSObject *ls = JS_NewObject(_cx, NULL, NULL, NULL);
JS::RootedValue lsVal(_cx);
lsVal = OBJECT_TO_JSVAL(ls);
JS_SetProperty(_cx, sys, "localStorage", lsVal);
// sys.localStorage functions
JSObject *system = ls;
#include "js_bindings_system_functions_registration.h"
// Init DB with full path
//NSString *path = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
//NSString *fullpath = [path stringByAppendingPathComponent:@"jsb.sqlite"];
std::string strFilePath = cocos2d::FileUtils::getInstance()->getWritablePath();
strFilePath += "/jsb.sqlite";
localStorageInit(strFilePath.c_str());
}

Просмотреть файл

@ -1,31 +0,0 @@
/*
* JS Bindings: https://github.com/zynga/jsbindings
*
* Copyright (c) 2012 Zynga Inc.
*
* 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 __JSB_SYSTEM_REGISTRATION
#define __JSB_SYSTEM_REGISTRATION
void jsb_register_system( JSContext *globalC, JSObject *globalO);
#endif // __JSB_CHIPMUNK_REGISTRATION

Просмотреть файл

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="js_bindings_system_functions.cpp" />
<ClCompile Include="js_bindings_system_registration.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="js_bindings_system_functions.h" />
<ClInclude Include="js_bindings_system_functions_registration.h" />
<ClInclude Include="js_bindings_system_registration.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{68F5F371-BD7B-4C30-AE5B-0B08F22E0CDE}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForLocalStorage</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\spidermonkey\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\spidermonkey\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,32 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="js_bindings_system_functions.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="js_bindings_system_registration.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="js_bindings_system_functions.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_system_functions_registration.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="js_bindings_system_registration.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,30 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := jsb_network_static
LOCAL_MODULE_FILENAME := libcocos2dxjsbnetwork
LOCAL_SRC_FILES := XMLHTTPRequest.cpp \
jsb_websocket.cpp
LOCAL_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_JAVASCRIPT
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_WHOLE_STATIC_LIBRARIES := spidermonkey_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_jsb_static
LOCAL_WHOLE_STATIC_LIBRARIES += cocos_network_static
LOCAL_WHOLE_STATIC_LIBRARIES += websockets_static
include $(BUILD_STATIC_LIBRARY)
$(call import-module,spidermonkey/prebuilt/android)
$(call import-module,scripting/javascript/bindings)
$(call import-module,network)
$(call import-module,websockets/prebuilt/android)

Просмотреть файл

@ -1,856 +0,0 @@
//
// XMLHTTPRequest.cpp
// XMLHttpRequest
//
// Created by Zynga 2013
//
// Heavy based on: https://github.com/funkaster/FakeWebGL/blob/master/FakeWebGL/WebGL/XMLHTTPRequest.cpp
// Copyright (c) 2012 Rolando Abarca. All rights reserved.
//
// 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 "XMLHTTPRequest.h"
#include <string>
using namespace std;
//#pragma mark - MinXmlHttpRequest
/**
* @brief Implementation for header retrieving.
* @param header
*/
void MinXmlHttpRequest::_gotHeader(string header)
{
// Get Header and Set StatusText
// Split String into Tokens
char * cstr = new char [header.length()+1];
// check for colon.
unsigned found_header_field = header.find_first_of(":");
if (found_header_field != std::string::npos)
{
// Found a header field.
string http_field;
string http_value;
http_field = header.substr(0,found_header_field);
http_value = header.substr(found_header_field+1, header.length());
// Get rid of all \n
if (!http_value.empty() && http_value[http_value.size() - 1] == '\n') {
http_value.erase(http_value.size() - 1);
}
_httpHeader[http_field] = http_value;
}
else
{
// Seems like we have the response Code! Parse it and check for it.
char * pch;
strcpy(cstr, header.c_str());
pch = strtok(cstr," ");
while (pch != NULL)
{
stringstream ss;
string val;
ss << pch;
val = ss.str();
unsigned found_http = val.find("HTTP");
// Check for HTTP Header to set statusText
if (found_http != std::string::npos) {
stringstream mystream;
// Get Response Status
pch = strtok (NULL, " ");
mystream << pch;
pch = strtok (NULL, " ");
mystream << " " << pch;
_statusText = mystream.str();
}
pch = strtok (NULL, " ");
}
}
CC_SAFE_DELETE_ARRAY(cstr);
}
/**
* @brief Set Request header for next call.
* @param field Name of the Header to be set.
* @param value Value of the Headerfield
*/
void MinXmlHttpRequest::_setRequestHeader(const char* field, const char* value)
{
stringstream header_s;
stringstream value_s;
string header;
auto iter = _requestHeader.find(field);
// Concatenate values when header exists.
if (iter != _requestHeader.end())
{
value_s << iter->second << "," << value;
}
else
{
value_s << value;
}
_requestHeader[field] = value_s.str();
}
/**
* @brief If headers has been set, pass them to curl.
*
*/
void MinXmlHttpRequest::_setHttpRequestHeader()
{
std::vector<string> header;
for (auto it = _requestHeader.begin(); it != _requestHeader.end(); ++it)
{
const char* first = it->first.c_str();
const char* second = it->second.c_str();
size_t len = sizeof(char) * (strlen(first) + 3 + strlen(second));
char* test = (char*) malloc(len);
memset(test, 0,len);
strcpy(test, first);
strcpy(test + strlen(first) , ": ");
strcpy(test + strlen(first) + 2, second);
header.push_back(test);
free(test);
}
if (!header.empty())
{
_httpRequest->setHeaders(header);
}
}
/**
* @brief Callback for HTTPRequest. Handles the response and invokes Callback.
* @param sender Object which initialized callback
* @param respone Response object
*/
void MinXmlHttpRequest::handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response)
{
if (0 != strlen(response->getHttpRequest()->getTag()))
{
CCLOG("%s completed", response->getHttpRequest()->getTag());
}
long statusCode = response->getResponseCode();
char statusString[64] = {0};
sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag());
if (!response->isSucceed())
{
CCLOG("Response failed, error buffer: %s", response->getErrorBuffer());
}
// set header
std::vector<char> *headers = response->getResponseHeader();
char* concatHeader = (char*) malloc(headers->size() + 1);
std::string header(headers->begin(), headers->end());
strcpy(concatHeader, header.c_str());
std::istringstream stream(concatHeader);
std::string line;
while(std::getline(stream, line)) {
_gotHeader(line);
}
/** get the response data **/
std::vector<char> *buffer = response->getResponseData();
if (statusCode == 200)
{
//Succeeded
_status = 200;
_readyState = DONE;
_dataSize = static_cast<uint32_t>(buffer->size());
CC_SAFE_FREE(_data);
_data = (char*) malloc(_dataSize + 1);
_data[_dataSize] = '\0';
memcpy((void*)_data, (const void*)buffer->data(), _dataSize);
}
else
{
_status = 0;
}
// Free Memory.
free((void*) concatHeader);
js_proxy_t * p;
void* ptr = (void*)this;
p = jsb_get_native_proxy(ptr);
if(p)
{
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
if (_onreadystateCallback)
{
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
//JS_IsExceptionPending(cx) && JS_ReportPendingException(cx);
jsval fval = OBJECT_TO_JSVAL(_onreadystateCallback);
jsval out;
JS_CallFunctionValue(cx, NULL, fval, 0, NULL, &out);
}
}
}
/**
* @brief Send out request and fire callback when done.
* @param cx Javascript context
*/
void MinXmlHttpRequest::_sendRequest(JSContext *cx)
{
_httpRequest->setResponseCallback(this, httpresponse_selector(MinXmlHttpRequest::handle_requestResponse));
cocos2d::network::HttpClient::getInstance()->send(_httpRequest);
_httpRequest->release();
}
/**
* @brief Constructor initializes cchttprequest and stuff
*
*/
MinXmlHttpRequest::MinXmlHttpRequest()
: _onreadystateCallback(nullptr)
, _isNetwork(true)
, _data(nullptr)
{
_httpHeader.clear();
_requestHeader.clear();
_withCredentialsValue = true;
_cx = ScriptingCore::getInstance()->getGlobalContext();
_httpRequest = new cocos2d::network::HttpRequest();
}
/**
* @brief Destructor cleans up _httpRequest and stuff
*
*/
MinXmlHttpRequest::~MinXmlHttpRequest()
{
_httpHeader.clear();
_requestHeader.clear();
if (_onreadystateCallback != NULL)
{
JS_RemoveObjectRoot(_cx, &_onreadystateCallback);
}
if (_httpRequest)
{
// We don't need to release _httpRequest here since it will be released in the http callback.
// _httpRequest->release();
}
CC_SAFE_FREE(_data);
}
/**
* @brief Initialize Object and needed properties.
*
*/
JS_BINDED_CLASS_GLUE_IMPL(MinXmlHttpRequest);
/**
* @brief Implementation for the Javascript Constructor
*
*/
JS_BINDED_CONSTRUCTOR_IMPL(MinXmlHttpRequest)
{
MinXmlHttpRequest* req = new MinXmlHttpRequest();
req->autorelease();
js_proxy_t *p;
jsval out;
JSObject *obj = JS_NewObject(cx, &MinXmlHttpRequest::js_class, MinXmlHttpRequest::js_proto, MinXmlHttpRequest::js_parent);
if (obj) {
JS_SetPrivate(obj, req);
out = OBJECT_TO_JSVAL(obj);
}
JS_SET_RVAL(cx, vp, out);
p =jsb_new_proxy(req, obj);
JS_AddNamedObjectRoot(cx, &p->obj, "XMLHttpRequest");
return true;
}
/**
* @brief get Callback function for Javascript
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, onreadystatechange)
{
if (_onreadystateCallback)
{
JSString *tmpstr = JS_NewStringCopyZ(cx, "1");
JS::RootedValue tmpval(cx);
tmpval = STRING_TO_JSVAL(tmpstr);
JS_SetProperty(cx, _onreadystateCallback, "readyState", tmpval);
jsval out = OBJECT_TO_JSVAL(_onreadystateCallback);
vp.set(out);
}
else
{
vp.set(JSVAL_NULL);
}
return true;
}
/**
* @brief Set Callback function coming from Javascript
*
*
*/
JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, onreadystatechange)
{
jsval callback = vp.get();
if (callback != JSVAL_NULL)
{
_onreadystateCallback = JSVAL_TO_OBJECT(callback);
JS_AddNamedObjectRoot(cx, &_onreadystateCallback, "onreadystateCallback");
}
return true;
}
/**
* @brief upload getter - TODO
*
* Placeholder for further implementations!!
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, upload)
{
vp.set(JSVAL_NULL);
return true;
}
/**
* @brief upload setter - TODO
*
* Placeholder for further implementations
*/
JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, upload)
{
vp.set(JSVAL_NULL);
return true;
}
/**
* @brief timeout getter - TODO
*
* Placeholder for further implementations
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, timeout)
{
vp.set(INT_TO_JSVAL(_timeout));
return true;
}
/**
* @brief timeout setter - TODO
*
* Placeholder for further implementations
*/
JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, timeout)
{
jsval timeout_ms = vp.get();
_timeout = JSVAL_TO_INT(timeout_ms);
//curl_easy_setopt(curlHandle, CURLOPT_CONNECTTIMEOUT_MS, timeout);
return true;
}
/**
* @brief get response type for actual XHR
*
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, responseType)
{
JSString* str = JS_NewStringCopyN(cx, "", 0);
vp.set(STRING_TO_JSVAL(str));
return true;
}
/**
* @brief responseXML getter - TODO
*
* Placeholder for further implementation.
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, responseXML)
{
vp.set(JSVAL_NULL);
return true;
}
/**
* @brief set response type for actual XHR
*
*
*/
JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, responseType)
{
jsval type = vp.get();
if (type.isString()) {
JSString* str = type.toString();
bool equal;
JS_StringEqualsAscii(cx, str, "text", &equal);
if (equal)
{
_responseType = ResponseType::STRING;
return true;
}
JS_StringEqualsAscii(cx, str, "arraybuffer", &equal);
if (equal)
{
_responseType = ResponseType::ARRAY_BUFFER;
return true;
}
JS_StringEqualsAscii(cx, str, "json", &equal);
if (equal)
{
_responseType = ResponseType::JSON;
return true;
}
// ignore the rest of the response types for now
return true;
}
JS_ReportError(cx, "Invalid response type");
return false;
}
/**
* @brief get readyState for actual XHR
*
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, readyState)
{
vp.set(INT_TO_JSVAL(_readyState));
return true;
}
/**
* @brief get status for actual XHR
*
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, status)
{
vp.set(INT_TO_JSVAL(_status));
return true;
}
/**
* @brief get statusText for actual XHR
*
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, statusText)
{
jsval strVal = std_string_to_jsval(cx, _statusText);
if (strVal != JSVAL_NULL)
{
vp.set(strVal);
return true;
}
else
{
JS_ReportError(cx, "Error trying to create JSString from data");
return false;
}
}
/**
* @brief get value of withCredentials property.
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, withCredentials)
{
vp.set(BOOLEAN_TO_JSVAL(_withCredentialsValue));
return true;
}
/**
* withCredentials - set value of withCredentials property.
*
*/
JS_BINDED_PROP_SET_IMPL(MinXmlHttpRequest, withCredentials)
{
jsval credential = vp.get();
if (credential != JSVAL_NULL)
{
_withCredentialsValue = JSVAL_TO_BOOLEAN(credential);
}
return true;
}
/**
* @brief get (raw) responseText
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, responseText)
{
if (_data)
{
jsval strVal = std_string_to_jsval(cx, _data);
if (strVal != JSVAL_NULL)
{
vp.set(strVal);
return true;
}
}
CCLOGERROR("ResponseText was empty, probably there is a network error!");
// Return an empty string
vp.set(std_string_to_jsval(cx, ""));
return true;
}
/**
* @brief get response of latest XHR
*
*/
JS_BINDED_PROP_GET_IMPL(MinXmlHttpRequest, response)
{
if (_responseType == ResponseType::JSON)
{
JS::RootedValue outVal(cx);
jsval strVal = std_string_to_jsval(cx, _data);
if (JS_ParseJSON(cx, JS_GetStringCharsZ(cx, JSVAL_TO_STRING(strVal)), _dataSize, &outVal))
{
vp.set(outVal);
return true;
}
}
else if (_responseType == ResponseType::ARRAY_BUFFER)
{
JSObject* tmp = JS_NewArrayBuffer(cx, _dataSize);
uint8_t* tmpData = JS_GetArrayBufferData(tmp);
memcpy((void*)tmpData, (const void*)_data, _dataSize);
jsval outVal = OBJECT_TO_JSVAL(tmp);
vp.set(outVal);
return true;
}
// by default, return text
return _js_get_responseText(cx, id, vp);
}
/**
* @brief initialize new xhr.
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, open)
{
if (argc >= 2)
{
jsval* argv = JS_ARGV(cx, vp);
const char* method;
const char* urlstr;
bool async = true;
JSString* jsMethod = JS_ValueToString(cx, argv[0]);
JSString* jsURL = JS_ValueToString(cx, argv[1]);
if (argc > 2) {
JS_ValueToBoolean(cx, argv[2], &async);
}
JSStringWrapper w1(jsMethod);
JSStringWrapper w2(jsURL);
method = w1.get();
urlstr = w2.get();
_url = urlstr;
_meth = method;
_readyState = 1;
_isAsync = async;
if (_url.length() > 5 && _url.compare(_url.length() - 5, 5, ".json") == 0)
{
_responseType = ResponseType::JSON;
}
if (_meth.compare("post") == 0 || _meth.compare("POST") == 0)
{
_httpRequest->setRequestType(cocos2d::network::HttpRequest::Type::POST);
}
else
{
_httpRequest->setRequestType(cocos2d::network::HttpRequest::Type::GET);
}
_httpRequest->setUrl(_url.c_str());
_isNetwork = true;
_readyState = OPENED;
return true;
}
JS_ReportError(cx, "invalid call: %s", __FUNCTION__);
return false;
}
/**
* @brief send xhr
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, send)
{
JSString *str = NULL;
std::string data;
// Clean up header map. New request, new headers!
_httpHeader.clear();
if (argc == 1)
{
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &str))
{
return false;
}
JSStringWrapper strWrap(str);
data = strWrap.get();
}
if (data.length() > 0 && (_meth.compare("post") == 0 || _meth.compare("POST") == 0))
{
_httpRequest->setRequestData(data.c_str(), data.length());
}
_setHttpRequestHeader();
_sendRequest(cx);
return true;
}
/**
* @brief abort function Placeholder!
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, abort)
{
return true;
}
/**
* @brief Get all response headers as a string
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, getAllResponseHeaders)
{
stringstream responseheaders;
string responseheader;
for (auto it = _httpHeader.begin(); it != _httpHeader.end(); ++it)
{
responseheaders << it->first << ": " << it->second << "\n";
}
responseheader = responseheaders.str();
jsval strVal = std_string_to_jsval(cx, responseheader);
if (strVal != JSVAL_NULL)
{
JS_SET_RVAL(cx, vp, strVal);
return true;
}
else
{
JS_ReportError(cx, "Error trying to create JSString from data");
return false;
}
return true;
}
/**
* @brief Get all response headers as a string
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, getResponseHeader)
{
JSString *header_value;
if (!JS_ConvertArguments(cx, argc, JS_ARGV(cx, vp), "S", &header_value)) {
return false;
};
std::string data;
JSStringWrapper strWrap(header_value);
data = strWrap.get();
stringstream streamdata;
streamdata << data;
string value = streamdata.str();
auto iter = _httpHeader.find(value);
if (iter != _httpHeader.end())
{
jsval js_ret_val = std_string_to_jsval(cx, iter->second);
JS_SET_RVAL(cx, vp, js_ret_val);
return true;
}
else {
JS_SET_RVAL(cx, vp, JSVAL_NULL);
return true;
}
}
/**
* @brief Set the given Fields to request Header.
*
*
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, setRequestHeader)
{
if (argc >= 2)
{
jsval* argv = JS_ARGV(cx, vp);
const char* field;
const char* value;
JSString* jsField = JS_ValueToString(cx, argv[0]);
JSString* jsValue = JS_ValueToString(cx, argv[1]);
JSStringWrapper w1(jsField);
JSStringWrapper w2(jsValue);
field = w1.get();
value = w2.get();
// Populate the request_header map.
_setRequestHeader(field, value);
return true;
}
return false;
}
/**
* @brief overrideMimeType function - TODO!
*
* Just a placeholder for further implementations.
*/
JS_BINDED_FUNC_IMPL(MinXmlHttpRequest, overrideMimeType)
{
return true;
}
/**
* @brief destructor for Javascript
*
*/
static void basic_object_finalize(JSFreeOp *freeOp, JSObject *obj)
{
CCLOG("basic_object_finalize %p ...", obj);
}
/**
* @brief Register XMLHttpRequest to be usable in JS and add properties and Mehtods.
* @param cx Global Spidermonkey JS Context.
* @param global Global Spidermonkey Javascript object.
*/
void MinXmlHttpRequest::_js_register(JSContext *cx, JSObject *global)
{
JSClass js_class = {
"XMLHttpRequest", JSCLASS_HAS_PRIVATE, JS_PropertyStub,
JS_DeletePropertyStub, JS_PropertyStub, JS_StrictPropertyStub,
JS_EnumerateStub, JS_ResolveStub, JS_ConvertStub,
basic_object_finalize, JSCLASS_NO_OPTIONAL_MEMBERS
};
MinXmlHttpRequest::js_class = js_class;
static JSPropertySpec props[] = {
JS_BINDED_PROP_DEF_ACCESSOR(MinXmlHttpRequest, onreadystatechange),
JS_BINDED_PROP_DEF_ACCESSOR(MinXmlHttpRequest, responseType),
JS_BINDED_PROP_DEF_ACCESSOR(MinXmlHttpRequest, withCredentials),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, readyState),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, status),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, statusText),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, responseText),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, responseXML),
JS_BINDED_PROP_DEF_GETTER(MinXmlHttpRequest, response),
{0, 0, 0, 0, 0}
};
static JSFunctionSpec funcs[] = {
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, open),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, abort),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, send),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, setRequestHeader),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, getAllResponseHeaders),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, getResponseHeader),
JS_BINDED_FUNC_FOR_DEF(MinXmlHttpRequest, overrideMimeType),
JS_FS_END
};
MinXmlHttpRequest::js_parent = NULL;
MinXmlHttpRequest::js_proto = JS_InitClass(cx, global, NULL, &MinXmlHttpRequest::js_class , MinXmlHttpRequest::_js_constructor, 0, props, funcs, NULL, NULL);
}

Просмотреть файл

@ -1,111 +0,0 @@
//
// XMLHTTPRequest.h
// XMLHttpRequest
//
// Created by Zynga 2013
//
// Heavy based on: https://github.com/funkaster/FakeWebGL/blob/master/FakeWebGL/WebGL/XMLHTTPRequest.h
// Copyright (c) 2012 Rolando Abarca. All rights reserved.
//
// 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 __FAKE_XMLHTTPREQUEST_H__
#define __FAKE_XMLHTTPREQUEST_H__
#include "jsapi.h"
#include "jsfriendapi.h"
#include "network/HttpClient.h"
#include "js_bindings_config.h"
#include "ScriptingCore.h"
#include "jsb_helper.h"
class MinXmlHttpRequest : public cocos2d::Ref
{
public:
enum class ResponseType
{
STRING,
ARRAY_BUFFER,
BLOB,
DOCUMENT,
JSON
};
// Ready States (http://www.w3.org/TR/XMLHttpRequest/#interface-xmlhttprequest)
static const unsigned short UNSENT = 0;
static const unsigned short OPENED = 1;
static const unsigned short HEADERS_RECEIVED = 2;
static const unsigned short LOADING = 3;
static const unsigned short DONE = 4;
MinXmlHttpRequest();
~MinXmlHttpRequest();
JS_BINDED_CLASS_GLUE(MinXmlHttpRequest);
JS_BINDED_CONSTRUCTOR(MinXmlHttpRequest);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, onreadystatechange);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, responseType);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, withCredentials);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, upload);
JS_BINDED_PROP_ACCESSOR(MinXmlHttpRequest, timeout);
JS_BINDED_PROP_GET(MinXmlHttpRequest, readyState);
JS_BINDED_PROP_GET(MinXmlHttpRequest, status);
JS_BINDED_PROP_GET(MinXmlHttpRequest, statusText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseText);
JS_BINDED_PROP_GET(MinXmlHttpRequest, response);
JS_BINDED_PROP_GET(MinXmlHttpRequest, responseXML);
JS_BINDED_FUNC(MinXmlHttpRequest, open);
JS_BINDED_FUNC(MinXmlHttpRequest, send);
JS_BINDED_FUNC(MinXmlHttpRequest, abort);
JS_BINDED_FUNC(MinXmlHttpRequest, getAllResponseHeaders);
JS_BINDED_FUNC(MinXmlHttpRequest, getResponseHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, setRequestHeader);
JS_BINDED_FUNC(MinXmlHttpRequest, overrideMimeType);
void handle_requestResponse(cocos2d::network::HttpClient *sender, cocos2d::network::HttpResponse *response);
private:
void _gotHeader(std::string header);
void _setRequestHeader(const char* field, const char* value);
void _setHttpRequestHeader();
void _sendRequest(JSContext *cx);
std::string _url;
JSContext* _cx;
std::string _meth;
std::string _type;
char* _data;
uint32_t _dataSize;
JSObject* _onreadystateCallback;
int _readyState;
int _status;
std::string _statusText;
ResponseType _responseType;
unsigned _timeout;
bool _isAsync;
cocos2d::network::HttpRequest* _httpRequest;
bool _isNetwork;
bool _withCredentialsValue;
std::unordered_map<std::string, std::string> _httpHeader;
std::unordered_map<std::string, std::string> _requestHeader;
};
#endif

Просмотреть файл

@ -1,396 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013 James Chen
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 "jsb_websocket.h"
#include "cocos2d.h"
#include "network/WebSocket.h"
#include "spidermonkey_specifics.h"
#include "ScriptingCore.h"
#include "cocos2d_specifics.hpp"
using namespace cocos2d::network;
/*
[Constructor(in DOMString url, in optional DOMString protocols)]
[Constructor(in DOMString url, in optional DOMString[] protocols)]
interface WebSocket {
readonly attribute DOMString url;
// ready state
const unsigned short CONNECTING = 0;
const unsigned short OPEN = 1;
const unsigned short CLOSING = 2;
const unsigned short CLOSED = 3;
readonly attribute unsigned short readyState;
readonly attribute unsigned long bufferedAmount;
// networking
attribute Function onopen;
attribute Function onmessage;
attribute Function onerror;
attribute Function onclose;
readonly attribute DOMString protocol;
void send(in DOMString data);
void close();
};
WebSocket implements EventTarget;
*/
class JSB_WebSocketDelegate : public WebSocket::Delegate
{
public:
virtual void onOpen(WebSocket* ws)
{
js_proxy_t * p = jsb_get_native_proxy(ws);
if (!p) return;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
JS::RootedValue vp(cx);
vp = c_string_to_jsval(cx, "open");
JS_SetProperty(cx, jsobj, "type", vp);
jsval args = OBJECT_TO_JSVAL(jsobj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "onopen", 1, &args);
}
virtual void onMessage(WebSocket* ws, const WebSocket::Data& data)
{
js_proxy_t * p = jsb_get_native_proxy(ws);
if (!p) return;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
JS::RootedValue vp(cx);
vp = c_string_to_jsval(cx, "message");
JS_SetProperty(cx, jsobj, "type", vp);
jsval args = OBJECT_TO_JSVAL(jsobj);
if (data.isBinary)
{// data is binary
JSObject* buffer = JS_NewArrayBuffer(cx, data.len);
uint8_t* bufdata = JS_GetArrayBufferData(buffer);
memcpy((void*)bufdata, (void*)data.bytes, data.len);
JS::RootedValue dataVal(cx);
dataVal = OBJECT_TO_JSVAL(buffer);
JS_SetProperty(cx, jsobj, "data", dataVal);
}
else
{// data is string
JS::RootedValue dataVal(cx);
dataVal = c_string_to_jsval(cx, data.bytes);
JS_SetProperty(cx, jsobj, "data", dataVal);
}
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "onmessage", 1, &args);
}
virtual void onClose(WebSocket* ws)
{
js_proxy_t * p = jsb_get_native_proxy(ws);
if (!p) return;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
JS::RootedValue vp(cx);
vp = c_string_to_jsval(cx, "close");
JS_SetProperty(cx, jsobj, "type", vp);
jsval args = OBJECT_TO_JSVAL(jsobj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "onclose", 1, &args);
js_proxy_t* jsproxy = jsb_get_js_proxy(p->obj);
JS_RemoveObjectRoot(cx, &jsproxy->obj);
jsb_remove_proxy(p, jsproxy);
CC_SAFE_DELETE(ws);
}
virtual void onError(WebSocket* ws, const WebSocket::ErrorCode& error)
{
js_proxy_t * p = jsb_get_native_proxy(ws);
if (!p) return;
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
JSContext* cx = ScriptingCore::getInstance()->getGlobalContext();
JSObject* jsobj = JS_NewObject(cx, NULL, NULL, NULL);
JS::RootedValue vp(cx);
vp = c_string_to_jsval(cx, "error");
JS_SetProperty(cx, jsobj, "type", vp);
jsval args = OBJECT_TO_JSVAL(jsobj);
ScriptingCore::getInstance()->executeFunctionWithOwner(OBJECT_TO_JSVAL(_JSDelegate), "onerror", 1, &args);
}
void setJSDelegate(JSObject* pJSDelegate)
{
_JSDelegate = pJSDelegate;
}
private:
JSObject* _JSDelegate;
};
JSClass *js_cocos2dx_websocket_class;
JSObject *js_cocos2dx_websocket_prototype;
void js_cocos2dx_WebSocket_finalize(JSFreeOp *fop, JSObject *obj) {
CCLOG("jsbindings: finalizing JS object %p (WebSocket)", obj);
}
bool js_cocos2dx_extension_WebSocket_send(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if(argc == 1){
do
{
if (JSVAL_IS_STRING(argv[0]))
{
std::string data;
jsval_to_std_string(cx, argv[0], &data);
cobj->send(data);
break;
}
if (argv[0].isObject())
{
uint8_t *bufdata = NULL;
uint32_t len = 0;
JSObject* jsobj = JSVAL_TO_OBJECT(argv[0]);
if (JS_IsArrayBufferObject(jsobj))
{
bufdata = JS_GetArrayBufferData(jsobj);
len = JS_GetArrayBufferByteLength(jsobj);
}
else if (JS_IsArrayBufferViewObject(jsobj))
{
bufdata = (uint8_t*)JS_GetArrayBufferViewData(jsobj);
len = JS_GetArrayBufferViewByteLength(jsobj);
}
if (bufdata && len > 0)
{
cobj->send(bufdata, len);
break;
}
}
JS_ReportError(cx, "data type to be sent is unsupported.");
} while (0);
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return true;
}
bool js_cocos2dx_extension_WebSocket_close(JSContext *cx, uint32_t argc, jsval *vp){
JSObject *obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy = jsb_get_js_proxy(obj);
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if(argc == 0){
cobj->close();
JS_SET_RVAL(cx, vp, JSVAL_VOID);
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
bool js_cocos2dx_extension_WebSocket_constructor(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
if (argc == 1 || argc == 2)
{
std::string url;
do {
bool ok = jsval_to_std_string(cx, argv[0], &url);
JSB_PRECONDITION2( ok, cx, false, "Error processing arguments");
} while (0);
JSObject *obj = JS_NewObject(cx, js_cocos2dx_websocket_class, js_cocos2dx_websocket_prototype, NULL);
WebSocket* cobj = new WebSocket();
JSB_WebSocketDelegate* delegate = new JSB_WebSocketDelegate();
delegate->setJSDelegate(obj);
if (argc == 2)
{
std::vector<std::string> protocols;
if (JSVAL_IS_STRING(argv[1]))
{
std::string protocol;
do {
bool ok = jsval_to_std_string(cx, argv[1], &protocol);
JSB_PRECONDITION2( ok, cx, false, "Error processing arguments");
} while (0);
protocols.push_back(protocol);
}
else if (argv[1].isObject())
{
bool ok = true;
JSObject* arg2 = JSVAL_TO_OBJECT(argv[1]);
JSB_PRECONDITION(JS_IsArrayObject( cx, arg2 ), "Object must be an array");
uint32_t len = 0;
JS_GetArrayLength(cx, arg2, &len);
for( uint32_t i=0; i< len;i++ )
{
JS::RootedValue valarg(cx);
JS_GetElement(cx, arg2, i, &valarg);
std::string protocol;
do {
ok = jsval_to_std_string(cx, valarg, &protocol);
JSB_PRECONDITION2( ok, cx, false, "Error processing arguments");
} while (0);
protocols.push_back(protocol);
}
}
cobj->init(*delegate, url, &protocols);
}
else
{
cobj->init(*delegate, url);
}
JS_DefineProperty(cx, obj, "URL", argv[0]
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
//protocol not support yet (always return "")
JS_DefineProperty(cx, obj, "protocol", c_string_to_jsval(cx, "")
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
// link the native object with the javascript object
js_proxy_t *p = jsb_new_proxy(cobj, obj);
JS_AddNamedObjectRoot(cx, &p->obj, "WebSocket");
JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj));
return true;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 0);
return false;
}
static bool js_cocos2dx_extension_WebSocket_get_readyState(JSContext *cx, JS::HandleObject obj, JS::HandleId id, JS::MutableHandleValue vp)
{
JSObject* jsobj = obj.get();
js_proxy_t *proxy = jsb_get_js_proxy(jsobj);
WebSocket* cobj = (WebSocket *)(proxy ? proxy->ptr : NULL);
JSB_PRECONDITION2( cobj, cx, false, "Invalid Native Object");
if (cobj) {
vp.set(INT_TO_JSVAL((int)cobj->getReadyState()));
return true;
} else {
JS_ReportError(cx, "Error: WebSocket instance is invalid.");
return false;
}
}
void register_jsb_websocket(JSContext *cx, JSObject *global) {
js_cocos2dx_websocket_class = (JSClass *)calloc(1, sizeof(JSClass));
js_cocos2dx_websocket_class->name = "WebSocket";
js_cocos2dx_websocket_class->addProperty = JS_PropertyStub;
js_cocos2dx_websocket_class->delProperty = JS_DeletePropertyStub;
js_cocos2dx_websocket_class->getProperty = JS_PropertyStub;
js_cocos2dx_websocket_class->setProperty = JS_StrictPropertyStub;
js_cocos2dx_websocket_class->enumerate = JS_EnumerateStub;
js_cocos2dx_websocket_class->resolve = JS_ResolveStub;
js_cocos2dx_websocket_class->convert = JS_ConvertStub;
js_cocos2dx_websocket_class->finalize = js_cocos2dx_WebSocket_finalize;
js_cocos2dx_websocket_class->flags = JSCLASS_HAS_RESERVED_SLOTS(2);
static JSPropertySpec properties[] = {
{"readyState", 0, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_SHARED, JSOP_WRAPPER(js_cocos2dx_extension_WebSocket_get_readyState), NULL},
{0, 0, 0, 0, 0}
};
static JSFunctionSpec funcs[] = {
JS_FN("send",js_cocos2dx_extension_WebSocket_send, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FN("close",js_cocos2dx_extension_WebSocket_close, 0, JSPROP_PERMANENT | JSPROP_ENUMERATE),
JS_FS_END
};
static JSFunctionSpec st_funcs[] = {
JS_FS_END
};
js_cocos2dx_websocket_prototype = JS_InitClass(
cx, global,
NULL,
js_cocos2dx_websocket_class,
js_cocos2dx_extension_WebSocket_constructor, 0, // constructor
properties,
funcs,
NULL, // no static properties
st_funcs);
JSObject* jsclassObj = JSVAL_TO_OBJECT(anonEvaluate(cx, global, "(function () { return WebSocket; })()"));
JS_DefineProperty(cx, jsclassObj, "CONNECTING", INT_TO_JSVAL((int)WebSocket::State::CONNECTING)
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
JS_DefineProperty(cx, jsclassObj, "OPEN", INT_TO_JSVAL((int)WebSocket::State::OPEN)
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
JS_DefineProperty(cx, jsclassObj, "CLOSING", INT_TO_JSVAL((int)WebSocket::State::CLOSING)
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
JS_DefineProperty(cx, jsclassObj, "CLOSED", INT_TO_JSVAL((int)WebSocket::State::CLOSED)
, NULL, NULL, JSPROP_ENUMERATE | JSPROP_PERMANENT | JSPROP_READONLY);
// make the class enumerable in the registered namespace
//FIXME: bool found;
// JS_SetPropertyAttributes(cx, global, "WebSocket", JSPROP_ENUMERATE | JSPROP_READONLY, &found);
}

Просмотреть файл

@ -1,34 +0,0 @@
/****************************************************************************
Copyright (c) 2013 cocos2d-x.org
Copyright (c) 2013 James Chen
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 __jsb_websocket__
#define __jsb_websocket__
#include "jsapi.h"
#include "jsfriendapi.h"
void register_jsb_websocket(JSContext* cx, JSObject* global);
#endif /* defined(__jsb_websocket__) */

Просмотреть файл

@ -1,115 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="jsb_websocket.cpp" />
<ClCompile Include="XMLHTTPRequest.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="jsb_websocket.h" />
<ClInclude Include="XMLHTTPRequest.h" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{3BEC13F5-E227-4D80-BC77-1C857F83BCFC}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBindingForNetwork</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\network;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\websockets\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\network;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\websockets\include\win32;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="jsb_websocket.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="XMLHTTPRequest.cpp">
<Filter>manual</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="jsb_websocket.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="XMLHTTPRequest.h">
<Filter>manual</Filter>
</ClInclude>
</ItemGroup>
</Project>

Просмотреть файл

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ShowAllFiles>false</ShowAllFiles>
</PropertyGroup>
</Project>

Просмотреть файл

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto.cpp" />
<ClCompile Include="..\cocos2d_specifics.cpp" />
<ClCompile Include="..\jsb_opengl_functions.cpp" />
<ClCompile Include="..\jsb_opengl_manual.cpp" />
<ClCompile Include="..\jsb_opengl_registration.cpp" />
<ClCompile Include="..\js_bindings_core.cpp" />
<ClCompile Include="..\js_bindings_opengl.cpp" />
<ClCompile Include="..\js_manual_conversions.cpp" />
<ClCompile Include="..\ScriptingCore.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto.hpp" />
<ClInclude Include="..\cocos2d_specifics.hpp" />
<ClInclude Include="..\jsb_helper.h" />
<ClInclude Include="..\jsb_opengl_functions.h" />
<ClInclude Include="..\jsb_opengl_manual.h" />
<ClInclude Include="..\jsb_opengl_registration.h" />
<ClInclude Include="..\js_bindings_config.h" />
<ClInclude Include="..\js_bindings_core.h" />
<ClInclude Include="..\js_bindings_opengl.h" />
<ClInclude Include="..\js_manual_conversions.h" />
<ClInclude Include="..\ScriptingCore.h" />
<ClInclude Include="..\spidermonkey_specifics.h" />
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto_api.js" />
<None Include="..\..\script\jsb.js" />
<None Include="..\..\script\jsb_chipmunk.js" />
<None Include="..\..\script\jsb_cocos2d.js" />
<None Include="..\..\script\jsb_cocos2d_extension.js" />
<None Include="..\..\script\jsb_cocosbuilder.js" />
<None Include="..\..\script\jsb_debugger.js" />
<None Include="..\..\script\jsb_opengl.js" />
<None Include="..\..\script\jsb_sys.js" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{39379840-825A-45A0-B363-C09FFEF864BD}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<RootNamespace>libJSBinding</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '10.0'">v100</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0'">v110</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' == '11.0' and exists('$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A')">v110_xp</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
<Import Project="..\..\..\..\2d\cocos2d_headers.props" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<IntDir>$(Configuration).win32\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_LIB;COCOS2D_DEBUG=1;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<MinimalRebuild>false</MinimalRebuild>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<PrecompiledHeader>
</PrecompiledHeader>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_LIB;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ProjectDir)..;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\audio\include;$(EngineRoot)cocos\scripting\auto-generated\js-bindings;$(EngineRoot)external\spidermonkey\include\win32;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4068;4101;4800;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<PreBuildEvent>
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
xcopy /Y /Q "$(ProjectDir)..\..\..\..\..\external\sqlite3\libraries\win32\*.*" "$(OutDir)"</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

Просмотреть файл

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="generated">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="manual">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="js">
<UniqueIdentifier>{e19c6b81-737e-46ca-a683-a6d1db50a29c}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\cocos2d_specifics.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\js_bindings_core.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\js_manual_conversions.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\ScriptingCore.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\js_bindings_opengl.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\jsb_opengl_registration.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\jsb_opengl_manual.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\jsb_opengl_functions.cpp">
<Filter>manual</Filter>
</ClCompile>
<ClCompile Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto.cpp">
<Filter>generated</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\cocos2d_specifics.hpp">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\js_bindings_config.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\js_bindings_core.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\js_manual_conversions.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\ScriptingCore.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\spidermonkey_specifics.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\js_bindings_opengl.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\jsb_opengl_functions.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\jsb_opengl_manual.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\jsb_opengl_registration.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\jsb_helper.h">
<Filter>manual</Filter>
</ClInclude>
<ClInclude Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto.hpp">
<Filter>generated</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="..\..\..\auto-generated\js-bindings\jsb_cocos2dx_auto_api.js">
<Filter>generated</Filter>
</None>
<None Include="..\..\script\jsb.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_chipmunk.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_cocos2d.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_cocos2d_extension.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_opengl.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_sys.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_debugger.js">
<Filter>js</Filter>
</None>
<None Include="..\..\script\jsb_cocosbuilder.js">
<Filter>js</Filter>
</None>
</ItemGroup>
</Project>

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше