mirror of https://github.com/axmolengine/axmol.git
Merge branch 'gles20' of git://github.com/cocos2d/cocos2d-x into gles20
This commit is contained in:
commit
58ea948cc8
151
build-win32.bat
151
build-win32.bat
|
@ -1,72 +1,79 @@
|
|||
@echo off
|
||||
|
||||
echo./*
|
||||
echo.* Check VC++ environment...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
if defined VS90COMNTOOLS (
|
||||
set VSVARS="%VS90COMNTOOLS%vsvars32.bat"
|
||||
set VC_VER=90
|
||||
) else if defined VS100COMNTOOLS (
|
||||
set VSVARS="%VS100COMNTOOLS%vsvars32.bat"
|
||||
set VC_VER=100
|
||||
)
|
||||
|
||||
if not defined VSVARS (
|
||||
echo Can't find VC2008 or VC2010 installed!
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Building cocos2d-x library binary, please wait a while...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
call %VSVARS%
|
||||
if %VC_VER%==90 (
|
||||
vcbuild /MP /M10 cocos2d-win32.vc2008.sln $ALL
|
||||
) else if %VC_VER%==100 (
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Debug"
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Release"
|
||||
) else (
|
||||
echo Script error.
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Check the cocos2d-win32 application "TestCpp.exe" ...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
cd ".\Release.win32\"
|
||||
|
||||
set CC_TEST_BIN=TestCpp.exe
|
||||
|
||||
set CC_TEST_RES=..\samples\TestCpp\Resources\*.*
|
||||
set CC_HELLOWORLD_RES=..\samples\HelloCpp\Resources\*.*
|
||||
set CC_HELLOLUA_RES=..\samples\HelloLua\Resources\*.*
|
||||
set CC_TESTJS_RES=..\samples\TestJavascript\Resources\*.*
|
||||
|
||||
if not exist "%CC_TEST_BIN%" (
|
||||
echo Can't find the binary "TestCpp.exe", is there build error?
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Run cocos2d-win32 tests.exe and view Cocos2d-x Application Wizard for Visual Studio User Guide.
|
||||
echo.*/
|
||||
echo.
|
||||
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||
|
||||
call "%CC_TEST_BIN%"
|
||||
start http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide
|
||||
goto EOF
|
||||
|
||||
:ERROR
|
||||
pause
|
||||
|
||||
:EOF
|
||||
@echo off
|
||||
|
||||
echo./*
|
||||
echo.* Check VC++ environment...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
if defined VS110COMNTOOLS (
|
||||
set VSVARS="%VS110COMNTOOLS%vsvars32.bat"
|
||||
set VC_VER=110
|
||||
) else if defined VS100COMNTOOLS (
|
||||
set VSVARS="%VS100COMNTOOLS%vsvars32.bat"
|
||||
set VC_VER=100
|
||||
) else if defined VS90COMNTOOLS (
|
||||
set VSVARS="%VS90COMNTOOLS%vsvars32.bat"
|
||||
set VC_VER=90
|
||||
)
|
||||
|
||||
if not defined VSVARS (
|
||||
echo Can't find VC2008, VC2010 or VC2012 installed!
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Building cocos2d-x library binary, please wait a while...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
call %VSVARS%
|
||||
if %VC_VER%==90 (
|
||||
vcbuild /MP /M10 cocos2d-win32.vc2008.sln $ALL
|
||||
) else if %VC_VER%==100 (
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Debug"
|
||||
msbuild cocos2d-win32.vc2010.sln /p:Configuration="Release"
|
||||
) else if %VC_VER%==110 (
|
||||
msbuild cocos2d-win32.vc2012.sln /t:Clean
|
||||
msbuild cocos2d-win32.vc2012.sln /p:Configuration="Debug" /m
|
||||
msbuild cocos2d-win32.vc2012.sln /p:Configuration="Release" /m
|
||||
) else (
|
||||
echo Script error.
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Check the cocos2d-win32 application "TestCpp.exe" ...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
cd ".\Release.win32\"
|
||||
|
||||
set CC_TEST_BIN=TestCpp.exe
|
||||
|
||||
set CC_TEST_RES=..\samples\TestCpp\Resources\*.*
|
||||
set CC_HELLOWORLD_RES=..\samples\HelloCpp\Resources\*.*
|
||||
set CC_HELLOLUA_RES=..\samples\HelloLua\Resources\*.*
|
||||
set CC_TESTJS_RES=..\samples\TestJavascript\Resources\*.*
|
||||
|
||||
if not exist "%CC_TEST_BIN%" (
|
||||
echo Can't find the binary "TestCpp.exe", is there build error?
|
||||
goto ERROR
|
||||
)
|
||||
|
||||
echo./*
|
||||
echo.* Run cocos2d-win32 tests.exe and view Cocos2d-x Application Wizard for Visual Studio User Guide.
|
||||
echo.*/
|
||||
echo.
|
||||
xcopy /E /Y /Q "%CC_TEST_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOWORLD_RES%" .
|
||||
xcopy /E /Y /Q "%CC_HELLOLUA_RES%" .
|
||||
xcopy /E /Y /Q "%CC_TESTJS_RES%" .
|
||||
|
||||
call "%CC_TEST_BIN%"
|
||||
start http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide
|
||||
goto EOF
|
||||
|
||||
:ERROR
|
||||
pause
|
||||
|
||||
:EOF
|
||||
|
|
|
@ -0,0 +1,188 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "external\Box2D\proj.win32\Box2D.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "external\chipmunk\proj.win32\chipmunk.vcxproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosDenshion", "CocosDenshion\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "cocos2dx\proj.win32\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "scripting\lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "samples\HelloLua\proj.win32\HelloLua.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp", "samples\HelloCpp\proj.win32\HelloCpp.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\proj.win32\TestCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
|
||||
EndProjectSection
|
||||
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}") = "TestLua", "samples\TestLua\proj.win32\TestLua.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159}
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
|
||||
{929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116}
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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
|
||||
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.Build.0 = Release|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.Build.0 = Release|Win32
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{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
|
||||
{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
|
||||
{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
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libBox2D", "external\Box2D\proj.win32\Box2D.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libchipmunk", "external\chipmunk\proj.win32\chipmunk.vcxproj", "{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libCocosDenshion", "CocosDenshion\proj.win32\CocosDenshion.vcxproj", "{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "cocos2dx\proj.win32\cocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblua", "scripting\lua\proj.win32\liblua.vcxproj", "{DDC3E27F-004D-4DD4-9DD3-931A013D2159}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloLua", "samples\HelloLua\proj.win32\HelloLua.vcxproj", "{13E55395-94A2-4CD9-BFC2-1A051F80C17D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HelloCpp", "samples\HelloCpp\proj.win32\HelloCpp.vcxproj", "{B8BF9E81-35FD-4582-BA1C-B85FA365BABB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestCpp", "samples\TestCpp\proj.win32\TestCpp.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestJavascript", "samples\TestJavascript\proj.win32\TestJavascript.vcxproj", "{D0F06A44-A245-4D13-A498-0120C203B539}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
|
||||
EndProjectSection
|
||||
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}") = "TestLua", "samples\TestLua\proj.win32\TestLua.win32.vcxproj", "{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28} = {21B2C324-891F-48EA-AD1A-5AE13DE12E28}
|
||||
{DDC3E27F-004D-4DD4-9DD3-931A013D2159} = {DDC3E27F-004D-4DD4-9DD3-931A013D2159}
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25} = {207BC7A9-CCF1-4F2F-A04D-45F72242AE25}
|
||||
{929480E7-23C0-4DF6-8456-096D71547116} = {929480E7-23C0-4DF6-8456-096D71547116}
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{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
|
||||
{929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{207BC7A9-CCF1-4F2F-A04D-45F72242AE25}.Release|Win32.Build.0 = Release|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}.Release|Win32.Build.0 = Release|Win32
|
||||
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{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
|
||||
{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
|
||||
{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
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D0F06A44-A245-4D13-A498-0120C203B539}.Release|Win32.Build.0 = Release|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{21B2C324-891F-48EA-AD1A-5AE13DE12E28}.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
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -101,7 +101,6 @@ bool CCAtlasNode::initWithTileFile(const char *tile, unsigned int tileWidth, uns
|
|||
if (! m_pTextureAtlas)
|
||||
{
|
||||
CCLOG("cocos2d: Could not initialize CCAtlasNode. Invalid Texture.");
|
||||
delete this;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ bool CCGridBase::initWithSize(const ccGridSize& gridSize)
|
|||
if (! pTexture)
|
||||
{
|
||||
CCLOG("cocos2d: CCGrid: error creating texture");
|
||||
delete this;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -1260,6 +1260,12 @@ void CCLabelBMFont::updateLabel()
|
|||
{
|
||||
float lineWidth = 0.0f;
|
||||
unsigned int line_length = last_line.size();
|
||||
// if last line is empty we must just increase lineNumber and work with next line
|
||||
if (line_length == 0)
|
||||
{
|
||||
lineNumber++;
|
||||
continue;
|
||||
}
|
||||
int index = i + line_length - 1 + lineNumber;
|
||||
if (index < 0) continue;
|
||||
|
||||
|
|
|
@ -22,8 +22,23 @@
|
|||
using namespace std;
|
||||
|
||||
struct TextLine {
|
||||
string sLineStr;
|
||||
int iLineWidth;
|
||||
wchar_t* text;
|
||||
};
|
||||
|
||||
struct FontTableItem {
|
||||
char* family_name;
|
||||
char* style_name;
|
||||
char* filename;
|
||||
};
|
||||
|
||||
const int fontTableItems = 4;
|
||||
const char* fontPath = "/usr/share/fonts/truetype/";
|
||||
FontTableItem fontsTable[fontTableItems] = {
|
||||
{ "Serif", "Medium", "freefont/FreeSerif.ttf" },
|
||||
{ "Sans", "Medium", "freefont/FreeSans.ttf" },
|
||||
{ "WenQuanYi Micro Hei", "Regular", "wqy/wqy-microhei.ttc" },
|
||||
{ "WenQuanYi Zen Hei", "Regular", "wqy/wqy-zenhei.ttc" },
|
||||
};
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
@ -43,89 +58,134 @@ public:
|
|||
// if (m_pData) {
|
||||
// delete m_pData;
|
||||
// }
|
||||
|
||||
reset();
|
||||
}
|
||||
|
||||
void reset() {
|
||||
iMaxLineWidth = 0;
|
||||
iMaxLineHeight = 0;
|
||||
vLines.clear();
|
||||
//Free all text lines
|
||||
size_t size = vLines.size();
|
||||
for (int i=0; i<size; ++i) {
|
||||
TextLine line = vLines[i];
|
||||
free(line.text);
|
||||
}
|
||||
vLines.clear();
|
||||
}
|
||||
|
||||
void buildLine(stringstream& ss, FT_Face face, int iCurXCursor, char cLastChar) {
|
||||
TextLine oTempLine;
|
||||
ss << '\0';
|
||||
oTempLine.sLineStr = ss.str();
|
||||
//get last glyph
|
||||
FT_Load_Glyph(face, FT_Get_Char_Index(face, cLastChar),
|
||||
FT_LOAD_DEFAULT);
|
||||
int utf8(char **p)
|
||||
{
|
||||
if ((**p & 0x80) == 0x00)
|
||||
{
|
||||
int a = *((*p)++);
|
||||
|
||||
oTempLine.iLineWidth = iCurXCursor - SHIFT6((face->glyph->metrics.horiAdvance + face->glyph->metrics.horiBearingX - face->glyph->metrics.width))/*-iInterval*/;//TODO interval
|
||||
return a;
|
||||
}
|
||||
if ((**p & 0xE0) == 0xC0)
|
||||
{
|
||||
int a = *((*p)++) & 0x1F;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 6) | b;
|
||||
}
|
||||
if ((**p & 0xF0) == 0xE0)
|
||||
{
|
||||
int a = *((*p)++) & 0x0F;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
int c = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 12) | (b << 6) | c;
|
||||
}
|
||||
if ((**p & 0xF8) == 0xF0)
|
||||
{
|
||||
int a = *((*p)++) & 0x07;
|
||||
int b = *((*p)++) & 0x3F;
|
||||
int c = *((*p)++) & 0x3F;
|
||||
int d = *((*p)++) & 0x3F;
|
||||
|
||||
return (a << 18) | (b << 12) | (c << 8) | d;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void buildLine(wchar_t* buf, size_t buf_len, FT_Face face, int iCurXCursor, FT_UInt cLastChar) {
|
||||
TextLine oTempLine;
|
||||
wchar_t* text = (wchar_t*)malloc(sizeof(wchar_t) * (buf_len+1));
|
||||
memcpy(text, buf, sizeof(wchar_t) * buf_len);
|
||||
text[buf_len] = '\0';
|
||||
oTempLine.text = text;
|
||||
|
||||
//get last glyph
|
||||
int iError = FT_Load_Char(face, cLastChar, FT_LOAD_DEFAULT);
|
||||
|
||||
oTempLine.iLineWidth = iCurXCursor;// - SHIFT6((face->glyph->metrics.horiAdvance + face->glyph->metrics.horiBearingX - face->glyph->metrics.width))/*-iInterval*/;//TODO interval
|
||||
iMaxLineWidth = MAX(iMaxLineWidth, oTempLine.iLineWidth);
|
||||
|
||||
ss.clear();
|
||||
ss.str("");
|
||||
vLines.push_back(oTempLine);
|
||||
vLines.push_back(oTempLine);
|
||||
}
|
||||
|
||||
bool divideString(FT_Face face, const char* sText, int iMaxWidth, int iMaxHeight) {
|
||||
const char* pText = sText;
|
||||
int iError = 0;
|
||||
int iCurXCursor, iCurYCursor;
|
||||
iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, *pText),
|
||||
FT_LOAD_DEFAULT);
|
||||
const char* pText = sText;
|
||||
|
||||
FT_UInt unicode = utf8((char**)&pText);
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
return false;
|
||||
}
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
|
||||
//init stringstream
|
||||
stringstream ss;
|
||||
FT_UInt cLastCh = 0;
|
||||
|
||||
int cLastCh = 0;
|
||||
pText = sText;
|
||||
size_t text_len = 0;
|
||||
wchar_t* text_buf = (wchar_t*) malloc(sizeof(wchar_t) * strlen(sText));
|
||||
while (unicode=utf8((char**)&pText)) {
|
||||
if (unicode == '\n') {
|
||||
buildLine(text_buf, text_len, face, iCurXCursor, cLastCh);
|
||||
text_len = 0;
|
||||
|
||||
while (*pText != '\0') {
|
||||
if (*pText == '\n') {
|
||||
buildLine(ss, face, iCurXCursor, cLastCh);
|
||||
|
||||
pText++;
|
||||
iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, *pText),
|
||||
FT_LOAD_DEFAULT);
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
}
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
continue;
|
||||
}
|
||||
|
||||
iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, *pText),
|
||||
FT_LOAD_DEFAULT);
|
||||
iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
//break;
|
||||
}
|
||||
|
||||
//check its width
|
||||
//divide it when exceeding
|
||||
if ((iMaxWidth > 0
|
||||
&& iCurXCursor + SHIFT6(face->glyph->metrics.width)
|
||||
> iMaxWidth)) {
|
||||
buildLine(ss, face , iCurXCursor, cLastCh);
|
||||
buildLine(text_buf, text_len, face , iCurXCursor, cLastCh);
|
||||
text_len = 0;
|
||||
|
||||
iCurXCursor = -SHIFT6(face->glyph->metrics.horiBearingX);
|
||||
}
|
||||
|
||||
cLastCh = *pText;
|
||||
ss << *pText;
|
||||
cLastCh = unicode;
|
||||
text_buf[text_len] = unicode;
|
||||
++text_len;
|
||||
iCurXCursor += SHIFT6(face->glyph->metrics.horiAdvance) + iInterval;
|
||||
pText++;
|
||||
|
||||
}
|
||||
|
||||
if (iError) {
|
||||
free(text_buf);
|
||||
return false;
|
||||
}
|
||||
|
||||
buildLine(ss,face, iCurXCursor, cLastCh);
|
||||
buildLine(text_buf, text_len, face, iCurXCursor, cLastCh);
|
||||
free(text_buf);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -137,11 +197,10 @@ public:
|
|||
* while -1 means fail
|
||||
*
|
||||
*/
|
||||
int computeLineStart(FT_Face face, CCImage::ETextAlign eAlignMask, char cText,
|
||||
int computeLineStart(FT_Face face, CCImage::ETextAlign eAlignMask, FT_UInt unicode,
|
||||
int iLineIndex) {
|
||||
int iRet;
|
||||
int iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, cText),
|
||||
FT_LOAD_DEFAULT);
|
||||
int iError = FT_Load_Char(face, unicode, FT_LOAD_DEFAULT);
|
||||
if (iError) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -179,11 +238,33 @@ public:
|
|||
return iRet;
|
||||
}
|
||||
|
||||
char* getFontFile(const char* family_name) {
|
||||
char* ret = NULL;
|
||||
for (int i=0; i<fontTableItems; ++i) {
|
||||
FontTableItem* item = &fontsTable[i];
|
||||
if (strcmp(item->family_name, family_name) == 0) {
|
||||
size_t len = strlen(fontPath) + strlen(item->filename) + 1;
|
||||
ret = (char*) malloc(len);
|
||||
snprintf(ret, len, "%s%s", fontPath, item->filename);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Return a default font , if font is not found
|
||||
if (ret == NULL) {
|
||||
FontTableItem* item = &fontsTable[0];
|
||||
size_t len = strlen(fontPath) + strlen(item->filename) + 1;
|
||||
ret = (char*) malloc(len);
|
||||
snprintf(ret, len, "%s%s", fontPath, item->filename);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool getBitmap(const char *text, int nWidth, int nHeight, CCImage::ETextAlign eAlignMask, const char * pFontName, float fontSize) {
|
||||
FT_Face face;
|
||||
FT_Error iError;
|
||||
|
||||
const char* pText = text;
|
||||
//data will be deleted by CCImage
|
||||
// if (m_pData) {
|
||||
// delete m_pData;
|
||||
|
@ -195,7 +276,9 @@ public:
|
|||
return false;
|
||||
}
|
||||
do {
|
||||
iError = FT_New_Face( library, pFontName, 0, &face );
|
||||
char* fontfile = getFontFile(pFontName);
|
||||
iError = FT_New_Face( library, fontfile, 0, &face );
|
||||
free(fontfile);
|
||||
|
||||
if (iError) {
|
||||
//no valid font found use default
|
||||
|
@ -216,8 +299,7 @@ public:
|
|||
//compute the final line width
|
||||
iMaxLineWidth = MAX(iMaxLineWidth, nWidth);
|
||||
|
||||
iMaxLineHeight = (face->size->metrics.ascender >> 6)
|
||||
- (face->size->metrics.descender >> 6);
|
||||
iMaxLineHeight = (face->size->metrics.ascender >> 6) - (face->size->metrics.descender >> 6);
|
||||
iMaxLineHeight *= vLines.size();
|
||||
|
||||
int txtHeight = iMaxLineHeight;
|
||||
|
@ -230,31 +312,34 @@ public:
|
|||
|
||||
memset(m_pData,0, iMaxLineWidth * iMaxLineHeight*4);
|
||||
|
||||
for (size_t i = 0; i < vLines.size(); i++) {
|
||||
pText = vLines[i].sLineStr.c_str();
|
||||
//initialize the origin cursor
|
||||
iCurXCursor = computeLineStart(face, eAlignMask, *pText, i);
|
||||
size_t lines = vLines.size();
|
||||
for (size_t i = 0; i < lines; i++) {
|
||||
const wchar_t* text_ptr = vLines[i].text;
|
||||
|
||||
while (*pText != 0) {
|
||||
int iError = FT_Load_Glyph(face, FT_Get_Char_Index(face, *pText),
|
||||
FT_LOAD_RENDER);
|
||||
//initialize the origin cursor
|
||||
iCurXCursor = computeLineStart(face, eAlignMask, text_ptr[0], i);
|
||||
|
||||
size_t text_len = wcslen(text_ptr);
|
||||
for (size_t i=0; i<text_len; ++i) {
|
||||
int iError = FT_Load_Char(face, text_ptr[i], FT_LOAD_RENDER);
|
||||
if (iError) {
|
||||
break;
|
||||
}
|
||||
|
||||
// convert glyph to bitmap with 256 gray
|
||||
// and get the bitmap
|
||||
FT_Bitmap & bitmap = face->glyph->bitmap;
|
||||
FT_Bitmap& bitmap = face->glyph->bitmap;
|
||||
|
||||
int yoffset = iCurYCursor - (face->glyph->metrics.horiBearingY >> 6);
|
||||
int xoffset = iCurXCursor + (face->glyph->metrics.horiBearingX >> 6);
|
||||
for (int i = 0; i < bitmap.rows; ++i) {
|
||||
for (int j = 0; j < bitmap.width; ++j) {
|
||||
unsigned char cTemp = bitmap.buffer[i * bitmap.width + j];
|
||||
if (cTemp == 0) continue;
|
||||
|
||||
// if it has gray>0 we set show it as 1, o otherwise
|
||||
int iY = iCurYCursor + i
|
||||
- (face->glyph->metrics.horiBearingY
|
||||
>> 6);
|
||||
int iX = iCurXCursor
|
||||
+ (face->glyph->metrics.horiBearingX
|
||||
>> 6) + j;
|
||||
int iY = yoffset + i;
|
||||
int iX = xoffset + j;
|
||||
|
||||
if (iY>=iMaxLineHeight) {
|
||||
//exceed the height truncate
|
||||
|
@ -270,20 +355,16 @@ public:
|
|||
// bitmap.buffer[i * bitmap.width + j];//G
|
||||
// m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] =
|
||||
// bitmap.buffer[i * bitmap.width + j];//B
|
||||
|
||||
int iTemp = 0;
|
||||
unsigned char cTemp = bitmap.buffer[i
|
||||
* bitmap.width + j];
|
||||
iTemp |= (cTemp ? 0xff : 0)<<24;
|
||||
iTemp |= cTemp << 16 | cTemp << 8 | cTemp;
|
||||
*(int*) &m_pData[(iY * iMaxLineWidth + iX)
|
||||
* 4 + 0] = iTemp;
|
||||
*(int*) &m_pData[(iY * iMaxLineWidth + iX) * 4 + 0] = iTemp;
|
||||
}
|
||||
}
|
||||
//step to next glyph
|
||||
iCurXCursor += (face->glyph->metrics.horiAdvance >> 6)
|
||||
+ iInterval;
|
||||
iCurXCursor += (face->glyph->metrics.horiAdvance >> 6) + iInterval;
|
||||
|
||||
pText++;
|
||||
}
|
||||
iCurYCursor += (face->size->metrics.ascender >> 6)
|
||||
- (face->size->metrics.descender >> 6);
|
||||
|
@ -301,9 +382,6 @@ public:
|
|||
FT_Done_Face(face);
|
||||
face = NULL;
|
||||
|
||||
//clear all lines
|
||||
vLines.clear();
|
||||
|
||||
//success;
|
||||
if (iError) {
|
||||
bRet = false;
|
||||
|
@ -344,9 +422,9 @@ bool CCImage::initWithString(
|
|||
|
||||
BitmapDC &dc = sharedBitmapDC();
|
||||
|
||||
const char* pFullFontName = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pFontName);
|
||||
//const char* pFullFontName = CCFileUtils::sharedFileUtils()->fullPathFromRelativePath(pFontName);
|
||||
|
||||
CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, pFullFontName, nSize));
|
||||
CC_BREAK_IF(! dc.getBitmap(pText, nWidth, nHeight, eAlignMask, pFontName, nSize));
|
||||
|
||||
// assign the dc.m_pData to m_pData in order to save time
|
||||
m_pData = dc.m_pData;
|
||||
|
|
|
@ -148,9 +148,7 @@ bool CCTextureAtlas::initWithFile(const char * file, unsigned int capacity)
|
|||
else
|
||||
{
|
||||
CCLOG("cocos2d: Could not open file: %s", file);
|
||||
delete this;
|
||||
|
||||
return NULL;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -149,6 +149,7 @@ CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite*
|
|||
void CCControlSlider::setMinimumValue(float minimumValue)
|
||||
{
|
||||
m_minimumValue=minimumValue;
|
||||
m_minimumAllowedValue = minimumValue;
|
||||
if (m_minimumValue >= m_maximumValue)
|
||||
m_maximumValue = m_minimumValue + 1.0f;
|
||||
setValue(m_value);
|
||||
|
@ -157,6 +158,7 @@ CCControlSlider* CCControlSlider::create(CCSprite * backgroundSprite, CCSprite*
|
|||
void CCControlSlider::setMaximumValue(float maximumValue)
|
||||
{
|
||||
m_maximumValue=maximumValue;
|
||||
m_maximumAllowedValue = maximumValue;
|
||||
if (m_maximumValue <= m_minimumValue)
|
||||
m_minimumValue = m_maximumValue - 1.0f;
|
||||
setValue(m_value);
|
||||
|
@ -224,7 +226,7 @@ void CCControlSlider::sliderEnded(CCPoint location)
|
|||
float CCControlSlider::valueForLocation(CCPoint location)
|
||||
{
|
||||
float percent = (location.x-SLIDER_MARGIN_H)/ m_backgroundSprite->getContentSize().width;
|
||||
return m_minimumValue + percent * (m_maximumValue - m_minimumValue);
|
||||
return MAX(MIN(m_minimumValue + percent * (m_maximumValue - m_minimumValue), m_maximumAllowedValue), m_minimumAllowedValue);
|
||||
}
|
||||
|
||||
NS_CC_EXT_END
|
||||
|
|
|
@ -55,6 +55,10 @@ class CCControlSlider: public CCControl
|
|||
virtual void setMinimumValue(float val);
|
||||
CC_SYNTHESIZE_READONLY(float, m_maximumValue, MaximumValue);
|
||||
virtual void setMaximumValue(float val);
|
||||
|
||||
CC_SYNTHESIZE(float, m_minimumAllowedValue, MinimumAllowedValue);
|
||||
CC_SYNTHESIZE(float, m_maximumAllowedValue, MaximumAllowedValue);
|
||||
|
||||
|
||||
//interval to snap to
|
||||
CC_SYNTHESIZE(float, m_snappingInterval, SnappingInterval);
|
||||
|
|
|
@ -1,17 +1,18 @@
|
|||
|
||||
echo./*
|
||||
echo.* Install Cocos2d-win32 application wizard...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
set SCRIPT_LOG=InstallWizardLog.txt
|
||||
set SCRIPT_DIR=.\template\msvc\
|
||||
|
||||
if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVC2008Express.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVC2010Express.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2008.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2010.js" /quiet
|
||||
if exist %SCRIPT_LOG% more %SCRIPT_LOG%
|
||||
if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
||||
|
||||
|
||||
echo./*
|
||||
echo.* Install Cocos2d-win32 application wizard...
|
||||
echo.*/
|
||||
echo.
|
||||
|
||||
set SCRIPT_LOG=InstallWizardLog.txt
|
||||
set SCRIPT_DIR=.\template\msvc\
|
||||
|
||||
if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVC2008Express.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVC2010Express.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2008.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2010.js" /quiet
|
||||
cscript "%SCRIPT_DIR%InstallWizardForVS2012.js" /quiet
|
||||
if exist %SCRIPT_LOG% more %SCRIPT_LOG%
|
||||
if exist %SCRIPT_LOG% del /Q %SCRIPT_LOG%
|
||||
|
||||
|
|
|
@ -43,10 +43,10 @@ bool CCControlSliderTest::init()
|
|||
CCSize screenSize = CCDirector::sharedDirector()->getWinSize();
|
||||
|
||||
// Add a label in which the slider value will be displayed
|
||||
m_pDisplayValueLabel = CCLabelTTF::create("Move the slider thumb!" ,"Marker Felt", 32);
|
||||
m_pDisplayValueLabel = CCLabelTTF::create("Move the slider thumb!\nThe lower slider is restricted." ,"Marker Felt", 32);
|
||||
m_pDisplayValueLabel->retain();
|
||||
m_pDisplayValueLabel->setAnchorPoint(ccp(0.5f, -1.0f));
|
||||
m_pDisplayValueLabel->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
m_pDisplayValueLabel->setPosition(ccp(screenSize.width / 1.7f, screenSize.height / 2.0f));
|
||||
addChild(m_pDisplayValueLabel);
|
||||
|
||||
// Add the slider
|
||||
|
@ -54,12 +54,27 @@ bool CCControlSliderTest::init()
|
|||
slider->setAnchorPoint(ccp(0.5f, 1.0f));
|
||||
slider->setMinimumValue(0.0f); // Sets the min value of range
|
||||
slider->setMaximumValue(5.0f); // Sets the max value of range
|
||||
slider->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f));
|
||||
slider->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f + 16));
|
||||
slider->setTag(1);
|
||||
|
||||
// When the value of the slider will change, the given selector will be call
|
||||
slider->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlSliderTest::valueChanged), CCControlEventValueChanged);
|
||||
|
||||
CCControlSlider *restrictSlider = CCControlSlider::create("extensions/sliderTrack.png","extensions/sliderProgress.png" ,"extensions/sliderThumb.png");
|
||||
restrictSlider->setAnchorPoint(ccp(0.5f, 1.0f));
|
||||
restrictSlider->setMinimumValue(0.0f); // Sets the min value of range
|
||||
restrictSlider->setMaximumValue(5.0f); // Sets the max value of range
|
||||
restrictSlider->setMaximumAllowedValue(4.0f);
|
||||
restrictSlider->setMinimumAllowedValue(1.5f);
|
||||
restrictSlider->setValue(3.0f);
|
||||
restrictSlider->setPosition(ccp(screenSize.width / 2.0f, screenSize.height / 2.0f - 24));
|
||||
restrictSlider->setTag(2);
|
||||
|
||||
//same with restricted
|
||||
restrictSlider->addTargetWithActionForControlEvents(this, cccontrol_selector(CCControlSliderTest::valueChanged), CCControlEventValueChanged);
|
||||
|
||||
addChild(slider);
|
||||
addChild(restrictSlider);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -69,6 +84,9 @@ void CCControlSliderTest::valueChanged(CCObject *sender, CCControlEvent controlE
|
|||
{
|
||||
CCControlSlider* pSlider = (CCControlSlider*)sender;
|
||||
// Change value of label.
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Slider value = %.02f", pSlider->getValue())->getCString());
|
||||
if(pSlider->getTag() == 1)
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Upper slider value = %.02f", pSlider->getValue())->getCString());
|
||||
if(pSlider->getTag() == 2)
|
||||
m_pDisplayValueLabel->setString(CCString::createWithFormat("Lower slider value = %.02f", pSlider->getValue())->getCString());
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,239 @@
|
|||
// Setup program for the Cocos2d-win32 App Wizard for VC++ 11.0 (VC2012)
|
||||
|
||||
main();
|
||||
|
||||
function EchoInfo(bQuiet, strMsg) {
|
||||
if (! bQuiet) {
|
||||
WScript.Echo(strMsg);
|
||||
}
|
||||
else {
|
||||
var FileSys = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var strLogPath = "InstallWizardLog.txt"
|
||||
var file = FileSys.OpenTextFile(strLogPath, 8, true);
|
||||
file.WriteLine(strMsg);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function EchoError(bQuiet, strMsg) {
|
||||
strMsg = "Error: " + strMsg;
|
||||
if (! bQuiet) {
|
||||
WScript.Echo(strMsg);
|
||||
}
|
||||
else {
|
||||
var FileSys = new ActiveXObject("Scripting.FileSystemObject");
|
||||
var strLogPath = "InstallWizardLog.txt"
|
||||
var file = FileSys.OpenTextFile(strLogPath, 8, true);
|
||||
file.WriteLine(strMsg);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
// Decode command line arguments
|
||||
var bDebug = false;
|
||||
var bQuiet = false;
|
||||
var bElevated = false;
|
||||
var Args = WScript.Arguments;
|
||||
for (var i = 0; i < Args.length; i++) {
|
||||
if (Args(i) == "/debug")
|
||||
bDebug = true;
|
||||
else if (Args(i) == "/elevated")
|
||||
bElevated = true;
|
||||
else if (Args(i) == "/quiet")
|
||||
bQuiet = true;
|
||||
}
|
||||
|
||||
// See if UAC is enabled
|
||||
var Shell = WScript.CreateObject("Shell.Application");
|
||||
if (!bElevated && Shell.IsRestricted("System", "EnableLUA")) {
|
||||
// Check that the script is being run interactively.
|
||||
if (!WScript.Interactive) {
|
||||
EchoError(bQuiet, "(Windows LUA) Elevation required.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Now relaunch the script, using the "RunAs" verb to elevate
|
||||
var strParams = "\"" + WScript.ScriptFullName + "\"";
|
||||
if (bDebug)
|
||||
strParams += " /debug";
|
||||
strParams += " /elevated";
|
||||
Shell.ShellExecute(WScript.FullName, strParams, null, "RunAs");
|
||||
return;
|
||||
}
|
||||
|
||||
// Create shell object
|
||||
var WSShell = WScript.CreateObject("WScript.Shell");
|
||||
// Create file system object
|
||||
var FileSys = WScript.CreateObject("Scripting.FileSystemObject");
|
||||
|
||||
// Get the folder containing the script file
|
||||
var strScriptPath = FileSys.GetParentFolderName(WScript.ScriptFullName);
|
||||
if (strScriptPath == null || strScriptPath == "")
|
||||
strScriptPath = ".";
|
||||
|
||||
// Get the folder script files copy to
|
||||
var strValue = "";
|
||||
try {
|
||||
var strVCKey = "HKLM\\Software\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir";
|
||||
strValue = WSShell.RegRead(strVCKey);
|
||||
}
|
||||
catch (e) {
|
||||
try {
|
||||
var strVCKey_x64 = "HKLM\\Software\\Wow6432Node\\Microsoft\\VisualStudio\\11.0\\Setup\\VC\\ProductDir";
|
||||
strValue = WSShell.RegRead(strVCKey_x64);
|
||||
}
|
||||
catch (e) {
|
||||
EchoError(bQuiet, "Cannot find where Visual Studio 2012 is installed.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
var strDestFolder = FileSys.BuildPath(strValue, "vcprojects");
|
||||
if (bDebug)
|
||||
WScript.Echo("Destination: " + strDestFolder);
|
||||
|
||||
if (!FileSys.FolderExists(strDestFolder)) {
|
||||
EchoError(bQuiet, "Cannot find destination folder (should be: " + strDestFolder + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Wizard Info
|
||||
var nNumWizards = 1;
|
||||
|
||||
var astrWizardName = new Array();
|
||||
astrWizardName[0] = "CCAppWiz.win32";
|
||||
|
||||
var nCntr;
|
||||
for (nCntr = 0; nCntr < nNumWizards; nCntr++) {
|
||||
var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]);
|
||||
|
||||
if (bDebug)
|
||||
WScript.Echo("Source: " + strSourceFolder);
|
||||
|
||||
if (!FileSys.FolderExists(strSourceFolder)) {
|
||||
EchoError(bQuiet, "Cannot find Wizard folder (should be: " + strSourceFolder + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Copy files
|
||||
try {
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".ico");
|
||||
var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".ico");
|
||||
FileSys.CopyFile(strSrc, strDest);
|
||||
|
||||
strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
FileSys.CopyFile(strSrc, strDest);
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot copy file (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read and write CCAppWiz.vsz, add engine version and replace path when found
|
||||
try {
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsz");
|
||||
var strDest = FileSys.BuildPath(strDestFolder, astrWizardName[nCntr] + ".vsz");
|
||||
|
||||
var ForReading = 1;
|
||||
var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
|
||||
if (fileSrc == null) {
|
||||
EchoError(bQuiet, "Cannot open source file: " + strSrc);
|
||||
return;
|
||||
}
|
||||
|
||||
var ForWriting = 2;
|
||||
var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
|
||||
if (fileDest == null) {
|
||||
EchoError(bQuiet, " Cannot open destination file: " + strDest);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!fileSrc.AtEndOfStream) {
|
||||
var strLine = fileSrc.ReadLine();
|
||||
if (strLine.indexOf("Wizard=VsWizard.VsWizardEngine") != -1)
|
||||
strLine += ".11.0";
|
||||
else if (strLine.indexOf("WIZARD_VERSION") != -1)
|
||||
strLine = "Param=\"WIZARD_VERSION = 11.0\"";
|
||||
else if (strLine.indexOf("ABSOLUTE_PATH") != -1)
|
||||
strLine = "Param=\"ABSOLUTE_PATH = " + strSourceFolder + "\"";
|
||||
fileDest.WriteLine(strLine);
|
||||
}
|
||||
|
||||
fileSrc.Close();
|
||||
fileDest.Close();
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot read and write CCAppWiz.vsz (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Create Cocos2d-x folder
|
||||
var strDestCCFolder = "";
|
||||
try {
|
||||
strDestCCFolder = FileSys.BuildPath(strDestFolder, "Cocos2d-x");
|
||||
if (!FileSys.FolderExists(strDestCCFolder))
|
||||
FileSys.CreateFolder(strDestCCFolder);
|
||||
if (bDebug)
|
||||
WScript.Echo("Cocos2d-x Folder: " + strDestCCFolder);
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot create Cocos2d-x folder (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
// Read and write additional CCAppWiz.vsdir, add path to the wizard location
|
||||
try {
|
||||
var strDest = FileSys.BuildPath(strDestCCFolder, "Cocos2d-x.vsdir");
|
||||
|
||||
var ForWriting = 2;
|
||||
|
||||
var fileDest = FileSys.OpenTextFile(strDest, ForWriting, true);
|
||||
if (fileDest == null) {
|
||||
EchoError(bQuiet, "Cannot open destination file: " + strDest);
|
||||
return;
|
||||
}
|
||||
|
||||
var nCntr;
|
||||
for (nCntr = 0; nCntr < nNumWizards; nCntr++) {
|
||||
var strSourceFolder = FileSys.BuildPath(strScriptPath, astrWizardName[nCntr]);
|
||||
var strSrc = FileSys.BuildPath(strSourceFolder, astrWizardName[nCntr] + ".vsdir");
|
||||
var ForReading = 1;
|
||||
var fileSrc = FileSys.OpenTextFile(strSrc, ForReading);
|
||||
if (fileSrc == null) {
|
||||
EchoError(bQuiet, "Cannot open source file: " + strSrc);
|
||||
return;
|
||||
}
|
||||
|
||||
while (!fileSrc.AtEndOfStream) {
|
||||
var strLine = fileSrc.ReadLine();
|
||||
if (strLine.indexOf(astrWizardName[nCntr] + ".vsz|") != -1)
|
||||
strLine = "..\\" + strLine;
|
||||
fileDest.WriteLine(strLine);
|
||||
}
|
||||
|
||||
fileSrc.Close();
|
||||
}
|
||||
fileDest.Close();
|
||||
}
|
||||
catch (e) {
|
||||
var strError = "no info";
|
||||
if (e.description.length != 0)
|
||||
strError = e.description;
|
||||
EchoError(bQuiet, "Cannot read and write Cocos2d-x\\CCAppWiz.vsdir (" + strError + ")");
|
||||
return;
|
||||
}
|
||||
|
||||
EchoInfo(bQuiet, "App Wizard successfully installed for VS2012!");
|
||||
}
|
Loading…
Reference in New Issue