зеркало из https://github.com/microsoft/cocos2d-x.git
lua-tests works ok for iOS / Mac, luabindings has its own project.
This commit is contained in:
Родитель
650a88a8b1
Коммит
69bbda688b
|
@ -1 +1 @@
|
|||
b3cf4fb2027b85ae59d2cf5a2db7323a0cdfcf95
|
||||
f990b31eefc9c1e77b714ac8cd2a7b99ba5afc19
|
|
@ -0,0 +1,86 @@
|
|||
<?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 = "1ABCA28518CD91510087CE3A"
|
||||
BuildableName = "Test lua Mac.app"
|
||||
BlueprintName = "Test lua Mac"
|
||||
ReferencedContainer = "container:cocos2d_samples.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 = "1ABCA28518CD91510087CE3A"
|
||||
BuildableName = "Test lua Mac.app"
|
||||
BlueprintName = "Test lua Mac"
|
||||
ReferencedContainer = "container:cocos2d_samples.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 = "1ABCA28518CD91510087CE3A"
|
||||
BuildableName = "Test lua Mac.app"
|
||||
BlueprintName = "Test lua Mac"
|
||||
ReferencedContainer = "container:cocos2d_samples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1ABCA28518CD91510087CE3A"
|
||||
BuildableName = "Test lua Mac.app"
|
||||
BlueprintName = "Test lua Mac"
|
||||
ReferencedContainer = "container:cocos2d_samples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -0,0 +1,86 @@
|
|||
<?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 = "1ABCA2CC18CD93580087CE3A"
|
||||
BuildableName = "Test lua iOS.app"
|
||||
BlueprintName = "Test lua iOS"
|
||||
ReferencedContainer = "container:cocos2d_samples.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 = "1ABCA2CC18CD93580087CE3A"
|
||||
BuildableName = "Test lua iOS.app"
|
||||
BlueprintName = "Test lua iOS"
|
||||
ReferencedContainer = "container:cocos2d_samples.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 = "1ABCA2CC18CD93580087CE3A"
|
||||
BuildableName = "Test lua iOS.app"
|
||||
BlueprintName = "Test lua iOS"
|
||||
ReferencedContainer = "container:cocos2d_samples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<AdditionalOptions>
|
||||
</AdditionalOptions>
|
||||
</LaunchAction>
|
||||
<ProfileAction
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
savedToolIdentifier = ""
|
||||
useCustomWorkingDirectory = "NO"
|
||||
buildConfiguration = "Release"
|
||||
debugDocumentVersioning = "YES">
|
||||
<BuildableProductRunnable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1ABCA2CC18CD93580087CE3A"
|
||||
BuildableName = "Test lua iOS.app"
|
||||
BlueprintName = "Test lua iOS"
|
||||
ReferencedContainer = "container:cocos2d_samples.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
</ProfileAction>
|
||||
<AnalyzeAction
|
||||
buildConfiguration = "Debug">
|
||||
</AnalyzeAction>
|
||||
<ArchiveAction
|
||||
buildConfiguration = "Release"
|
||||
revealArchiveInOrganizer = "YES">
|
||||
</ArchiveAction>
|
||||
</Scheme>
|
|
@ -119,6 +119,94 @@
|
|||
1AACE83418BC45C200215002 /* CCLuaObjcBridge.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1AACE78F18BC45C200215002 /* CCLuaObjcBridge.mm */; };
|
||||
1AACE87B18BC45C200215002 /* tolua_fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE7B418BC45C200215002 /* tolua_fix.h */; };
|
||||
1AACE87C18BC45C200215002 /* tolua_fix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AACE7B418BC45C200215002 /* tolua_fix.h */; };
|
||||
1ABCA1EA18CD8F470087CE3A /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E618CD8F470087CE3A /* lauxlib.h */; };
|
||||
1ABCA1EB18CD8F470087CE3A /* lauxlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E618CD8F470087CE3A /* lauxlib.h */; };
|
||||
1ABCA1EC18CD8F470087CE3A /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E718CD8F470087CE3A /* lua.h */; };
|
||||
1ABCA1ED18CD8F470087CE3A /* lua.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E718CD8F470087CE3A /* lua.h */; };
|
||||
1ABCA1EE18CD8F470087CE3A /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E818CD8F470087CE3A /* luaconf.h */; };
|
||||
1ABCA1EF18CD8F470087CE3A /* luaconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E818CD8F470087CE3A /* luaconf.h */; };
|
||||
1ABCA1F018CD8F470087CE3A /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E918CD8F470087CE3A /* lualib.h */; };
|
||||
1ABCA1F118CD8F470087CE3A /* lualib.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1E918CD8F470087CE3A /* lualib.h */; };
|
||||
1ABCA1F418CD8F540087CE3A /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA1F318CD8F540087CE3A /* libluajit.a */; };
|
||||
1ABCA20018CD8F6E0087CE3A /* tolua_event.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1F918CD8F6E0087CE3A /* tolua_event.c */; };
|
||||
1ABCA20118CD8F6E0087CE3A /* tolua_event.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1F918CD8F6E0087CE3A /* tolua_event.c */; };
|
||||
1ABCA20218CD8F6E0087CE3A /* tolua_event.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1FA18CD8F6E0087CE3A /* tolua_event.h */; };
|
||||
1ABCA20318CD8F6E0087CE3A /* tolua_event.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1FA18CD8F6E0087CE3A /* tolua_event.h */; };
|
||||
1ABCA20418CD8F6E0087CE3A /* tolua_is.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FB18CD8F6E0087CE3A /* tolua_is.c */; };
|
||||
1ABCA20518CD8F6E0087CE3A /* tolua_is.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FB18CD8F6E0087CE3A /* tolua_is.c */; };
|
||||
1ABCA20618CD8F6E0087CE3A /* tolua_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FC18CD8F6E0087CE3A /* tolua_map.c */; };
|
||||
1ABCA20718CD8F6E0087CE3A /* tolua_map.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FC18CD8F6E0087CE3A /* tolua_map.c */; };
|
||||
1ABCA20818CD8F6E0087CE3A /* tolua_push.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FD18CD8F6E0087CE3A /* tolua_push.c */; };
|
||||
1ABCA20918CD8F6E0087CE3A /* tolua_push.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FD18CD8F6E0087CE3A /* tolua_push.c */; };
|
||||
1ABCA20A18CD8F6E0087CE3A /* tolua_to.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FE18CD8F6E0087CE3A /* tolua_to.c */; };
|
||||
1ABCA20B18CD8F6E0087CE3A /* tolua_to.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA1FE18CD8F6E0087CE3A /* tolua_to.c */; };
|
||||
1ABCA20C18CD8F6E0087CE3A /* tolua++.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1FF18CD8F6E0087CE3A /* tolua++.h */; };
|
||||
1ABCA20D18CD8F6E0087CE3A /* tolua++.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA1FF18CD8F6E0087CE3A /* tolua++.h */; };
|
||||
1ABCA23118CD8F7D0087CE3A /* auxiliar.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA20F18CD8F7D0087CE3A /* auxiliar.c */; };
|
||||
1ABCA23218CD8F7D0087CE3A /* auxiliar.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA20F18CD8F7D0087CE3A /* auxiliar.c */; };
|
||||
1ABCA23318CD8F7D0087CE3A /* auxiliar.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21018CD8F7D0087CE3A /* auxiliar.h */; };
|
||||
1ABCA23418CD8F7D0087CE3A /* auxiliar.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21018CD8F7D0087CE3A /* auxiliar.h */; };
|
||||
1ABCA23518CD8F7D0087CE3A /* except.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21118CD8F7D0087CE3A /* except.c */; };
|
||||
1ABCA23618CD8F7D0087CE3A /* except.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21118CD8F7D0087CE3A /* except.c */; };
|
||||
1ABCA23718CD8F7D0087CE3A /* except.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21218CD8F7D0087CE3A /* except.h */; };
|
||||
1ABCA23818CD8F7D0087CE3A /* except.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21218CD8F7D0087CE3A /* except.h */; };
|
||||
1ABCA23918CD8F7D0087CE3A /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21318CD8F7D0087CE3A /* inet.c */; };
|
||||
1ABCA23A18CD8F7D0087CE3A /* inet.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21318CD8F7D0087CE3A /* inet.c */; };
|
||||
1ABCA23B18CD8F7D0087CE3A /* inet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21418CD8F7D0087CE3A /* inet.h */; };
|
||||
1ABCA23C18CD8F7D0087CE3A /* inet.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21418CD8F7D0087CE3A /* inet.h */; };
|
||||
1ABCA23D18CD8F7D0087CE3A /* luasocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21518CD8F7D0087CE3A /* luasocket.c */; };
|
||||
1ABCA23E18CD8F7D0087CE3A /* luasocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21518CD8F7D0087CE3A /* luasocket.c */; };
|
||||
1ABCA23F18CD8F7D0087CE3A /* luasocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21618CD8F7D0087CE3A /* luasocket.h */; };
|
||||
1ABCA24018CD8F7D0087CE3A /* luasocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21618CD8F7D0087CE3A /* luasocket.h */; };
|
||||
1ABCA24118CD8F7D0087CE3A /* luasocket_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21718CD8F7D0087CE3A /* luasocket_buffer.c */; };
|
||||
1ABCA24218CD8F7D0087CE3A /* luasocket_buffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21718CD8F7D0087CE3A /* luasocket_buffer.c */; };
|
||||
1ABCA24318CD8F7D0087CE3A /* luasocket_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21818CD8F7D0087CE3A /* luasocket_buffer.h */; };
|
||||
1ABCA24418CD8F7D0087CE3A /* luasocket_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21818CD8F7D0087CE3A /* luasocket_buffer.h */; };
|
||||
1ABCA24518CD8F7D0087CE3A /* luasocket_io.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21918CD8F7D0087CE3A /* luasocket_io.c */; };
|
||||
1ABCA24618CD8F7D0087CE3A /* luasocket_io.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21918CD8F7D0087CE3A /* luasocket_io.c */; };
|
||||
1ABCA24718CD8F7D0087CE3A /* luasocket_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21A18CD8F7D0087CE3A /* luasocket_io.h */; };
|
||||
1ABCA24818CD8F7D0087CE3A /* luasocket_io.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21A18CD8F7D0087CE3A /* luasocket_io.h */; };
|
||||
1ABCA24918CD8F7D0087CE3A /* mime.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21B18CD8F7D0087CE3A /* mime.c */; };
|
||||
1ABCA24A18CD8F7D0087CE3A /* mime.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21B18CD8F7D0087CE3A /* mime.c */; };
|
||||
1ABCA24B18CD8F7D0087CE3A /* mime.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21C18CD8F7D0087CE3A /* mime.h */; };
|
||||
1ABCA24C18CD8F7D0087CE3A /* mime.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21C18CD8F7D0087CE3A /* mime.h */; };
|
||||
1ABCA24D18CD8F7D0087CE3A /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21D18CD8F7D0087CE3A /* options.c */; };
|
||||
1ABCA24E18CD8F7D0087CE3A /* options.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21D18CD8F7D0087CE3A /* options.c */; };
|
||||
1ABCA24F18CD8F7D0087CE3A /* options.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21E18CD8F7D0087CE3A /* options.h */; };
|
||||
1ABCA25018CD8F7D0087CE3A /* options.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA21E18CD8F7D0087CE3A /* options.h */; };
|
||||
1ABCA25118CD8F7D0087CE3A /* select.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21F18CD8F7D0087CE3A /* select.c */; };
|
||||
1ABCA25218CD8F7D0087CE3A /* select.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA21F18CD8F7D0087CE3A /* select.c */; };
|
||||
1ABCA25318CD8F7D0087CE3A /* select.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22018CD8F7D0087CE3A /* select.h */; };
|
||||
1ABCA25418CD8F7D0087CE3A /* select.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22018CD8F7D0087CE3A /* select.h */; };
|
||||
1ABCA25518CD8F7D0087CE3A /* serial.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22118CD8F7D0087CE3A /* serial.c */; };
|
||||
1ABCA25618CD8F7D0087CE3A /* serial.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22118CD8F7D0087CE3A /* serial.c */; };
|
||||
1ABCA25718CD8F7D0087CE3A /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22218CD8F7D0087CE3A /* socket.h */; };
|
||||
1ABCA25818CD8F7D0087CE3A /* socket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22218CD8F7D0087CE3A /* socket.h */; };
|
||||
1ABCA25918CD8F7D0087CE3A /* socket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22318CD8F7D0087CE3A /* socket_scripts.c */; };
|
||||
1ABCA25A18CD8F7D0087CE3A /* socket_scripts.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22318CD8F7D0087CE3A /* socket_scripts.c */; };
|
||||
1ABCA25B18CD8F7D0087CE3A /* socket_scripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22418CD8F7D0087CE3A /* socket_scripts.h */; };
|
||||
1ABCA25C18CD8F7D0087CE3A /* socket_scripts.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22418CD8F7D0087CE3A /* socket_scripts.h */; };
|
||||
1ABCA25D18CD8F7D0087CE3A /* tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22518CD8F7D0087CE3A /* tcp.c */; };
|
||||
1ABCA25E18CD8F7D0087CE3A /* tcp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22518CD8F7D0087CE3A /* tcp.c */; };
|
||||
1ABCA25F18CD8F7D0087CE3A /* tcp.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22618CD8F7D0087CE3A /* tcp.h */; };
|
||||
1ABCA26018CD8F7D0087CE3A /* tcp.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22618CD8F7D0087CE3A /* tcp.h */; };
|
||||
1ABCA26118CD8F7D0087CE3A /* timeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22718CD8F7D0087CE3A /* timeout.c */; };
|
||||
1ABCA26218CD8F7D0087CE3A /* timeout.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22718CD8F7D0087CE3A /* timeout.c */; };
|
||||
1ABCA26318CD8F7D0087CE3A /* timeout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22818CD8F7D0087CE3A /* timeout.h */; };
|
||||
1ABCA26418CD8F7D0087CE3A /* timeout.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22818CD8F7D0087CE3A /* timeout.h */; };
|
||||
1ABCA26518CD8F7D0087CE3A /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22918CD8F7D0087CE3A /* udp.c */; };
|
||||
1ABCA26618CD8F7D0087CE3A /* udp.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22918CD8F7D0087CE3A /* udp.c */; };
|
||||
1ABCA26718CD8F7D0087CE3A /* udp.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22A18CD8F7D0087CE3A /* udp.h */; };
|
||||
1ABCA26818CD8F7D0087CE3A /* udp.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22A18CD8F7D0087CE3A /* udp.h */; };
|
||||
1ABCA26918CD8F7D0087CE3A /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22B18CD8F7D0087CE3A /* unix.c */; };
|
||||
1ABCA26A18CD8F7D0087CE3A /* unix.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22B18CD8F7D0087CE3A /* unix.c */; };
|
||||
1ABCA26B18CD8F7D0087CE3A /* unix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22C18CD8F7D0087CE3A /* unix.h */; };
|
||||
1ABCA26C18CD8F7D0087CE3A /* unix.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22C18CD8F7D0087CE3A /* unix.h */; };
|
||||
1ABCA26D18CD8F7D0087CE3A /* usocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22D18CD8F7D0087CE3A /* usocket.c */; };
|
||||
1ABCA26E18CD8F7D0087CE3A /* usocket.c in Sources */ = {isa = PBXBuildFile; fileRef = 1ABCA22D18CD8F7D0087CE3A /* usocket.c */; };
|
||||
1ABCA26F18CD8F7D0087CE3A /* usocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22E18CD8F7D0087CE3A /* usocket.h */; };
|
||||
1ABCA27018CD8F7D0087CE3A /* usocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ABCA22E18CD8F7D0087CE3A /* usocket.h */; };
|
||||
1ABCA36318CD9D7F0087CE3A /* libluajit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1ABCA1F618CD8F5F0087CE3A /* libluajit.a */; };
|
||||
C0FEF4D618BE0E70001F446C /* lua_debugger.c in Sources */ = {isa = PBXBuildFile; fileRef = C0FEF4D418BE0E70001F446C /* lua_debugger.c */; };
|
||||
C0FEF4D718BE0E70001F446C /* lua_debugger.c in Sources */ = {isa = PBXBuildFile; fileRef = C0FEF4D418BE0E70001F446C /* lua_debugger.c */; };
|
||||
C0FEF4D818BE0E70001F446C /* lua_debugger.h in Headers */ = {isa = PBXBuildFile; fileRef = C0FEF4D518BE0E70001F446C /* lua_debugger.h */; };
|
||||
|
@ -184,6 +272,51 @@
|
|||
1AACE78E18BC45C200215002 /* CCLuaObjcBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CCLuaObjcBridge.h; sourceTree = "<group>"; };
|
||||
1AACE78F18BC45C200215002 /* CCLuaObjcBridge.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = CCLuaObjcBridge.mm; sourceTree = "<group>"; };
|
||||
1AACE7B418BC45C200215002 /* tolua_fix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tolua_fix.h; sourceTree = "<group>"; };
|
||||
1ABCA1E618CD8F470087CE3A /* lauxlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lauxlib.h; sourceTree = "<group>"; };
|
||||
1ABCA1E718CD8F470087CE3A /* lua.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua.h; sourceTree = "<group>"; };
|
||||
1ABCA1E818CD8F470087CE3A /* luaconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luaconf.h; sourceTree = "<group>"; };
|
||||
1ABCA1E918CD8F470087CE3A /* lualib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lualib.h; sourceTree = "<group>"; };
|
||||
1ABCA1F318CD8F540087CE3A /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libluajit.a; sourceTree = "<group>"; };
|
||||
1ABCA1F618CD8F5F0087CE3A /* libluajit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libluajit.a; sourceTree = "<group>"; };
|
||||
1ABCA1F918CD8F6E0087CE3A /* tolua_event.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tolua_event.c; path = ../../../../external/lua/tolua/tolua_event.c; sourceTree = "<group>"; };
|
||||
1ABCA1FA18CD8F6E0087CE3A /* tolua_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tolua_event.h; path = ../../../../external/lua/tolua/tolua_event.h; sourceTree = "<group>"; };
|
||||
1ABCA1FB18CD8F6E0087CE3A /* tolua_is.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tolua_is.c; path = ../../../../external/lua/tolua/tolua_is.c; sourceTree = "<group>"; };
|
||||
1ABCA1FC18CD8F6E0087CE3A /* tolua_map.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tolua_map.c; path = ../../../../external/lua/tolua/tolua_map.c; sourceTree = "<group>"; };
|
||||
1ABCA1FD18CD8F6E0087CE3A /* tolua_push.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tolua_push.c; path = ../../../../external/lua/tolua/tolua_push.c; sourceTree = "<group>"; };
|
||||
1ABCA1FE18CD8F6E0087CE3A /* tolua_to.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = tolua_to.c; path = ../../../../external/lua/tolua/tolua_to.c; sourceTree = "<group>"; };
|
||||
1ABCA1FF18CD8F6E0087CE3A /* tolua++.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "tolua++.h"; path = "../../../../external/lua/tolua/tolua++.h"; sourceTree = "<group>"; };
|
||||
1ABCA20F18CD8F7D0087CE3A /* auxiliar.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = auxiliar.c; sourceTree = "<group>"; };
|
||||
1ABCA21018CD8F7D0087CE3A /* auxiliar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = auxiliar.h; sourceTree = "<group>"; };
|
||||
1ABCA21118CD8F7D0087CE3A /* except.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = except.c; sourceTree = "<group>"; };
|
||||
1ABCA21218CD8F7D0087CE3A /* except.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = except.h; sourceTree = "<group>"; };
|
||||
1ABCA21318CD8F7D0087CE3A /* inet.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet.c; sourceTree = "<group>"; };
|
||||
1ABCA21418CD8F7D0087CE3A /* inet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inet.h; sourceTree = "<group>"; };
|
||||
1ABCA21518CD8F7D0087CE3A /* luasocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = luasocket.c; sourceTree = "<group>"; };
|
||||
1ABCA21618CD8F7D0087CE3A /* luasocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luasocket.h; sourceTree = "<group>"; };
|
||||
1ABCA21718CD8F7D0087CE3A /* luasocket_buffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = luasocket_buffer.c; sourceTree = "<group>"; };
|
||||
1ABCA21818CD8F7D0087CE3A /* luasocket_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luasocket_buffer.h; sourceTree = "<group>"; };
|
||||
1ABCA21918CD8F7D0087CE3A /* luasocket_io.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = luasocket_io.c; sourceTree = "<group>"; };
|
||||
1ABCA21A18CD8F7D0087CE3A /* luasocket_io.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = luasocket_io.h; sourceTree = "<group>"; };
|
||||
1ABCA21B18CD8F7D0087CE3A /* mime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mime.c; sourceTree = "<group>"; };
|
||||
1ABCA21C18CD8F7D0087CE3A /* mime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mime.h; sourceTree = "<group>"; };
|
||||
1ABCA21D18CD8F7D0087CE3A /* options.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = options.c; sourceTree = "<group>"; };
|
||||
1ABCA21E18CD8F7D0087CE3A /* options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = options.h; sourceTree = "<group>"; };
|
||||
1ABCA21F18CD8F7D0087CE3A /* select.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = select.c; sourceTree = "<group>"; };
|
||||
1ABCA22018CD8F7D0087CE3A /* select.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = select.h; sourceTree = "<group>"; };
|
||||
1ABCA22118CD8F7D0087CE3A /* serial.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = serial.c; sourceTree = "<group>"; };
|
||||
1ABCA22218CD8F7D0087CE3A /* socket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socket.h; sourceTree = "<group>"; };
|
||||
1ABCA22318CD8F7D0087CE3A /* socket_scripts.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = socket_scripts.c; sourceTree = "<group>"; };
|
||||
1ABCA22418CD8F7D0087CE3A /* socket_scripts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = socket_scripts.h; sourceTree = "<group>"; };
|
||||
1ABCA22518CD8F7D0087CE3A /* tcp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = tcp.c; sourceTree = "<group>"; };
|
||||
1ABCA22618CD8F7D0087CE3A /* tcp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tcp.h; sourceTree = "<group>"; };
|
||||
1ABCA22718CD8F7D0087CE3A /* timeout.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = timeout.c; sourceTree = "<group>"; };
|
||||
1ABCA22818CD8F7D0087CE3A /* timeout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = timeout.h; sourceTree = "<group>"; };
|
||||
1ABCA22918CD8F7D0087CE3A /* udp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = udp.c; sourceTree = "<group>"; };
|
||||
1ABCA22A18CD8F7D0087CE3A /* udp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = udp.h; sourceTree = "<group>"; };
|
||||
1ABCA22B18CD8F7D0087CE3A /* unix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = unix.c; sourceTree = "<group>"; };
|
||||
1ABCA22C18CD8F7D0087CE3A /* unix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unix.h; sourceTree = "<group>"; };
|
||||
1ABCA22D18CD8F7D0087CE3A /* usocket.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usocket.c; sourceTree = "<group>"; };
|
||||
1ABCA22E18CD8F7D0087CE3A /* usocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usocket.h; sourceTree = "<group>"; };
|
||||
C0FEF4D418BE0E70001F446C /* lua_debugger.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lua_debugger.c; sourceTree = "<group>"; };
|
||||
C0FEF4D518BE0E70001F446C /* lua_debugger.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lua_debugger.h; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
@ -193,6 +326,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1ABCA1F418CD8F540087CE3A /* libluajit.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -200,6 +334,7 @@
|
|||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1ABCA36318CD9D7F0087CE3A /* libluajit.a in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -209,6 +344,7 @@
|
|||
1551A334158F2AB200E66CFE = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1E218CD8F230087CE3A /* external */,
|
||||
1AACE74818BC45C200215002 /* auto */,
|
||||
1AACE75B18BC45C200215002 /* manual */,
|
||||
1AACE74618BC45A000215002 /* libluabindings Mac.a */,
|
||||
|
@ -306,6 +442,110 @@
|
|||
path = ios;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1E218CD8F230087CE3A /* external */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1E318CD8F2D0087CE3A /* luajit */,
|
||||
1ABCA20E18CD8F7D0087CE3A /* luasocket */,
|
||||
1ABCA1E418CD8F330087CE3A /* tolua */,
|
||||
);
|
||||
name = external;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1E318CD8F2D0087CE3A /* luajit */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1E518CD8F470087CE3A /* include */,
|
||||
1ABCA1F218CD8F540087CE3A /* ios */,
|
||||
1ABCA1F518CD8F5F0087CE3A /* mac */,
|
||||
);
|
||||
name = luajit;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1E418CD8F330087CE3A /* tolua */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1F918CD8F6E0087CE3A /* tolua_event.c */,
|
||||
1ABCA1FA18CD8F6E0087CE3A /* tolua_event.h */,
|
||||
1ABCA1FB18CD8F6E0087CE3A /* tolua_is.c */,
|
||||
1ABCA1FC18CD8F6E0087CE3A /* tolua_map.c */,
|
||||
1ABCA1FD18CD8F6E0087CE3A /* tolua_push.c */,
|
||||
1ABCA1FE18CD8F6E0087CE3A /* tolua_to.c */,
|
||||
1ABCA1FF18CD8F6E0087CE3A /* tolua++.h */,
|
||||
);
|
||||
name = tolua;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1E518CD8F470087CE3A /* include */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1E618CD8F470087CE3A /* lauxlib.h */,
|
||||
1ABCA1E718CD8F470087CE3A /* lua.h */,
|
||||
1ABCA1E818CD8F470087CE3A /* luaconf.h */,
|
||||
1ABCA1E918CD8F470087CE3A /* lualib.h */,
|
||||
);
|
||||
name = include;
|
||||
path = ../../../../external/lua/luajit/include;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1F218CD8F540087CE3A /* ios */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1F318CD8F540087CE3A /* libluajit.a */,
|
||||
);
|
||||
name = ios;
|
||||
path = ../../../../external/lua/luajit/prebuilt/ios;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA1F518CD8F5F0087CE3A /* mac */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA1F618CD8F5F0087CE3A /* libluajit.a */,
|
||||
);
|
||||
name = mac;
|
||||
path = ../../../../external/lua/luajit/prebuilt/mac;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1ABCA20E18CD8F7D0087CE3A /* luasocket */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
1ABCA20F18CD8F7D0087CE3A /* auxiliar.c */,
|
||||
1ABCA21018CD8F7D0087CE3A /* auxiliar.h */,
|
||||
1ABCA21118CD8F7D0087CE3A /* except.c */,
|
||||
1ABCA21218CD8F7D0087CE3A /* except.h */,
|
||||
1ABCA21318CD8F7D0087CE3A /* inet.c */,
|
||||
1ABCA21418CD8F7D0087CE3A /* inet.h */,
|
||||
1ABCA21518CD8F7D0087CE3A /* luasocket.c */,
|
||||
1ABCA21618CD8F7D0087CE3A /* luasocket.h */,
|
||||
1ABCA21718CD8F7D0087CE3A /* luasocket_buffer.c */,
|
||||
1ABCA21818CD8F7D0087CE3A /* luasocket_buffer.h */,
|
||||
1ABCA21918CD8F7D0087CE3A /* luasocket_io.c */,
|
||||
1ABCA21A18CD8F7D0087CE3A /* luasocket_io.h */,
|
||||
1ABCA21B18CD8F7D0087CE3A /* mime.c */,
|
||||
1ABCA21C18CD8F7D0087CE3A /* mime.h */,
|
||||
1ABCA21D18CD8F7D0087CE3A /* options.c */,
|
||||
1ABCA21E18CD8F7D0087CE3A /* options.h */,
|
||||
1ABCA21F18CD8F7D0087CE3A /* select.c */,
|
||||
1ABCA22018CD8F7D0087CE3A /* select.h */,
|
||||
1ABCA22118CD8F7D0087CE3A /* serial.c */,
|
||||
1ABCA22218CD8F7D0087CE3A /* socket.h */,
|
||||
1ABCA22318CD8F7D0087CE3A /* socket_scripts.c */,
|
||||
1ABCA22418CD8F7D0087CE3A /* socket_scripts.h */,
|
||||
1ABCA22518CD8F7D0087CE3A /* tcp.c */,
|
||||
1ABCA22618CD8F7D0087CE3A /* tcp.h */,
|
||||
1ABCA22718CD8F7D0087CE3A /* timeout.c */,
|
||||
1ABCA22818CD8F7D0087CE3A /* timeout.h */,
|
||||
1ABCA22918CD8F7D0087CE3A /* udp.c */,
|
||||
1ABCA22A18CD8F7D0087CE3A /* udp.h */,
|
||||
1ABCA22B18CD8F7D0087CE3A /* unix.c */,
|
||||
1ABCA22C18CD8F7D0087CE3A /* unix.h */,
|
||||
1ABCA22D18CD8F7D0087CE3A /* usocket.c */,
|
||||
1ABCA22E18CD8F7D0087CE3A /* usocket.h */,
|
||||
);
|
||||
name = luasocket;
|
||||
path = ../../../../external/lua/luasocket;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXHeadersBuildPhase section */
|
||||
|
@ -313,34 +553,56 @@
|
|||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1ABCA26C18CD8F7D0087CE3A /* unix.h in Headers */,
|
||||
1AACE7E018BC45C200215002 /* CCLuaBridge.h in Headers */,
|
||||
C0FEF4D918BE0E70001F446C /* lua_debugger.h in Headers */,
|
||||
1AACE7B818BC45C200215002 /* lua_cocos2dx_auto.hpp in Headers */,
|
||||
1AACE7E418BC45C200215002 /* CCLuaEngine.h in Headers */,
|
||||
1ABCA25C18CD8F7D0087CE3A /* socket_scripts.h in Headers */,
|
||||
1ABCA24818CD8F7D0087CE3A /* luasocket_io.h in Headers */,
|
||||
1AACE7F018BC45C200215002 /* Cocos2dxLuaLoader.h in Headers */,
|
||||
1AACE7DC18BC45C200215002 /* CCBProxy.h in Headers */,
|
||||
1ABCA20D18CD8F6E0087CE3A /* tolua++.h in Headers */,
|
||||
1ABCA24018CD8F7D0087CE3A /* luasocket.h in Headers */,
|
||||
1ABCA25818CD8F7D0087CE3A /* socket.h in Headers */,
|
||||
1ABCA23418CD8F7D0087CE3A /* auxiliar.h in Headers */,
|
||||
1AACE7E818BC45C200215002 /* CCLuaStack.h in Headers */,
|
||||
1ABCA1EF18CD8F470087CE3A /* luaconf.h in Headers */,
|
||||
1ABCA23C18CD8F7D0087CE3A /* inet.h in Headers */,
|
||||
1AACE7D018BC45C200215002 /* lua_cocos2dx_spine_auto.hpp in Headers */,
|
||||
1ABCA1EB18CD8F470087CE3A /* lauxlib.h in Headers */,
|
||||
1AACE81018BC45C200215002 /* lua_extensions.h in Headers */,
|
||||
1AACE82018BC45C200215002 /* LuaOpengl.h in Headers */,
|
||||
1ABCA26018CD8F7D0087CE3A /* tcp.h in Headers */,
|
||||
1AACE80418BC45C200215002 /* lua_cocos2dx_manual.hpp in Headers */,
|
||||
1AACE81818BC45C200215002 /* lua_xml_http_request.h in Headers */,
|
||||
1AACE87C18BC45C200215002 /* tolua_fix.h in Headers */,
|
||||
1AACE83218BC45C200215002 /* CCLuaObjcBridge.h in Headers */,
|
||||
1ABCA24418CD8F7D0087CE3A /* luasocket_buffer.h in Headers */,
|
||||
1AACE82418BC45C200215002 /* LuaScriptHandlerMgr.h in Headers */,
|
||||
1AACE7FC18BC45C200215002 /* lua_cocos2dx_extension_manual.h in Headers */,
|
||||
1AACE80018BC45C200215002 /* lua_cocos2dx_gui_manual.hpp in Headers */,
|
||||
1AACE7EC18BC45C200215002 /* CCLuaValue.h in Headers */,
|
||||
1AACE80C18BC45C200215002 /* lua_cocos2dx_spine_manual.hpp in Headers */,
|
||||
1AACE7C418BC45C200215002 /* lua_cocos2dx_gui_auto.hpp in Headers */,
|
||||
1ABCA25018CD8F7D0087CE3A /* options.h in Headers */,
|
||||
1ABCA1F118CD8F470087CE3A /* lualib.h in Headers */,
|
||||
1ABCA20318CD8F6E0087CE3A /* tolua_event.h in Headers */,
|
||||
1AACE82818BC45C200215002 /* LuaSkeletonAnimation.h in Headers */,
|
||||
1ABCA27018CD8F7D0087CE3A /* usocket.h in Headers */,
|
||||
1AACE80818BC45C200215002 /* lua_cocos2dx_physics_manual.hpp in Headers */,
|
||||
1AACE7BE18BC45C200215002 /* lua_cocos2dx_extension_auto.hpp in Headers */,
|
||||
1ABCA23818CD8F7D0087CE3A /* except.h in Headers */,
|
||||
1ABCA26418CD8F7D0087CE3A /* timeout.h in Headers */,
|
||||
1AACE81418BC45C200215002 /* Lua_web_socket.h in Headers */,
|
||||
1AACE81C18BC45C200215002 /* LuaBasicConversions.h in Headers */,
|
||||
1AACE7CA18BC45C200215002 /* lua_cocos2dx_physics_auto.hpp in Headers */,
|
||||
1AACE7F818BC45C200215002 /* lua_cocos2dx_deprecated.h in Headers */,
|
||||
1ABCA24C18CD8F7D0087CE3A /* mime.h in Headers */,
|
||||
1ABCA1ED18CD8F470087CE3A /* lua.h in Headers */,
|
||||
1AACE7F418BC45C200215002 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */,
|
||||
1ABCA26818CD8F7D0087CE3A /* udp.h in Headers */,
|
||||
1ABCA25418CD8F7D0087CE3A /* select.h in Headers */,
|
||||
1AACE7D618BC45C200215002 /* lua_cocos2dx_studio_auto.hpp in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -349,34 +611,56 @@
|
|||
isa = PBXHeadersBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
1ABCA26B18CD8F7D0087CE3A /* unix.h in Headers */,
|
||||
1AACE7DF18BC45C200215002 /* CCLuaBridge.h in Headers */,
|
||||
C0FEF4D818BE0E70001F446C /* lua_debugger.h in Headers */,
|
||||
1AACE7B718BC45C200215002 /* lua_cocos2dx_auto.hpp in Headers */,
|
||||
1AACE7E318BC45C200215002 /* CCLuaEngine.h in Headers */,
|
||||
1ABCA25B18CD8F7D0087CE3A /* socket_scripts.h in Headers */,
|
||||
1ABCA24718CD8F7D0087CE3A /* luasocket_io.h in Headers */,
|
||||
1AACE7EF18BC45C200215002 /* Cocos2dxLuaLoader.h in Headers */,
|
||||
1AACE7DB18BC45C200215002 /* CCBProxy.h in Headers */,
|
||||
1ABCA20C18CD8F6E0087CE3A /* tolua++.h in Headers */,
|
||||
1ABCA23F18CD8F7D0087CE3A /* luasocket.h in Headers */,
|
||||
1ABCA25718CD8F7D0087CE3A /* socket.h in Headers */,
|
||||
1ABCA23318CD8F7D0087CE3A /* auxiliar.h in Headers */,
|
||||
1AACE7E718BC45C200215002 /* CCLuaStack.h in Headers */,
|
||||
1ABCA1EE18CD8F470087CE3A /* luaconf.h in Headers */,
|
||||
1ABCA23B18CD8F7D0087CE3A /* inet.h in Headers */,
|
||||
1AACE7CF18BC45C200215002 /* lua_cocos2dx_spine_auto.hpp in Headers */,
|
||||
1ABCA1EA18CD8F470087CE3A /* lauxlib.h in Headers */,
|
||||
1AACE80F18BC45C200215002 /* lua_extensions.h in Headers */,
|
||||
1AACE81F18BC45C200215002 /* LuaOpengl.h in Headers */,
|
||||
1ABCA25F18CD8F7D0087CE3A /* tcp.h in Headers */,
|
||||
1AACE80318BC45C200215002 /* lua_cocos2dx_manual.hpp in Headers */,
|
||||
1AACE81718BC45C200215002 /* lua_xml_http_request.h in Headers */,
|
||||
1AACE87B18BC45C200215002 /* tolua_fix.h in Headers */,
|
||||
1AACE83118BC45C200215002 /* CCLuaObjcBridge.h in Headers */,
|
||||
1ABCA24318CD8F7D0087CE3A /* luasocket_buffer.h in Headers */,
|
||||
1AACE82318BC45C200215002 /* LuaScriptHandlerMgr.h in Headers */,
|
||||
1AACE7FB18BC45C200215002 /* lua_cocos2dx_extension_manual.h in Headers */,
|
||||
1AACE7FF18BC45C200215002 /* lua_cocos2dx_gui_manual.hpp in Headers */,
|
||||
1AACE7EB18BC45C200215002 /* CCLuaValue.h in Headers */,
|
||||
1AACE80B18BC45C200215002 /* lua_cocos2dx_spine_manual.hpp in Headers */,
|
||||
1AACE7C318BC45C200215002 /* lua_cocos2dx_gui_auto.hpp in Headers */,
|
||||
1ABCA24F18CD8F7D0087CE3A /* options.h in Headers */,
|
||||
1ABCA1F018CD8F470087CE3A /* lualib.h in Headers */,
|
||||
1ABCA20218CD8F6E0087CE3A /* tolua_event.h in Headers */,
|
||||
1AACE82718BC45C200215002 /* LuaSkeletonAnimation.h in Headers */,
|
||||
1ABCA26F18CD8F7D0087CE3A /* usocket.h in Headers */,
|
||||
1AACE80718BC45C200215002 /* lua_cocos2dx_physics_manual.hpp in Headers */,
|
||||
1AACE7BD18BC45C200215002 /* lua_cocos2dx_extension_auto.hpp in Headers */,
|
||||
1ABCA23718CD8F7D0087CE3A /* except.h in Headers */,
|
||||
1ABCA26318CD8F7D0087CE3A /* timeout.h in Headers */,
|
||||
1AACE81318BC45C200215002 /* Lua_web_socket.h in Headers */,
|
||||
1AACE81B18BC45C200215002 /* LuaBasicConversions.h in Headers */,
|
||||
1AACE7C918BC45C200215002 /* lua_cocos2dx_physics_auto.hpp in Headers */,
|
||||
1AACE7F718BC45C200215002 /* lua_cocos2dx_deprecated.h in Headers */,
|
||||
1ABCA24B18CD8F7D0087CE3A /* mime.h in Headers */,
|
||||
1ABCA1EC18CD8F470087CE3A /* lua.h in Headers */,
|
||||
1AACE7F318BC45C200215002 /* lua_cocos2dx_coco_studio_manual.hpp in Headers */,
|
||||
1ABCA26718CD8F7D0087CE3A /* udp.h in Headers */,
|
||||
1ABCA25318CD8F7D0087CE3A /* select.h in Headers */,
|
||||
1AACE7D518BC45C200215002 /* lua_cocos2dx_studio_auto.hpp in Headers */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -452,32 +736,53 @@
|
|||
files = (
|
||||
1AACE7C818BC45C200215002 /* lua_cocos2dx_physics_auto.cpp in Sources */,
|
||||
1AACE83418BC45C200215002 /* CCLuaObjcBridge.mm in Sources */,
|
||||
1ABCA20518CD8F6E0087CE3A /* tolua_is.c in Sources */,
|
||||
1AACE7F618BC45C200215002 /* lua_cocos2dx_deprecated.cpp in Sources */,
|
||||
1ABCA24E18CD8F7D0087CE3A /* options.c in Sources */,
|
||||
1A262AB918BEEF5900D2DB92 /* tolua_fix.cpp in Sources */,
|
||||
1AACE81E18BC45C200215002 /* LuaOpengl.cpp in Sources */,
|
||||
1AACE7C218BC45C200215002 /* lua_cocos2dx_gui_auto.cpp in Sources */,
|
||||
1AACE7CE18BC45C200215002 /* lua_cocos2dx_spine_auto.cpp in Sources */,
|
||||
1AACE80218BC45C200215002 /* lua_cocos2dx_manual.cpp in Sources */,
|
||||
1ABCA24618CD8F7D0087CE3A /* luasocket_io.c in Sources */,
|
||||
1ABCA23E18CD8F7D0087CE3A /* luasocket.c in Sources */,
|
||||
1ABCA25218CD8F7D0087CE3A /* select.c in Sources */,
|
||||
1ABCA24A18CD8F7D0087CE3A /* mime.c in Sources */,
|
||||
1ABCA26218CD8F7D0087CE3A /* timeout.c in Sources */,
|
||||
1ABCA26618CD8F7D0087CE3A /* udp.c in Sources */,
|
||||
1AACE82218BC45C200215002 /* LuaScriptHandlerMgr.cpp in Sources */,
|
||||
1ABCA23618CD8F7D0087CE3A /* except.c in Sources */,
|
||||
1ABCA26A18CD8F7D0087CE3A /* unix.c in Sources */,
|
||||
1AACE7F218BC45C200215002 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */,
|
||||
1AACE80E18BC45C200215002 /* lua_extensions.c in Sources */,
|
||||
1AACE7EA18BC45C200215002 /* CCLuaValue.cpp in Sources */,
|
||||
1AACE7D418BC45C200215002 /* lua_cocos2dx_studio_auto.cpp in Sources */,
|
||||
1AACE7BC18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp in Sources */,
|
||||
1ABCA20918CD8F6E0087CE3A /* tolua_push.c in Sources */,
|
||||
1AACE82618BC45C200215002 /* LuaSkeletonAnimation.cpp in Sources */,
|
||||
1ABCA25E18CD8F7D0087CE3A /* tcp.c in Sources */,
|
||||
1AACE80A18BC45C200215002 /* lua_cocos2dx_spine_manual.cpp in Sources */,
|
||||
1ABCA24218CD8F7D0087CE3A /* luasocket_buffer.c in Sources */,
|
||||
1AACE81A18BC45C200215002 /* LuaBasicConversions.cpp in Sources */,
|
||||
1AACE7EE18BC45C200215002 /* Cocos2dxLuaLoader.cpp in Sources */,
|
||||
1ABCA25A18CD8F7D0087CE3A /* socket_scripts.c in Sources */,
|
||||
1AACE7DA18BC45C200215002 /* CCBProxy.cpp in Sources */,
|
||||
1AACE81618BC45C200215002 /* lua_xml_http_request.cpp in Sources */,
|
||||
1ABCA23A18CD8F7D0087CE3A /* inet.c in Sources */,
|
||||
1AACE7E218BC45C200215002 /* CCLuaEngine.cpp in Sources */,
|
||||
1ABCA26E18CD8F7D0087CE3A /* usocket.c in Sources */,
|
||||
1AACE81218BC45C200215002 /* Lua_web_socket.cpp in Sources */,
|
||||
1AACE7FA18BC45C200215002 /* lua_cocos2dx_extension_manual.cpp in Sources */,
|
||||
1AACE7DE18BC45C200215002 /* CCLuaBridge.cpp in Sources */,
|
||||
1ABCA23218CD8F7D0087CE3A /* auxiliar.c in Sources */,
|
||||
1ABCA20118CD8F6E0087CE3A /* tolua_event.c in Sources */,
|
||||
C0FEF4D718BE0E70001F446C /* lua_debugger.c in Sources */,
|
||||
1AACE7E618BC45C200215002 /* CCLuaStack.cpp in Sources */,
|
||||
1AACE80618BC45C200215002 /* lua_cocos2dx_physics_manual.cpp in Sources */,
|
||||
1AACE7B618BC45C200215002 /* lua_cocos2dx_auto.cpp in Sources */,
|
||||
1ABCA20718CD8F6E0087CE3A /* tolua_map.c in Sources */,
|
||||
1ABCA25618CD8F7D0087CE3A /* serial.c in Sources */,
|
||||
1ABCA20B18CD8F6E0087CE3A /* tolua_to.c in Sources */,
|
||||
1AACE7FE18BC45C200215002 /* lua_cocos2dx_gui_manual.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -488,32 +793,53 @@
|
|||
files = (
|
||||
1AACE7C718BC45C200215002 /* lua_cocos2dx_physics_auto.cpp in Sources */,
|
||||
1AACE83318BC45C200215002 /* CCLuaObjcBridge.mm in Sources */,
|
||||
1ABCA20418CD8F6E0087CE3A /* tolua_is.c in Sources */,
|
||||
1AACE7F518BC45C200215002 /* lua_cocos2dx_deprecated.cpp in Sources */,
|
||||
1ABCA24D18CD8F7D0087CE3A /* options.c in Sources */,
|
||||
1A262AB818BEEF5900D2DB92 /* tolua_fix.cpp in Sources */,
|
||||
1AACE81D18BC45C200215002 /* LuaOpengl.cpp in Sources */,
|
||||
1AACE7C118BC45C200215002 /* lua_cocos2dx_gui_auto.cpp in Sources */,
|
||||
1AACE7CD18BC45C200215002 /* lua_cocos2dx_spine_auto.cpp in Sources */,
|
||||
1AACE80118BC45C200215002 /* lua_cocos2dx_manual.cpp in Sources */,
|
||||
1ABCA24518CD8F7D0087CE3A /* luasocket_io.c in Sources */,
|
||||
1ABCA23D18CD8F7D0087CE3A /* luasocket.c in Sources */,
|
||||
1ABCA25118CD8F7D0087CE3A /* select.c in Sources */,
|
||||
1ABCA24918CD8F7D0087CE3A /* mime.c in Sources */,
|
||||
1ABCA26118CD8F7D0087CE3A /* timeout.c in Sources */,
|
||||
1ABCA26518CD8F7D0087CE3A /* udp.c in Sources */,
|
||||
1AACE82118BC45C200215002 /* LuaScriptHandlerMgr.cpp in Sources */,
|
||||
1ABCA23518CD8F7D0087CE3A /* except.c in Sources */,
|
||||
1ABCA26918CD8F7D0087CE3A /* unix.c in Sources */,
|
||||
1AACE7F118BC45C200215002 /* lua_cocos2dx_coco_studio_manual.cpp in Sources */,
|
||||
1AACE80D18BC45C200215002 /* lua_extensions.c in Sources */,
|
||||
1AACE7E918BC45C200215002 /* CCLuaValue.cpp in Sources */,
|
||||
1AACE7D318BC45C200215002 /* lua_cocos2dx_studio_auto.cpp in Sources */,
|
||||
1AACE7BB18BC45C200215002 /* lua_cocos2dx_extension_auto.cpp in Sources */,
|
||||
1ABCA20818CD8F6E0087CE3A /* tolua_push.c in Sources */,
|
||||
1AACE82518BC45C200215002 /* LuaSkeletonAnimation.cpp in Sources */,
|
||||
1ABCA25D18CD8F7D0087CE3A /* tcp.c in Sources */,
|
||||
1AACE80918BC45C200215002 /* lua_cocos2dx_spine_manual.cpp in Sources */,
|
||||
1ABCA24118CD8F7D0087CE3A /* luasocket_buffer.c in Sources */,
|
||||
1AACE81918BC45C200215002 /* LuaBasicConversions.cpp in Sources */,
|
||||
1AACE7ED18BC45C200215002 /* Cocos2dxLuaLoader.cpp in Sources */,
|
||||
1ABCA25918CD8F7D0087CE3A /* socket_scripts.c in Sources */,
|
||||
1AACE7D918BC45C200215002 /* CCBProxy.cpp in Sources */,
|
||||
1AACE81518BC45C200215002 /* lua_xml_http_request.cpp in Sources */,
|
||||
1ABCA23918CD8F7D0087CE3A /* inet.c in Sources */,
|
||||
1AACE7E118BC45C200215002 /* CCLuaEngine.cpp in Sources */,
|
||||
1ABCA26D18CD8F7D0087CE3A /* usocket.c in Sources */,
|
||||
1AACE81118BC45C200215002 /* Lua_web_socket.cpp in Sources */,
|
||||
1AACE7F918BC45C200215002 /* lua_cocos2dx_extension_manual.cpp in Sources */,
|
||||
1AACE7DD18BC45C200215002 /* CCLuaBridge.cpp in Sources */,
|
||||
1ABCA23118CD8F7D0087CE3A /* auxiliar.c in Sources */,
|
||||
1ABCA20018CD8F6E0087CE3A /* tolua_event.c in Sources */,
|
||||
C0FEF4D618BE0E70001F446C /* lua_debugger.c in Sources */,
|
||||
1AACE7E518BC45C200215002 /* CCLuaStack.cpp in Sources */,
|
||||
1AACE80518BC45C200215002 /* lua_cocos2dx_physics_manual.cpp in Sources */,
|
||||
1AACE7B518BC45C200215002 /* lua_cocos2dx_auto.cpp in Sources */,
|
||||
1ABCA20618CD8F6E0087CE3A /* tolua_map.c in Sources */,
|
||||
1ABCA25518CD8F7D0087CE3A /* serial.c in Sources */,
|
||||
1ABCA20A18CD8F6E0087CE3A /* tolua_to.c in Sources */,
|
||||
1AACE7FD18BC45C200215002 /* lua_cocos2dx_gui_manual.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
|
@ -555,7 +881,7 @@
|
|||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../cocos2d-x $(SRCROOT)/../../cocos2d-x/cocos $(SRCROOT)/../../cocos2d-x/cocos/base $(SRCROOT)/../../cocos2d-x/cocos/2d $(SRCROOT)/../../cocos2d-x/cocos/physics $(SRCROOT)/../../cocos2d-x/cocos/math/kazmath $(SRCROOT)/../../cocos2d-x/cocos/2d/platform $(SRCROOT)/../../cocos2d-x/cocos/audio/include $(SRCROOT)/../../cocos2d-x/cocos/editor-support $(SRCROOT)/../../cocos2d-x/cocos/editor-support/spine $(SRCROOT)/../../cocos2d-x/cocos/editor-support/cocostudio $(SRCROOT)/../../cocos2d-x/cocos/editor-support/cocosbuilder $(SRCROOT)/../../cocos2d-x/cocos/gui $(SRCROOT)/../../cocos2d-x/cocos/storage $(SRCROOT)/../../cocos2d-x/extensions $(SRCROOT)/../../cocos2d-x/external/chipmunk/include/chipmunk $(SRCROOT)/../../cocos2d-x/external $(SRCROOT)/../../external/luajit/include $(SRCROOT)/../../external/tolua $(SRCROOT)/../../external";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../gui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -588,7 +914,7 @@
|
|||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
SDKROOT = macosx;
|
||||
SKIP_INSTALL = YES;
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../cocos2d-x $(SRCROOT)/../../cocos2d-x/cocos $(SRCROOT)/../../cocos2d-x/cocos/base $(SRCROOT)/../../cocos2d-x/cocos/2d $(SRCROOT)/../../cocos2d-x/cocos/physics $(SRCROOT)/../../cocos2d-x/cocos/math/kazmath $(SRCROOT)/../../cocos2d-x/cocos/2d/platform $(SRCROOT)/../../cocos2d-x/cocos/audio/include $(SRCROOT)/../../cocos2d-x/cocos/editor-support $(SRCROOT)/../../cocos2d-x/cocos/editor-support/spine $(SRCROOT)/../../cocos2d-x/cocos/editor-support/cocostudio $(SRCROOT)/../../cocos2d-x/cocos/editor-support/cocosbuilder $(SRCROOT)/../../cocos2d-x/cocos/gui $(SRCROOT)/../../cocos2d-x/cocos/storage $(SRCROOT)/../../cocos2d-x/extensions $(SRCROOT)/../../cocos2d-x/external/chipmunk/include/chipmunk $(SRCROOT)/../../cocos2d-x/external $(SRCROOT)/../../external/luajit/include $(SRCROOT)/../../external/tolua $(SRCROOT)/../../external";
|
||||
USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/../../../.. $(SRCROOT)/../../.. $(SRCROOT)/../../../base $(SRCROOT)/../../../2d $(SRCROOT)/../../../physics $(SRCROOT)/../../../math/kazmath $(SRCROOT)/../../../2d/platform $(SRCROOT)/../../../audio/include $(SRCROOT)/../../../editor-support $(SRCROOT)/../../../editor-support/spine $(SRCROOT)/../../../editor-support/cocostudio $(SRCROOT)/../../../editor-support/cocosbuilder $(SRCROOT)/../../../gui $(SRCROOT)/../../../storage $(SRCROOT)/../../../../extensions $(SRCROOT)/../../../../external $(SRCROOT)/../../../../external/chipmunk/include/chipmunk $(SRCROOT)/../../../../external/lua $(SRCROOT)/../../../../external/lua/luajit/include $(SRCROOT)/../../../../external/lua/tolua";
|
||||
VALIDATE_PRODUCT = YES;
|
||||
};
|
||||
name = Release;
|
||||
|
@ -606,10 +932,10 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../external/luajit/prebuilt/ios";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/2d/platform/ios";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../2d/platform/ios";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -626,10 +952,10 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../external/luajit/prebuilt/ios";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/ios";
|
||||
SDKROOT = iphoneos;
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/2d/platform/ios";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../2d/platform/ios";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
@ -647,9 +973,9 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../external/luajit/prebuilt/mac";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/mac";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/2d/platform/mac $(SRCROOT)/../../cocos2d-x/external/glfw3/include/mac";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../2d/platform/mac $(SRCROOT)/../../../../external/glfw3/include/mac";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
|
@ -667,9 +993,9 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 5.0;
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../external/luajit/prebuilt/mac";
|
||||
LIBRARY_SEARCH_PATHS = "$(SRCROOT)/../../../../external/lua/luajit/prebuilt/mac";
|
||||
TARGETED_DEVICE_FAMILY = "1,2";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../cocos2d-x/cocos/2d/platform/mac $(SRCROOT)/../../cocos2d-x/external/glfw3/include/mac";
|
||||
USER_HEADER_SEARCH_PATHS = "$(inherited) $(SRCROOT)/../../../2d/platform/mac $(SRCROOT)/../../../../external/glfw3/include/mac";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,59 @@
|
|||
<?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_lua_bindings.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>
|
|
@ -0,0 +1,59 @@
|
|||
<?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_lua_bindings.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>
|
|
@ -0,0 +1,118 @@
|
|||
#include "cocos2d.h"
|
||||
#include "AppDelegate.h"
|
||||
#include "CCLuaEngine.h"
|
||||
#include "SimpleAudioEngine.h"
|
||||
#include "lua_assetsmanager_test_sample.h"
|
||||
|
||||
using namespace CocosDenshion;
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
SimpleAudioEngine::end();
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
auto director = Director::getInstance();
|
||||
auto glview = director->getOpenGLView();
|
||||
if(!glview) {
|
||||
glview = GLView::createWithRect("Test Lua", Rect(0,0,900,640));
|
||||
director->setOpenGLView(glview);
|
||||
}
|
||||
|
||||
// turn on display FPS
|
||||
director->setDisplayStats(true);
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
director->setAnimationInterval(1.0 / 60);
|
||||
|
||||
auto screenSize = glview->getFrameSize();
|
||||
|
||||
auto designSize = Size(480, 320);
|
||||
|
||||
auto pFileUtils = FileUtils::getInstance();
|
||||
|
||||
if (screenSize.height > 320)
|
||||
{
|
||||
auto resourceSize = Size(960, 640);
|
||||
std::vector<std::string> searchPaths;
|
||||
searchPaths.push_back("hd");
|
||||
pFileUtils->setSearchPaths(searchPaths);
|
||||
director->setContentScaleFactor(resourceSize.height/designSize.height);
|
||||
}
|
||||
|
||||
glview->setDesignResolutionSize(designSize.width, designSize.height, ResolutionPolicy::FIXED_HEIGHT);
|
||||
|
||||
// register lua engine
|
||||
LuaEngine* pEngine = LuaEngine::getInstance();
|
||||
ScriptEngineManager::getInstance()->setScriptEngine(pEngine);
|
||||
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID ||CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
LuaStack* stack = pEngine->getLuaStack();
|
||||
register_assetsmanager_test_sample(stack->getLuaState());
|
||||
#endif
|
||||
|
||||
std::string resPrefix("res/");
|
||||
|
||||
std::vector<std::string> searchPaths = pFileUtils->getSearchPaths();
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix);
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "Images");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "cocosbuilderRes");
|
||||
if (screenSize.height > 320)
|
||||
{
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/Images");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/ArmatureComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/AttributeComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/BackgroundComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/EffectComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/LoadSceneEdtiorFileTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/ParticleComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/SpriteComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/TmxMapComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/UIComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "hd/scenetest/TriggerTest");
|
||||
}
|
||||
else
|
||||
{
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/ArmatureComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/AttributeComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/BackgroundComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/EffectComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/LoadSceneEdtiorFileTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/ParticleComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/SpriteComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/TmxMapComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/UIComponentTest");
|
||||
searchPaths.insert(searchPaths.begin(), resPrefix + "scenetest/TriggerTest");
|
||||
}
|
||||
|
||||
|
||||
FileUtils::getInstance()->setSearchPaths(searchPaths);
|
||||
|
||||
pEngine->executeScriptFile("src/controller.lua");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
Director::getInstance()->stopAnimation();
|
||||
|
||||
SimpleAudioEngine::getInstance()->pauseBackgroundMusic();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
Director::getInstance()->startAnimation();
|
||||
|
||||
SimpleAudioEngine::getInstance()->resumeBackgroundMusic();
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
#ifndef __APP_DELEGATE_H__
|
||||
#define __APP_DELEGATE_H__
|
||||
|
||||
#include "cocos2d.h"
|
||||
|
||||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by Director.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::Application
|
||||
{
|
||||
public:
|
||||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
/**
|
||||
@brief Implement Director and Scene init code here.
|
||||
@return true Initialize success, app continue.
|
||||
@return false Initialize failed, app terminate.
|
||||
*/
|
||||
virtual bool applicationDidFinishLaunching();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter background
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationDidEnterBackground();
|
||||
|
||||
/**
|
||||
@brief The function be called when the application enter foreground
|
||||
@param the pointer of the application
|
||||
*/
|
||||
virtual void applicationWillEnterForeground();
|
||||
};
|
||||
|
||||
#endif // __APP_DELEGATE_H__
|
||||
|
|
@ -0,0 +1,154 @@
|
|||
#include "lua_assetsmanager_test_sample.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua_fix.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "extensions/cocos-ext.h"
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
USING_NS_CC;
|
||||
USING_NS_CC_EXT;
|
||||
|
||||
|
||||
static int lua_cocos2dx_createDownloadDir(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
if (0 == argc)
|
||||
{
|
||||
std::string pathToSave = FileUtils::getInstance()->getWritablePath();
|
||||
pathToSave += "tmpdir";
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
||||
DIR *pDir = NULL;
|
||||
|
||||
pDir = opendir (pathToSave.c_str());
|
||||
if (! pDir)
|
||||
{
|
||||
mkdir(pathToSave.c_str(), S_IRWXU | S_IRWXG | S_IRWXO);
|
||||
}
|
||||
#else
|
||||
if ((GetFileAttributesA(pathToSave.c_str())) == INVALID_FILE_ATTRIBUTES)
|
||||
{
|
||||
CreateDirectoryA(pathToSave.c_str(), 0);
|
||||
}
|
||||
#endif
|
||||
tolua_pushstring(L, pathToSave.c_str());
|
||||
return 1;
|
||||
}
|
||||
|
||||
CCLOG("'createDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_deleteDownloadDir(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
if (1 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isstring(L, 1, 0, &tolua_err)) goto tolua_lerror;
|
||||
#endif
|
||||
std::string pathToSave = tolua_tostring(L, 1, "");
|
||||
|
||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_WIN32)
|
||||
std::string command = "rm -r ";
|
||||
// Path may include space.
|
||||
command += "\"" + pathToSave + "\"";
|
||||
system(command.c_str());
|
||||
#else
|
||||
std::string command = "rd /s /q ";
|
||||
// Path may include space.
|
||||
command += "\"" + pathToSave + "\"";
|
||||
system(command.c_str());
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
CCLOG("'resetDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 1);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(L,"#ferror in function 'resetDownloadDir'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static int lua_cocos2dx_addSearchPath(lua_State* L)
|
||||
{
|
||||
if (nullptr == L)
|
||||
return 0;
|
||||
|
||||
int argc = lua_gettop(L);
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_Error tolua_err;
|
||||
#endif
|
||||
|
||||
|
||||
if (2 == argc)
|
||||
{
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
if (!tolua_isstring(L, 1, 0, &tolua_err) ||
|
||||
!tolua_isboolean(L, 2, 0, &tolua_err))
|
||||
goto tolua_lerror;
|
||||
#endif
|
||||
std::string pathToSave = tolua_tostring(L, 1, "");
|
||||
bool before = tolua_toboolean(L, 2, 0);
|
||||
std::vector<std::string> searchPaths = FileUtils::getInstance()->getSearchPaths();
|
||||
if (before)
|
||||
{
|
||||
searchPaths.insert(searchPaths.begin(), pathToSave);
|
||||
}
|
||||
else
|
||||
{
|
||||
searchPaths.push_back(pathToSave);
|
||||
}
|
||||
|
||||
FileUtils::getInstance()->setSearchPaths(searchPaths);
|
||||
|
||||
return 0;
|
||||
}
|
||||
CCLOG("'addSearchPath' function wrong number of arguments: %d, was expecting %d\n", argc, 2);
|
||||
return 0;
|
||||
|
||||
#if COCOS2D_DEBUG >= 1
|
||||
tolua_lerror:
|
||||
tolua_error(L,"#ferror in function 'addSearchPath'.",&tolua_err);
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int register_assetsmanager_test_sample(lua_State* L)
|
||||
{
|
||||
tolua_open(L);
|
||||
tolua_module(L, NULL, 0);
|
||||
tolua_beginmodule(L, NULL);
|
||||
tolua_function(L, "createDownloadDir", lua_cocos2dx_createDownloadDir);
|
||||
tolua_function(L, "deleteDownloadDir", lua_cocos2dx_deleteDownloadDir);
|
||||
tolua_function(L, "addSearchPath", lua_cocos2dx_addSearchPath);
|
||||
tolua_endmodule(L);
|
||||
return 0;
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
#ifndef COCOS2DX_COCOS_SCRIPTING_LUA_BINDINGS_LUA_ASSETSMANAGER_TEST_SAMPLE_H
|
||||
#define COCOS2DX_COCOS_SCRIPTING_LUA_BINDINGS_LUA_ASSETSMANAGER_TEST_SAMPLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#include "tolua++.h"
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The apis which are bound in this file are temporary for the assetsmanager test sample.After the completion of some systems like fileutils,these apis will be deprecated
|
||||
*/
|
||||
TOLUA_API int register_assetsmanager_test_sample(lua_State* tolua_S);
|
||||
|
||||
#endif // #ifndef COCOS2DX_COCOS_SCRIPTING_LUA_BINDINGS_LUA_ASSETSMANAGER_TEST_SAMPLE_H
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>TestLua</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>com.android.ide.eclipse.adt.ApkBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
|
||||
<triggers>full,incremental,</triggers>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.cdt.core.cnature</nature>
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
<name>Resources</name>
|
||||
<type>2</type>
|
||||
<locationURI>PARENT-1-PROJECT_LOC/Resources</locationURI>
|
||||
</link>
|
||||
</linkedResources>
|
||||
</projectDescription>
|
|
@ -0,0 +1,35 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.cocos2dx.testlua"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="9"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon">
|
||||
|
||||
<activity android:name=".Cocos2dxActivity"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="landscape"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:configChanges="orientation">
|
||||
|
||||
<!-- Tell NativeActivity the name of our .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
android:value="testlua" />
|
||||
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:anyDensity="true"
|
||||
android:smallScreens="true"
|
||||
android:normalScreens="true"
|
||||
android:largeScreens="true"
|
||||
android:xlargeScreens="true"/>
|
||||
<uses-permission android:name="android.permission.INTERNET"/>
|
||||
</manifest>
|
|
@ -0,0 +1,17 @@
|
|||
# This file is used to override default values used by the Ant build system.
|
||||
#
|
||||
# This file must be checked into Version Control Systems, as it is
|
||||
# integral to the build system of your project.
|
||||
|
||||
# This file is only used by the Ant script.
|
||||
|
||||
# You can use this to override default values such as
|
||||
# 'source.dir' for the location of your java source folder and
|
||||
# 'out.dir' for the location of your output folder.
|
||||
|
||||
# You can also use it define how the release builds are signed by declaring
|
||||
# the following properties:
|
||||
# 'key.store' for the location of your keystore and
|
||||
# 'key.alias' for the name of the key to use.
|
||||
# The password will be asked during the build when you use the 'release' target.
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="TestLua" default="help">
|
||||
|
||||
<!-- The local.properties file is created and updated by the 'android' tool.
|
||||
It contains the path to the SDK. It should *NOT* be checked into
|
||||
Version Control Systems. -->
|
||||
<property file="local.properties" />
|
||||
|
||||
<!-- The ant.properties file can be created by you. It is only edited by the
|
||||
'android' tool to add properties to it.
|
||||
This is the place to change some Ant specific build properties.
|
||||
Here are some properties you may want to change/update:
|
||||
|
||||
source.dir
|
||||
The name of the source directory. Default is 'src'.
|
||||
out.dir
|
||||
The name of the output directory. Default is 'bin'.
|
||||
|
||||
For other overridable properties, look at the beginning of the rules
|
||||
files in the SDK, at tools/ant/build.xml
|
||||
|
||||
Properties related to the SDK location or the project target should
|
||||
be updated using the 'android' tool with the 'update' action.
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems.
|
||||
|
||||
-->
|
||||
<property file="ant.properties" />
|
||||
|
||||
<!-- The project.properties file is created and updated by the 'android'
|
||||
tool, as well as ADT.
|
||||
|
||||
This contains project specific properties such as project target, and library
|
||||
dependencies. Lower level build properties are stored in ant.properties
|
||||
(or in .classpath for Eclipse projects).
|
||||
|
||||
This file is an integral part of the build system for your
|
||||
application and should be checked into Version Control Systems. -->
|
||||
<loadproperties srcFile="project.properties" />
|
||||
|
||||
<!-- quick check on sdk.dir -->
|
||||
<fail
|
||||
message="sdk.dir is missing. Make sure to generate local.properties using 'android update project' or to inject it through an env var"
|
||||
unless="sdk.dir"
|
||||
/>
|
||||
|
||||
<!--
|
||||
Import per project custom build rules if present at the root of the project.
|
||||
This is the place to put custom intermediary targets such as:
|
||||
-pre-build
|
||||
-pre-compile
|
||||
-post-compile (This is typically used for code obfuscation.
|
||||
Compiled code location: ${out.classes.absolute.dir}
|
||||
If this is not done in place, override ${out.dex.input.absolute.dir})
|
||||
-post-package
|
||||
-post-build
|
||||
-pre-clean
|
||||
-->
|
||||
<import file="custom_rules.xml" optional="true" />
|
||||
|
||||
<!-- Import the actual build file.
|
||||
|
||||
To customize existing targets, there are two options:
|
||||
- Customize only one target:
|
||||
- copy/paste the target into this file, *before* the
|
||||
<import> task.
|
||||
- customize it to your needs.
|
||||
- Customize the whole content of build.xml
|
||||
- copy/paste the content of the rules files (minus the top node)
|
||||
into this file, replacing the <import> task.
|
||||
- customize to your needs.
|
||||
|
||||
***********************
|
||||
****** IMPORTANT ******
|
||||
***********************
|
||||
In all cases you must update the value of version-tag below to read 'custom' instead of an integer,
|
||||
in order to avoid having your file be overridden by tools such as "android update project"
|
||||
-->
|
||||
<!-- version-tag: 1 -->
|
||||
<import file="${sdk.dir}/tools/ant/build.xml" />
|
||||
|
||||
</project>
|
|
@ -0,0 +1,22 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := testlua_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libtestlua
|
||||
|
||||
LOCAL_SRC_FILES += testlua/main.cpp \
|
||||
../../Classes/AppDelegate.cpp \
|
||||
../../Classes/lua_assetsmanager_test_sample.cpp
|
||||
|
||||
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_STATIC_LIBRARIES := curl_static_prebuilt
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos_lua_static
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,bindings)
|
|
@ -0,0 +1,8 @@
|
|||
APP_STL := gnustl_static
|
||||
|
||||
# add -Wno-literal-suffix to avoid warning: warning: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wliteral-suffix]
|
||||
# in NDK_ROOT/arch-arm/usr/include/sys/cdefs_elf.h:35:28: when using ndk-r9
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_DEBUG=1 -std=c++11 -Wno-literal-suffix -fsigned-char
|
||||
|
||||
APP_CPPFLAGS += -fexceptions
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
#include "CCEventType.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "main"
|
||||
#define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__)
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
void cocos_android_app_init (struct android_app* app) {
|
||||
LOGD("cocos_android_app_init");
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
# To enable ProGuard in your project, edit project.properties
|
||||
# to define the proguard.config property as described in that file.
|
||||
#
|
||||
# Add project specific ProGuard rules here.
|
||||
# By default, the flags in this file are appended to flags specified
|
||||
# in ${sdk.dir}/tools/proguard/proguard-android.txt
|
||||
# You can edit the include path and order by changing the ProGuard
|
||||
# include property in project.properties.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# Add any project specific keep options here:
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
|
@ -0,0 +1,13 @@
|
|||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must be checked in Version Control Systems.
|
||||
#
|
||||
# To customize properties used by the Ant build system use,
|
||||
# "ant.properties", and override values to adapt the script to your
|
||||
# project structure.
|
||||
|
||||
# Project target.
|
||||
target=android-10
|
||||
|
||||
android.library.reference.1=../../../../frameworks/lua-bindings/cocos2d-x/cocos/2d/platform/android/java
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">TestLua</string>
|
||||
</resources>
|
|
@ -0,0 +1,38 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2012 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
package com.cocos2dx.sample.LuaJavaBridgeTest;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxLuaJavaBridge;
|
||||
|
||||
public class LuaJavaBridgeTest
|
||||
{
|
||||
public static int addTwoNumbers(final int num1,final int num2){
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
public static void callbackLua(final String tipInfo,final int luaFunc){
|
||||
Cocos2dxLuaJavaBridge.callLuaFunctionWithString(luaFunc, "success");
|
||||
Cocos2dxLuaJavaBridge.releaseLuaFunction(luaFunc);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package org.cocos2dx.testlua;
|
||||
|
||||
import android.app.NativeActivity;
|
||||
import android.os.Bundle;
|
||||
|
||||
public class Cocos2dxActivity extends NativeActivity{
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
//For supports translucency
|
||||
|
||||
//1.change "attribs" in cocos\2d\platform\android\nativeactivity.cpp
|
||||
/*const EGLint attribs[] = {
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
|
||||
//EGL_BLUE_SIZE, 5, -->delete
|
||||
//EGL_GREEN_SIZE, 6, -->delete
|
||||
//EGL_RED_SIZE, 5, -->delete
|
||||
EGL_BUFFER_SIZE, 32, //-->new field
|
||||
EGL_DEPTH_SIZE, 16,
|
||||
EGL_STENCIL_SIZE, 8,
|
||||
EGL_NONE
|
||||
};*/
|
||||
|
||||
//2.Set the format of window
|
||||
// getWindow().setFormat(PixelFormat.TRANSLUCENT);
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
@class RootViewController;
|
||||
|
||||
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
RootViewController *viewController;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "CCEAGLView.h"
|
||||
#import "AppDelegate.h"
|
||||
|
||||
#import "RootViewController.h"
|
||||
|
||||
@implementation AppController
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Application lifecycle
|
||||
|
||||
// cocos2d application instance
|
||||
static AppDelegate s_sharedApplication;
|
||||
|
||||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||
|
||||
// Override point for customization after application launch.
|
||||
|
||||
// Add the view controller's view to the window and display.
|
||||
window = [[UIWindow alloc] initWithFrame: [[UIScreen mainScreen] bounds]];
|
||||
CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: GL_DEPTH24_STENCIL8_OES
|
||||
preserveBackbuffer: NO
|
||||
sharegroup: nil
|
||||
multiSampling: NO
|
||||
numberOfSamples: 0 ];
|
||||
|
||||
[eaglView setMultipleTouchEnabled:YES];
|
||||
|
||||
// Use RootViewController manage CCEAGLView
|
||||
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
|
||||
viewController.wantsFullScreenLayout = YES;
|
||||
viewController.view = eaglView;
|
||||
|
||||
// Set RootViewController to window
|
||||
if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
|
||||
{
|
||||
// warning: addSubView doesn't work on iOS6
|
||||
[window addSubview: viewController.view];
|
||||
}
|
||||
else
|
||||
{
|
||||
// use this method on ios6
|
||||
[window setRootViewController:viewController];
|
||||
}
|
||||
|
||||
[window makeKeyAndVisible];
|
||||
|
||||
[[UIApplication sharedApplication] setStatusBarHidden: YES];
|
||||
|
||||
|
||||
// IMPORTANT: Setting the GLView should be done after creating the RootViewController
|
||||
cocos2d::GLView *glview = cocos2d::GLView::createWithEAGLView(eaglView);
|
||||
cocos2d::Director::getInstance()->setOpenGLView(glview);
|
||||
|
||||
cocos2d::Application::getInstance()->run();
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
- (void)applicationWillResignActive:(UIApplication *)application {
|
||||
/*
|
||||
Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
|
||||
Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
|
||||
*/
|
||||
cocos2d::Director::getInstance()->pause();
|
||||
}
|
||||
|
||||
- (void)applicationDidBecomeActive:(UIApplication *)application {
|
||||
/*
|
||||
Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
|
||||
*/
|
||||
cocos2d::Director::getInstance()->resume();
|
||||
}
|
||||
|
||||
- (void)applicationDidEnterBackground:(UIApplication *)application {
|
||||
/*
|
||||
Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
|
||||
If your application supports background execution, called instead of applicationWillTerminate: when the user quits.
|
||||
*/
|
||||
cocos2d::Application::getInstance()->applicationDidEnterBackground();
|
||||
}
|
||||
|
||||
- (void)applicationWillEnterForeground:(UIApplication *)application {
|
||||
/*
|
||||
Called as part of transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
|
||||
*/
|
||||
cocos2d::Application::getInstance()->applicationWillEnterForeground();
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(UIApplication *)application {
|
||||
/*
|
||||
Called when the application is about to terminate.
|
||||
See also applicationDidEnterBackground:.
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Memory management
|
||||
|
||||
- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application {
|
||||
/*
|
||||
Free up as much memory as possible by purging cached data objects that can be recreated (or reloaded from disk) later.
|
||||
*/
|
||||
cocos2d::Director::getInstance()->purgeCachedData();
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1 @@
|
|||
66c6d1cead373b45218424f6a82f370897e443e4
|
|
@ -0,0 +1 @@
|
|||
84689888a14a2123d2b39f7f2f61be8c15207479
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
||||
#define COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface LuaObjectCBridgeTest : NSObject {
|
||||
int _scriptHandler;
|
||||
}
|
||||
+ (LuaObjectCBridgeTest*) getInstance;
|
||||
+ (void) destroyInstance;
|
||||
|
||||
+ (void) registerScriptHandler:(NSDictionary *)dict;
|
||||
+ (void) unregisterScriptHandler;
|
||||
|
||||
+ (int) addTwoNumbers:(NSDictionary *)dict;
|
||||
+ (void) callbackScriptHandler;
|
||||
|
||||
- (void) init;
|
||||
@end
|
||||
|
||||
#endif // COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
|
@ -0,0 +1,81 @@
|
|||
#import "LuaObjectCBridgeTest.h"
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCLuaEngine.h"
|
||||
#include "CCLuaBridge.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
@implementation LuaObjectCBridgeTest
|
||||
|
||||
static LuaObjectCBridgeTest* s_instance = nil;
|
||||
|
||||
+ (LuaObjectCBridgeTest*) getInstance
|
||||
{
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = [LuaObjectCBridgeTest alloc];
|
||||
[s_instance init];
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
+ (void) destroyInstance
|
||||
{
|
||||
[s_instance release];
|
||||
}
|
||||
|
||||
- (void) setScriptHandler:(int)scriptHandler
|
||||
{
|
||||
if (_scriptHandler)
|
||||
{
|
||||
LuaBridge::releaseLuaFunctionById(_scriptHandler);
|
||||
_scriptHandler = 0;
|
||||
}
|
||||
_scriptHandler = scriptHandler;
|
||||
}
|
||||
|
||||
- (int) getScriptHandler
|
||||
{
|
||||
return _scriptHandler;
|
||||
}
|
||||
|
||||
|
||||
+(void) registerScriptHandler:(NSDictionary *)dict
|
||||
{
|
||||
[[LuaObjectCBridgeTest getInstance] setScriptHandler:[[dict objectForKey:@"scriptHandler"] intValue]];
|
||||
}
|
||||
|
||||
|
||||
+ (void) unregisterScriptHandler
|
||||
{
|
||||
[[LuaObjectCBridgeTest getInstance] setScriptHandler:0];
|
||||
}
|
||||
|
||||
+ (int) addTwoNumbers:(NSDictionary *)dict
|
||||
{
|
||||
int num1 = [[dict objectForKey:@"num1"] intValue];
|
||||
int num2 = [[dict objectForKey:@"num2"] intValue];
|
||||
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
+ (void) callbackScriptHandler
|
||||
{
|
||||
int scriptHandler = [[LuaObjectCBridgeTest getInstance] getScriptHandler];
|
||||
if (scriptHandler)
|
||||
{
|
||||
LuaBridge::pushLuaFunctionById(scriptHandler);
|
||||
LuaStack *stack = LuaBridge::getStack();
|
||||
stack->pushString("success");
|
||||
stack->executeFunction(1);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)init
|
||||
{
|
||||
_scriptHandler = 0;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,33 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
|
||||
@interface RootViewController : UIViewController {
|
||||
|
||||
}
|
||||
- (BOOL)prefersStatusBarHidden;
|
||||
@end
|
|
@ -0,0 +1,96 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010-2011 cocos2d-x.org
|
||||
Copyright (c) 2010 Ricardo Quesada
|
||||
|
||||
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.
|
||||
****************************************************************************/
|
||||
|
||||
#import "RootViewController.h"
|
||||
|
||||
|
||||
@implementation RootViewController
|
||||
|
||||
/*
|
||||
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
|
||||
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
|
||||
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
|
||||
// Custom initialization
|
||||
}
|
||||
return self;
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Implement loadView to create a view hierarchy programmatically, without using a nib.
|
||||
- (void)loadView {
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
}
|
||||
|
||||
*/
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
// This method is deprecated on ios6
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
|
||||
}
|
||||
|
||||
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
|
||||
- (NSUInteger) supportedInterfaceOrientations{
|
||||
#ifdef __IPHONE_6_0
|
||||
return UIInterfaceOrientationMaskAllButUpsideDown;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL) shouldAutorotate {
|
||||
return YES;
|
||||
}
|
||||
|
||||
//fix not hide status on ios7
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
// Releases the view if it doesn't have a superview.
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
// Release any cached data, images, etc that aren't in use.
|
||||
}
|
||||
|
||||
- (void)viewDidUnload {
|
||||
[super viewDidUnload];
|
||||
// Release any retained subviews of the main view.
|
||||
// e.g. self.myOutlet = nil;
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'TestLua' target in the 'TestLua' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
|
@ -0,0 +1,15 @@
|
|||
//
|
||||
// main.m
|
||||
// TestLua
|
||||
//
|
||||
// Copyright __MyCompanyName__ 2011. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
NSAutoreleasePool *pool = [NSAutoreleasePool new];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
3d09e8fb4f4ca1c1ae7ab0a6948db592c7c3d9a0
|
|
@ -0,0 +1,20 @@
|
|||
#ifndef COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
||||
#define COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface LuaObjectCBridgeTest : NSObject {
|
||||
int _scriptHandler;
|
||||
}
|
||||
+ (LuaObjectCBridgeTest*) getInstance;
|
||||
+ (void) destroyInstance;
|
||||
|
||||
+ (void) registerScriptHandler:(NSDictionary *)dict;
|
||||
+ (void) unregisterScriptHandler;
|
||||
|
||||
+ (int) addTwoNumbers:(NSDictionary *)dict;
|
||||
+ (void) callbackScriptHandler;
|
||||
|
||||
- (void) init;
|
||||
@end
|
||||
|
||||
#endif // COCOS2DX_SAMPLES_TESTLUA_PROJ_IOS_LUAOBJECTCBRIDGETEST_H
|
|
@ -0,0 +1,81 @@
|
|||
#import "LuaObjectCBridgeTest.h"
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "CCLuaEngine.h"
|
||||
#include "CCLuaBridge.h"
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
@implementation LuaObjectCBridgeTest
|
||||
|
||||
static LuaObjectCBridgeTest* s_instance = nil;
|
||||
|
||||
+ (LuaObjectCBridgeTest*) getInstance
|
||||
{
|
||||
if (!s_instance)
|
||||
{
|
||||
s_instance = [LuaObjectCBridgeTest alloc];
|
||||
[s_instance init];
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
+ (void) destroyInstance
|
||||
{
|
||||
[s_instance release];
|
||||
}
|
||||
|
||||
- (void) setScriptHandler:(int)scriptHandler
|
||||
{
|
||||
if (_scriptHandler)
|
||||
{
|
||||
LuaBridge::releaseLuaFunctionById(_scriptHandler);
|
||||
_scriptHandler = 0;
|
||||
}
|
||||
_scriptHandler = scriptHandler;
|
||||
}
|
||||
|
||||
- (int) getScriptHandler
|
||||
{
|
||||
return _scriptHandler;
|
||||
}
|
||||
|
||||
|
||||
+(void) registerScriptHandler:(NSDictionary *)dict
|
||||
{
|
||||
[[LuaObjectCBridgeTest getInstance] setScriptHandler:[[dict objectForKey:@"scriptHandler"] intValue]];
|
||||
}
|
||||
|
||||
|
||||
+ (void) unregisterScriptHandler
|
||||
{
|
||||
[[LuaObjectCBridgeTest getInstance] setScriptHandler:0];
|
||||
}
|
||||
|
||||
+ (int) addTwoNumbers:(NSDictionary *)dict
|
||||
{
|
||||
int num1 = [[dict objectForKey:@"num1"] intValue];
|
||||
int num2 = [[dict objectForKey:@"num2"] intValue];
|
||||
|
||||
return num1 + num2;
|
||||
}
|
||||
|
||||
+ (void) callbackScriptHandler
|
||||
{
|
||||
int scriptHandler = [[LuaObjectCBridgeTest getInstance] getScriptHandler];
|
||||
if (scriptHandler)
|
||||
{
|
||||
LuaBridge::pushLuaFunctionById(scriptHandler);
|
||||
LuaStack *stack = LuaBridge::getStack();
|
||||
stack->pushString("success");
|
||||
stack->executeFunction(1);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)init
|
||||
{
|
||||
_scriptHandler = 0;
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,7 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'Paralaxer' target in the 'Paralaxer' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
|
@ -0,0 +1,2 @@
|
|||
/* Localized versions of Info.plist keys */
|
||||
|
|
@ -0,0 +1,812 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1060</int>
|
||||
<string key="IBDocument.SystemVersion">10K549</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
|
||||
<string key="IBDocument.AppKitVersion">1038.36</string>
|
||||
<string key="IBDocument.HIToolboxVersion">461.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="NS.object.0">1938</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSMenuItem</string>
|
||||
<string>NSCustomObject</string>
|
||||
<string>NSMenu</string>
|
||||
</object>
|
||||
<object class="NSArray" key="IBDocument.PluginDependencies">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="IBDocument.Metadata">
|
||||
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
|
||||
<integer value="1" key="NS.object.0"/>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSCustomObject" id="1021">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1014">
|
||||
<string key="NSClassName">FirstResponder</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="1050">
|
||||
<string key="NSClassName">NSApplication</string>
|
||||
</object>
|
||||
<object class="NSMenu" id="649796088">
|
||||
<string key="NSTitle">AMainMenu</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="694149608">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">HelloCpp</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<object class="NSCustomResource" key="NSOnImage" id="35465992">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuCheckmark</string>
|
||||
</object>
|
||||
<object class="NSCustomResource" key="NSMixedImage" id="502551668">
|
||||
<string key="NSClassName">NSImage</string>
|
||||
<string key="NSResourceName">NSMenuMixedState</string>
|
||||
</object>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="110575045">
|
||||
<string key="NSTitle">HelloCpp</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="238522557">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">About HelloCpp</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="304266470">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="609285721">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Preferences…</string>
|
||||
<string key="NSKeyEquiv">,</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="481834944">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="1046388886">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Services</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="752062318">
|
||||
<string key="NSTitle">Services</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<string key="NSName">_NSServicesMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="646227648">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="755159360">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Hide HelloCpp</string>
|
||||
<string key="NSKeyEquiv">h</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="342932134">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Hide Others</string>
|
||||
<string key="NSKeyEquiv">h</string>
|
||||
<int key="NSKeyEquivModMask">1572864</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="908899353">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Show All</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="1056857174">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="632727374">
|
||||
<reference key="NSMenu" ref="110575045"/>
|
||||
<string key="NSTitle">Quit HelloCpp</string>
|
||||
<string key="NSKeyEquiv">q</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSName">_NSAppleMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="586577488">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">View</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="466310130">
|
||||
<string key="NSTitle">View</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="204933491">
|
||||
<reference key="NSMenu" ref="466310130"/>
|
||||
<string key="NSTitle">Toggle Fullscreen</string>
|
||||
<string key="NSKeyEquiv">f</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="713487014">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">Window</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="835318025">
|
||||
<string key="NSTitle">Window</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="1011231497">
|
||||
<reference key="NSMenu" ref="835318025"/>
|
||||
<string key="NSTitle">Minimize</string>
|
||||
<string key="NSKeyEquiv">m</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="575023229">
|
||||
<reference key="NSMenu" ref="835318025"/>
|
||||
<string key="NSTitle">Zoom</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="299356726">
|
||||
<reference key="NSMenu" ref="835318025"/>
|
||||
<bool key="NSIsDisabled">YES</bool>
|
||||
<bool key="NSIsSeparator">YES</bool>
|
||||
<string key="NSTitle"/>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="625202149">
|
||||
<reference key="NSMenu" ref="835318025"/>
|
||||
<string key="NSTitle">Bring All to Front</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSName">_NSWindowsMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMenuItem" id="448692316">
|
||||
<reference key="NSMenu" ref="649796088"/>
|
||||
<string key="NSTitle">Help</string>
|
||||
<string key="NSKeyEquiv"/>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
<string key="NSAction">submenuAction:</string>
|
||||
<object class="NSMenu" key="NSSubmenu" id="992780483">
|
||||
<string key="NSTitle">Help</string>
|
||||
<object class="NSMutableArray" key="NSMenuItems">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSMenuItem" id="105068016">
|
||||
<reference key="NSMenu" ref="992780483"/>
|
||||
<string key="NSTitle">HelloCpp Help</string>
|
||||
<string key="NSKeyEquiv">?</string>
|
||||
<int key="NSKeyEquivModMask">1048576</int>
|
||||
<int key="NSMnemonicLoc">2147483647</int>
|
||||
<reference key="NSOnImage" ref="35465992"/>
|
||||
<reference key="NSMixedImage" ref="502551668"/>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSName">_NSHelpMenu</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<string key="NSName">_NSMainMenu</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="976324537">
|
||||
<string key="NSClassName">AppController</string>
|
||||
</object>
|
||||
<object class="NSCustomObject" id="755631768">
|
||||
<string key="NSClassName">NSFontManager</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBObjectContainer" key="IBDocument.Objects">
|
||||
<object class="NSMutableArray" key="connectionRecords">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">terminate:</string>
|
||||
<reference key="source" ref="1050"/>
|
||||
<reference key="destination" ref="632727374"/>
|
||||
</object>
|
||||
<int key="connectionID">449</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">orderFrontStandardAboutPanel:</string>
|
||||
<reference key="source" ref="1021"/>
|
||||
<reference key="destination" ref="238522557"/>
|
||||
</object>
|
||||
<int key="connectionID">142</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBOutletConnection" key="connection">
|
||||
<string key="label">delegate</string>
|
||||
<reference key="source" ref="1021"/>
|
||||
<reference key="destination" ref="976324537"/>
|
||||
</object>
|
||||
<int key="connectionID">495</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">performMiniaturize:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="1011231497"/>
|
||||
</object>
|
||||
<int key="connectionID">37</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">arrangeInFront:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="625202149"/>
|
||||
</object>
|
||||
<int key="connectionID">39</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">performZoom:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="575023229"/>
|
||||
</object>
|
||||
<int key="connectionID">240</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">hide:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="755159360"/>
|
||||
</object>
|
||||
<int key="connectionID">367</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">hideOtherApplications:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="342932134"/>
|
||||
</object>
|
||||
<int key="connectionID">368</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">unhideAllApplications:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="908899353"/>
|
||||
</object>
|
||||
<int key="connectionID">370</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">showHelp:</string>
|
||||
<reference key="source" ref="1014"/>
|
||||
<reference key="destination" ref="105068016"/>
|
||||
</object>
|
||||
<int key="connectionID">493</int>
|
||||
</object>
|
||||
<object class="IBConnectionRecord">
|
||||
<object class="IBActionConnection" key="connection">
|
||||
<string key="label">toggleFullScreen:</string>
|
||||
<reference key="source" ref="976324537"/>
|
||||
<reference key="destination" ref="204933491"/>
|
||||
</object>
|
||||
<int key="connectionID">537</int>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBMutableOrderedSet" key="objectRecords">
|
||||
<object class="NSArray" key="orderedObjects">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">0</int>
|
||||
<object class="NSArray" key="object" id="0">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
</object>
|
||||
<reference key="children" ref="1048"/>
|
||||
<nil key="parent"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-2</int>
|
||||
<reference key="object" ref="1021"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">File's Owner</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-1</int>
|
||||
<reference key="object" ref="1014"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">First Responder</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">-3</int>
|
||||
<reference key="object" ref="1050"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
<string key="objectName">Application</string>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">29</int>
|
||||
<reference key="object" ref="649796088"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="713487014"/>
|
||||
<reference ref="694149608"/>
|
||||
<reference ref="586577488"/>
|
||||
<reference ref="448692316"/>
|
||||
</object>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">19</int>
|
||||
<reference key="object" ref="713487014"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="835318025"/>
|
||||
</object>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">56</int>
|
||||
<reference key="object" ref="694149608"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="110575045"/>
|
||||
</object>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">57</int>
|
||||
<reference key="object" ref="110575045"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="238522557"/>
|
||||
<reference ref="755159360"/>
|
||||
<reference ref="908899353"/>
|
||||
<reference ref="632727374"/>
|
||||
<reference ref="646227648"/>
|
||||
<reference ref="609285721"/>
|
||||
<reference ref="481834944"/>
|
||||
<reference ref="304266470"/>
|
||||
<reference ref="1046388886"/>
|
||||
<reference ref="1056857174"/>
|
||||
<reference ref="342932134"/>
|
||||
</object>
|
||||
<reference key="parent" ref="694149608"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">58</int>
|
||||
<reference key="object" ref="238522557"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">134</int>
|
||||
<reference key="object" ref="755159360"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">150</int>
|
||||
<reference key="object" ref="908899353"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">136</int>
|
||||
<reference key="object" ref="632727374"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">144</int>
|
||||
<reference key="object" ref="646227648"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">129</int>
|
||||
<reference key="object" ref="609285721"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">143</int>
|
||||
<reference key="object" ref="481834944"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">236</int>
|
||||
<reference key="object" ref="304266470"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">131</int>
|
||||
<reference key="object" ref="1046388886"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="752062318"/>
|
||||
</object>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">149</int>
|
||||
<reference key="object" ref="1056857174"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">145</int>
|
||||
<reference key="object" ref="342932134"/>
|
||||
<reference key="parent" ref="110575045"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">130</int>
|
||||
<reference key="object" ref="752062318"/>
|
||||
<reference key="parent" ref="1046388886"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">24</int>
|
||||
<reference key="object" ref="835318025"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="299356726"/>
|
||||
<reference ref="625202149"/>
|
||||
<reference ref="575023229"/>
|
||||
<reference ref="1011231497"/>
|
||||
</object>
|
||||
<reference key="parent" ref="713487014"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">92</int>
|
||||
<reference key="object" ref="299356726"/>
|
||||
<reference key="parent" ref="835318025"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">5</int>
|
||||
<reference key="object" ref="625202149"/>
|
||||
<reference key="parent" ref="835318025"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">239</int>
|
||||
<reference key="object" ref="575023229"/>
|
||||
<reference key="parent" ref="835318025"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">23</int>
|
||||
<reference key="object" ref="1011231497"/>
|
||||
<reference key="parent" ref="835318025"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">295</int>
|
||||
<reference key="object" ref="586577488"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="466310130"/>
|
||||
</object>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">296</int>
|
||||
<reference key="object" ref="466310130"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="204933491"/>
|
||||
</object>
|
||||
<reference key="parent" ref="586577488"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">420</int>
|
||||
<reference key="object" ref="755631768"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">490</int>
|
||||
<reference key="object" ref="448692316"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="992780483"/>
|
||||
</object>
|
||||
<reference key="parent" ref="649796088"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">491</int>
|
||||
<reference key="object" ref="992780483"/>
|
||||
<object class="NSMutableArray" key="children">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference ref="105068016"/>
|
||||
</object>
|
||||
<reference key="parent" ref="448692316"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">492</int>
|
||||
<reference key="object" ref="105068016"/>
|
||||
<reference key="parent" ref="992780483"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">494</int>
|
||||
<reference key="object" ref="976324537"/>
|
||||
<reference key="parent" ref="0"/>
|
||||
</object>
|
||||
<object class="IBObjectRecord">
|
||||
<int key="objectID">536</int>
|
||||
<reference key="object" ref="204933491"/>
|
||||
<reference key="parent" ref="466310130"/>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="flattenedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>-1.IBPluginDependency</string>
|
||||
<string>-2.IBPluginDependency</string>
|
||||
<string>-3.IBPluginDependency</string>
|
||||
<string>129.IBPluginDependency</string>
|
||||
<string>130.IBPluginDependency</string>
|
||||
<string>131.IBPluginDependency</string>
|
||||
<string>134.IBPluginDependency</string>
|
||||
<string>136.IBPluginDependency</string>
|
||||
<string>143.IBPluginDependency</string>
|
||||
<string>144.IBPluginDependency</string>
|
||||
<string>145.IBPluginDependency</string>
|
||||
<string>149.IBPluginDependency</string>
|
||||
<string>150.IBPluginDependency</string>
|
||||
<string>19.IBPluginDependency</string>
|
||||
<string>23.IBPluginDependency</string>
|
||||
<string>236.IBPluginDependency</string>
|
||||
<string>239.IBPluginDependency</string>
|
||||
<string>24.IBPluginDependency</string>
|
||||
<string>29.IBPluginDependency</string>
|
||||
<string>295.IBPluginDependency</string>
|
||||
<string>296.IBPluginDependency</string>
|
||||
<string>420.IBPluginDependency</string>
|
||||
<string>490.IBPluginDependency</string>
|
||||
<string>491.IBPluginDependency</string>
|
||||
<string>492.IBPluginDependency</string>
|
||||
<string>494.IBPluginDependency</string>
|
||||
<string>5.IBPluginDependency</string>
|
||||
<string>536.IBPluginDependency</string>
|
||||
<string>56.IBPluginDependency</string>
|
||||
<string>57.IBPluginDependency</string>
|
||||
<string>58.IBPluginDependency</string>
|
||||
<string>92.IBPluginDependency</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="unlocalizedProperties">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="activeLocalization"/>
|
||||
<object class="NSMutableDictionary" key="localizations">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<reference key="dict.sortedKeys" ref="0"/>
|
||||
<reference key="dict.values" ref="0"/>
|
||||
</object>
|
||||
<nil key="sourceID"/>
|
||||
<int key="maxID">541</int>
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">AppController</string>
|
||||
<string key="superclassName">NSObject</string>
|
||||
<object class="NSMutableDictionary" key="actions">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>exitFullScreen:</string>
|
||||
<string>toggleFullScreen:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>id</string>
|
||||
<string>id</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>exitFullScreen:</string>
|
||||
<string>toggleFullScreen:</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">exitFullScreen:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
<object class="IBActionInfo">
|
||||
<string key="name">toggleFullScreen:</string>
|
||||
<string key="candidateClassName">id</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="outlets">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>glView</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>EAGLView</string>
|
||||
<string>Window</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>glView</string>
|
||||
<string>window</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">glView</string>
|
||||
<string key="candidateClassName">EAGLView</string>
|
||||
</object>
|
||||
<object class="IBToOneOutletInfo">
|
||||
<string key="name">window</string>
|
||||
<string key="candidateClassName">Window</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/AppController.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">EAGLView</string>
|
||||
<string key="superclassName">NSOpenGLView</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/EAGLView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<int key="IBDocument.localizationMode">0</int>
|
||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
|
||||
<integer value="3000" key="NS.object.0"/>
|
||||
</object>
|
||||
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
|
||||
<int key="IBDocument.defaultPropertyAccessControl">3</int>
|
||||
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<object class="NSArray" key="dict.sortedKeys">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>NSMenuCheckmark</string>
|
||||
<string>NSMenuMixedState</string>
|
||||
</object>
|
||||
<object class="NSMutableArray" key="dict.values">
|
||||
<bool key="EncodedWithXMLCoder">YES</bool>
|
||||
<string>{9, 8}</string>
|
||||
<string>{7, 2}</string>
|
||||
</object>
|
||||
</object>
|
||||
</data>
|
||||
</archive>
|
|
@ -0,0 +1,33 @@
|
|||
/****************************************************************************
|
||||
Copyright (c) 2010 cocos2d-x.org
|
||||
|
||||
http://www.cocos2d-x.org
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "AppDelegate.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
AppDelegate app;
|
||||
return Application::getInstance()->run();
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#define APSTUDIO_HIDDEN_SYMBOLS
|
||||
#include "windows.h"
|
||||
#undef APSTUDIO_HIDDEN_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON "res\\TestLua.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,1
|
||||
PRODUCTVERSION 1,0,0,1
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "040904B0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "\0"
|
||||
VALUE "FileDescription", "TestLua Module\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "TestLua\0"
|
||||
VALUE "LegalCopyright", "Copyright \0"
|
||||
VALUE "OriginalFilename", "TestLua.exe\0"
|
||||
VALUE "ProductName", "TestLua Module\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 1\0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x0409, 0x04B0
|
||||
END
|
||||
END
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
|
@ -0,0 +1,224 @@
|
|||
<?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>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}</ProjectGuid>
|
||||
<ProjectName>TestLua</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</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>Application</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="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\2d\cocos2dx.props" />
|
||||
<Import Project="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\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="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\2d\cocos2dx.props" />
|
||||
<Import Project="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\2d\cocos2d_headers.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir>$(Configuration).win32\</IntDir>
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<IncludePath>$(IncludePath)</IncludePath>
|
||||
<SourcePath>$(SourcePath);</SourcePath>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir>$(Configuration).win32\</IntDir>
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot)..\bindings\auto;$(EngineRoot)..\bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)..\external\lua;$(EngineRoot)..\external\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<DebugInformationFormat>OldStyle</DebugInformationFormat>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<HeaderFileName>TestLua.h</HeaderFileName>
|
||||
<InterfaceIdentifierFileName>TestLua_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>TestLua_p.c</ProxyFileName>
|
||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
||||
<TypeLibraryName>$(IntDir)/TestLua.tlb</TypeLibraryName>
|
||||
<DllDataFileName>
|
||||
</DllDataFileName>
|
||||
</Midl>
|
||||
<PreBuildEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
if exist "$(OutDir)\test-lua-res" rd /s /q "$(OutDir)\test-lua-res"
|
||||
mkdir "$(OutDir)\test-lua-res"
|
||||
mkdir "$(OutDir)\test-lua-res\src"
|
||||
mkdir "$(OutDir)\test-lua-res\res"
|
||||
xcopy "$(ProjectDir)..\..\..\..\frameworks\lua-bindings\bindings\script" "$(OutDir)\test-lua-res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\src" "$(OutDir)\test-lua-res\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\res" "$(OutDir)\test-lua-res\res" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
</PreBuildEvent>
|
||||
<PreLinkEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</Command>
|
||||
</PreLinkEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot)..\bindings\auto;$(EngineRoot)..\bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)..\external\lua;$(EngineRoot)..\external\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>libcurl_imp.lib;lua51.lib;websockets.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
<ResourceCompile>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ResourceCompile>
|
||||
<Midl>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<HeaderFileName>TestLua.h</HeaderFileName>
|
||||
<InterfaceIdentifierFileName>TestLua_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>TestLua_p.c</ProxyFileName>
|
||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
||||
<TypeLibraryName>$(IntDir)/TestLua.tlb</TypeLibraryName>
|
||||
<DllDataFileName>
|
||||
</DllDataFileName>
|
||||
</Midl>
|
||||
<PreBuildEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
if exist "$(OutDir)\test-lua-res" rd /s /q "$(OutDir)\test-lua-res"
|
||||
mkdir "$(OutDir)\test-lua-res"
|
||||
mkdir "$(OutDir)\test-lua-res\src"
|
||||
mkdir "$(OutDir)\test-lua-res\res"
|
||||
xcopy "$(ProjectDir)..\..\..\..\frameworks\lua-bindings\bindings\script" "$(OutDir)\test-lua-res" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\src" "$(OutDir)\test-lua-res\src" /e /Y
|
||||
xcopy "$(ProjectDir)..\..\res" "$(OutDir)\test-lua-res\res" /e /Y</Command>
|
||||
<Message>copy files</Message>
|
||||
</PreBuildEvent>
|
||||
<PreLinkEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
xcopy /Y /Q "$(EngineRoot)external\websockets\prebuilt\win32\*.*" "$(OutDir)"</Command>
|
||||
</PreLinkEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Classes\AppDelegate.h" />
|
||||
<ClInclude Include="..\Classes\lua_assetsmanager_test_sample.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Classes\AppDelegate.cpp" />
|
||||
<ClCompile Include="..\Classes\lua_assetsmanager_test_sample.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\bindings\proj.win32\liblua.vcxproj">
|
||||
<Project>{ddc3e27f-004d-4dd4-9dd3-931a013d2159}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\2d\cocos2d.vcxproj">
|
||||
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\audio\proj.win32\CocosDenshion.vcxproj">
|
||||
<Project>{f8edd7fa-9a51-4e80-baeb-860825d2eac6}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\editor-support\cocosbuilder\proj.win32\libCocosBuilder.vcxproj">
|
||||
<Project>{811c0dab-7b96-4bd3-a154-b7572b58e4ab}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\editor-support\cocostudio\proj.win32\libCocosStudio.vcxproj">
|
||||
<Project>{b57cf53f-2e49-4031-9822-047cc0e6bde2}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\editor-support\spine\proj.win32\libSpine.vcxproj">
|
||||
<Project>{b7c2a162-dec9-4418-972e-240ab3cbfcae}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\gui\proj.win32\libGUI.vcxproj">
|
||||
<Project>{7e06e92c-537a-442b-9e4a-4761c84f8a1a}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\network\proj.win32\libNetwork.vcxproj">
|
||||
<Project>{df2638c0-8128-4847-867c-6eafe3dee7b5}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\cocos\storage\local-storage\proj.win32\libLocalStorage.vcxproj">
|
||||
<Project>{632a8f38-d0f0-4d22-86b3-d69f5e6bf63a}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\extensions\proj.win32\libExtensions.vcxproj">
|
||||
<Project>{21b2c324-891f-48ea-ad1a-5ae13de12e28}</Project>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\frameworks\lua-bindings\cocos2d-x\external\chipmunk\proj.win32\chipmunk.vcxproj">
|
||||
<Project>{207bc7a9-ccf1-4f2f-a04d-45f72242ae25}</Project>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Classes">
|
||||
<UniqueIdentifier>{fc5cb953-2953-4968-83b3-39e3ff951754}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="win32">
|
||||
<UniqueIdentifier>{037a9a02-b906-4cc5-ad98-304acd4e25ee}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\Classes\AppDelegate.h">
|
||||
<Filter>Classes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\lua_assetsmanager_test_sample.h">
|
||||
<Filter>Classes</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\Classes\AppDelegate.cpp">
|
||||
<Filter>Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>win32</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\lua_assetsmanager_test_sample.cpp">
|
||||
<Filter>Classes</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
<LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(OutDir)/test-lua-res</LocalDebuggerWorkingDirectory>
|
||||
<LocalDebuggerWorkingDirectory Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(OutDir)/test-lua-res</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">WindowsLocalDebugger</DebuggerFlavor>
|
||||
<DebuggerFlavor Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,35 @@
|
|||
#include "main.h"
|
||||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
|
||||
USING_NS_CC;
|
||||
|
||||
// uncomment below line, open debug console
|
||||
#define USE_WIN32_CONSOLE
|
||||
|
||||
int APIENTRY _tWinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPTSTR lpCmdLine,
|
||||
int nCmdShow)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
||||
|
||||
#ifdef USE_WIN32_CONSOLE
|
||||
AllocConsole();
|
||||
freopen("CONIN$", "r", stdin);
|
||||
freopen("CONOUT$", "w", stdout);
|
||||
freopen("CONOUT$", "w", stderr);
|
||||
#endif
|
||||
|
||||
// create the application instance
|
||||
AppDelegate app;
|
||||
|
||||
int ret = Application::getInstance()->run();
|
||||
|
||||
#ifdef USE_WIN32_CONSOLE
|
||||
FreeConsole();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef __MAIN_H__
|
||||
#define __MAIN_H__
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
// Windows Header Files:
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
#endif // __WINMAIN_H__
|
Двоичный файл не отображается.
После Ширина: | Высота: | Размер: 46 KiB |
|
@ -0,0 +1,20 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by TestLua.RC
|
||||
//
|
||||
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_TESTLUA 100
|
||||
|
||||
#define ID_FILE_NEW_WINDOW 32771
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 201
|
||||
#define _APS_NEXT_CONTROL_VALUE 1000
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#define _APS_NEXT_COMMAND_VALUE 32775
|
||||
#endif
|
||||
#endif
|
|
@ -0,0 +1 @@
|
|||
38e3a5fabac55b5649842cb35930af7594f093ef
|
|
@ -0,0 +1 @@
|
|||
13382b4a2fc6364d425aedd849893d8de79f72fb
|
|
@ -0,0 +1 @@
|
|||
5a60849ce6d5a81e3d62587a6651eb1a7ed7d488
|
|
@ -0,0 +1 @@
|
|||
2685fbcab626d939a8e2ea65b05a8a82beb90afa
|
|
@ -0,0 +1,73 @@
|
|||
local function AccelerometerMainLayer()
|
||||
|
||||
local function title()
|
||||
return "AccelerometerTest"
|
||||
end
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local function onEnter()
|
||||
layer:setAccelerometerEnabled(true)
|
||||
|
||||
local label = cc.LabelTTF:create(title(), "Arial", 32)
|
||||
layer:addChild(label, 1)
|
||||
label:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 50) )
|
||||
|
||||
local ball = cc.Sprite:create("Images/ball.png")
|
||||
ball:setPosition(cc.p(VisibleRect:center().x, VisibleRect:center().y))
|
||||
layer:addChild(ball)
|
||||
|
||||
local function accelerometerListener(event,x,y,z,timestamp)
|
||||
local target = event:getCurrentTarget()
|
||||
local ballSize = target:getContentSize()
|
||||
local ptNowX,ptNowY = target:getPosition()
|
||||
ptNowX = ptNowX + x * 9.81
|
||||
ptNowY = ptNowY + y * 9.81
|
||||
|
||||
local minX = math.floor(VisibleRect:left().x + ballSize.width / 2.0)
|
||||
local maxX = math.floor(VisibleRect:right().x - ballSize.width / 2.0)
|
||||
if ptNowX < minX then
|
||||
ptNowX = minX
|
||||
elseif ptNowX > maxX then
|
||||
ptNowX = maxX
|
||||
end
|
||||
|
||||
local minY = math.floor(VisibleRect:bottom().y + ballSize.height / 2.0)
|
||||
local maxY = math.floor(VisibleRect:top().y - ballSize.height / 2.0)
|
||||
if ptNowY < minY then
|
||||
ptNowY = minY
|
||||
elseif ptNowY > maxY then
|
||||
ptNowY = maxY
|
||||
end
|
||||
|
||||
target:setPosition(cc.p(ptNowX , ptNowY))
|
||||
end
|
||||
|
||||
local listerner = cc.EventListenerAcceleration:create(accelerometerListener)
|
||||
layer:getEventDispatcher():addEventListenerWithSceneGraphPriority(listerner,ball)
|
||||
end
|
||||
|
||||
local function onExit()
|
||||
layer:setAccelerometerEnabled(false)
|
||||
end
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
onEnter()
|
||||
elseif "exit" == event then
|
||||
onExit()
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
function AccelerometerMain()
|
||||
cclog("AccelerometerMain")
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(AccelerometerMainLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,194 @@
|
|||
local kTagNode = 0
|
||||
local kTagGrossini = 1
|
||||
local kTagSequence = 2
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Test1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
local function CrashTest()
|
||||
local ret = createTestLayer("Test 1. Should not crash")
|
||||
|
||||
local child = cc.Sprite:create(s_pPathGrossini)
|
||||
child:setPosition( 200,200 )
|
||||
ret:addChild(child, 1)
|
||||
|
||||
--Sum of all action's duration is 1.5 second.
|
||||
child:runAction(cc.RotateBy:create(1.5, 90))
|
||||
child:runAction(cc.Sequence:create(cc.DelayTime:create(1.4),cc.FadeOut:create(1.1)))
|
||||
|
||||
local function removeThis()
|
||||
ret:getParent():removeChild(ret, true)
|
||||
Helper.nextAction()
|
||||
end
|
||||
|
||||
--After 1.5 second, self will be removed.
|
||||
ret:runAction( cc.Sequence:create(cc.DelayTime:create(1.4),cc.CallFunc:create(removeThis)))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- LogicTest
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function LogicTest()
|
||||
local ret = createTestLayer("Logic test")
|
||||
local grossini = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(grossini, 0, 2)
|
||||
grossini:setPosition(200,200)
|
||||
local function bugMe(node)
|
||||
node:stopAllActions() --After this stop next action not working, if remove this stop everything is working
|
||||
node:runAction(cc.ScaleTo:create(2, 2))
|
||||
end
|
||||
grossini:runAction( cc.Sequence:create(cc.MoveBy:create(1, cc.p(150,0)) ,cc.CallFunc:create(bugMe)))
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- PauseTest
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
local function PauseTest()
|
||||
local ret = createTestLayer("Pause Test")
|
||||
local schedulerEntry = nil
|
||||
local function unpause(dt)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
schedulerEntry = nil
|
||||
local node = ret:getChildByTag( kTagGrossini )
|
||||
local pDirector = cc.Director:getInstance()
|
||||
pDirector:getActionManager():resumeTarget(node)
|
||||
end
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local l = cc.LabelTTF:create("After 3 seconds grossini should move", "Thonburi", 16)
|
||||
ret:addChild(l)
|
||||
l:setPosition( cc.p(s.width / 2, 245) )
|
||||
|
||||
local grossini = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(grossini, 0, kTagGrossini)
|
||||
grossini:setPosition(cc.p(200,200))
|
||||
|
||||
local action = cc.MoveBy:create(1, cc.p(150,0))
|
||||
|
||||
local pDirector = cc.Director:getInstance()
|
||||
pDirector:getActionManager():addAction(action, grossini, true)
|
||||
|
||||
schedulerEntry = scheduler:scheduleScriptFunc(unpause, 3.0, false)
|
||||
|
||||
elseif event == "exit" then
|
||||
if schedulerEntry ~= nil then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- RemoveTest
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function RemoveTest()
|
||||
local ret = createTestLayer("Remove Test")
|
||||
local l = cc.LabelTTF:create("Should not crash", "Thonburi", 16)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
ret:addChild(l)
|
||||
l:setPosition( cc.p(s.width / 2, 245))
|
||||
|
||||
local pMove = cc.MoveBy:create(2, cc.p(200, 0))
|
||||
local function stopAction()
|
||||
local pSprite = ret:getChildByTag(kTagGrossini)
|
||||
pSprite:stopActionByTag(kTagSequence)
|
||||
end
|
||||
|
||||
local callfunc = cc.CallFunc:create(stopAction)
|
||||
local pSequence = cc.Sequence:create(pMove,callfunc)
|
||||
pSequence:setTag(kTagSequence)
|
||||
|
||||
local pChild = cc.Sprite:create(s_pPathGrossini)
|
||||
pChild:setPosition( 200, 200 )
|
||||
|
||||
ret:addChild(pChild, 1, kTagGrossini)
|
||||
pChild:runAction(pSequence)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- ResumeTest
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function ResumeTest()
|
||||
local ret = createTestLayer("Resume Test")
|
||||
|
||||
local schedulerEntry = nil
|
||||
local function resumeGrossini(time)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
schedulerEntry = nil
|
||||
local pGrossini = ret:getChildByTag(kTagGrossini)
|
||||
local pDirector = cc.Director:getInstance()
|
||||
pDirector:getActionManager():resumeTarget(pGrossini)
|
||||
end
|
||||
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
local l = cc.LabelTTF:create("Grossini only rotate/scale in 3 seconds", "Thonburi", 16)
|
||||
ret:addChild(l)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
l:setPosition( s.width / 2, 245)
|
||||
|
||||
local pGrossini = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(pGrossini, 0, kTagGrossini)
|
||||
pGrossini:setPosition(200,200)
|
||||
|
||||
pGrossini:runAction(cc.ScaleBy:create(2, 2))
|
||||
|
||||
local pDirector = cc.Director:getInstance()
|
||||
pDirector:getActionManager():pauseTarget(pGrossini)
|
||||
pGrossini:runAction(cc.RotateBy:create(2, 360))
|
||||
|
||||
schedulerEntry = scheduler:scheduleScriptFunc(resumeGrossini, 3.0, false)
|
||||
elseif event == "exit" then
|
||||
if schedulerEntry ~= nil then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function ActionManagerTestMain()
|
||||
cclog("ActionManagerTestMain")
|
||||
Helper.index = 1
|
||||
cc.Director:getInstance():setDepthTest(true)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
CrashTest,
|
||||
LogicTest,
|
||||
PauseTest,
|
||||
RemoveTest,
|
||||
ResumeTest
|
||||
}
|
||||
scene:addChild(CrashTest())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
||||
|
|
@ -0,0 +1,468 @@
|
|||
local kTagAction1 = 1
|
||||
local kTagAction2 = 2
|
||||
local kTagSlider = 1
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
|
||||
local function createSimpleMoveBy()
|
||||
return cc.MoveBy:create(3, cc.p(s.width - 130, 0))
|
||||
end
|
||||
|
||||
local function createSimpleDelayTime()
|
||||
return cc.DelayTime:create(0.25)
|
||||
end
|
||||
|
||||
local function positionForTwo()
|
||||
grossini:setPosition(cc.p(60, s.height * 1 / 5))
|
||||
tamara:setPosition(cc.p(60, s.height * 4 / 5))
|
||||
kathia:setVisible(false)
|
||||
end
|
||||
|
||||
local function getBaseLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
grossini = cc.Sprite:create(s_pPathGrossini)
|
||||
tamara = cc.Sprite:create(s_pPathSister1)
|
||||
kathia = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
layer:addChild(grossini, 3)
|
||||
layer:addChild(kathia, 2)
|
||||
layer:addChild(tamara, 1)
|
||||
|
||||
grossini:setPosition(cc.p(60, s.height * 1 / 5))
|
||||
kathia:setPosition(cc.p(60, s.height * 2.5 / 5))
|
||||
tamara:setPosition(cc.p(60, s.height * 4 / 5))
|
||||
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEase
|
||||
-----------------------------------
|
||||
local SpriteEase_entry = nil
|
||||
|
||||
local function testStopAction(dt)
|
||||
scheduler:unscheduleScriptEntry(SpriteEase_entry)
|
||||
tamara:stopActionByTag(1)
|
||||
kathia:stopActionByTag(1)
|
||||
grossini:stopActionByTag(1)
|
||||
end
|
||||
|
||||
local function SpriteEase_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
SpriteEase_entry = scheduler:scheduleScriptFunc(testStopAction, 6.25, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(SpriteEase_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function SpriteEase()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseIn:create(createSimpleMoveBy(), 2.5)
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseOut:create(createSimpleMoveBy(), 2.5)
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease_in,createSimpleDelayTime(),move_ease_in_back,createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out,createSimpleDelayTime(),move_ease_out_back,createSimpleDelayTime())
|
||||
|
||||
local a2 = grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
a2:setTag(1)
|
||||
local a1 = tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
a1:setTag(1)
|
||||
local a = kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
a:setTag(1)
|
||||
|
||||
layer:registerScriptHandler(SpriteEase_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("EaseIn - EaseOut - Stop")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
|
||||
local move_ease_inout1 = cc.EaseInOut:create(createSimpleMoveBy(), 0.65)
|
||||
local move_ease_inout_back1 = move_ease_inout1:reverse()
|
||||
|
||||
local move_ease_inout2 = cc.EaseInOut:create(createSimpleMoveBy(), 1.35)
|
||||
local move_ease_inout_back2 = move_ease_inout2:reverse()
|
||||
|
||||
local move_ease_inout3 = cc.EaseInOut:create(createSimpleMoveBy(), 1.0)
|
||||
local move_ease_inout_back3 = move_ease_inout3:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move_ease_inout1,delay,move_ease_inout_back1,createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease_inout2,createSimpleDelayTime(),move_ease_inout_back2,createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime() )
|
||||
|
||||
tamara:runAction(cc.RepeatForever:create(seq1))
|
||||
kathia:runAction(cc.RepeatForever:create(seq2))
|
||||
grossini:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("EaseInOut and rates")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseExponential
|
||||
-----------------------------------
|
||||
local function SpriteEaseExponential()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseExponentialIn:create(createSimpleMoveBy())
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseExponentialOut:create(createSimpleMoveBy())
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("ExpIn - ExpOut actions")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseExponentialInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseExponentialInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease = cc.EaseExponentialInOut:create(createSimpleMoveBy())
|
||||
local move_ease_back = move_ease:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime() )
|
||||
|
||||
positionForTwo()
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
|
||||
Helper.titleLabel:setString("EaseExponentialInOut action")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseSine
|
||||
-----------------------------------
|
||||
local function SpriteEaseSine()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseSineIn:create(createSimpleMoveBy())
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseSineOut:create(createSimpleMoveBy())
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
||||
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back,createSimpleDelayTime())
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("EaseSineIn - EaseSineOut")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseSineInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseSineInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease = cc.EaseSineInOut:create(createSimpleMoveBy())
|
||||
local move_ease_back = move_ease:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
||||
|
||||
positionForTwo()
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
|
||||
Helper.titleLabel:setString("EaseSineInOut action")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseElastic
|
||||
-----------------------------------
|
||||
local function SpriteEaseElastic()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseElasticIn:create(createSimpleMoveBy())
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseElasticOut:create(createSimpleMoveBy())
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
||||
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("Elastic In - Out actions")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseElasticInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseElasticInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
|
||||
local move_ease_inout1 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.3)
|
||||
local move_ease_inout_back1 = move_ease_inout1:reverse()
|
||||
|
||||
local move_ease_inout2 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.45)
|
||||
local move_ease_inout_back2 = move_ease_inout2:reverse()
|
||||
|
||||
local move_ease_inout3 = cc.EaseElasticInOut:create(createSimpleMoveBy(), 0.6)
|
||||
local move_ease_inout_back3 = move_ease_inout3:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move_ease_inout1, delay, move_ease_inout_back1, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease_inout2, createSimpleDelayTime(), move_ease_inout_back2, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_inout3, createSimpleDelayTime(), move_ease_inout_back3, createSimpleDelayTime())
|
||||
|
||||
tamara:runAction(cc.RepeatForever:create(seq1))
|
||||
kathia:runAction(cc.RepeatForever:create(seq2))
|
||||
grossini:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("EaseElasticInOut action")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseBounce
|
||||
-----------------------------------
|
||||
local function SpriteEaseBounce()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseBounceIn:create(createSimpleMoveBy())
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseBounceOut:create(createSimpleMoveBy())
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime() )
|
||||
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("Bounce In - Out actions")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseBounceInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseBounceInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease = cc.EaseBounceInOut:create(createSimpleMoveBy())
|
||||
local move_ease_back = move_ease:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease, createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
||||
|
||||
positionForTwo()
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
|
||||
Helper.titleLabel:setString("EaseBounceInOut action")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseBack
|
||||
-----------------------------------
|
||||
local function SpriteEaseBack()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease_in = cc.EaseBackIn:create(createSimpleMoveBy())
|
||||
local move_ease_in_back = move_ease_in:reverse()
|
||||
|
||||
local move_ease_out = cc.EaseBackOut:create(createSimpleMoveBy())
|
||||
local move_ease_out_back = move_ease_out:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease_in, createSimpleDelayTime(), move_ease_in_back, createSimpleDelayTime())
|
||||
local seq3 = cc.Sequence:create(move_ease_out, createSimpleDelayTime(), move_ease_out_back, createSimpleDelayTime())
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
kathia:runAction(cc.RepeatForever:create(seq3))
|
||||
|
||||
Helper.titleLabel:setString("Back In - Out actions")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteEaseBackInOut
|
||||
-----------------------------------
|
||||
local function SpriteEaseBackInOut()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local move = createSimpleMoveBy()
|
||||
local move_back = move:reverse()
|
||||
|
||||
local move_ease = cc.EaseBackInOut:create(createSimpleMoveBy())
|
||||
local move_ease_back = move_ease:reverse()
|
||||
|
||||
local delay = createSimpleDelayTime()
|
||||
local seq1 = cc.Sequence:create(move, delay, move_back, createSimpleDelayTime())
|
||||
local seq2 = cc.Sequence:create(move_ease,createSimpleDelayTime(), move_ease_back, createSimpleDelayTime())
|
||||
|
||||
positionForTwo()
|
||||
|
||||
grossini:runAction(cc.RepeatForever:create(seq1))
|
||||
tamara:runAction(cc.RepeatForever:create(seq2))
|
||||
|
||||
Helper.titleLabel:setString("EaseBackInOut action")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpeedTest
|
||||
-----------------------------------
|
||||
local SpeedTest_entry = nil
|
||||
local SpeedTest_action1 = nil
|
||||
local SpeedTest_action2 = nil
|
||||
local SpeedTest_action3 = nil
|
||||
|
||||
local function altertime(dt)
|
||||
SpeedTest_action1:setSpeed(math.random() * 2)
|
||||
SpeedTest_action2:setSpeed(math.random() * 2)
|
||||
SpeedTest_action3:setSpeed(math.random() * 2)
|
||||
end
|
||||
|
||||
local function SpeedTest_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
SpeedTest_entry = scheduler:scheduleScriptFunc(altertime, 1.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(SpeedTest_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function SpeedTest()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local jump1 = cc.JumpBy:create(4, cc.p(- s.width + 80, 0), 100, 4)
|
||||
local jump2 = jump1:reverse()
|
||||
local rot1 = cc.RotateBy:create(4, 360 * 2)
|
||||
local rot2 = rot1:reverse()
|
||||
|
||||
local seq3_1 = cc.Sequence:create(jump2, jump1)
|
||||
local seq3_2 = cc.Sequence:create(rot1, rot2)
|
||||
|
||||
local spawn = cc.Spawn:create(seq3_1, seq3_2)
|
||||
SpeedTest_action1 = cc.Speed:create(cc.RepeatForever:create(spawn), 1.0)
|
||||
|
||||
local spawn2 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
SpeedTest_action2 = cc.Speed:create(cc.RepeatForever:create(spawn2), 1.0)
|
||||
|
||||
local spawn3 = tolua.cast(spawn:clone(), "cc.Spawn")
|
||||
SpeedTest_action3 = cc.Speed:create(cc.RepeatForever:create(spawn3), 1.0)
|
||||
|
||||
grossini:runAction(SpeedTest_action2)
|
||||
tamara:runAction(SpeedTest_action3)
|
||||
kathia:runAction(SpeedTest_action1)
|
||||
|
||||
layer:registerScriptHandler(SpeedTest_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("Speed action")
|
||||
return layer
|
||||
end
|
||||
|
||||
function EaseActionsTest()
|
||||
local scene = cc.Scene:create()
|
||||
cclog("EaseActionsTest")
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
SpriteEase,
|
||||
SpriteEaseInOut,
|
||||
SpriteEaseExponential,
|
||||
SpriteEaseExponentialInOut,
|
||||
SpriteEaseSine,
|
||||
SpriteEaseSineInOut,
|
||||
SpriteEaseElastic,
|
||||
SpriteEaseElasticInOut,
|
||||
SpriteEaseBounce,
|
||||
SpriteEaseBounceInOut,
|
||||
SpriteEaseBack,
|
||||
SpriteEaseBackInOut,
|
||||
SpeedTest
|
||||
}
|
||||
|
||||
scene:addChild(SpriteEase())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,298 @@
|
|||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressToRadial
|
||||
------------------------------------
|
||||
local function SpriteProgressToRadial()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to1 = cc.ProgressTo:create(2, 100)
|
||||
local to2 = cc.ProgressTo:create(2, 100)
|
||||
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(to1))
|
||||
layer:addChild(left)
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
|
||||
-- Makes the ridial CCW
|
||||
right:setReverseDirection(true)
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(to2))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Radial")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressToHorizontal
|
||||
------------------------------------
|
||||
local function SpriteProgressToHorizontal()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to1 = cc.ProgressTo:create(2, 100)
|
||||
local to2 = cc.ProgressTo:create(2, 100)
|
||||
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the left since the midpoint is 0 for the x
|
||||
left:setMidpoint(cc.p(0, 0))
|
||||
-- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
left:setBarChangeRate(cc.p(1, 0))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(to1))
|
||||
layer:addChild(left)
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the left since the midpoint is 1 for the x
|
||||
right:setMidpoint(cc.p(1, 0))
|
||||
-- Setup for a horizontal bar since the bar change rate is 0 for y meaning no vertical change
|
||||
right:setBarChangeRate(cc.p(1, 0))
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(to2))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Horizontal")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressToVertical
|
||||
------------------------------------
|
||||
local function SpriteProgressToVertical()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to1 = cc.ProgressTo:create(2, 100)
|
||||
local to2 = cc.ProgressTo:create(2, 100)
|
||||
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
left:setMidpoint(cc.p(0,0))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left:setBarChangeRate(cc.p(0, 1))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(to1))
|
||||
layer:addChild(left)
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
right:setMidpoint(cc.p(0, 1))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right:setBarChangeRate(cc.p(0, 1))
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(to2))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Vertical")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressToRadialMidpointChanged
|
||||
------------------------------------
|
||||
local function SpriteProgressToRadialMidpointChanged()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local action = cc.ProgressTo:create(2, 100)
|
||||
|
||||
-- Our image on the left should be a radial progress indicator, clockwise
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
|
||||
left:setMidpoint(cc.p(0.25, 0.75))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
|
||||
layer:addChild(left)
|
||||
|
||||
-- Our image on the left should be a radial progress indicator, counter clockwise
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathBlock))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_RADIAL)
|
||||
right:setMidpoint(cc.p(0.75, 0.25))
|
||||
|
||||
--[[
|
||||
Note the reverse property (default=NO) is only added to the right image. That's how
|
||||
we get a counter clockwise progress.
|
||||
]]
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("Radial w/ Different Midpoints")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressBarVarious
|
||||
------------------------------------
|
||||
local function SpriteProgressBarVarious()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to = cc.ProgressTo:create(2, 100)
|
||||
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
left:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left:setBarChangeRate(cc.p(1, 0))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
|
||||
layer:addChild(left)
|
||||
|
||||
local middle = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
middle:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle:setBarChangeRate(cc.p(1, 1))
|
||||
middle:setPosition(cc.p(s.width/2, s.height/2))
|
||||
middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
|
||||
layer:addChild(middle)
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
right:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right:setBarChangeRate(cc.p(0, 1))
|
||||
right:setPosition(cc.p(s.width-100, s.height/2))
|
||||
right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(2, 100)))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Bar Mid")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressBarTintAndFade
|
||||
------------------------------------
|
||||
local function SpriteProgressBarTintAndFade()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to = cc.ProgressTo:create(6, 100)
|
||||
local tint = cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))
|
||||
local fade = cc.Sequence:create(cc.FadeTo:create(1.0, 0),cc.FadeTo:create(1.0, 255))
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister1))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
left:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left:setBarChangeRate(cc.p(1, 0))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
left:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))))
|
||||
layer:addChild(left)
|
||||
|
||||
left:addChild(cc.LabelTTF:create("Tint", "Marker Felt", 20.0))
|
||||
|
||||
local middle = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
middle:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle:setBarChangeRate(cc.p(1, 1))
|
||||
middle:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
|
||||
local fade2 = cc.Sequence:create(cc.FadeTo:create(1.0, 0), cc.FadeTo:create(1.0, 255))
|
||||
middle:runAction(cc.RepeatForever:create(fade2))
|
||||
layer:addChild(middle)
|
||||
|
||||
middle:addChild(cc.LabelTTF:create("Fade", "Marker Felt", 20.0))
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:create(s_pPathSister2))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
right:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right:setBarChangeRate(cc.p(0, 1))
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
right:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(1, 255, 0, 0), cc.TintTo:create(1, 0, 255, 0), cc.TintTo:create(1, 0, 0, 255))))
|
||||
right:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(1.0, 0), cc.FadeTo:create(1.0, 255))))
|
||||
layer:addChild(right)
|
||||
|
||||
right:addChild(cc.LabelTTF:create("Tint and Fade", "Marker Felt", 20.0))
|
||||
|
||||
Helper.subtitleLabel:setString("ProgressTo Bar Mid")
|
||||
return layer
|
||||
end
|
||||
|
||||
------------------------------------
|
||||
-- SpriteProgressWithSpriteFrame
|
||||
------------------------------------
|
||||
local function SpriteProgressWithSpriteFrame()
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
local to = cc.ProgressTo:create(6, 100)
|
||||
|
||||
cc.SpriteFrameCache:getInstance():addSpriteFrames("zwoptex/grossini.plist")
|
||||
|
||||
local left = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_01.png"))
|
||||
left:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
left:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
left:setBarChangeRate(cc.p(1, 0))
|
||||
left:setPosition(cc.p(100, s.height / 2))
|
||||
left:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
layer:addChild(left)
|
||||
|
||||
local middle = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_02.png"))
|
||||
middle:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
middle:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
middle:setBarChangeRate(cc.p(1, 1))
|
||||
middle:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
middle:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
layer:addChild(middle)
|
||||
|
||||
local right = cc.ProgressTimer:create(cc.Sprite:createWithSpriteFrameName("grossini_dance_03.png"))
|
||||
right:setType(cc.PROGRESS_TIMER_TYPE_BAR)
|
||||
-- Setup for a bar starting from the bottom since the midpoint is 0 for the y
|
||||
right:setMidpoint(cc.p(0.5, 0.5))
|
||||
-- Setup for a vertical bar since the bar change rate is 0 for x meaning no horizontal change
|
||||
right:setBarChangeRate(cc.p(0, 1))
|
||||
right:setPosition(cc.p(s.width - 100, s.height / 2))
|
||||
right:runAction(cc.RepeatForever:create(cc.ProgressTo:create(6, 100)))
|
||||
layer:addChild(right)
|
||||
|
||||
Helper.subtitleLabel:setString("Progress With Sprite Frame")
|
||||
return layer
|
||||
end
|
||||
|
||||
function ProgressActionsTest()
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
SpriteProgressToRadial,
|
||||
SpriteProgressToHorizontal,
|
||||
SpriteProgressToVertical,
|
||||
SpriteProgressToRadialMidpointChanged,
|
||||
SpriteProgressBarVarious,
|
||||
SpriteProgressBarTintAndFade,
|
||||
SpriteProgressWithSpriteFrame
|
||||
}
|
||||
|
||||
scene:addChild(SpriteProgressToRadial())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,43 @@
|
|||
local AssetManagerModule = {}
|
||||
|
||||
function AssetManagerModule.newScene(backfunc)
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local newScene = cc.Scene:create()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local function backToUpdate()
|
||||
local scene = backfunc()
|
||||
if scene ~= nil then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
|
||||
--Create BackMneu
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local backMenuItem = cc.MenuItemFont:create("Back")
|
||||
backMenuItem:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
backMenuItem:registerScriptTapHandler(backToUpdate)
|
||||
|
||||
local backMenu = cc.Menu:create()
|
||||
backMenu:setPosition(0, 0)
|
||||
backMenu:addChild(backMenuItem)
|
||||
layer:addChild(backMenu,6)
|
||||
|
||||
local helloLabel = cc.LabelTTF:create("Hello World", "Arial", 38)
|
||||
helloLabel:setPosition(cc.p(winSize.width / 2, winSize.height - 40))
|
||||
layer:addChild(helloLabel, 5)
|
||||
|
||||
local sprite = cc.Sprite:create("background.png")
|
||||
sprite:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
sprite:setPosition(cc.p(winSize.width / 2, winSize.height / 2))
|
||||
layer:addChild(sprite, 0)
|
||||
|
||||
newScene:addChild(layer)
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
|
||||
|
||||
return AssetManagerModule
|
|
@ -0,0 +1,158 @@
|
|||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
|
||||
local lineSpace = 40
|
||||
local itemTagBasic = 1000
|
||||
local menuItemNames =
|
||||
{
|
||||
"enter",
|
||||
"reset",
|
||||
"update",
|
||||
}
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function updateLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local support = false
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform)
|
||||
or (cc.PLATFORM_OS_WINDOWS == targetPlatform) or (cc.PLATFORM_OS_ANDROID == targetPlatform)
|
||||
or (cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
support = true
|
||||
end
|
||||
|
||||
if not support then
|
||||
print("Platform is not supported!")
|
||||
return layer
|
||||
end
|
||||
|
||||
local isUpdateItemClicked = false
|
||||
local assetsManager = nil
|
||||
local pathToSave = ""
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
|
||||
local progressLable = cc.LabelTTF:create("","Arial",30)
|
||||
progressLable:setPosition(cc.p(140,50))
|
||||
layer:addChild(progressLable)
|
||||
|
||||
pathToSave = createDownloadDir()
|
||||
|
||||
local function onError(errorCode)
|
||||
if errorCode == cc.ASSETSMANAGER_NO_NEW_VERSION then
|
||||
progressLable:setString("no new version")
|
||||
elseif errorCode == cc.ASSETSMANAGER_NETWORK then
|
||||
progressLable:setString("network error")
|
||||
end
|
||||
end
|
||||
|
||||
local function onProgress( percent )
|
||||
local progress = string.format("downloading %d%%",percent)
|
||||
progressLable:setString(progress)
|
||||
end
|
||||
|
||||
local function onSuccess()
|
||||
progressLable:setString("downloading ok")
|
||||
end
|
||||
|
||||
local function getAssetsManager()
|
||||
if nil == assetsManager then
|
||||
assetsManager = cc.AssetsManager:new("https://raw.github.com/samuele3hu/AssetsManagerTest/master/package.zip",
|
||||
"https://raw.github.com/samuele3hu/AssetsManagerTest/master/version",
|
||||
pathToSave)
|
||||
assetsManager:retain()
|
||||
assetsManager:setDelegate(onError, cc.ASSETSMANAGER_PROTOCOL_ERROR )
|
||||
assetsManager:setDelegate(onProgress, cc.ASSETSMANAGER_PROTOCOL_PROGRESS)
|
||||
assetsManager:setDelegate(onSuccess, cc.ASSETSMANAGER_PROTOCOL_SUCCESS )
|
||||
assetsManager:setConnectionTimeout(3)
|
||||
end
|
||||
|
||||
return assetsManager
|
||||
end
|
||||
|
||||
local function update(sender)
|
||||
progressLable:setString("")
|
||||
|
||||
getAssetsManager():update()
|
||||
end
|
||||
|
||||
local function reset(sender)
|
||||
progressLable:setString("")
|
||||
|
||||
deleteDownloadDir(pathToSave)
|
||||
|
||||
getAssetsManager():deleteVersion()
|
||||
|
||||
createDownloadDir()
|
||||
end
|
||||
|
||||
local function reloadModule( moduleName )
|
||||
|
||||
package.loaded[moduleName] = nil
|
||||
|
||||
return require(moduleName)
|
||||
end
|
||||
|
||||
local function enter(sender)
|
||||
|
||||
if not isUpdateItemClicked then
|
||||
addSearchPath(pathToSave,true)
|
||||
end
|
||||
|
||||
assetsManagerModule = reloadModule("src/AssetsManagerTest/AssetsManagerModule")
|
||||
|
||||
assetsManagerModule.newScene(AssetsManagerTestMain)
|
||||
end
|
||||
|
||||
local callbackFuncs =
|
||||
{
|
||||
enter,
|
||||
reset,
|
||||
update,
|
||||
}
|
||||
|
||||
local function menuCallback(tag, menuItem)
|
||||
local scene = nil
|
||||
local nIdx = menuItem:getLocalZOrder() - itemTagBasic
|
||||
local ExtensionsTestScene = CreateExtensionsTestScene(nIdx)
|
||||
if nil ~= ExtensionsTestScene then
|
||||
cc.Director:getInstance():replaceScene(ExtensionsTestScene)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, table.getn(menuItemNames) do
|
||||
local item = cc.MenuItemFont:create(menuItemNames[i])
|
||||
item:registerScriptTapHandler(callbackFuncs[i])
|
||||
item:setPosition(winSize.width / 2, winSize.height - i * lineSpace)
|
||||
if not support then
|
||||
item:setEnabled(false)
|
||||
end
|
||||
menu:addChild(item, itemTagBasic + i)
|
||||
end
|
||||
|
||||
local function onNodeEvent(msgName)
|
||||
if nil ~= assetsManager then
|
||||
assetsManager:release()
|
||||
assetsManager = nil
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
layer:addChild(menu)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- AssetsManager Test
|
||||
-------------------------------------
|
||||
function AssetsManagerTestMain()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(updateLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,644 @@
|
|||
local MAX_COUNT = 9
|
||||
local LINE_SPACE = 40
|
||||
local kItemTagBasic = 5432
|
||||
|
||||
local Winsize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local testNames = {
|
||||
"Bug-350",
|
||||
"Bug-422",
|
||||
"Bug-458",
|
||||
"Bug-624",
|
||||
"Bug-886",
|
||||
"Bug-899",
|
||||
"Bug-914",
|
||||
"Bug-1159",
|
||||
"Bug-1174"
|
||||
}
|
||||
|
||||
local function CreateBugsTestBackMenuItem(pLayer)
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local pMenuItemFont = cc.MenuItemFont:create("Back")
|
||||
pMenuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
local function menuCallback()
|
||||
local pScene = BugsTestMain()
|
||||
if pScene ~= nil then
|
||||
cc.Director:getInstance():replaceScene(pScene)
|
||||
end
|
||||
end
|
||||
pMenuItemFont:registerScriptTapHandler(menuCallback)
|
||||
local pMenu = cc.Menu:create()
|
||||
pMenu:addChild(pMenuItemFont)
|
||||
pMenu:setPosition(cc.p(0, 0))
|
||||
pLayer:addChild(pMenu)
|
||||
end
|
||||
|
||||
--BugTest350
|
||||
local function BugTest350()
|
||||
local pLayer = cc.Layer:create()
|
||||
local pBackground = cc.Sprite:create("Hello.png")
|
||||
pBackground:setPosition(cc.p(Winsize.width/2, Winsize.height/2))
|
||||
pLayer:addChild(pBackground)
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest422
|
||||
local nLocalTag = 0
|
||||
local function BugTest422()
|
||||
local function reset(pResetLayer)
|
||||
nLocalTag = nLocalTag + 1
|
||||
local pNode = pResetLayer:getChildByTag(nLocalTag - 1)
|
||||
if nil ~= pNode then
|
||||
--userdata per
|
||||
local strLog = "Menu:"..nLocalTag
|
||||
print(strLog)
|
||||
end
|
||||
|
||||
pResetLayer:removeChild(pNode, false)
|
||||
|
||||
local function menuCallback(tag,pMenuItem)
|
||||
if nil ~= pMenuItem then
|
||||
local pCallbackLayer = pMenuItem:getParent():getParent()
|
||||
reset(pCallbackLayer)
|
||||
end
|
||||
end
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local pMenuItem1 = cc.MenuItemFont:create("One")
|
||||
pMenuItem1:registerScriptTapHandler(menuCallback)
|
||||
local pMenuItem2 = cc.MenuItemFont:create("Two")
|
||||
pMenuItem2:registerScriptTapHandler(menuCallback)
|
||||
local pMenu = cc.Menu:create(pMenuItem1, pMenuItem2)
|
||||
pMenu:alignItemsVertically()
|
||||
local fX = math.random() * 50
|
||||
local fY = math.random() * 50
|
||||
local menuPosX ,menuPosY = pMenu:getPosition()
|
||||
pMenu:setPosition(cc.p(menuPosX + fX,menuPosY + fY))
|
||||
pResetLayer:addChild(pMenu,0,nLocalTag)
|
||||
end
|
||||
|
||||
local pLayer = cc.Layer:create()
|
||||
reset(pLayer)
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest458
|
||||
local nColorFlag = 0
|
||||
local function BugTest458()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local function InitQuestionContainerSprite(pSprite)
|
||||
--Add label
|
||||
local pLabel = cc.LabelTTF:create("Answer 1", "Arial", 12)
|
||||
pLabel:setTag(100)
|
||||
|
||||
--Add the background
|
||||
local pCorner = cc.Sprite:create("Images/bugs/corner.png")
|
||||
local nWidth = Winsize.width * 0.9 - (pCorner:getContentSize().width * 2)
|
||||
local nHeight = Winsize.height * 0.15 - (pCorner:getContentSize().height * 2)
|
||||
local pColorLayer = cc.LayerColor:create(cc.c4b(255, 255, 255, 255 * .75), nWidth, nHeight)
|
||||
pColorLayer:setPosition(cc.p(-nWidth / 2, -nHeight / 2))
|
||||
--First button is blue,Second is red,Used for testing - change later
|
||||
if (0 == nColorFlag) then
|
||||
pLabel:setColor(cc.c3b(0,0,255))
|
||||
else
|
||||
print("Color changed")
|
||||
pLabel:setColor(cc.c3b(255,0,0))
|
||||
end
|
||||
nColorFlag = nColorFlag + 1
|
||||
pSprite:addChild(pColorLayer)
|
||||
|
||||
pCorner:setPosition(cc.p(-(nWidth / 2 + pCorner:getContentSize().width / 2), -(nHeight / 2 + pCorner:getContentSize().height / 2)))
|
||||
pSprite:addChild(pCorner)
|
||||
|
||||
local nX,nY = pCorner:getPosition()
|
||||
local pCorner2 = cc.Sprite:create("Images/bugs/corner.png")
|
||||
pCorner2:setPosition(cc.p(-nX, nY))
|
||||
pCorner2:setFlipX(true)
|
||||
pSprite:addChild(pCorner2)
|
||||
|
||||
local pCorner3 = cc.Sprite:create("Images/bugs/corner.png")
|
||||
pCorner3:setPosition(cc.p(nX, -nY))
|
||||
pCorner3:setFlipY(true)
|
||||
pSprite:addChild(pCorner3)
|
||||
|
||||
local pCorner4 = cc.Sprite:create("Images/bugs/corner.png")
|
||||
pCorner4:setPosition(cc.p(-nX, -nY))
|
||||
pCorner4:setFlipX(true)
|
||||
pCorner4:setFlipY(true)
|
||||
pSprite:addChild(pCorner4)
|
||||
|
||||
local pEdge = cc.Sprite:create("Images/bugs/edge.png")
|
||||
pEdge:setScaleX(nWidth)
|
||||
pEdge:setPosition(cc.p(nX + (pCorner:getContentSize().width / 2) + (nWidth / 2), nY))
|
||||
pSprite:addChild(pEdge)
|
||||
|
||||
local pEdge2 = cc.Sprite:create("Images/bugs/edge.png")
|
||||
pEdge2:setScaleX(nWidth)
|
||||
pEdge2:setPosition(cc.p(nX + (pCorner:getContentSize().width / 2) + (nWidth / 2), -nY))
|
||||
pEdge2:setFlipY(true)
|
||||
pSprite:addChild(pEdge2)
|
||||
|
||||
local pEdge3 = cc.Sprite:create("Images/bugs/edge.png")
|
||||
pEdge3:setRotation(90)
|
||||
pEdge3:setScaleX(nHeight)
|
||||
pEdge3:setPosition(cc.p(nX, nY + (pCorner:getContentSize().height / 2) + (nHeight / 2)))
|
||||
pSprite:addChild(pEdge3)
|
||||
|
||||
local pEdge4 = cc.Sprite:create("Images/bugs/edge.png")
|
||||
pEdge4:setRotation(270)
|
||||
pEdge4:setScaleX(nHeight)
|
||||
pEdge4:setPosition(cc.p(-nX, nY + (pCorner:getContentSize().height / 2) + (nHeight / 2)))
|
||||
pSprite:addChild(pEdge4)
|
||||
|
||||
pSprite:addChild(pLabel)
|
||||
end
|
||||
|
||||
local pQuestion1 = cc.Sprite:create()
|
||||
InitQuestionContainerSprite(pQuestion1)
|
||||
local pQuestion2 = cc.Sprite:create()
|
||||
InitQuestionContainerSprite(pQuestion2)
|
||||
|
||||
local function menuCallback()
|
||||
print("Selected")
|
||||
end
|
||||
local pMenuItemSprite = cc.MenuItemSprite:create(pQuestion1,pQuestion2)
|
||||
pMenuItemSprite:registerScriptTapHandler(menuCallback)
|
||||
local pLayerColor1 = cc.LayerColor:create(cc.c4b(0,0,255,255), 100, 100)
|
||||
-- question->release()
|
||||
-- question2->release()
|
||||
|
||||
local pLayerColor2 = cc.LayerColor:create(cc.c4b(255,0,0,255), 100, 100)
|
||||
local pMenuItemSprite2 = cc.MenuItemSprite:create(pLayerColor1, pLayerColor2)
|
||||
pMenuItemSprite2:registerScriptTapHandler(menuCallback)
|
||||
local pMenu = cc.Menu:create(pMenuItemSprite, pMenuItemSprite2)
|
||||
pMenu:alignItemsVerticallyWithPadding(100)
|
||||
pMenu:setPosition(cc.p(Winsize.width / 2, Winsize.height / 2))
|
||||
|
||||
-- add the label as a child to this Layer
|
||||
pLayer:addChild(pMenu)
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest624
|
||||
local BugTest624_entry = nil
|
||||
local BugTest624_2_entry = nil
|
||||
|
||||
local function BugTest624()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pLabel = cc.LabelTTF:create("Layer1", "Marker Felt", 36)
|
||||
pLabel:setPosition(cc.p(Winsize.width / 2, Winsize.height / 2))
|
||||
pLayer:addChild(pLabel)
|
||||
pLayer:setAccelerometerEnabled(true)
|
||||
-- schedule(schedule_selector(Bug624Layer::switchLayer), 5.0f)
|
||||
|
||||
local function BugTest624_SwitchLayer()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
scheduler:unscheduleScriptEntry(BugTest624_entry)
|
||||
|
||||
local pScene = cc.Scene:create()
|
||||
local pNewPlayer = BugTest624_2()
|
||||
CreateBugsTestBackMenuItem(pNewPlayer)
|
||||
pScene:addChild(pNewPlayer)
|
||||
cc.Director:getInstance():replaceScene(cc.TransitionFade:create(2.0, pScene, cc.c3b(255,255,255)))
|
||||
end
|
||||
|
||||
|
||||
local function BugTest624_OnEnterOrExit(tag)
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
if tag == "enter" then
|
||||
BugTest624_entry = scheduler:scheduleScriptFunc(BugTest624_SwitchLayer, 5.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(BugTest624_entry)
|
||||
end
|
||||
end
|
||||
pLayer:registerScriptHandler(BugTest624_OnEnterOrExit)
|
||||
|
||||
local function didAccelerate(x,y,z,timestamp)
|
||||
print("Layer1 accel")
|
||||
end
|
||||
pLayer:registerScriptAccelerateHandler(didAccelerate)
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
function BugTest624_2()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pLabel = cc.LabelTTF:create("Layer2", "Marker Felt", 36)
|
||||
pLabel:setPosition(cc.p(Winsize.width / 2, Winsize.height / 2))
|
||||
pLayer:addChild(pLabel)
|
||||
pLayer:setAccelerometerEnabled(true)
|
||||
|
||||
local function BugTest624_2_SwitchLayer()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
scheduler:unscheduleScriptEntry(BugTest624_2_entry)
|
||||
|
||||
local pScene = cc.Scene:create()
|
||||
local pNewPlayer = BugTest624()
|
||||
CreateBugsTestBackMenuItem(pNewPlayer)
|
||||
pScene:addChild(pNewPlayer)
|
||||
cc.Director:getInstance():replaceScene(cc.TransitionFade:create(2.0, pScene, cc.c3b(255,0,0)))
|
||||
end
|
||||
|
||||
local function BugTest624_2_OnEnterOrExit(tag)
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
if tag == "enter" then
|
||||
BugTest624_2_entry = scheduler:scheduleScriptFunc(BugTest624_2_SwitchLayer, 5.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(BugTest624_2_entry)
|
||||
end
|
||||
end
|
||||
pLayer:registerScriptHandler(BugTest624_2_OnEnterOrExit)
|
||||
|
||||
local function didAccelerate(x,y,z,timestamp)
|
||||
print("Layer2 accel")
|
||||
end
|
||||
|
||||
pLayer:registerScriptAccelerateHandler(didAccelerate)
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest886
|
||||
local function BugTest886()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pSprite1 = cc.Sprite:create("Images/bugs/bug886.jpg")
|
||||
pSprite1:setAnchorPoint(cc.p(0, 0))
|
||||
pSprite1:setPosition(cc.p(0, 0))
|
||||
pSprite1:setScaleX(0.6)
|
||||
pLayer:addChild(pSprite1)
|
||||
|
||||
local pSprite2 = cc.Sprite:create("Images/bugs/bug886.jpg")
|
||||
pSprite2:setAnchorPoint(cc.p(0, 0))
|
||||
pSprite2:setScaleX(0.6)
|
||||
pSprite2:setPosition(cc.p(pSprite1:getContentSize().width * 0.6 + 10, 0))
|
||||
pLayer:addChild(pSprite2)
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest899
|
||||
local function BugTest899()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local pBg = cc.Sprite:create("Images/bugs/RetinaDisplay.jpg")
|
||||
pLayer:addChild(pBg,0)
|
||||
pBg:setAnchorPoint(cc.p(0, 0))
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest914
|
||||
local function BugTest914()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local layerColor = nil
|
||||
|
||||
for i = 0, 4 do
|
||||
layerColor = cc.LayerColor:create(cc.c4b(i*20, i*20, i*20,255))
|
||||
layerColor:setContentSize(cc.size(i*100, i*100))
|
||||
layerColor:setPosition(cc.p(Winsize.width/2, Winsize.height/2))
|
||||
layerColor:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
layerColor:ignoreAnchorPointForPosition(false)
|
||||
layer:addChild(layerColor, -1-i)
|
||||
end
|
||||
|
||||
--create and initialize a Label
|
||||
local function restart()
|
||||
local scene = cc.Scene:create()
|
||||
local newLayer = BugTest914()
|
||||
CreateBugsTestBackMenuItem(newLayer)
|
||||
scene:addChild(newLayer)
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local label = cc.LabelTTF:create("Hello World", "Marker Felt", 64)
|
||||
--position the label on the center of the screen
|
||||
label:setPosition(cc.p( Winsize.width /2 , Winsize.height/2 ))
|
||||
layer:addChild(label)
|
||||
|
||||
local item1 = cc.MenuItemFont:create("restart")
|
||||
item1:registerScriptTapHandler(restart)
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(item1)
|
||||
menu:alignItemsVertically()
|
||||
menu:setPosition(cc.p(Winsize.width/2, 100))
|
||||
layer:addChild(menu)
|
||||
|
||||
-- handling touch events
|
||||
local function onTouchMoved(touches, event)
|
||||
local count = table.getn(touches)
|
||||
print("Number of touches: ",count)
|
||||
end
|
||||
local function onTouchBegan(touches, event)
|
||||
onTouchMoved(touches, event)
|
||||
end
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCHES_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
|
||||
local eventDispatcher = layer:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
--BugTest1159
|
||||
local function BugTest1159()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
cc.Director:getInstance():setDepthTest(true)
|
||||
|
||||
local background = cc.LayerColor:create(cc.c4b(255, 0, 255, 255))
|
||||
pLayer:addChild(background)
|
||||
|
||||
local sprite_a = cc.LayerColor:create(cc.c4b(255, 0, 0, 255), 700, 700)
|
||||
sprite_a:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
sprite_a:ignoreAnchorPointForPosition(false)
|
||||
sprite_a:setPosition(cc.p(0.0, Winsize.height/2))
|
||||
pLayer:addChild(sprite_a)
|
||||
local seq = cc.Sequence:create(cc.MoveTo:create(1.0, cc.p(1024.0, 384.0)), cc.MoveTo:create(1.0, cc.p(0.0, 384.0)))
|
||||
sprite_a:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
local sprite_b = cc.LayerColor:create(cc.c4b(0, 0, 255, 255), 400, 400)
|
||||
sprite_b:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
sprite_b:ignoreAnchorPointForPosition(false)
|
||||
sprite_b:setPosition(cc.p(Winsize.width/2, Winsize.height/2))
|
||||
pLayer:addChild(sprite_b)
|
||||
|
||||
local function menuCallback()
|
||||
local pScene = cc.Scene:create()
|
||||
local pLayer = BugTest1159()
|
||||
CreateBugsTestBackMenuItem(pLayer)
|
||||
pScene:addChild(pLayer)
|
||||
cc.Director:getInstance():replaceScene(cc.TransitionPageTurn:create(1.0, pScene, false))
|
||||
end
|
||||
local label = cc.MenuItemLabel:create(cc.LabelTTF:create("Flip Me", "Helvetica", 24))
|
||||
label:registerScriptTapHandler(menuCallback)
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(label)
|
||||
menu:setPosition(cc.p(Winsize.width - 200.0, 50.0))
|
||||
pLayer:addChild(menu)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
--[[
|
||||
if schedulerEntry ~= nil then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
end
|
||||
]]--
|
||||
cc.Director:getInstance():setDepthTest(false)
|
||||
end
|
||||
end
|
||||
|
||||
pLayer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
--BugTest1174
|
||||
local function BugTest1174()
|
||||
local pLayer = cc.Layer:create()
|
||||
|
||||
local function check_for_error(p1,p2,p3,p4,s,t)
|
||||
local p4_p3 = cc.pSub(p4,p3)
|
||||
local p4_p3_t = cc.pMul(p4_p3,t)
|
||||
local hitp1 = cc.pAdd(p3,p4_p3_t)
|
||||
|
||||
local p2_p1 = cc.pSub(p2,p1)
|
||||
local p2_p1_s = cc.pMul(p2_p1,s)
|
||||
local hitp2 = cc.pAdd(p1,p2_p1_s)
|
||||
|
||||
if math.abs(hitp1.x - hitp2.x ) > 0.1 or math.abs(hitp1.y - hitp2.y) > 0.1 then
|
||||
local strErr = "ERROR: ("..hitp1.x..","..hitp1.y..") != ("..hitp2.x..","..hitp2.y..")"
|
||||
print(strErr)
|
||||
return 1
|
||||
end
|
||||
return 0
|
||||
end
|
||||
local A,B,C,D,p1,p2,p3,p4
|
||||
local s = 0.0
|
||||
local t = 0.0
|
||||
local err = 0
|
||||
local ok = 0
|
||||
local bRet = false
|
||||
|
||||
print("Test1 - Start")
|
||||
local i = 0
|
||||
for i = 0, 9999 do
|
||||
--[[
|
||||
A|b
|
||||
-----
|
||||
c|d
|
||||
]]--
|
||||
local ax = math.random() * -5000
|
||||
local ay = math.random() * 5000
|
||||
--[[
|
||||
a|b
|
||||
-----
|
||||
c|D
|
||||
]]--
|
||||
local dx = math.random() * 5000
|
||||
local dy = math.random() * -5000
|
||||
|
||||
--[[
|
||||
a|B
|
||||
-----
|
||||
c|d
|
||||
]]--
|
||||
local bx = math.random() * 5000
|
||||
local by = math.random() * 5000
|
||||
|
||||
--[[
|
||||
a|b
|
||||
-----
|
||||
C|d
|
||||
]]--
|
||||
local cx = math.random() * -5000
|
||||
local cy = math.random() * -5000
|
||||
|
||||
A = cc.p(ax,ay)
|
||||
B = cc.p(bx,by)
|
||||
C = cc.p(cx,cy)
|
||||
D = cc.p(dx,dy)
|
||||
|
||||
bRet,s,t = cc.pIsLineIntersect( A, D, B, C, s, t)
|
||||
if true == bRet then
|
||||
if 1 == check_for_error(A,D,B,C,s,t) then
|
||||
err = err + 1
|
||||
else
|
||||
ok = ok + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
local strLog = "Test1 - End. OK="..ok..", Err="..err
|
||||
print(strLog)
|
||||
--------
|
||||
--Test 2
|
||||
--------
|
||||
print("Test2 - Start")
|
||||
|
||||
p1 = cc.p(220,480)
|
||||
p2 = cc.p(304,325)
|
||||
p3 = cc.p(264,416)
|
||||
p4 = cc.p(186,416)
|
||||
s = 0.0
|
||||
t = 0.0
|
||||
bRet,s,t = cc.pIsLineIntersect( p1, p2, p3, p4, s, t)
|
||||
if true == bRet then
|
||||
check_for_error(p1, p2, p3, p4, s, t)
|
||||
end
|
||||
print("Test2 - End")
|
||||
|
||||
------
|
||||
--Test 3
|
||||
------
|
||||
print("Test3 - Start")
|
||||
|
||||
ok=0
|
||||
err=0
|
||||
for i = 0 , 9999 do
|
||||
-- A | b
|
||||
-- -----
|
||||
-- c | d
|
||||
local ax = math.random() * -500
|
||||
local ay = math.random() * 500
|
||||
p1 = cc.p(ax,ay)
|
||||
-- a | b
|
||||
-- -----
|
||||
-- c | D
|
||||
local dx = math.random() * 500
|
||||
local dy = math.random() * -500
|
||||
p2 = cc.p(dx,dy)
|
||||
|
||||
-------
|
||||
|
||||
local y = ay - ((ay - dy) / 2.0)
|
||||
|
||||
-- a | b
|
||||
-- -----
|
||||
-- C | d
|
||||
local cx = math.random() * -500
|
||||
p3 = cc.p(cx,y)
|
||||
|
||||
-- a | B
|
||||
-- -----
|
||||
-- c | d
|
||||
local bx = math.random() * 500
|
||||
p4 = cc.p(bx,y)
|
||||
|
||||
s = 0.0
|
||||
t = 0.0
|
||||
bRet,s,t = cc.pIsLineIntersect(p1, p2, p3, p4, s, t)
|
||||
if true == bRet then
|
||||
if 1 == check_for_error(p1, p2, p3, p4, s,t ) then
|
||||
err = err + 1
|
||||
else
|
||||
ok = ok + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
strLog = "Test3 - End. OK="..ok..", Err="..err
|
||||
print(strLog)
|
||||
|
||||
return pLayer
|
||||
end
|
||||
|
||||
local CreateBugsTestTable = {
|
||||
BugTest350,
|
||||
BugTest422,
|
||||
BugTest458,
|
||||
BugTest624,
|
||||
BugTest886,
|
||||
BugTest899,
|
||||
BugTest914,
|
||||
BugTest1159,
|
||||
BugTest1174,
|
||||
}
|
||||
|
||||
local function CreateBugsTestScene(nBugNo)
|
||||
local pNewscene = cc.Scene:create()
|
||||
local pLayer = CreateBugsTestTable[nBugNo]()
|
||||
CreateBugsTestBackMenuItem(pLayer)
|
||||
pNewscene:addChild(pLayer)
|
||||
cc.Director:getInstance():replaceScene(pNewscene)
|
||||
--pLayer:autorelease()
|
||||
end
|
||||
|
||||
|
||||
local function BugsTestMainLayer()
|
||||
local ret = cc.Layer:create()
|
||||
|
||||
--menu callback
|
||||
local function menuCallback(tag, pMenuItem)
|
||||
local nIdx = pMenuItem:getLocalZOrder() - kItemTagBasic
|
||||
local BugTestScene = CreateBugsTestScene(nIdx)
|
||||
if nil ~= testScene then
|
||||
cc.Director:getInstance():replaceScene(testScene)
|
||||
end
|
||||
end
|
||||
|
||||
-- add menu items for tests
|
||||
local pItemMenu = cc.Menu:create()
|
||||
local nTestCount = table.getn(testNames)
|
||||
|
||||
local i = 1
|
||||
for i = 1, nTestCount do
|
||||
local label = cc.LabelTTF:create(testNames[i], "Arial", 24)
|
||||
local pMenuItem = cc.MenuItemLabel:create(label)
|
||||
pMenuItem:registerScriptTapHandler(menuCallback)
|
||||
pItemMenu:addChild(pMenuItem, i + kItemTagBasic)
|
||||
pMenuItem:setPosition( cc.p( VisibleRect:center().x, (VisibleRect:top().y - i * LINE_SPACE) ))
|
||||
end
|
||||
|
||||
pItemMenu:setPosition(cc.p(0, 0))
|
||||
ret:addChild(pItemMenu)
|
||||
|
||||
-- handling touch events
|
||||
local ptBeginPos = {x = 0, y = 0}
|
||||
local ptCurPos = {x = 0, y = 0}
|
||||
|
||||
-- handling touch events
|
||||
local function onTouchMoved(touches, event)
|
||||
local touchLocation = touches[1]:getLocation()
|
||||
local nMoveY = touchLocation.y - ptBeginPos.y
|
||||
local curPosx, curPosy = pItemMenu:getPosition()
|
||||
local nextPosy = curPosy + nMoveY
|
||||
if nextPosy < 0 then
|
||||
pItemMenu:setPosition(0, 0)
|
||||
return
|
||||
end
|
||||
|
||||
if nextPosy > ((nTestCount + 1) * LINE_SPACE - Winsize.height) then
|
||||
pItemMenu:setPosition(0, ((nTestCount + 1) * LINE_SPACE - Winsize.height))
|
||||
return
|
||||
end
|
||||
|
||||
pItemMenu:setPosition(curPosx, nextPosy)
|
||||
ptBeginPos = touchLocation
|
||||
ptCurPos = {x = curPosx, y = nextPosy}
|
||||
end
|
||||
local function onTouchBegan(touches, event)
|
||||
ptBeginPos = touches[1]:getLocation()
|
||||
end
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCHES_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
|
||||
return ret
|
||||
end
|
||||
function BugsTestMain()
|
||||
cclog("BugsTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(BugsTestMainLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,69 @@
|
|||
local size = cc.Director:getInstance():getWinSize()
|
||||
local layer = nil
|
||||
local kTagSprite = 1
|
||||
|
||||
local function initWithLayer()
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
|
||||
local bgLayer = cc.LayerColor:create(cc.c4b(255,255,0,255))
|
||||
layer:addChild(bgLayer, -1)
|
||||
|
||||
layer:addChild(sprite, 0, kTagSprite)
|
||||
sprite:setPosition(cc.p(20,150))
|
||||
|
||||
sprite:runAction(cc.JumpTo:create(4, cc.p(300,48), 100, 4))
|
||||
|
||||
bgLayer:runAction(cc.RepeatForever:create(cc.Sequence:create(
|
||||
cc.FadeIn:create(1),
|
||||
cc.FadeOut:create(1))))
|
||||
|
||||
local function onTouchBegan(touch, event)
|
||||
return true
|
||||
end
|
||||
|
||||
local function onTouchEnded(touch, event)
|
||||
|
||||
local location = touch:getLocation()
|
||||
|
||||
local s = layer:getChildByTag(kTagSprite)
|
||||
s:stopAllActions()
|
||||
s:runAction(cc.MoveTo:create(1, cc.p(location.x, location.y)))
|
||||
local posX, posY = s:getPosition()
|
||||
local o = location.x - posX
|
||||
local a = location.y - posY
|
||||
local at = math.atan(o / a) / math.pi * 180.0
|
||||
|
||||
if a < 0 then
|
||||
if o < 0 then
|
||||
at = 180 + math.abs(at)
|
||||
else
|
||||
at = 180 - math.abs(at)
|
||||
end
|
||||
end
|
||||
s:runAction(cc.RotateTo:create(1, at))
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED )
|
||||
local eventDispatcher = layer:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
--------------------------------
|
||||
-- Click And Move Test
|
||||
--------------------------------
|
||||
function ClickAndMoveTest()
|
||||
cclog("ClickAndMoveTest")
|
||||
local scene = cc.Scene:create()
|
||||
layer = cc.Layer:create()
|
||||
|
||||
initWithLayer()
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1 @@
|
|||
09ed3c488f6d182685c416c291f8f325fb5cc2d2
|
|
@ -0,0 +1,751 @@
|
|||
require "src/CocoStudioTest/CocoStudioSceneTest/TriggerCode/acts"
|
||||
require "src/CocoStudioTest/CocoStudioSceneTest/TriggerCode/cons"
|
||||
require "src/CocoStudioTest/CocoStudioSceneTest/TriggerCode/eventDef"
|
||||
|
||||
local itemTagBasic = 1000
|
||||
|
||||
local sceneEditorTestIdx = 1
|
||||
|
||||
local SceneEditorTestLayer = class("SceneEditorTestLayer")
|
||||
SceneEditorTestLayer.__index = SceneEditorTestLayer
|
||||
SceneEditorTestLayer._backItem = nil
|
||||
SceneEditorTestLayer._restarItem = nil
|
||||
SceneEditorTestLayer._nextItem = nil
|
||||
SceneEditorTestLayer.title =
|
||||
{
|
||||
"loadSceneEdtiorFile Test",
|
||||
"Sprite Component Test",
|
||||
"Armature Component Test",
|
||||
"UI Component Test",
|
||||
"TmxMap Component Test",
|
||||
"Particle Component Test",
|
||||
"Effect Component Test",
|
||||
"Background Component Test",
|
||||
"Attribute Component Test",
|
||||
"Trigger Test",
|
||||
}
|
||||
|
||||
function SceneEditorTestLayer.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, SceneEditorTestLayer)
|
||||
return target
|
||||
end
|
||||
|
||||
|
||||
function SceneEditorTestLayer:onEnter()
|
||||
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:onExit()
|
||||
ccs.TriggerMng.destroyInstance()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
ccs.SceneReader:destroyInstance()
|
||||
ccs.ActionManagerEx:destroyInstance()
|
||||
ccs.GUIReader:destroyInstance()
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer.create()
|
||||
local layer = SceneEditorTestLayer.extend(cc.Layer:create())
|
||||
if nil ~= layer then
|
||||
layer:createTitle()
|
||||
layer:createMenu()
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:createTitle()
|
||||
local title = cc.LabelTTF:create(self.title[sceneEditorTestIdx],"Arial",18)
|
||||
title:setColor(cc.c3b(255, 255, 255))
|
||||
self:addChild(title, 1, 10000)
|
||||
title:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y - 30))
|
||||
end
|
||||
|
||||
function SceneEditorTestLayer:createMenu()
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
local function pre()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(backSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function restart()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(restartSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function next()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(nextSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
self._backItem = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
self._backItem:registerScriptTapHandler(pre)
|
||||
self._restarItem = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
self._restarItem:registerScriptTapHandler(restart)
|
||||
self._nextItem = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
self._nextItem:registerScriptTapHandler(next)
|
||||
|
||||
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
self._backItem:setPosition(cc.p(size.width / 2 - self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
self._restarItem:setPosition(cc.p(size.width / 2, self._restarItem:getContentSize().height / 2))
|
||||
self._nextItem:setPosition(cc.p(size.width / 2 + self._restarItem:getContentSize().width * 2, self._restarItem:getContentSize().height / 2))
|
||||
|
||||
menu:addChild(self._backItem,itemTagBasic)
|
||||
menu:addChild(self._restarItem,itemTagBasic)
|
||||
menu:addChild(self._nextItem,itemTagBasic)
|
||||
menu:setPosition(cc.p(0,0))
|
||||
self:addChild(menu, 100)
|
||||
|
||||
local function back()
|
||||
local scene = CocoStudioTestMain()
|
||||
if nil ~= scene then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
|
||||
local backMenu = cc.Menu:create()
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
menuItemFont:registerScriptTapHandler(back)
|
||||
|
||||
backMenu:addChild(menuItemFont)
|
||||
backMenu:setPosition(cc.p(0, 0))
|
||||
self:addChild(backMenu,10)
|
||||
end
|
||||
|
||||
local LoadSceneEdtiorFileTest = class("LoadSceneEdtiorFileTest",SceneEditorTestLayer)
|
||||
LoadSceneEdtiorFileTest.__index = LoadSceneEdtiorFileTest
|
||||
|
||||
function LoadSceneEdtiorFileTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, LoadSceneEdtiorFileTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/LoadSceneEdtiorFileTest/FishJoy2.json")
|
||||
return node
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function LoadSceneEdtiorFileTest.create()
|
||||
local layer = LoadSceneEdtiorFileTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local SpriteComponentTest = class("SpriteComponentTest",SceneEditorTestLayer)
|
||||
SpriteComponentTest.__index = SpriteComponentTest
|
||||
|
||||
function SpriteComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, SpriteComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function SpriteComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/SpriteComponentTest/SpriteComponentTest.json")
|
||||
if nil ~= node then
|
||||
local action1 = cc.Blink:create(2, 10)
|
||||
local action2 = cc.Blink:create(2, 5)
|
||||
|
||||
local sister1 = tolua.cast(node:getChildByTag(10003):getComponent("CCSprite"),"ccs.ComRender")
|
||||
sister1:getNode():runAction(action1)
|
||||
local sister2 = tolua.cast(node:getChildByTag(10004):getComponent("CCSprite"),"ccs.ComRender")
|
||||
sister2:getNode():runAction(action2)
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function SpriteComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function SpriteComponentTest.create()
|
||||
local layer = SpriteComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local ArmatureComponentTest = class("ArmatureComponentTest",SceneEditorTestLayer)
|
||||
ArmatureComponentTest.__index = ArmatureComponentTest
|
||||
|
||||
function ArmatureComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, ArmatureComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function ArmatureComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ArmatureComponentTest/ArmatureComponentTest.json")
|
||||
if nil ~= node then
|
||||
local blowFish = tolua.cast(node:getChildByTag(10007):getComponent("CCArmature"),"ccs.ComRender")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10008):getComponent("CCArmature"),"ccs.ComRender")
|
||||
butterflyfish:getNode():runAction(CCMoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function ArmatureComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ArmatureComponentTest.create()
|
||||
local layer = ArmatureComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local UIComponentTest = class("UIComponentTest",SceneEditorTestLayer)
|
||||
UIComponentTest.__index = UIComponentTest
|
||||
|
||||
function UIComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, UIComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function UIComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/UIComponentTest/UIComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10025):getComponent("GUIComponent"),"ccs.ComRender")
|
||||
local widget = tolua.cast(render:getNode(), "ccui.Widget")
|
||||
local button = tolua.cast(widget:getChildByName("Button_156"),"ccui.Button")
|
||||
local function onTouch(sender, eventType)
|
||||
if eventType == ccui.TouchEventType.began then
|
||||
local blowFish = tolua.cast(node:getChildByTag(10010):getComponent("CCArmature"), "ccs.ComRender")
|
||||
blowFish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
|
||||
local butterflyfish = tolua.cast(node:getChildByTag(10011):getComponent("CCArmature"), "ccs.ComRender")
|
||||
butterflyfish:getNode():runAction(cc.MoveBy:create(10.0, cc.p(-1000.0, 0)))
|
||||
end
|
||||
end
|
||||
|
||||
button:addTouchEventListener(onTouch)
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function UIComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function UIComponentTest.create()
|
||||
local layer = UIComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TmxMapComponentTest = class("TmxMapComponentTest",SceneEditorTestLayer)
|
||||
TmxMapComponentTest.__index = TmxMapComponentTest
|
||||
|
||||
function TmxMapComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TmxMapComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function TmxMapComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TmxMapComponentTest/TmxMapComponentTest.json")
|
||||
if nil ~= node then
|
||||
local tmxMap = tolua.cast(node:getChildByTag(10015):getComponent("CCTMXTiledMap"),"ccs.ComRender")
|
||||
local actionTo = cc.SkewTo:create(2, 0.0, 2.0)
|
||||
local rotateTo = cc.RotateTo:create(2, 61.0)
|
||||
local actionScaleTo = cc.ScaleTo:create(2, -0.44, 0.47)
|
||||
|
||||
local actionScaleToBack = cc.ScaleTo:create(2, 1.0, 1.0)
|
||||
local rotateToBack = cc.RotateTo:create(2, 0)
|
||||
local actionToBack = cc.SkewTo:create(2, 0, 0)
|
||||
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(actionTo, actionToBack))
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(rotateTo, rotateToBack))
|
||||
tmxMap:getNode():runAction(cc.Sequence:create(actionScaleTo, actionScaleToBack))
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function TmxMapComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function TmxMapComponentTest.create()
|
||||
local layer = TmxMapComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local ParticleComponentTest = class("ParticleComponentTest",SceneEditorTestLayer)
|
||||
ParticleComponentTest.__index = ParticleComponentTest
|
||||
|
||||
function ParticleComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, ParticleComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function ParticleComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/ParticleComponentTest/ParticleComponentTest.json")
|
||||
if nil ~= node then
|
||||
local particle = tolua.cast(node:getChildByTag(10020):getComponent("CCParticleSystemQuad"),"ccs.ComRender")
|
||||
local jump = cc.JumpBy:create(5, cc.p(-500,0), 50, 4)
|
||||
local action = cc.Sequence:create( jump, jump:reverse())
|
||||
particle:getNode():runAction(action)
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function ParticleComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function ParticleComponentTest.create()
|
||||
local layer = ParticleComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local EffectComponentTest = class("EffectComponentTest",SceneEditorTestLayer)
|
||||
EffectComponentTest.__index = EffectComponentTest
|
||||
|
||||
function EffectComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, EffectComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function EffectComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/EffectComponentTest/EffectComponentTest.json")
|
||||
if nil ~= node then
|
||||
local render = tolua.cast(node:getChildByTag(10015):getComponent("CCArmature"),"ccs.ComRender")
|
||||
local armature = tolua.cast(render:getNode(),"ccs.Armature")
|
||||
local function animationEvent(armatureBack,movementType,movementID)
|
||||
local id = movementID
|
||||
if movementType == ccs.MovementEventType.loopComplete then
|
||||
if id == "Fire" then
|
||||
local audio = tolua.cast(node:getChildByTag(10015):getComponent("CCComAudio"), "ccs.ComAudio")
|
||||
audio:playEffect()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
armature:getAnimation():setMovementEventCallFunc(animationEvent)
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function EffectComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function EffectComponentTest.create()
|
||||
local layer = EffectComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local BackgroundComponentTest = class("BackgroundComponentTest",SceneEditorTestLayer)
|
||||
BackgroundComponentTest.__index = BackgroundComponentTest
|
||||
|
||||
function BackgroundComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, BackgroundComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function BackgroundComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/BackgroundComponentTest/BackgroundComponentTest.json")
|
||||
if nil ~= node then
|
||||
local audio = tolua.cast(node:getComponent("CCBackgroundAudio"),"ccs.ComAudio")
|
||||
audio:playBackgroundMusic()
|
||||
end
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function BackgroundComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function BackgroundComponentTest.create()
|
||||
local layer = BackgroundComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local AttributeComponentTest = class("AttributeComponentTest",SceneEditorTestLayer)
|
||||
AttributeComponentTest.__index = AttributeComponentTest
|
||||
|
||||
function AttributeComponentTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, AttributeComponentTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function AttributeComponentTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/AttributeComponentTest/AttributeComponentTest.json")
|
||||
local attribute = tolua.cast(node:getChildByTag(10015):getComponent("CCComAttribute"), "ccs.ComAttribute")
|
||||
print(string.format("Name: %s, HP: %f, MP: %f", attribute:getString("name"), attribute:getFloat("maxHP"), attribute:getFloat("maxMP")))
|
||||
return node
|
||||
end
|
||||
|
||||
function AttributeComponentTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function AttributeComponentTest.create()
|
||||
local layer = AttributeComponentTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local TriggerTest = class("TriggerTest",SceneEditorTestLayer)
|
||||
TriggerTest.__index = TriggerTest
|
||||
TriggerTest._touchListener = nil
|
||||
|
||||
function TriggerTest.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, TriggerTest)
|
||||
return target
|
||||
end
|
||||
|
||||
function TriggerTest:createGameScene()
|
||||
local node = ccs.SceneReader:getInstance():createNodeWithSceneFile("scenetest/TriggerTest/TriggerTest.json")
|
||||
|
||||
return node
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchBegan(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHBEGAN)
|
||||
return true
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchMoved(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHMOVED)
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchEnded(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHENDED)
|
||||
end
|
||||
|
||||
function TriggerTest:onTouchCancelled(touch,event)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_TOUCHCANCELLED)
|
||||
end
|
||||
|
||||
function TriggerTest:onEnter()
|
||||
self:createMenu()
|
||||
self:createTitle()
|
||||
local root = self:createGameScene()
|
||||
if nil ~= root then
|
||||
self:addChild(root, 0, 1)
|
||||
self._touchListener = nil
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:setSwallowTouches(true)
|
||||
listener:registerScriptHandler(self.onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(self.onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
listener:registerScriptHandler(self.onTouchEnded,cc.Handler.EVENT_TOUCH_ENDED )
|
||||
listener:registerScriptHandler(self.onTouchCancelled,cc.Handler.EVENT_TOUCH_CANCELLED )
|
||||
local eventDispatcher = self:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, self)
|
||||
self._touchListener = listener
|
||||
local function update(dt)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_UPDATESCENE)
|
||||
end
|
||||
self:scheduleUpdateWithPriorityLua(update,0)
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_ENTERSCENE)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function TriggerTest:onExit()
|
||||
ccs.sendTriggerEvent(triggerEventDef.TRIGGEREVENT_LEAVESCENE)
|
||||
self:unscheduleUpdate()
|
||||
local dispatcher = self:getEventDispatcher()
|
||||
dispatcher:removeEventListener(self._touchListener)
|
||||
ccs.TriggerMng.destroyInstance()
|
||||
ccs.ArmatureDataManager:destroyInstance()
|
||||
ccs.SceneReader:destroyInstance()
|
||||
ccs.ActionManagerEx:destroyInstance()
|
||||
ccs.GUIReader:destroyInstance()
|
||||
end
|
||||
|
||||
function TriggerTest.create()
|
||||
local layer = TriggerTest.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
local function onNodeEvent(event)
|
||||
if "enter" == event then
|
||||
layer:onEnter()
|
||||
elseif "exit" == event then
|
||||
layer:onExit()
|
||||
end
|
||||
end
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
end
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local createSceneEditorTest =
|
||||
{
|
||||
LoadSceneEdtiorFileTest.create,
|
||||
SpriteComponentTest.create,
|
||||
ArmatureComponentTest.create,
|
||||
UIComponentTest.create,
|
||||
TmxMapComponentTest.create,
|
||||
ParticleComponentTest.create,
|
||||
EffectComponentTest.create,
|
||||
BackgroundComponentTest.create,
|
||||
AttributeComponentTest.create,
|
||||
TriggerTest.create,
|
||||
}
|
||||
|
||||
function nextSceneEditorTest( )
|
||||
sceneEditorTestIdx = sceneEditorTestIdx + 1
|
||||
sceneEditorTestIdx = sceneEditorTestIdx % table.getn(createSceneEditorTest)
|
||||
|
||||
if 0 == sceneEditorTestIdx then
|
||||
sceneEditorTestIdx = table.getn(createSceneEditorTest)
|
||||
end
|
||||
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function backSceneEditorTest()
|
||||
sceneEditorTestIdx = sceneEditorTestIdx - 1
|
||||
if sceneEditorTestIdx <= 0 then
|
||||
sceneEditorTestIdx = sceneEditorTestIdx + table.getn(createSceneEditorTest)
|
||||
end
|
||||
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function restartSceneEditorTest()
|
||||
return createSceneEditorTest[sceneEditorTestIdx]()
|
||||
end
|
||||
|
||||
function runCocosSceneTestScene()
|
||||
local scene = cc.Scene:create()
|
||||
sceneEditorTestIdx = 1
|
||||
scene:addChild(restartSceneEditorTest())
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
|
@ -0,0 +1,172 @@
|
|||
require "CocoStudio"
|
||||
|
||||
local TMoveBy = class("TMoveBy")
|
||||
TMoveBy._tag = -1
|
||||
TMoveBy._duration = 0
|
||||
TMoveBy._x = 0
|
||||
TMoveBy._y = 0
|
||||
TMoveBy._reverse = false
|
||||
function TMoveBy:ctor()
|
||||
self._tag = -1
|
||||
self._duration = 0.0
|
||||
self._x = 0
|
||||
self._y = 0
|
||||
self._reverse = false
|
||||
end
|
||||
|
||||
function TMoveBy:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TMoveBy:done()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil == node then
|
||||
return
|
||||
end
|
||||
local actionBy = cc.MoveBy:create(self._duration, cc.p(self._x, self._y))
|
||||
if nil == actionBy then
|
||||
return
|
||||
end
|
||||
|
||||
if true == self._reverse then
|
||||
local actionByBack = actionBy:reverse()
|
||||
node:runAction(cc.Sequence:create(actionBy, actionByBack))
|
||||
else
|
||||
node:runAction(actionBy)
|
||||
end
|
||||
end
|
||||
|
||||
function TMoveBy:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "Duration" then
|
||||
self._duration = subDict["value"]
|
||||
elseif key == "x" then
|
||||
self._x = subDict["value"]
|
||||
elseif key == "y" then
|
||||
self._y = subDict["value"]
|
||||
elseif key == "IsReverse" then
|
||||
self._reverse = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TMoveBy:removeAll()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
node:getActionManager():removeAllActions()
|
||||
print("TMoveBy::removeAll")
|
||||
end
|
||||
|
||||
local TScaleTo = class("TScaleTo")
|
||||
TScaleTo._tag = -1
|
||||
TScaleTo._duration = 0
|
||||
TScaleTo._scaleX = 0
|
||||
TScaleTo._scaleY = 0
|
||||
|
||||
function TScaleTo:ctor()
|
||||
self._tag = -1
|
||||
self._duration = 0
|
||||
self._scaleX = 0
|
||||
self._scaleY = 0
|
||||
end
|
||||
|
||||
function TScaleTo:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TScaleTo:done()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil == node then
|
||||
return
|
||||
end
|
||||
|
||||
local actionTo = cc.ScaleTo:create(self._duration, self._scaleX, self._scaleY)
|
||||
if nil == actionTo then
|
||||
return
|
||||
end
|
||||
|
||||
node:runAction(actionTo)
|
||||
end
|
||||
|
||||
function TScaleTo:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "Duration" then
|
||||
self._duration = subDict["value"]
|
||||
elseif key == "ScaleX" then
|
||||
self._scaleX = subDict["value"]
|
||||
elseif key == "ScaleY" then
|
||||
self._scaleY = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TScaleTo:removeAll()
|
||||
print("TScaleTo::removeAll")
|
||||
end
|
||||
|
||||
|
||||
local TriggerState = class("TriggerState")
|
||||
TriggerState._id = -1
|
||||
TriggerState._state = 0
|
||||
|
||||
function TriggerState:ctor()
|
||||
self._id = -1
|
||||
self._state = 0
|
||||
end
|
||||
|
||||
function TriggerState:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function TriggerState:done()
|
||||
local obj = ccs.TriggerMng.getInstance():getTriggerObj(self._id)
|
||||
if nil ~= obj then
|
||||
if self._state == 0 then
|
||||
obj:setEnable(false)
|
||||
elseif self._state == 1 then
|
||||
obj:setEnable(true)
|
||||
elseif self._state == 2 then
|
||||
ccs.TriggerMng.getInstance():removeTriggerObj(self._id)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TriggerState:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "ID" then
|
||||
self._id = subDict["value"]
|
||||
elseif key == "State" then
|
||||
self._state = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TriggerState:removeAll()
|
||||
print("TriggerState::removeAll")
|
||||
end
|
||||
|
||||
|
||||
ccs.registerTriggerClass("TScaleTo",TScaleTo.new)
|
||||
ccs.registerTriggerClass("TMoveBy",TMoveBy.new)
|
||||
ccs.registerTriggerClass("TriggerState",TriggerState.new)
|
|
@ -0,0 +1,55 @@
|
|||
require ("CocoStudio")
|
||||
|
||||
local NodeInRect = class("NodeInRect")
|
||||
NodeInRect._tag = -1
|
||||
NodeInRect._origin = nil
|
||||
NodeInRect._size = nil
|
||||
|
||||
function NodeInRect:ctor()
|
||||
self._tag = -1
|
||||
self._origin = nil
|
||||
self._size = nil
|
||||
self._origin = cc.p(0, 0)
|
||||
self._size = cc.size(0, 0)
|
||||
end
|
||||
|
||||
function NodeInRect:init()
|
||||
return true
|
||||
end
|
||||
|
||||
function NodeInRect:detect()
|
||||
local node = ccs.SceneReader:getInstance():getNodeByTag(self._tag)
|
||||
if nil ~= node and math.abs(node:getPositionX() - self._origin.x) <= self._size.width and math.abs(node:getPositionY() - self._origin.y) <= self._size.height then
|
||||
return true
|
||||
end
|
||||
|
||||
return false
|
||||
end
|
||||
|
||||
function NodeInRect:serialize(value)
|
||||
local dataItems = value["dataitems"]
|
||||
if nil ~= dataItems then
|
||||
local count = table.getn(dataItems)
|
||||
for i = 1, count do
|
||||
local subDict = dataItems[i]
|
||||
local key = subDict["key"]
|
||||
if key == "Tag" then
|
||||
self._tag = subDict["value"]
|
||||
elseif key == "originX" then
|
||||
self._origin.x = subDict["value"]
|
||||
elseif key == "originY" then
|
||||
self._origin.y = subDict["value"]
|
||||
elseif key == "sizeWidth" then
|
||||
self._size.width = subDict["value"]
|
||||
elseif key == "sizeHeight" then
|
||||
self._size.height = subDict["value"]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function NodeInRect:removeAll()
|
||||
print("NodeInRect::removeAll")
|
||||
end
|
||||
|
||||
ccs.registerTriggerClass("NodeInRect",NodeInRect.new)
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
triggerEventDef =
|
||||
{
|
||||
TRIGGEREVENT_ENTERSCENE = 0,
|
||||
TRIGGEREVENT_LEAVESCENE = 1,
|
||||
TRIGGEREVENT_INITSCENE = 2,
|
||||
TRIGGEREVENT_UPDATESCENE = 3,
|
||||
TRIGGEREVENT_TOUCHBEGAN = 4,
|
||||
TRIGGEREVENT_TOUCHMOVED = 5,
|
||||
TRIGGEREVENT_TOUCHENDED = 6,
|
||||
TRIGGEREVENT_TOUCHCANCELLED = 7,
|
||||
}
|
|
@ -0,0 +1,111 @@
|
|||
require "src/CocoStudioTest/CocoStudioGUITest/CocoStudioGUITest"
|
||||
require "src/CocoStudioTest/CocoStudioSceneTest/CocoStudioSceneTest"
|
||||
require "src/CocoStudioTest/CocoStudioArmatureTest/CocoStudioArmatureTest"
|
||||
|
||||
local LINE_SPACE = 40
|
||||
local ITEM_TAG_BASIC = 1000
|
||||
|
||||
local cocoStudioTestItemNames =
|
||||
{
|
||||
{
|
||||
itemTitle = "CocoStudioArmatureTest",
|
||||
testScene = function ()
|
||||
runArmatureTestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioGUITest",
|
||||
testScene = function ()
|
||||
runCocosGUITestScene()
|
||||
end
|
||||
},
|
||||
|
||||
{
|
||||
itemTitle = "CocoStudioSceneTest",
|
||||
testScene = function ()
|
||||
runCocosSceneTestScene()
|
||||
end
|
||||
},
|
||||
}
|
||||
|
||||
local CocoStudioTestScene = class("CocoStudioTestScene")
|
||||
CocoStudioTestScene.__index = CocoStudioTestScene
|
||||
|
||||
function CocoStudioTestScene.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, CocoStudioTestScene)
|
||||
return target
|
||||
end
|
||||
|
||||
function CocoStudioTestScene:runThisTest()
|
||||
|
||||
--armatureSceneIdx = ArmatureTestIndex.TEST_COCOSTUDIO_WITH_SKELETON
|
||||
--self:addChild(restartArmatureTest())
|
||||
end
|
||||
|
||||
function CocoStudioTestScene.create()
|
||||
local scene = CocoStudioTestScene.extend(cc.Scene:create())
|
||||
return scene
|
||||
end
|
||||
|
||||
local CocoStudioTestLayer = class("CocoStudioTestLayer")
|
||||
CocoStudioTestLayer.__index = CocoStudioTestLayer
|
||||
|
||||
function CocoStudioTestLayer.extend(target)
|
||||
local t = tolua.getpeer(target)
|
||||
if not t then
|
||||
t = {}
|
||||
tolua.setpeer(target, t)
|
||||
end
|
||||
setmetatable(t, CocoStudioTestLayer)
|
||||
return target
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer.onMenuCallback(tag,sender)
|
||||
local index = sender:getLocalZOrder() - ITEM_TAG_BASIC
|
||||
cocoStudioTestItemNames[index].testScene()
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer:createMenu()
|
||||
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:setPosition(cc.p(0,0))
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
|
||||
for i = 1, table.getn(cocoStudioTestItemNames) do
|
||||
local menuItem = cc.MenuItemFont:create(cocoStudioTestItemNames[i].itemTitle)
|
||||
menuItem:setPosition(cc.p(winSize.width / 2, winSize.height - (i + 1) * LINE_SPACE))
|
||||
menuItem:registerScriptTapHandler(CocoStudioTestLayer.onMenuCallback)
|
||||
menu:addChild(menuItem, ITEM_TAG_BASIC + i)
|
||||
end
|
||||
|
||||
self:addChild(menu)
|
||||
end
|
||||
|
||||
function CocoStudioTestLayer.create()
|
||||
local layer = CocoStudioTestLayer.extend(cc.Layer:create())
|
||||
|
||||
if nil ~= layer then
|
||||
layer:createMenu()
|
||||
end
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
--CocoStudio Test
|
||||
-------------------------------------
|
||||
function CocoStudioTestMain()
|
||||
local newScene = CocoStudioTestScene.create()
|
||||
newScene:addChild(CreateBackMenuItem())
|
||||
newScene:addChild(CocoStudioTestLayer.create())
|
||||
newScene:runThisTest()
|
||||
return newScene
|
||||
end
|
|
@ -0,0 +1,210 @@
|
|||
require "AudioEngine"
|
||||
local EFFECT_FILE = "effect1.wav"
|
||||
local MUSIC_FILE = "background.mp3"
|
||||
|
||||
local LINE_SPACE = 40
|
||||
|
||||
local function CocosDenshionTest()
|
||||
local ret = cc.Layer:create()
|
||||
local m_pItmeMenu = nil
|
||||
local m_tBeginPos = cc.p(0, 0)
|
||||
local m_nSoundId = 0
|
||||
|
||||
local testItems = {
|
||||
"play background music",
|
||||
"stop background music",
|
||||
"pause background music",
|
||||
"resume background music",
|
||||
"rewind background music",
|
||||
"is background music playing",
|
||||
"play effect",
|
||||
"play effect repeatly",
|
||||
"stop effect",
|
||||
"unload effect",
|
||||
"add background music volume",
|
||||
"sub background music volume",
|
||||
"add effects volume",
|
||||
"sub effects volume",
|
||||
"pause effect",
|
||||
"resume effect",
|
||||
"pause all effects",
|
||||
"resume all effects",
|
||||
"stop all effects"
|
||||
}
|
||||
|
||||
local function menuCallback(tag, pMenuItem)
|
||||
local nIdx = pMenuItem:getLocalZOrder() - 10000
|
||||
-- play background music
|
||||
if nIdx == 0 then
|
||||
AudioEngine.playMusic(MUSIC_FILE, true)
|
||||
elseif nIdx == 1 then
|
||||
-- stop background music
|
||||
AudioEngine.stopMusic()
|
||||
elseif nIdx == 2 then
|
||||
-- pause background music
|
||||
AudioEngine.pauseMusic()
|
||||
elseif nIdx == 3 then
|
||||
-- resume background music
|
||||
AudioEngine.resumeMusic()
|
||||
-- rewind background music
|
||||
elseif nIdx == 4 then
|
||||
AudioEngine.rewindMusic()
|
||||
elseif nIdx == 5 then
|
||||
-- is background music playing
|
||||
if AudioEngine.isMusicPlaying () then
|
||||
cclog("background music is playing")
|
||||
else
|
||||
cclog("background music is not playing")
|
||||
end
|
||||
elseif nIdx == 6 then
|
||||
-- play effect
|
||||
m_nSoundId = AudioEngine.playEffect(EFFECT_FILE)
|
||||
elseif nIdx == 7 then
|
||||
-- play effect
|
||||
m_nSoundId = AudioEngine.playEffect(EFFECT_FILE, true)
|
||||
elseif nIdx == 8 then
|
||||
-- stop effect
|
||||
AudioEngine.stopEffect(m_nSoundId)
|
||||
elseif nIdx == 9 then
|
||||
-- unload effect
|
||||
AudioEngine.unloadEffect(EFFECT_FILE)
|
||||
elseif nIdx == 10 then
|
||||
-- add bakcground music volume
|
||||
AudioEngine.setMusicVolume(AudioEngine.getMusicVolume() + 0.1)
|
||||
elseif nIdx == 11 then
|
||||
-- sub backgroud music volume
|
||||
AudioEngine.setMusicVolume(AudioEngine.getMusicVolume() - 0.1)
|
||||
elseif nIdx == 12 then
|
||||
-- add effects volume
|
||||
AudioEngine.setEffectsVolume(AudioEngine.getEffectsVolume() + 0.1)
|
||||
elseif nIdx == 13 then
|
||||
-- sub effects volume
|
||||
AudioEngine.setEffectsVolume(AudioEngine.getEffectsVolume() - 0.1)
|
||||
elseif nIdx == 14 then
|
||||
AudioEngine.pauseEffect(m_nSoundId)
|
||||
elseif nIdx == 15 then
|
||||
AudioEngine.resumeEffect(m_nSoundId)
|
||||
elseif nIdx == 16 then
|
||||
AudioEngine.pauseAllEffects()
|
||||
elseif nIdx == 17 then
|
||||
AudioEngine.resumeAllEffects()
|
||||
elseif nIdx == 18 then
|
||||
AudioEngine.stopAllEffects()
|
||||
end
|
||||
end
|
||||
-- add menu items for tests
|
||||
m_pItmeMenu = cc.Menu:create()
|
||||
|
||||
m_nTestCount = table.getn(testItems)
|
||||
local i = 1
|
||||
for i = 1, m_nTestCount do
|
||||
local label = cc.LabelTTF:create(testItems[i], "Arial", 24)
|
||||
local pMenuItem = cc.MenuItemLabel:create(label)
|
||||
pMenuItem:registerScriptTapHandler(menuCallback)
|
||||
m_pItmeMenu:addChild(pMenuItem, i + 10000 -1)
|
||||
pMenuItem:setPosition( cc.p( VisibleRect:center().x, (VisibleRect:top().y - i * LINE_SPACE) ))
|
||||
end
|
||||
|
||||
m_pItmeMenu:setContentSize(cc.size(VisibleRect:getVisibleRect().width, (m_nTestCount + 1) * LINE_SPACE))
|
||||
m_pItmeMenu:setPosition(cc.p(0, 0))
|
||||
ret:addChild(m_pItmeMenu)
|
||||
|
||||
-- preload background music and effect
|
||||
AudioEngine.preloadMusic( MUSIC_FILE )
|
||||
AudioEngine.preloadEffect( EFFECT_FILE )
|
||||
|
||||
-- set default volume
|
||||
AudioEngine.setEffectsVolume(0.5)
|
||||
AudioEngine.setMusicVolume(0.5)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
|
||||
elseif event == "exit" then
|
||||
--SimpleAudioEngine:getInstance():endToLua()
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
local prev = {x = 0, y = 0}
|
||||
local function onTouchEvent(eventType, x, y)
|
||||
if eventType == "began" then
|
||||
prev.x = x
|
||||
prev.y = y
|
||||
m_tBeginPos = cc.p(x, y)
|
||||
return true
|
||||
elseif eventType == "moved" then
|
||||
local touchLocation = cc.p(x, y)
|
||||
local nMoveY = touchLocation.y - m_tBeginPos.y
|
||||
local curPosX, curPosY = m_pItmeMenu:getPosition()
|
||||
local curPos = cc.p(curPosX, curPosY)
|
||||
local nextPos = cc.p(curPos.x, curPos.y + nMoveY)
|
||||
|
||||
if nextPos.y < 0.0 then
|
||||
m_pItmeMenu:setPosition(cc.p(0, 0))
|
||||
end
|
||||
|
||||
if nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - VisibleRect:getVisibleRect().height) then
|
||||
m_pItmeMenu:setPosition(cc.p(0, ((m_nTestCount + 1)* LINE_SPACE - VisibleRect:getVisibleRect().height)))
|
||||
end
|
||||
|
||||
m_pItmeMenu:setPosition(nextPos)
|
||||
m_tBeginPos.x = touchLocation.x
|
||||
m_tBeginPos.y = touchLocation.y
|
||||
|
||||
prev.x = x
|
||||
prev.y = y
|
||||
end
|
||||
end
|
||||
|
||||
local function onTouchBegan(touch, event)
|
||||
local location = touch:getLocation()
|
||||
prev.x = location.x
|
||||
prev.y = location.y
|
||||
m_tBeginPos = location
|
||||
return true
|
||||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
local location = touch:getLocation()
|
||||
local touchLocation = location
|
||||
local nMoveY = touchLocation.y - m_tBeginPos.y
|
||||
local curPosX, curPosY = m_pItmeMenu:getPosition()
|
||||
local curPos = cc.p(curPosX, curPosY)
|
||||
local nextPos = cc.p(curPos.x, curPos.y + nMoveY)
|
||||
|
||||
if nextPos.y < 0.0 then
|
||||
m_pItmeMenu:setPosition(cc.p(0, 0))
|
||||
end
|
||||
|
||||
if nextPos.y > ((m_nTestCount + 1)* LINE_SPACE - VisibleRect:getVisibleRect().height) then
|
||||
m_pItmeMenu:setPosition(cc.p(0, ((m_nTestCount + 1)* LINE_SPACE - VisibleRect:getVisibleRect().height)))
|
||||
end
|
||||
|
||||
m_pItmeMenu:setPosition(nextPos)
|
||||
m_tBeginPos.x = touchLocation.x
|
||||
m_tBeginPos.y = touchLocation.y
|
||||
|
||||
prev.x = location.x
|
||||
prev.y = location.y
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:setSwallowTouches(true)
|
||||
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function CocosDenshionTestMain()
|
||||
cclog("CocosDenshionTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(CocosDenshionTest())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,47 @@
|
|||
local function CurrentLanguageTest()
|
||||
local ret = cc.Layer:create()
|
||||
local label = cc.LabelTTF:create("Current language Test", "Arial", 28)
|
||||
ret:addChild(label, 0)
|
||||
label:setPosition( cc.p(VisibleRect:center().x, VisibleRect:top().y-50) )
|
||||
|
||||
local labelLanguage = cc.LabelTTF:create("", "Arial", 20)
|
||||
labelLanguage:setPosition(VisibleRect:center())
|
||||
|
||||
local currentLanguageType = cc.Application:getInstance():getCurrentLanguage()
|
||||
|
||||
if currentLanguageType == cc.LANGUAGE_ENGLISH then
|
||||
labelLanguage:setString("current language is English")
|
||||
elseif currentLanguageType == cc.LANGUAGE_CHINESE then
|
||||
labelLanguage:setString("current language is Chinese")
|
||||
elseif currentLanguageType == cc.LANGUAGE_FRENCH then
|
||||
labelLanguage:setString("current language is French")
|
||||
elseif currentLanguageType == cc.LANGUAGE_GERMAN then
|
||||
labelLanguage:setString("current language is German")
|
||||
elseif currentLanguageType == cc.LANGUAGE_ITALIAN then
|
||||
labelLanguage:setString("current language is Italian")
|
||||
elseif currentLanguageType == cc.LANGUAGE_RUSSIAN then
|
||||
labelLanguage:setString("current language is Russian")
|
||||
elseif currentLanguageType == cc.LANGUAGE_SPANISH then
|
||||
labelLanguage:setString("current language is Spanish")
|
||||
elseif currentLanguageType == cc.LANGUAGE_KOREAN then
|
||||
labelLanguage:setString("current language is Korean")
|
||||
elseif currentLanguageType == cc.LANGUAGE_JAPANESE then
|
||||
labelLanguage:setString("current language is Japanese")
|
||||
elseif currentLanguageType == cc.LANGUAGE_HUNGARIAN then
|
||||
labelLanguage:setString("current language is Hungarian")
|
||||
elseif currentLanguageType == cc.LANGUAGE_PORTUGUESE then
|
||||
labelLanguage:setString("current language is Portuguese")
|
||||
elseif currentLanguageType == cc.LANGUAGE_ARABIC then
|
||||
labelLanguage:setString("current language is Arabic")
|
||||
end
|
||||
ret:addChild(labelLanguage)
|
||||
return ret
|
||||
end
|
||||
|
||||
function CurrentLanguageTestMain()
|
||||
local scene = cc.Scene:create()
|
||||
local pLayer = CurrentLanguageTest()
|
||||
scene:addChild(pLayer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,237 @@
|
|||
|
||||
|
||||
local function drawPrimitivesMainLayer()
|
||||
local kItemTagBasic = 1000
|
||||
local testCount = 2
|
||||
local maxCases = testCount
|
||||
local curCase = 0
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
local curLayer = nil
|
||||
|
||||
local function orderCallbackMenu()
|
||||
local function backCallback()
|
||||
curCase = curCase - 1
|
||||
if curCase < 0 then
|
||||
curCase = curCase + maxCases
|
||||
end
|
||||
showCurrentTest()
|
||||
end
|
||||
|
||||
local function restartCallback()
|
||||
showCurrentTest()
|
||||
end
|
||||
|
||||
local function nextCallback()
|
||||
curCase = curCase + 1
|
||||
curCase = curCase % maxCases
|
||||
showCurrentTest()
|
||||
end
|
||||
|
||||
local ordercallbackmenu = cc.Menu:create()
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
item1:registerScriptTapHandler(backCallback)
|
||||
ordercallbackmenu:addChild(item1,kItemTagBasic)
|
||||
local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
item2:registerScriptTapHandler(restartCallback)
|
||||
ordercallbackmenu:addChild(item2,kItemTagBasic)
|
||||
local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
ordercallbackmenu:addChild(item3,kItemTagBasic)
|
||||
item3:registerScriptTapHandler(nextCallback)
|
||||
|
||||
item1:setPosition(cc.p(size.width / 2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2))
|
||||
item2:setPosition(cc.p(size.width / 2, item2:getContentSize().height / 2))
|
||||
item3:setPosition(cc.p(size.width / 2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2))
|
||||
|
||||
ordercallbackmenu:setPosition(cc.p(0, 0))
|
||||
|
||||
return ordercallbackmenu
|
||||
end
|
||||
|
||||
local function GetTitle()
|
||||
if 0 == curCase then
|
||||
return "Draw primitives"
|
||||
elseif 1 == curCase then
|
||||
return "Test DrawNode"
|
||||
end
|
||||
end
|
||||
|
||||
local function GetSubTitle()
|
||||
if 0 == curCase then
|
||||
return "Drawing Primitives by call gl funtions"
|
||||
elseif 1 == curCase then
|
||||
return "Testing DrawNode - batched draws. Concave polygons are BROKEN"
|
||||
end
|
||||
end
|
||||
|
||||
local function InitTitle(layer)
|
||||
--Title
|
||||
local lableTitle = cc.LabelTTF:create(GetTitle(), "Arial", 40)
|
||||
layer:addChild(lableTitle, 15)
|
||||
lableTitle:setPosition(cc.p(size.width / 2, size.height - 32))
|
||||
lableTitle:setColor(cc.c3b(255, 255, 40))
|
||||
--SubTitle
|
||||
local subLabelTitle = cc.LabelTTF:create(GetSubTitle(), "Thonburi", 16)
|
||||
layer:addChild(subLabelTitle, 15)
|
||||
subLabelTitle:setPosition(cc.p(size.width / 2, size.height - 80))
|
||||
end
|
||||
|
||||
local function createDrawPrimitivesEffect()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
InitTitle(layer)
|
||||
|
||||
local glNode = gl.glNodeCreate()
|
||||
glNode:setContentSize(cc.size(size.width, size.height))
|
||||
glNode:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
|
||||
local function primitivesDraw()
|
||||
cc.DrawPrimitives.drawLine(VisibleRect:leftBottom(), VisibleRect:rightTop() )
|
||||
|
||||
gl.lineWidth( 5.0 )
|
||||
cc.DrawPrimitives.drawColor4B(255,0,0,255)
|
||||
cc.DrawPrimitives.drawLine( VisibleRect:leftTop(), VisibleRect:rightBottom() )
|
||||
|
||||
|
||||
|
||||
cc.DrawPrimitives.setPointSize(64)
|
||||
cc.DrawPrimitives.drawColor4B(0, 0, 255, 128)
|
||||
cc.DrawPrimitives.drawPoint(VisibleRect:center())
|
||||
|
||||
local points = {cc.p(60,60), cc.p(70,70), cc.p(60,70), cc.p(70,60) }
|
||||
cc.DrawPrimitives.setPointSize(4)
|
||||
cc.DrawPrimitives.drawColor4B(0,255,255,255)
|
||||
cc.DrawPrimitives.drawPoints(points,4)
|
||||
|
||||
gl.lineWidth(16)
|
||||
cc.DrawPrimitives.drawColor4B(0, 255, 0, 255)
|
||||
cc.DrawPrimitives.drawCircle( VisibleRect:center(), 100, 0, 10, false)
|
||||
|
||||
gl.lineWidth(2)
|
||||
cc.DrawPrimitives.drawColor4B(0, 255, 255, 255)
|
||||
cc.DrawPrimitives.drawCircle( VisibleRect:center(), 50, math.pi / 2, 50, true)
|
||||
|
||||
gl.lineWidth(2)
|
||||
cc.DrawPrimitives.drawColor4B(255, 0, 255, 255)
|
||||
cc.DrawPrimitives.drawSolidCircle( cc.p(VisibleRect:center().x + 140 ,VisibleRect:center().y), 40, math.rad(90), 50, 1.0, 1.0)
|
||||
|
||||
gl.lineWidth(10)
|
||||
cc.DrawPrimitives.drawColor4B(255, 255, 0, 255)
|
||||
local yellowPoints = { cc.p(0,0), cc.p(50,50), cc.p(100,50), cc.p(100,100), cc.p(50,100)}
|
||||
cc.DrawPrimitives.drawPoly( yellowPoints, 5, false)
|
||||
|
||||
gl.lineWidth(1)
|
||||
local filledVertices = { cc.p(0,120), cc.p(50,120), cc.p(50,170), cc.p(25,200), cc.p(0,170) }
|
||||
cc.DrawPrimitives.drawSolidPoly(filledVertices, 5, cc.c4f(0.5, 0.5, 1, 1))
|
||||
|
||||
gl.lineWidth(2)
|
||||
cc.DrawPrimitives.drawColor4B(255, 0, 255, 255)
|
||||
local closePoints= { cc.p(30,130), cc.p(30,230), cc.p(50,200) }
|
||||
cc.DrawPrimitives.drawPoly( closePoints, 3, true)
|
||||
|
||||
cc.DrawPrimitives.drawQuadBezier(VisibleRect:leftTop(), VisibleRect:center(), VisibleRect:rightTop(), 50)
|
||||
|
||||
cc.DrawPrimitives.drawCubicBezier(VisibleRect:center(), cc.p(VisibleRect:center().x + 30, VisibleRect:center().y + 50), cc.p(VisibleRect:center().x + 60,VisibleRect:center().y - 50), VisibleRect:right(), 100)
|
||||
|
||||
local solidvertices = {cc.p(60,160), cc.p(70,190), cc.p(100,190), cc.p(90,160)}
|
||||
cc.DrawPrimitives.drawSolidPoly( solidvertices, 4, cc.c4f(1, 1, 0, 1) )
|
||||
|
||||
local array = {
|
||||
cc.p(0, 0),
|
||||
cc.p(size.width / 2 - 30, 0),
|
||||
cc.p(size.width / 2 - 30, size.height - 80),
|
||||
cc.p(0, size.height - 80),
|
||||
cc.p(0, 0),
|
||||
}
|
||||
cc.DrawPrimitives.drawCatmullRom( array, 5)
|
||||
|
||||
cc.DrawPrimitives.drawCardinalSpline( array, 0,100)
|
||||
|
||||
gl.lineWidth(1)
|
||||
cc.DrawPrimitives.drawColor4B(255,255,255,255)
|
||||
cc.DrawPrimitives.setPointSize(1)
|
||||
end
|
||||
|
||||
glNode:registerScriptDrawHandler(primitivesDraw)
|
||||
layer:addChild(glNode,-10)
|
||||
glNode:setPosition( size.width / 2, size.height / 2)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local function createDrawNodeTest()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
InitTitle(layer)
|
||||
|
||||
local draw = cc.DrawNode:create()
|
||||
layer:addChild(draw, 10)
|
||||
|
||||
--Draw 10 circles
|
||||
for i=1, 10 do
|
||||
draw:drawDot(cc.p(size.width/2, size.height/2), 10*(10-i), cc.c4f(math.random(0,1), math.random(0,1), math.random(0,1), 1))
|
||||
end
|
||||
|
||||
--Draw polygons
|
||||
points = { cc.p(size.height/4, 0), cc.p(size.width, size.height / 5), cc.p(size.width / 3 * 2, size.height) }
|
||||
draw:drawPolygon(points, table.getn(points), cc.c4f(1,0,0,0.5), 4, cc.c4f(0,0,1,1))
|
||||
|
||||
local o = 80
|
||||
local w = 20
|
||||
local h = 50
|
||||
local star1 = { cc.p( o + w, o - h), cc.p(o + w * 2, o), cc.p(o + w * 2 + h, o + w), cc.p(o + w * 2, o + w * 2) }
|
||||
|
||||
draw:drawPolygon(star1, table.getn(star1), cc.c4f(1,0,0,0.5), 1, cc.c4f(0,0,1,1))
|
||||
|
||||
o = 180
|
||||
w = 20
|
||||
h = 50
|
||||
local star2 = {
|
||||
cc.p(o, o), cc.p(o + w, o - h), cc.p(o + w * 2, o), --lower spike
|
||||
cc.p(o + w * 2 + h, o + w ), cc.p(o + w * 2, o + w * 2), --right spike
|
||||
cc.p(o + w, o + w * 2 + h), cc.p(o, o + w * 2), --top spike
|
||||
cc.p(o - h, o + w), --left spike
|
||||
};
|
||||
|
||||
draw:drawPolygon(star2, table.getn(star2), cc.c4f(1,0,0,0.5), 1, cc.c4f(0,0,1,1))
|
||||
|
||||
draw:drawSegment(cc.p(20,size.height), cc.p(20,size.height/2), 10, cc.c4f(0, 1, 0, 1))
|
||||
|
||||
draw:drawSegment(cc.p(10,size.height/2), cc.p(size.width/2, size.height/2), 40, cc.c4f(1, 0, 1, 0.5))
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local function createLayerByCurCase(curCase)
|
||||
if 0 == curCase then
|
||||
return createDrawPrimitivesEffect()
|
||||
elseif 1 == curCase then
|
||||
return createDrawNodeTest()
|
||||
end
|
||||
end
|
||||
|
||||
function showCurrentTest()
|
||||
local curScene = cc.Scene:create()
|
||||
if nil ~= curScene then
|
||||
curLayer = createLayerByCurCase(curCase)
|
||||
if nil ~= curLayer then
|
||||
curScene:addChild(curLayer)
|
||||
curLayer:addChild(orderCallbackMenu(),15)
|
||||
curScene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():replaceScene(curScene)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
curLayer = createLayerByCurCase(curCase)
|
||||
curLayer:addChild(orderCallbackMenu(),15)
|
||||
return curLayer
|
||||
end
|
||||
|
||||
function DrawPrimitivesTest()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(drawPrimitivesMainLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
||||
|
|
@ -0,0 +1,263 @@
|
|||
local kTagTextLayer = 1
|
||||
local kTagSprite1 = 1
|
||||
local kTagSprite2 = 2
|
||||
local kTagBackground = 1
|
||||
local kTagLabel = 2
|
||||
|
||||
local originCreateLayer = createTestLayer
|
||||
|
||||
local function createTestLayer(title, subtitle)
|
||||
local ret = originCreateLayer(title, subtitle)
|
||||
local bgNode = cc.NodeGrid:create()
|
||||
bgNode:setAnchorPoint(cc.p(0.5,0.5))
|
||||
ret:addChild(bgNode,0,kTagBackground)
|
||||
|
||||
local bg = cc.Sprite:create("Images/background3.png")
|
||||
bg:setPosition( VisibleRect:center())
|
||||
bgNode:addChild(bg)
|
||||
|
||||
local target1 = cc.NodeGrid:create()
|
||||
target1:setAnchorPoint(cc.p(0.5,0.5))
|
||||
local grossini = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
target1:addChild(grossini)
|
||||
bgNode:addChild(target1,1,kTagSprite1)
|
||||
target1:setPosition(cc.p(VisibleRect:left().x+VisibleRect:getVisibleRect().width/3.0, VisibleRect:bottom().y+ 200) )
|
||||
local sc = cc.ScaleBy:create(2, 5)
|
||||
local sc_back = sc:reverse()
|
||||
target1:runAction( cc.RepeatForever:create(cc.Sequence:create(sc, sc_back)))
|
||||
|
||||
local target2 = cc.NodeGrid:create()
|
||||
target2:setAnchorPoint(cc.p(0.5,0.5))
|
||||
local tamara = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
target2:addChild(tamara)
|
||||
bgNode:addChild(target2,1,kTagSprite2)
|
||||
target2:setPosition( cc.p(VisibleRect:left().x+2*VisibleRect:getVisibleRect().width/3.0,VisibleRect:bottom().y+200) )
|
||||
local sc2 = cc.ScaleBy:create(2, 5)
|
||||
local sc2_back = sc2:reverse()
|
||||
target2:runAction( cc.RepeatForever:create(cc.Sequence:create(sc2, sc2_back)))
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Effect1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function Effect1()
|
||||
local ret = createTestLayer("Lens + Waves3d and OrbitCamera")
|
||||
local target = ret:getChildByTag(kTagBackground)
|
||||
|
||||
-- To reuse a grid the grid size and the grid type must be the same.
|
||||
-- in this case:
|
||||
-- Lens3D is Grid3D and it's size is (15,10)
|
||||
-- Waves3D is Grid3D and it's size is (15,10)
|
||||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
local lens = cc.Lens3D:create(0.0, cc.size(15,10), cc.p(size.width/2,size.height/2), 240)
|
||||
local waves = cc.Waves3D:create(10, cc.size(15,10), 18, 15)
|
||||
|
||||
local reuse = cc.ReuseGrid:create(1)
|
||||
local delay = cc.DelayTime:create(8)
|
||||
|
||||
-- local orbit = cc.OrbitCamera:create(5, 1, 2, 0, 180, 0, -90)
|
||||
-- local orbit_back = orbit:reverse()
|
||||
-- target:runAction( cc.RepeatForever:create( cc.Sequence:create(orbit, orbit_back)))
|
||||
target:runAction( cc.Sequence:create(lens, delay, reuse, waves))
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Effect2
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function Effect2()
|
||||
local ret = createTestLayer("ShakyTiles + ShuffleTiles + TurnOffTiles")
|
||||
local target = ret:getChildByTag(kTagBackground)
|
||||
|
||||
-- To reuse a grid the grid size and the grid type must be the same.
|
||||
-- in this case:
|
||||
-- ShakyTiles is TiledGrid3D and it's size is (15,10)
|
||||
-- Shuffletiles is TiledGrid3D and it's size is (15,10)
|
||||
-- TurnOfftiles is TiledGrid3D and it's size is (15,10)
|
||||
local shaky = cc.ShakyTiles3D:create(5, cc.size(15,10), 4, false)
|
||||
local shuffle = cc.ShuffleTiles:create(0, cc.size(15,10), 3)
|
||||
local turnoff = cc.TurnOffTiles:create(0, cc.size(15,10), 3)
|
||||
local turnon = turnoff:reverse()
|
||||
|
||||
-- reuse 2 times:
|
||||
-- 1 for shuffle
|
||||
-- 2 for turn off
|
||||
-- turnon tiles will use a new grid
|
||||
local reuse = cc.ReuseGrid:create(2)
|
||||
|
||||
local delay = cc.DelayTime:create(1)
|
||||
|
||||
target:runAction(cc.Sequence:create(shaky, delay ,reuse, shuffle, tolua.cast(delay:clone(), "cc.Action"), turnoff, turnon))
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Effect3
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function Effect3()
|
||||
local ret = createTestLayer("Effects on 2 sprites")
|
||||
local bg = ret:getChildByTag(kTagBackground)
|
||||
local target1 = bg:getChildByTag(kTagSprite1)
|
||||
local target2 = bg:getChildByTag(kTagSprite2)
|
||||
|
||||
local waves = cc.Waves:create(5, cc.size(15,10), 5, 20, true, false)
|
||||
local shaky = cc.Shaky3D:create(5, cc.size(15,10), 4, false)
|
||||
|
||||
target1:runAction( cc.RepeatForever:create( waves ) )
|
||||
target2:runAction( cc.RepeatForever:create( shaky ) )
|
||||
|
||||
-- moving background. Testing issue #244
|
||||
local move = cc.MoveBy:create(3, cc.p(200,0) )
|
||||
bg:runAction(cc.RepeatForever:create( cc.Sequence:create(move, move:reverse())))
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Effect4
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
-- class Lens3DTarget : public cc.Node
|
||||
|
||||
-- public:
|
||||
-- virtual void setPosition(const CCPoint& var)
|
||||
|
||||
-- m_pLens3D:setPosition(var)
|
||||
-- end
|
||||
|
||||
-- virtual const CCPoint& getPosition()
|
||||
|
||||
-- return m_pLens3D:getPosition()
|
||||
-- end
|
||||
|
||||
-- static Lens3DTarget* create(cc.Lens3D* pAction)
|
||||
|
||||
-- Lens3DTarget* pRet = new Lens3DTarget()
|
||||
-- pRet:m_pLens3D = pAction
|
||||
-- pRet:autorelease()
|
||||
-- return pRet
|
||||
-- end
|
||||
-- private:
|
||||
|
||||
-- Lens3DTarget()
|
||||
-- : m_pLens3D(NULL)
|
||||
-- {}
|
||||
|
||||
-- cc.Lens3D* m_pLens3D
|
||||
-- end
|
||||
|
||||
local function Effect4()
|
||||
local ret = createTestLayer("Jumpy Lens3D")
|
||||
local lens = cc.Lens3D:create(10, cc.size(32,24), cc.p(100,180), 150)
|
||||
local move = cc.JumpBy:create(5, cc.p(380,0), 100, 4)
|
||||
local move_back = move:reverse()
|
||||
local seq = cc.Sequence:create( move, move_back)
|
||||
|
||||
-- /* In cocos2d-iphone, the type of action's target is 'id', so it supports using the instance of 'cc.Lens3D' as its target.
|
||||
-- While in cocos2d-x, the target of action only supports cc.Node or its subclass,
|
||||
-- so we make an encapsulation for cc.Lens3D to achieve that.
|
||||
-- */
|
||||
|
||||
local director = cc.Director:getInstance()
|
||||
-- local pTarget = Lens3DTarget:create(lens)
|
||||
-- -- Please make sure the target been added to its parent.
|
||||
-- ret:addChild(pTarget)
|
||||
|
||||
-- director:getActionManager():addAction(seq, pTarget, false)
|
||||
local bg = ret:getChildByTag(kTagBackground)
|
||||
bg:runAction( lens )
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Effect5
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function Effect5()
|
||||
local ret = createTestLayer("Test Stop-Copy-Restar")
|
||||
|
||||
local effect = cc.Liquid:create(2, cc.size(32,24), 1, 20)
|
||||
|
||||
local stopEffect = cc.Sequence:create(effect, cc.DelayTime:create(2), cc.StopGrid:create())
|
||||
local bg = ret:getChildByTag(kTagBackground)
|
||||
bg:runAction(stopEffect)
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION_3D)
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Issue631
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function Issue631()
|
||||
local ret = createTestLayer("Testing Opacity",
|
||||
"Effect image should be 100% opaque. Testing issue #631")
|
||||
|
||||
local effect = cc.Sequence:create(cc.DelayTime:create(2.0),cc.Shaky3D:create(5.0, cc.size(5, 5), 16, false))
|
||||
|
||||
-- cleanup
|
||||
local bg = ret:getChildByTag(kTagBackground)
|
||||
ret:removeChild(bg, true)
|
||||
|
||||
-- background
|
||||
local layer = cc.LayerColor:create( cc.c4b(255,0,0,255) )
|
||||
ret:addChild(layer, -10)
|
||||
local sprite = cc.Sprite:create("Images/grossini.png")
|
||||
sprite:setPosition( cc.p(50,80) )
|
||||
layer:addChild(sprite, 10)
|
||||
|
||||
-- foreground
|
||||
local layer2BaseGrid = cc.NodeGrid:create()
|
||||
local layer2 = cc.LayerColor:create(cc.c4b( 0, 255,0,255 ) )
|
||||
local fog = cc.Sprite:create("Images/Fog.png")
|
||||
|
||||
--local bf = BlendFunc()
|
||||
--bf.src = GL_SRC_ALPHA
|
||||
--bf.dst = GL_ONE_MINUS_SRC_ALPHA
|
||||
|
||||
fog:setBlendFunc(gl.SRC_ALPHA , gl.ONE_MINUS_SRC_ALPHA )
|
||||
layer2:addChild(fog, 1)
|
||||
ret:addChild(layer2BaseGrid, 1)
|
||||
layer2BaseGrid:addChild(layer2)
|
||||
|
||||
layer2BaseGrid:runAction( cc.RepeatForever:create(effect) )
|
||||
return ret
|
||||
end
|
||||
|
||||
function EffectAdvancedTestMain()
|
||||
cclog("EffectAdvancedTestMain")
|
||||
Helper.index = 1
|
||||
|
||||
local scene = cc.Scene:create()
|
||||
Helper.createFunctionTable = {
|
||||
Effect3,
|
||||
Effect2,
|
||||
Effect1,
|
||||
Effect4,
|
||||
Effect5,
|
||||
Issue631
|
||||
}
|
||||
scene:addChild(Effect3())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
EffectsList =
|
||||
{
|
||||
[0] = "Shaky3D",
|
||||
"Waves3D",
|
||||
"FlipX3D",
|
||||
"FlipY3D",
|
||||
"Lens3D",
|
||||
"Ripple3D",
|
||||
"Liquid",
|
||||
"Waves",
|
||||
"Twirl",
|
||||
"ShakyTiles3D",
|
||||
"ShatteredTiles3D",
|
||||
"ShuffleTiles",
|
||||
"FadeOutTRTiles",
|
||||
"FadeOutBLTiles",
|
||||
"FadeOutUpTiles",
|
||||
"FadeOutDownTiles",
|
||||
"TurnOffTiles",
|
||||
"WavesTiles3D",
|
||||
"JumpTiles3D",
|
||||
"SplitRows",
|
||||
"SplitCols",
|
||||
"PageTurn3D",
|
||||
}
|
|
@ -0,0 +1,392 @@
|
|||
require "src/EffectsTest/EffectsName"
|
||||
|
||||
|
||||
local ActionIdx = -1
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
local kTagTextLayer = 1
|
||||
local kTagBackground = 1
|
||||
local kTagLabel = 2
|
||||
local MAX_LAYER = 22
|
||||
|
||||
local testLayer = nil
|
||||
local titleLabel = nil
|
||||
local entry = nil
|
||||
local gridNodeTarget = nil
|
||||
|
||||
local function checkAnim(dt)
|
||||
|
||||
if nil == gridNodeTarget then
|
||||
return
|
||||
end
|
||||
|
||||
if gridNodeTarget:getNumberOfRunningActions() == 0 and nil ~=gridNodeTarget:getGrid() then
|
||||
gridNodeTarget:setGrid(nil)
|
||||
end
|
||||
end
|
||||
|
||||
local function onEnterOrExit(tag)
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
if tag == "enter" then
|
||||
entry = scheduler:scheduleScriptFunc(checkAnim, 0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function backAction()
|
||||
ActionIdx = ActionIdx - 1
|
||||
if ActionIdx < 0 then
|
||||
ActionIdx = ActionIdx + MAX_LAYER
|
||||
end
|
||||
|
||||
return CreateEffectsTestLayer()
|
||||
end
|
||||
|
||||
local function restartAction()
|
||||
return CreateEffectsTestLayer()
|
||||
end
|
||||
|
||||
local function nextAction()
|
||||
ActionIdx = ActionIdx + 1
|
||||
ActionIdx = math.mod(ActionIdx, MAX_LAYER)
|
||||
|
||||
return CreateEffectsTestLayer()
|
||||
end
|
||||
|
||||
local function backCallback(sender)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
scene:addChild(backAction())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function restartCallback(sender)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
scene:addChild(restartAction())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function nextCallback(sender)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
scene:addChild(nextAction())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Shaky3DDemo
|
||||
--------------------------------------
|
||||
local function Shaky3DDemo(t)
|
||||
return cc.Shaky3D:create(t, cc.size(15,10), 5, false)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Waves3DDemo
|
||||
--------------------------------------
|
||||
local function Waves3DDemo(t)
|
||||
return cc.Waves3D:create(t, cc.size(15,10), 5, 40)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FlipX3DDemo
|
||||
--------------------------------------
|
||||
local function FlipX3DDemo(t)
|
||||
local flipx = cc.FlipX3D:create(t)
|
||||
local flipx_back = flipx:reverse()
|
||||
local delay = cc.DelayTime:create(2)
|
||||
|
||||
return cc.Sequence:create(flipx, flipx_back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FlipY3DDemo
|
||||
--------------------------------------
|
||||
local function FlipY3DDemo(t)
|
||||
local flipy = cc.FlipY3D:create(t)
|
||||
local flipy_back = flipy:reverse()
|
||||
local delay = cc.DelayTime:create(2)
|
||||
|
||||
return cc.Sequence:create(flipy, flipy_back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Lens3DDemo
|
||||
--------------------------------------
|
||||
local function Lens3DDemo(t)
|
||||
return cc.Lens3D:create(t, cc.size(15,10), cc.p(size.width/2,size.height/2), 240)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Ripple3DDemo
|
||||
--------------------------------------
|
||||
local function Ripple3DDemo(t)
|
||||
return cc.Ripple3D:create(t, cc.size(32,24), cc.p(size.width/2,size.height/2), 240, 4, 160)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- LiquidDemo
|
||||
--------------------------------------
|
||||
local function LiquidDemo(t)
|
||||
return cc.Liquid:create(t, cc.size(16,12), 4, 20)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- WavesDemo
|
||||
--------------------------------------
|
||||
local function WavesDemo(t)
|
||||
return cc.Waves:create(t, cc.size(16,12), 4, 20, true, true)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- TwirlDemo
|
||||
--------------------------------------
|
||||
local function TwirlDemo(t)
|
||||
return cc.Twirl:create(t, cc.size(12,8), cc.p(size.width/2, size.height/2), 1, 2.5)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- ShakyTiles3DDemo
|
||||
--------------------------------------
|
||||
local function ShakyTiles3DDemo(t)
|
||||
return cc.ShakyTiles3D:create(t, cc.size(16,12), 5, false)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- ShatteredTiles3DDemo
|
||||
--------------------------------------
|
||||
local function ShatteredTiles3DDemo(t)
|
||||
return cc.ShatteredTiles3D:create(t, cc.size(16,12), 5, false)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- ShuffleTilesDemo
|
||||
--------------------------------------
|
||||
local function ShuffleTilesDemo(t)
|
||||
local shuffle = cc.ShuffleTiles:create(t, cc.size(16,12), 25)
|
||||
local shuffle_back = shuffle:reverse()
|
||||
local delay = cc.DelayTime:create(2)
|
||||
|
||||
return cc.Sequence:create(shuffle, shuffle_back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FadeOutTRTilesDemo
|
||||
--------------------------------------
|
||||
local function FadeOutTRTilesDemo(t)
|
||||
local fadeout = cc.FadeOutTRTiles:create(t, cc.size(16,12))
|
||||
local back = fadeout:reverse()
|
||||
local delay = cc.DelayTime:create(0.5)
|
||||
|
||||
return cc.Sequence:create(fadeout, back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FadeOutBLTilesDemo
|
||||
--------------------------------------
|
||||
local function FadeOutBLTilesDemo(t)
|
||||
local fadeout = cc.FadeOutBLTiles:create(t, cc.size(16,12))
|
||||
local back = fadeout:reverse()
|
||||
local delay = cc.DelayTime:create(0.5)
|
||||
|
||||
return cc.Sequence:create(fadeout, back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FadeOutUpTilesDemo
|
||||
--------------------------------------
|
||||
local function FadeOutUpTilesDemo(t)
|
||||
local fadeout = cc.FadeOutUpTiles:create(t, cc.size(16,12))
|
||||
local back = fadeout:reverse()
|
||||
local delay = cc.DelayTime:create(0.5)
|
||||
|
||||
return cc.Sequence:create(fadeout, back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- FadeOutDownTilesDemo
|
||||
--------------------------------------
|
||||
local function FadeOutDownTilesDemo(t)
|
||||
local fadeout = cc.FadeOutDownTiles:create(t, cc.size(16,12))
|
||||
local back = fadeout:reverse()
|
||||
local delay = cc.DelayTime:create(0.5)
|
||||
|
||||
return cc.Sequence:create(fadeout, back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- TurnOffTilesDemo
|
||||
--------------------------------------
|
||||
local function TurnOffTilesDemo(t)
|
||||
local fadeout = cc.TurnOffTiles:create(t, cc.size(48,32), 25)
|
||||
local back = fadeout:reverse()
|
||||
local delay = cc.DelayTime:create(0.5)
|
||||
|
||||
return cc.Sequence:create(fadeout, back, delay)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- WavesTiles3DDemo
|
||||
--------------------------------------
|
||||
local function WavesTiles3DDemo(t)
|
||||
return cc.WavesTiles3D:create(t, cc.size(15,10), 4, 120)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- JumpTiles3DDemo
|
||||
--------------------------------------
|
||||
local function JumpTiles3DDemo(t)
|
||||
return cc.JumpTiles3D:create(t, cc.size(15,10), 2, 30)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- SplitRowsDemo
|
||||
--------------------------------------
|
||||
local function SplitRowsDemo(t)
|
||||
return cc.SplitRows:create(t, 9)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- SplitColsDemo
|
||||
--------------------------------------
|
||||
local function SplitColsDemo(t)
|
||||
return cc.SplitCols:create(t, 9)
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- PageTurn3DDemo
|
||||
--------------------------------------
|
||||
local function PageTurn3DDemo(t)
|
||||
cc.Director:getInstance():setDepthTest(true)
|
||||
return cc.PageTurn3D:create(t, cc.size(15,10))
|
||||
end
|
||||
|
||||
--------------------------------------
|
||||
-- Effects Test
|
||||
--------------------------------------
|
||||
local function createEffect(idx, t)
|
||||
cc.Director:getInstance():setDepthTest(false)
|
||||
local action = nil
|
||||
|
||||
if idx == 0 then
|
||||
action = Shaky3DDemo(t)
|
||||
elseif idx == 1 then
|
||||
action = Waves3DDemo(t)
|
||||
elseif idx == 2 then
|
||||
action = FlipX3DDemo(t)
|
||||
elseif idx == 3 then
|
||||
action = FlipY3DDemo(t)
|
||||
elseif idx == 4 then
|
||||
action = Lens3DDemo(t)
|
||||
elseif idx == 5 then
|
||||
action = Ripple3DDemo(t)
|
||||
elseif idx == 6 then
|
||||
action = LiquidDemo(t)
|
||||
elseif idx == 7 then
|
||||
action = WavesDemo(t)
|
||||
elseif idx == 8 then
|
||||
action = TwirlDemo(t)
|
||||
elseif idx == 9 then
|
||||
action = ShakyTiles3DDemo(t)
|
||||
elseif idx == 10 then
|
||||
action = ShatteredTiles3DDemo(t)
|
||||
elseif idx == 11 then
|
||||
action = ShuffleTilesDemo(t)
|
||||
elseif idx == 12 then
|
||||
action = FadeOutTRTilesDemo(t)
|
||||
elseif idx == 13 then
|
||||
action = FadeOutBLTilesDemo(t)
|
||||
elseif idx == 14 then
|
||||
action = FadeOutUpTilesDemo(t)
|
||||
elseif idx == 15 then
|
||||
action = FadeOutDownTilesDemo(t)
|
||||
elseif idx == 16 then
|
||||
action = TurnOffTilesDemo(t)
|
||||
elseif idx == 17 then
|
||||
action = WavesTiles3DDemo(t)
|
||||
elseif idx == 18 then
|
||||
action = JumpTiles3DDemo(t)
|
||||
elseif idx == 19 then
|
||||
action = SplitRowsDemo(t)
|
||||
elseif idx == 20 then
|
||||
action = SplitColsDemo(t)
|
||||
elseif idx == 21 then
|
||||
action = PageTurn3DDemo(t)
|
||||
end
|
||||
|
||||
return action
|
||||
end
|
||||
|
||||
function CreateEffectsTestLayer()
|
||||
testLayer = cc.LayerColor:create(cc.c4b(32,128,32,255))
|
||||
|
||||
|
||||
gridNodeTarget = cc.NodeGrid:create()
|
||||
local effect = createEffect(ActionIdx, 3)
|
||||
gridNodeTarget:runAction(effect)
|
||||
testLayer:addChild(gridNodeTarget, 0, kTagBackground)
|
||||
|
||||
local bg = cc.Sprite:create(s_back3)
|
||||
gridNodeTarget:addChild(bg, 0)
|
||||
bg:setPosition(VisibleRect:center())
|
||||
|
||||
local grossini = cc.Sprite:create(s_pPathSister2)
|
||||
gridNodeTarget:addChild(grossini, 1)
|
||||
grossini:setPosition( cc.p(VisibleRect:left().x+VisibleRect:getVisibleRect().width/3,VisibleRect:center().y) )
|
||||
local sc = cc.ScaleBy:create(2, 5)
|
||||
local sc_back = sc:reverse()
|
||||
grossini:runAction( cc.RepeatForever:create(cc.Sequence:create(sc, sc_back) ) )
|
||||
|
||||
local tamara = cc.Sprite:create(s_pPathSister1)
|
||||
gridNodeTarget:addChild(tamara, 1)
|
||||
tamara:setPosition( cc.p(VisibleRect:left().x+2*VisibleRect:getVisibleRect().width/3,VisibleRect:center().y) )
|
||||
local sc2 = cc.ScaleBy:create(2, 5)
|
||||
local sc2_back = sc2:reverse()
|
||||
tamara:runAction( cc.RepeatForever:create(cc.Sequence:create(sc2, sc2_back)) )
|
||||
|
||||
local x, y = size.width, size.height
|
||||
|
||||
titleLabel = cc.LabelTTF:create(EffectsList[ActionIdx], "Marker Felt", 32)
|
||||
titleLabel:setPosition(x / 2, y - 80)
|
||||
testLayer:addChild(titleLabel)
|
||||
titleLabel:setTag(kTagLabel)
|
||||
|
||||
local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
item1:registerScriptTapHandler(backCallback)
|
||||
item2:registerScriptTapHandler(restartCallback)
|
||||
item3:registerScriptTapHandler(nextCallback)
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(item1)
|
||||
menu:addChild(item2)
|
||||
menu:addChild(item3)
|
||||
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
item1:setPosition(cc.p(size.width/2 - item2:getContentSize().width * 2, item2:getContentSize().height / 2))
|
||||
item2:setPosition(cc.p(size.width/2, item2:getContentSize().height / 2))
|
||||
item3:setPosition(cc.p(size.width/2 + item2:getContentSize().width * 2, item2:getContentSize().height / 2))
|
||||
|
||||
testLayer:addChild(menu, 1)
|
||||
|
||||
testLayer:registerScriptHandler(onEnterOrExit)
|
||||
|
||||
return testLayer
|
||||
end
|
||||
|
||||
function EffectsTest()
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
ActionIdx = -1
|
||||
scene:addChild(nextAction())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,319 @@
|
|||
|
||||
require "CCBReaderLoad"
|
||||
|
||||
HelloCocosBuilderLayer = HelloCocosBuilderLayer or {}
|
||||
ccb["HelloCocosBuilderLayer"] = HelloCocosBuilderLayer
|
||||
|
||||
TestMenusLayer = TestMenusLayer or {}
|
||||
ccb["TestMenusLayer"] = TestMenusLayer
|
||||
|
||||
TestButtonsLayer = TestButtonsLayer or {}
|
||||
ccb["TestButtonsLayer"] = TestButtonsLayer
|
||||
|
||||
TestHeaderLayer = TestHeaderLayer or {}
|
||||
ccb["TestHeaderLayer"] = TestHeaderLayer
|
||||
|
||||
TestSpritesLayer = TestSpritesLayer or {}
|
||||
ccb["TestSpritesLayer"] = TestSpritesLayer
|
||||
|
||||
TestParticleSystemsLayer = TestParticleSystemsLayer or {}
|
||||
ccb["TestParticleSystemsLayer"] = TestParticleSystemsLayer
|
||||
|
||||
TestAnimationsLayer = TestAnimationsLayer or {}
|
||||
ccb["TestAnimationsLayer"] = TestAnimationsLayer
|
||||
|
||||
TestTimelineLayer = TestTimelineLayer or {}
|
||||
ccb["TestTimelineLayer"] = TestTimelineLayer
|
||||
|
||||
TestScrollViewsLayer = TestScrollViewsLayer or {}
|
||||
ccb["TestScrollViewsLayer"] = TestScrollViewsLayer
|
||||
|
||||
local function onMenuItemAClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item A clicked.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onMenuItemBClicked()
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item B clicked.");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function pressedC( ... )
|
||||
if nil ~= TestMenusLayer["mMenuItemStatusLabelBMFont"] then
|
||||
local labelBmFt = tolua.cast(TestMenusLayer["mMenuItemStatusLabelBMFont"],"cc.LabelBMFont")
|
||||
if nil ~= labelBmFt then
|
||||
labelBmFt:setString("Menu Item C clicked.");
|
||||
end
|
||||
end
|
||||
end
|
||||
local function onMenuTestClicked()
|
||||
cclog("CCBMenuTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestMenus.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestMenus.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
TestMenusLayer["onMenuItemAClicked"] = onMenuItemAClicked
|
||||
TestMenusLayer["onMenuItemBClicked"] = onMenuItemBClicked
|
||||
TestMenusLayer["pressedC:"] = pressedC
|
||||
|
||||
local function onBackClicked()
|
||||
cc.Director:getInstance():popScene();
|
||||
end
|
||||
|
||||
TestHeaderLayer["onBackClicked"] = onBackClicked
|
||||
|
||||
local function onSpriteTestClicked()
|
||||
cclog("CCBSpriteTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestSprites.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestSprites.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
local function onButtonTestClicked()
|
||||
cclog("CCBButtionTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestButtons.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestButtons.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
local function onCCControlButtonClicked(sender,controlEvent)
|
||||
local labelTTF = tolua.cast(TestButtonsLayer["mCCControlEventLabel"],"cc.LabelBMFont")
|
||||
|
||||
if nil == labelTTF then
|
||||
return
|
||||
end
|
||||
|
||||
if controlEvent == cc.CONTROL_EVENTTYPE_TOUCH_DOWN then
|
||||
labelTTF:setString("Touch Down.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_DRAG_INSIDE then
|
||||
labelTTF:setString("Touch Drag Inside.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_DRAG_OUTSIDE then
|
||||
labelTTF:setString("Touch Drag Outside.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_DRAG_ENTER then
|
||||
labelTTF:setString("Touch Drag Enter.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_DRAG_EXIT then
|
||||
labelTTF:setString("Touch Drag Exit.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_TOUCH_UP_INSIDE then
|
||||
labelTTF:setString("Touch Up Inside.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_TOUCH_UP_OUTSIDE then
|
||||
labelTTF:setString("Touch Up Outside.")
|
||||
elseif controlEvent == cc.CONTROL_EVENTTYPE_TOUCH_CANCEL then
|
||||
labelTTF:setString("Touch Cancel.")
|
||||
elseif controlEvent == cc.CONTROL_EVENT_VALUECHANGED then
|
||||
labelTTF:setString("Value Changed.")
|
||||
end
|
||||
end
|
||||
|
||||
TestButtonsLayer["onCCControlButtonClicked"] = onCCControlButtonClicked
|
||||
|
||||
|
||||
|
||||
local function onAnimationsTestClicked()
|
||||
cclog("CCBAnimationsTestTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestAnimations.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestAnimations.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
local function onParticleSystemTestClicked()
|
||||
cclog("CCBParticleSystemTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestParticleSystems.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestParticleSystems.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
local function onCCControlButtonIdleClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Idle", 0.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onCCControlButtonWaveClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Wave", 0.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onCCControlButtonJumpClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Jump", 0.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function onCCControlButtonFunkyClicked()
|
||||
if nil ~= TestAnimationsLayer["mAnimationManager"] then
|
||||
local animationMgr = tolua.cast(TestAnimationsLayer["mAnimationManager"],"cc.CCBAnimationManager")
|
||||
if nil ~= animationMgr then
|
||||
animationMgr:runAnimationsForSequenceNamedTweenDuration("Funky", 0.3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
TestAnimationsLayer["onCCControlButtonIdleClicked"] = onCCControlButtonIdleClicked
|
||||
TestAnimationsLayer["onCCControlButtonWaveClicked"] = onCCControlButtonWaveClicked
|
||||
TestAnimationsLayer["onCCControlButtonJumpClicked"] = onCCControlButtonJumpClicked
|
||||
TestAnimationsLayer["onCCControlButtonFunkyClicked"] = onCCControlButtonFunkyClicked
|
||||
|
||||
|
||||
local function onScrollViewTestClicked()
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestScrollViews.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestScrollViews.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
local function onTimelineCallbackSoundClicked()
|
||||
cclog("CCBTimelineTest");
|
||||
local scene = cc.Scene:create()
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/ccb/TestTimelineCallback.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
if nil ~= HelloCocosBuilderLayer["mTestTitleLabelTTF"] then
|
||||
local ccLabelTTF = tolua.cast(HelloCocosBuilderLayer["mTestTitleLabelTTF"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:setString("ccb/ccb/TestTimelineCallback.ccbi")
|
||||
end
|
||||
end
|
||||
if nil ~= scene then
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, scene, cc.c3b(0,0,0)));
|
||||
end
|
||||
end
|
||||
|
||||
function onCallback1()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(1, 360))
|
||||
ccLabelTTF:setString("Callback 1");
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function onCallback2()
|
||||
if nil ~= TestTimelineLayer["helloLabel"] then
|
||||
local ccLabelTTF = tolua.cast(TestTimelineLayer["helloLabel"],"cc.LabelTTF")
|
||||
if nil ~= ccLabelTTF then
|
||||
ccLabelTTF:runAction(cc.RotateBy:create(2, 360))
|
||||
ccLabelTTF:setString("Callback 2");
|
||||
end
|
||||
end
|
||||
end
|
||||
TestTimelineLayer["onCallback1"] = onCallback1
|
||||
TestTimelineLayer["onCallback2"] = onCallback2
|
||||
|
||||
HelloCocosBuilderLayer["onMenuTestClicked"] = onMenuTestClicked
|
||||
HelloCocosBuilderLayer["onSpriteTestClicked"] = onSpriteTestClicked
|
||||
HelloCocosBuilderLayer["onButtonTestClicked"] = onButtonTestClicked
|
||||
HelloCocosBuilderLayer["onAnimationsTestClicked"] = onAnimationsTestClicked
|
||||
HelloCocosBuilderLayer["onParticleSystemTestClicked"] = onParticleSystemTestClicked
|
||||
HelloCocosBuilderLayer["onScrollViewTestClicked"] = onScrollViewTestClicked
|
||||
HelloCocosBuilderLayer["onTimelineCallbackSoundClicked"] = onTimelineCallbackSoundClicked
|
||||
|
||||
|
||||
|
||||
local function HelloCCBTestMainLayer()
|
||||
print(type(cc.Scene))
|
||||
local proxy = cc.CCBProxy:create()
|
||||
local node = CCBReaderLoad("cocosbuilderRes/ccb/HelloCocosBuilder.ccbi",proxy,HelloCocosBuilderLayer)
|
||||
local layer = tolua.cast(node,"cc.Layer")
|
||||
return layer
|
||||
end
|
||||
|
||||
function runCocosBuilder()
|
||||
cclog("HelloCCBSceneTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(HelloCCBTestMainLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,202 @@
|
|||
|
||||
local function WebSocketTestLayer()
|
||||
local layer = cc.Layer:create()
|
||||
local winSize = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local MARGIN = 40
|
||||
local SPACE = 35
|
||||
|
||||
local wsSendText = nil
|
||||
local wsSendBinary = nil
|
||||
local wsError = nil
|
||||
local sendTextStatus = nil
|
||||
local sendBinaryStatus = nil
|
||||
local errorStatus = nil
|
||||
local receiveTextTimes = 0
|
||||
local receiveBinaryTimes = 0
|
||||
|
||||
local label = cc.LabelTTF:create("WebSocket Test", "Arial", 28)
|
||||
label:setPosition(cc.p( winSize.width / 2, winSize.height - MARGIN))
|
||||
layer:addChild(label, 0)
|
||||
|
||||
local menuRequest = cc.Menu:create()
|
||||
menuRequest:setPosition(cc.p(0, 0))
|
||||
layer:addChild(menuRequest)
|
||||
|
||||
--Send Text
|
||||
local function onMenuSendTextClicked()
|
||||
if nil ~= wsSendText then
|
||||
if cc.WEBSOCKET_STATE_OPEN == wsSendText:getReadyState() then
|
||||
sendTextStatus:setString("Send Text WS is waiting...")
|
||||
wsSendText:sendString("Hello WebSocket中文, I'm a text message.")
|
||||
else
|
||||
local warningStr = "send text websocket instance wasn't ready..."
|
||||
print(warningStr)
|
||||
sendTextStatus:setString(warningStr)
|
||||
end
|
||||
end
|
||||
end
|
||||
local labelSendText = cc.LabelTTF:create("Send Text", "Arial", 22)
|
||||
local itemSendText = cc.MenuItemLabel:create(labelSendText)
|
||||
itemSendText:registerScriptTapHandler(onMenuSendTextClicked)
|
||||
itemSendText:setPosition(cc.p(winSize.width / 2, winSize.height - MARGIN - SPACE))
|
||||
menuRequest:addChild(itemSendText)
|
||||
|
||||
--Send Binary
|
||||
local function onMenuSendBinaryClicked()
|
||||
if nil ~= wsSendBinary then
|
||||
if cc.WEBSOCKET_STATE_OPEN == wsSendBinary:getReadyState() then
|
||||
sendBinaryStatus:setString("Send Binary WS is waiting...")
|
||||
wsSendBinary:sendString("Hello WebSocket中文--,\0 I'm\0 a\0 binary\0 message\0.")
|
||||
else
|
||||
local warningStr = "send binary websocket instance wasn't ready..."
|
||||
sendBinaryStatus:setString(warningStr)
|
||||
end
|
||||
end
|
||||
end
|
||||
local labelSendBinary = cc.LabelTTF:create("Send Binary", "Arial", 22)
|
||||
local itemSendBinary = cc.MenuItemLabel:create(labelSendBinary)
|
||||
itemSendBinary:registerScriptTapHandler(onMenuSendBinaryClicked)
|
||||
itemSendBinary:setPosition(cc.p(winSize.width / 2, winSize.height - MARGIN - 2 * SPACE))
|
||||
menuRequest:addChild(itemSendBinary)
|
||||
|
||||
--Send Text Status Label
|
||||
sendTextStatus = cc.LabelTTF:create("Send Text WS is waiting...", "Arial", 14,cc.size(160, 100),cc.VERTICAL_TEXT_ALIGNMENT_CENTER,cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendTextStatus:setAnchorPoint(cc.p(0, 0))
|
||||
sendTextStatus:setPosition(cc.p(0, 25))
|
||||
layer:addChild(sendTextStatus)
|
||||
|
||||
--Send Binary Status Label
|
||||
sendBinaryStatus = cc.LabelTTF:create("Send Binary WS is waiting...", "Arial", 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
sendBinaryStatus:setAnchorPoint(cc.p(0, 0))
|
||||
sendBinaryStatus:setPosition(cc.p(160, 25))
|
||||
layer:addChild(sendBinaryStatus)
|
||||
|
||||
--Error Label
|
||||
errorStatus = cc.LabelTTF:create("Error WS is waiting...", "Arial", 14, cc.size(160, 100), cc.VERTICAL_TEXT_ALIGNMENT_CENTER, cc.VERTICAL_TEXT_ALIGNMENT_TOP)
|
||||
errorStatus:setAnchorPoint(cc.p(0, 0))
|
||||
errorStatus:setPosition(cc.p(320, 25))
|
||||
layer:addChild(errorStatus)
|
||||
|
||||
local toMainMenu = cc.Menu:create()
|
||||
CreateExtensionsBasicLayerMenu(toMainMenu)
|
||||
toMainMenu:setPosition(cc.p(0, 0))
|
||||
layer:addChild(toMainMenu,10)
|
||||
|
||||
wsSendText = cc.WebSocket:create("ws://echo.websocket.org")
|
||||
wsSendBinary = cc.WebSocket:create("ws://echo.websocket.org")
|
||||
wsError = cc.WebSocket:create("ws://invalid.url.com")
|
||||
|
||||
local function wsSendTextOpen(strData)
|
||||
sendTextStatus:setString("Send Text WS was opened.")
|
||||
end
|
||||
|
||||
local function wsSendTextMessage(strData)
|
||||
receiveTextTimes= receiveTextTimes + 1
|
||||
local strInfo= "response text msg: "..strData..", "..receiveTextTimes
|
||||
sendTextStatus:setString(strInfo)
|
||||
end
|
||||
|
||||
local function wsSendTextClose(strData)
|
||||
print("_wsiSendText websocket instance closed.")
|
||||
sendTextStatus = nil
|
||||
wsSendText = nil
|
||||
end
|
||||
|
||||
local function wsSendTextError(strData)
|
||||
print("sendText Error was fired")
|
||||
end
|
||||
|
||||
local function wsSendBinaryOpen(strData)
|
||||
sendBinaryStatus:setString("Send Binary WS was opened.")
|
||||
end
|
||||
|
||||
local function wsSendBinaryMessage(paramTable)
|
||||
local length = table.getn(paramTable)
|
||||
local i = 1
|
||||
local strInfo = "response bin msg: "
|
||||
for i = 1,length do
|
||||
if 0 == paramTable[i] then
|
||||
strInfo = strInfo.."\'\\0\'"
|
||||
else
|
||||
strInfo = strInfo..string.char(paramTable[i])
|
||||
end
|
||||
end
|
||||
receiveBinaryTimes = receiveBinaryTimes + 1
|
||||
strInfo = strInfo..receiveBinaryTimes
|
||||
sendBinaryStatus:setString(strInfo)
|
||||
end
|
||||
|
||||
local function wsSendBinaryClose(strData)
|
||||
print("_wsiSendBinary websocket instance closed.")
|
||||
sendBinaryStatus = nil
|
||||
wsSendBinary = nil
|
||||
end
|
||||
|
||||
local function wsSendBinaryError(strData)
|
||||
print("sendBinary Error was fired")
|
||||
end
|
||||
|
||||
local function wsErrorOpen(strData)
|
||||
end
|
||||
|
||||
local function wsErrorMessage(strData)
|
||||
|
||||
end
|
||||
|
||||
local function wsErrorError(strData)
|
||||
print("Error was fired")
|
||||
errorStatus:setString("an error was fired")
|
||||
end
|
||||
|
||||
local function wsErrorClose(strData)
|
||||
print("_wsiError websocket instance closed.")
|
||||
errorStatus= nil
|
||||
wsError = nil
|
||||
end
|
||||
|
||||
if nil ~= wsSendText then
|
||||
wsSendText:registerScriptHandler(wsSendTextOpen,cc.WEBSOCKET_OPEN)
|
||||
wsSendText:registerScriptHandler(wsSendTextMessage,cc.WEBSOCKET_MESSAGE)
|
||||
wsSendText:registerScriptHandler(wsSendTextClose,cc.WEBSOCKET_CLOSE)
|
||||
wsSendText:registerScriptHandler(wsSendTextError,cc.WEBSOCKET_ERROR)
|
||||
end
|
||||
|
||||
if nil ~= wsSendBinary then
|
||||
wsSendBinary:registerScriptHandler(wsSendBinaryOpen,cc.WEBSOCKET_OPEN)
|
||||
wsSendBinary:registerScriptHandler(wsSendBinaryMessage,cc.WEBSOCKET_MESSAGE)
|
||||
wsSendBinary:registerScriptHandler(wsSendBinaryClose,cc.WEBSOCKET_CLOSE)
|
||||
wsSendBinary:registerScriptHandler(wsSendBinaryError,cc.WEBSOCKET_ERROR)
|
||||
end
|
||||
|
||||
if nil ~= wsError then
|
||||
wsError:registerScriptHandler(wsErrorOpen,cc.WEBSOCKET_OPEN)
|
||||
wsError:registerScriptHandler(wsErrorMessage,cc.WEBSOCKET_MESSAGE)
|
||||
wsError:registerScriptHandler(wsErrorClose,cc.WEBSOCKET_CLOSE)
|
||||
wsError:registerScriptHandler(wsErrorError,cc.WEBSOCKET_ERROR)
|
||||
end
|
||||
|
||||
local function OnExit(strEventName)
|
||||
if "exit" == strEventName then
|
||||
if nil ~= wsSendText then
|
||||
wsSendText:close()
|
||||
end
|
||||
if nil ~= wsSendBinary then
|
||||
wsSendBinary:close()
|
||||
end
|
||||
if nil ~= wsError then
|
||||
wsError:close()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(OnExit)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
function runWebSocketTest()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(WebSocketTestLayer())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,113 @@
|
|||
local kTagLabel1 = 0
|
||||
local kTagLabel2 = 1
|
||||
local kTagLabel3 = 2
|
||||
local kTagLabel4 = 3
|
||||
|
||||
local fontList = {
|
||||
"fonts/A Damn Mess.ttf",
|
||||
"fonts/Abberancy.ttf",
|
||||
"fonts/Abduction.ttf",
|
||||
"fonts/Paint Boy.ttf",
|
||||
"fonts/Schwarzwald Regular.ttf",
|
||||
"fonts/Scissor Cuts.ttf"
|
||||
}
|
||||
|
||||
local fontCount = table.getn(fontList)
|
||||
cclog("font count = "..fontCount)
|
||||
|
||||
local vAlignIdx = 1
|
||||
local verticalAlignment = {
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_TOP,
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_CENTER,
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM,
|
||||
}
|
||||
|
||||
local vAlignCount = table.getn(verticalAlignment)
|
||||
|
||||
local function showFont(ret, pFont)
|
||||
|
||||
cclog("vAlignIdx="..vAlignIdx)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local blockSize = cc.size(s.width/3, 200)
|
||||
local fontSize = 26
|
||||
|
||||
ret:removeChildByTag(kTagLabel1, true)
|
||||
ret:removeChildByTag(kTagLabel2, true)
|
||||
ret:removeChildByTag(kTagLabel3, true)
|
||||
ret:removeChildByTag(kTagLabel4, true)
|
||||
|
||||
local top = cc.LabelTTF:create(pFont, pFont, 24)
|
||||
local left = cc.LabelTTF:create("alignment left", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_LEFT, verticalAlignment[vAlignIdx])
|
||||
local center = cc.LabelTTF:create("alignment center", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_CENTER, verticalAlignment[vAlignIdx])
|
||||
local right = cc.LabelTTF:create("alignment right", pFont, fontSize,
|
||||
blockSize, cc.TEXT_ALIGNMENT_RIGHT, verticalAlignment[vAlignIdx])
|
||||
|
||||
local leftColor = cc.LayerColor:create(cc.c4b(100, 100, 100, 255), blockSize.width, blockSize.height)
|
||||
local centerColor = cc.LayerColor:create(cc.c4b(200, 100, 100, 255), blockSize.width, blockSize.height)
|
||||
local rightColor = cc.LayerColor:create(cc.c4b(100, 100, 200, 255), blockSize.width, blockSize.height)
|
||||
|
||||
leftColor:ignoreAnchorPointForPosition(false)
|
||||
centerColor:ignoreAnchorPointForPosition(false)
|
||||
rightColor:ignoreAnchorPointForPosition(false)
|
||||
|
||||
top:setAnchorPoint(cc.p(0.5, 1))
|
||||
left:setAnchorPoint(cc.p(0,0.5))
|
||||
leftColor:setAnchorPoint(cc.p(0,0.5))
|
||||
center:setAnchorPoint(cc.p(0,0.5))
|
||||
centerColor:setAnchorPoint(cc.p(0,0.5))
|
||||
right:setAnchorPoint(cc.p(0,0.5))
|
||||
rightColor:setAnchorPoint(cc.p(0,0.5))
|
||||
|
||||
top:setPosition(cc.p(s.width/2,s.height-20))
|
||||
left:setPosition(cc.p(0,s.height/2))
|
||||
leftColor:setPosition(left:getPosition())
|
||||
center:setPosition(cc.p(blockSize.width, s.height/2))
|
||||
centerColor:setPosition(center:getPosition())
|
||||
right:setPosition(cc.p(blockSize.width*2, s.height/2))
|
||||
rightColor:setPosition(right:getPosition())
|
||||
|
||||
ret:addChild(leftColor, -1)
|
||||
ret:addChild(left, 0, kTagLabel1)
|
||||
ret:addChild(rightColor, -1)
|
||||
ret:addChild(right, 0, kTagLabel2)
|
||||
ret:addChild(centerColor, -1)
|
||||
ret:addChild(center, 0, kTagLabel3)
|
||||
ret:addChild(top, 0, kTagLabel4)
|
||||
end
|
||||
|
||||
local isFirst = true
|
||||
local originCreateLayer = createTestLayer
|
||||
local function createTestLayer()
|
||||
if isFirst == false then
|
||||
if Helper.index == 1 then
|
||||
vAlignIdx = vAlignIdx % vAlignCount + 1
|
||||
end
|
||||
else
|
||||
isFirst = false
|
||||
end
|
||||
|
||||
local ret = originCreateLayer("")
|
||||
showFont(ret, fontList[Helper.index])
|
||||
return ret
|
||||
end
|
||||
|
||||
function FontTestMain()
|
||||
cclog("FontTestMain")
|
||||
Helper.index = 1
|
||||
vAlignIdx = 1
|
||||
local scene = cc.Scene:create()
|
||||
Helper.createFunctionTable = {
|
||||
createTestLayer,
|
||||
createTestLayer,
|
||||
createTestLayer,
|
||||
createTestLayer,
|
||||
createTestLayer,
|
||||
createTestLayer
|
||||
}
|
||||
scene:addChild(createTestLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,136 @@
|
|||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local SID_STEP1 = 100
|
||||
local SID_STEP2 = 101
|
||||
local SID_STEP3 = 102
|
||||
local IDC_PAUSE = 200
|
||||
|
||||
local function IntervalLayer()
|
||||
local ret = cc.Layer:create()
|
||||
local m_time0 = 0
|
||||
local m_time1 = 0
|
||||
local m_time2 = 0
|
||||
local m_time3 = 0
|
||||
local m_time4 = 0
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
-- sun
|
||||
local sun = cc.ParticleSun:create()
|
||||
sun:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png"))
|
||||
sun:setPosition( cc.p(VisibleRect:rightTop().x-32,VisibleRect:rightTop().y-32) )
|
||||
|
||||
sun:setTotalParticles(130)
|
||||
sun:setLife(0.6)
|
||||
ret:addChild(sun)
|
||||
|
||||
-- timers
|
||||
m_label0 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt")
|
||||
m_label1 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt")
|
||||
m_label2 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt")
|
||||
m_label3 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt")
|
||||
m_label4 = cc.LabelBMFont:create("0", "fonts/bitmapFontTest4.fnt")
|
||||
|
||||
local function update(dt)
|
||||
m_time0 = m_time0 + dt
|
||||
local str = string.format("%2.1f", m_time0)
|
||||
m_label0:setString(str)
|
||||
end
|
||||
|
||||
ret:scheduleUpdateWithPriorityLua(update, 0)
|
||||
|
||||
local function step1(dt)
|
||||
m_time1 = m_time1 + dt
|
||||
local str = string.format("%2.1f", m_time1)
|
||||
m_label1:setString( str )
|
||||
end
|
||||
|
||||
local function step2(dt)
|
||||
m_time2 = m_time2 + dt
|
||||
local str = string.format("%2.1f", m_time2)
|
||||
m_label2:setString( str )
|
||||
end
|
||||
|
||||
local function step3(dt)
|
||||
m_time3 = m_time3 + dt
|
||||
local str = string.format("%2.1f", m_time3)
|
||||
m_label3:setString( str )
|
||||
end
|
||||
|
||||
local function step4(dt)
|
||||
m_time4 = m_time4 + dt
|
||||
local str = string.format("%2.1f", m_time4)
|
||||
m_label4:setString( str )
|
||||
end
|
||||
|
||||
local schedulerEntry1 = nil
|
||||
local schedulerEntry2 = nil
|
||||
local schedulerEntry3 = nil
|
||||
local schedulerEntry4 = nil
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
schedulerEntry1 = scheduler:scheduleScriptFunc(step1, 0, false)
|
||||
schedulerEntry2 = scheduler:scheduleScriptFunc(step2, 0, false)
|
||||
schedulerEntry3 = scheduler:scheduleScriptFunc(step3, 1.0, false)
|
||||
schedulerEntry4 = scheduler:scheduleScriptFunc(step4, 2.0, false)
|
||||
elseif event == "exit" then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry1)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry2)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry3)
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry4)
|
||||
if cc.Director:getInstance():isPaused() then
|
||||
cc.Director:getInstance():resume()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
|
||||
m_label0:setPosition(cc.p(s.width*1/6, s.height/2))
|
||||
m_label1:setPosition(cc.p(s.width*2/6, s.height/2))
|
||||
m_label2:setPosition(cc.p(s.width*3/6, s.height/2))
|
||||
m_label3:setPosition(cc.p(s.width*4/6, s.height/2))
|
||||
m_label4:setPosition(cc.p(s.width*5/6, s.height/2))
|
||||
|
||||
ret:addChild(m_label0)
|
||||
ret:addChild(m_label1)
|
||||
ret:addChild(m_label2)
|
||||
ret:addChild(m_label3)
|
||||
ret:addChild(m_label4)
|
||||
|
||||
-- Sprite
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
sprite:setPosition( cc.p(VisibleRect:left().x + 40, VisibleRect:bottom().y + 50) )
|
||||
|
||||
local jump = cc.JumpBy:create(3, cc.p(s.width-80,0), 50, 4)
|
||||
|
||||
ret:addChild(sprite)
|
||||
sprite:runAction( cc.RepeatForever:create(cc.Sequence:create(jump, jump:reverse())))
|
||||
-- pause button
|
||||
local item1 = cc.MenuItemFont:create("Pause")
|
||||
local function onPause(tag, pSender)
|
||||
if cc.Director:getInstance():isPaused() then
|
||||
cc.Director:getInstance():resume()
|
||||
else
|
||||
cc.Director:getInstance():pause()
|
||||
end
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(onPause)
|
||||
local menu = cc.Menu:create(item1)
|
||||
menu:setPosition( cc.p(s.width/2, s.height-50) )
|
||||
|
||||
ret:addChild( menu )
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function IntervalTestMain()
|
||||
cclog("IntervalTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
local layer = IntervalLayer()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,49 @@
|
|||
local function KeypadMainLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local function onEnter()
|
||||
print("come in")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local label = cc.LabelTTF:create("Keypad Test", "Arial", 28)
|
||||
layer:addChild(label, 0)
|
||||
label:setPosition(cc.p(s.width/2, s.height-50))
|
||||
|
||||
local labelTip = cc.LabelTTF:create("Please press any key...", "Arial", 22)
|
||||
labelTip:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
layer:addChild(labelTip, 0)
|
||||
|
||||
local function onKeyReleased(keyCode, event)
|
||||
local label = event:getCurrentTarget()
|
||||
if keyCode == cc.KeyCode.KEY_BACKSPACE then
|
||||
label:setString("BACK clicked!")
|
||||
elseif keyCode == cc.KeyCode.KEY_MENU then
|
||||
label:setString("MENU clicked!")
|
||||
end
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerKeyboard:create()
|
||||
listener:registerScriptHandler(onKeyReleased, cc.Handler.EVENT_KEYBOARD_RELEASED )
|
||||
|
||||
local eventDispatcher = layer:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, labelTip)
|
||||
end
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
onEnter()
|
||||
end
|
||||
end
|
||||
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
function KeypadTestMain()
|
||||
cclog("KeypadTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(KeypadMainLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,651 @@
|
|||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local kTagLayer = 1
|
||||
|
||||
local function createLayerDemoLayer(title, subtitle)
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
local titleStr = title == nil and "No title" or title
|
||||
local subTitleStr = subtitle == nil and "" or subtitle
|
||||
Helper.titleLabel:setString(titleStr)
|
||||
Helper.subtitleLabel:setString(subTitleStr)
|
||||
|
||||
-- local prev = {x = 0, y = 0}
|
||||
-- local function onTouchEvent(eventType, x, y)
|
||||
-- if eventType == "began" then
|
||||
-- prev.x = x
|
||||
-- prev.y = y
|
||||
-- return true
|
||||
-- elseif eventType == "moved" then
|
||||
-- local node = layer:getChildByTag(kTagTileMap)
|
||||
-- local newX = node:getPositionX()
|
||||
-- local newY = node:getPositionY()
|
||||
-- local diffX = x - prev.x
|
||||
-- local diffY = y - prev.y
|
||||
|
||||
-- node:setPosition( cc.p.__add(cc.p(newX, newY), cc.p(diffX, diffY)) )
|
||||
-- prev.x = x
|
||||
-- prev.y = y
|
||||
-- end
|
||||
-- end
|
||||
-- layer:setTouchEnabled(true)
|
||||
-- layer:registerScriptTouchHandler(onTouchEvent)
|
||||
return layer
|
||||
end
|
||||
|
||||
--#pragma mark - Cascading support extensions
|
||||
|
||||
local function setEnableRecursiveCascading(node, enable)
|
||||
if node == nil then
|
||||
-- cclog("node == nil, return directly")
|
||||
return
|
||||
end
|
||||
|
||||
if node.setCascadeColorEnabled ~= nil and node.setCascadeOpacityEnabled ~= nil then
|
||||
node:setCascadeColorEnabled(enable)
|
||||
node:setCascadeOpacityEnabled(enable)
|
||||
end
|
||||
|
||||
local obj = nil
|
||||
local children = node:getChildren()
|
||||
if children == nil then
|
||||
-- cclog("children is nil")
|
||||
print("children is nil")
|
||||
return
|
||||
end
|
||||
|
||||
local i = 0
|
||||
local len = table.getn(children)
|
||||
for i = 0, len-1, 1 do
|
||||
setEnableRecursiveCascading(children[i + 1], enable)
|
||||
end
|
||||
end
|
||||
|
||||
-- LayerTestCascadingOpacityA
|
||||
local function LayerTestCascadingOpacityA()
|
||||
local ret = createLayerDemoLayer("Layer: cascading opacity")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.Layer:create()
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, s.height/2))
|
||||
sister2:setPosition( cc.p( s.width*2/3, s.height/2))
|
||||
label:setPosition( cc.p( s.width/2, s.height/2))
|
||||
|
||||
layer1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(4, 0),
|
||||
cc.FadeTo:create(4, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
|
||||
sister1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(2, 0),
|
||||
cc.FadeTo:create(2, 255),
|
||||
cc.FadeTo:create(2, 0),
|
||||
cc.FadeTo:create(2, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
-- Enable cascading in scene
|
||||
setEnableRecursiveCascading(ret, true)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerTestCascadingOpacityB
|
||||
local function LayerTestCascadingOpacityB()
|
||||
local ret = createLayerDemoLayer("CCLayerColor: cascading opacity")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create(cc.c4b(192, 0, 0, 255), s.width, s.height/2)
|
||||
layer1:setCascadeColorEnabled(false)
|
||||
|
||||
layer1:setPosition( cc.p(0, s.height/2))
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, 0))
|
||||
sister2:setPosition( cc.p( s.width*2/3, 0))
|
||||
label:setPosition( cc.p( s.width/2, 0))
|
||||
|
||||
layer1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(4, 0),cc.FadeTo:create(4, 255),cc.DelayTime:create(1))))
|
||||
|
||||
sister1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(2, 0),cc.FadeTo:create(2, 255),cc.FadeTo:create(2, 0),cc.FadeTo:create(2, 255),cc.DelayTime:create(1))))
|
||||
|
||||
-- Enable cascading in scene
|
||||
setEnableRecursiveCascading(ret, true)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerTestCascadingOpacityC
|
||||
local function LayerTestCascadingOpacityC()
|
||||
local ret = createLayerDemoLayer("LayerColor: non-cascading opacity")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create(cc.c4b(192, 0, 0, 255), s.width, s.height/2)
|
||||
layer1:setCascadeColorEnabled(false)
|
||||
layer1:setCascadeOpacityEnabled(false)
|
||||
|
||||
layer1:setPosition( cc.p(0, s.height/2))
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, 0))
|
||||
sister2:setPosition( cc.p( s.width*2/3, 0))
|
||||
label:setPosition( cc.p( s.width/2, 0))
|
||||
|
||||
layer1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(4, 0),
|
||||
cc.FadeTo:create(4, 255),cc.DelayTime:create(1))))
|
||||
|
||||
sister1:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeTo:create(2, 0),cc.FadeTo:create(2, 255),
|
||||
cc.FadeTo:create(2, 0),cc.FadeTo:create(2, 255),cc.DelayTime:create(1))))
|
||||
return ret
|
||||
end
|
||||
|
||||
--#pragma mark Example LayerTestCascadingColor
|
||||
|
||||
-- LayerTestCascadingColorA
|
||||
local function LayerTestCascadingColorA()
|
||||
local ret = createLayerDemoLayer("Layer: cascading color")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.Layer:create()
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, s.height/2))
|
||||
sister2:setPosition( cc.p( s.width*2/3, s.height/2))
|
||||
label:setPosition( cc.p( s.width/2, s.height/2))
|
||||
|
||||
layer1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(6, 255, 0, 255),
|
||||
cc.TintTo:create(6, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
|
||||
sister1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(2, 255, 255, 0),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 0, 255, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 255, 0, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
-- Enable cascading in scene
|
||||
setEnableRecursiveCascading(ret, true)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerTestCascadingColorB
|
||||
local function LayerTestCascadingColorB()
|
||||
local ret = createLayerDemoLayer("LayerColor: cascading color")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create(cc.c4b(255, 255, 255, 255), s.width, s.height/2)
|
||||
|
||||
layer1:setPosition( cc.p(0, s.height/2))
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, 0))
|
||||
sister2:setPosition( cc.p( s.width*2/3, 0))
|
||||
label:setPosition( cc.p( s.width/2, 0))
|
||||
|
||||
layer1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(6, 255, 0, 255),
|
||||
cc.TintTo:create(6, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
sister1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(2, 255, 255, 0),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 0, 255, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 255, 0, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
-- Enable cascading in scene
|
||||
setEnableRecursiveCascading(ret, true)
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerTestCascadingColorC
|
||||
local function LayerTestCascadingColorC()
|
||||
local ret = createLayerDemoLayer("LayerColor: non-cascading color")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create(cc.c4b(255, 255, 255, 255), s.width, s.height/2)
|
||||
layer1:setCascadeColorEnabled(false)
|
||||
layer1:setPosition( cc.p(0, s.height/2))
|
||||
|
||||
local sister1 = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
local sister2 = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
local label = cc.LabelBMFont:create("Test", "fonts/bitmapFontTest.fnt")
|
||||
|
||||
layer1:addChild(sister1)
|
||||
layer1:addChild(sister2)
|
||||
layer1:addChild(label)
|
||||
ret:addChild( layer1, 0, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, 0))
|
||||
sister2:setPosition( cc.p( s.width*2/3, 0))
|
||||
label:setPosition( cc.p( s.width/2, 0))
|
||||
|
||||
layer1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(6, 255, 0, 255),
|
||||
cc.TintTo:create(6, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
|
||||
sister1:runAction(
|
||||
cc.RepeatForever:create(
|
||||
cc.Sequence:create(cc.TintTo:create(2, 255, 255, 0),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 0, 255, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.TintTo:create(2, 255, 0, 255),
|
||||
cc.TintTo:create(2, 255, 255, 255),
|
||||
cc.DelayTime:create(1)
|
||||
)))
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- LayerTest1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function LayerTest1()
|
||||
local ret = createLayerDemoLayer("ColorLayer resize (tap & move)")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer = cc.LayerColor:create( cc.c4b(0xFF, 0x00, 0x00, 0x80), 200, 200)
|
||||
|
||||
layer:ignoreAnchorPointForPosition(false)
|
||||
layer:setPosition( cc.p(s.width/2, s.height/2) )
|
||||
ret:addChild(layer, 1, kTagLayer)
|
||||
|
||||
local function updateSize(x, y)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local newSize = cc.size( math.abs(x - s.width/2)*2, math.abs(y - s.height/2)*2)
|
||||
|
||||
local l = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
|
||||
l:setContentSize( newSize )
|
||||
end
|
||||
|
||||
local function onTouchesMoved(touches, event)
|
||||
local touchLocation = touches[1]:getLocation()
|
||||
|
||||
updateSize(touchLocation.x, touchLocation.y)
|
||||
end
|
||||
|
||||
local function onTouchesBegan(touches, event)
|
||||
onTouchesMoved(touches, event)
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesBegan,cc.Handler.EVENT_TOUCHES_BEGAN )
|
||||
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- LayerTest2
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function LayerTest2()
|
||||
local ret = createLayerDemoLayer("ColorLayer: fade and tint")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create( cc.c4b(255, 255, 0, 80), 100, 300)
|
||||
layer1:setPosition(cc.p(s.width/3, s.height/2))
|
||||
layer1:ignoreAnchorPointForPosition(false)
|
||||
ret:addChild(layer1, 1)
|
||||
|
||||
local layer2 = cc.LayerColor:create( cc.c4b(0, 0, 255, 255), 100, 300)
|
||||
layer2:setPosition(cc.p((s.width/3)*2, s.height/2))
|
||||
layer2:ignoreAnchorPointForPosition(false)
|
||||
ret:addChild(layer2, 1)
|
||||
|
||||
local actionTint = cc.TintBy:create(2, -255, -127, 0)
|
||||
local actionTintBack = actionTint:reverse()
|
||||
local seq1 = cc.Sequence:create(actionTint,actionTintBack)
|
||||
layer1:runAction(seq1)
|
||||
|
||||
local actionFade = cc.FadeOut:create(2.0)
|
||||
local actionFadeBack = actionFade:reverse()
|
||||
local seq2 = cc.Sequence:create(actionFade,actionFadeBack)
|
||||
layer2:runAction(seq2)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- LayerTestBlend
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
local function LayerTestBlend()
|
||||
local ret = createLayerDemoLayer("ColorLayer: blend")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local layer1 = cc.LayerColor:create( cc.c4b(255, 255, 255, 80) )
|
||||
|
||||
local sister1 = cc.Sprite:create(s_pPathSister1)
|
||||
local sister2 = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
ret:addChild(sister1)
|
||||
ret:addChild(sister2)
|
||||
ret:addChild(layer1, 100, kTagLayer)
|
||||
|
||||
sister1:setPosition( cc.p( s.width*1/3, s.height/2) )
|
||||
sister2:setPosition( cc.p( s.width*2/3, s.height/2) )
|
||||
|
||||
local blend = true
|
||||
|
||||
local function newBlend(dt)
|
||||
local layer = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerColor")
|
||||
|
||||
local src = 0
|
||||
local dst = 0
|
||||
|
||||
if blend then
|
||||
src = gl.SRC_ALPHA
|
||||
dst = gl.ONE_MINUS_SRC_ALPHA
|
||||
else
|
||||
src = gl.ONE_MINUS_DST_COLOR
|
||||
dst = gl.ZERO
|
||||
end
|
||||
|
||||
layer:setBlendFunc(src, dst)
|
||||
blend = not blend
|
||||
end
|
||||
|
||||
|
||||
local schedulerEntry = nil
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
schedulerEntry = scheduler:scheduleScriptFunc(newBlend, 1.0, false)
|
||||
elseif event == "exit" then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- LayerGradient
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function LayerGradient()
|
||||
local ret = createLayerDemoLayer("LayerGradient", "Touch the screen and move your finger")
|
||||
local layer1 = cc.LayerGradient:create(cc.c4b(255,0,0,255), cc.c4b(0,255,0,255), cc.p(0.9, 0.9))
|
||||
ret:addChild(layer1, 0, kTagLayer)
|
||||
|
||||
local label1 = cc.LabelTTF:create("Compressed Interpolation: Enabled", "Marker Felt", 26)
|
||||
local label2 = cc.LabelTTF:create("Compressed Interpolation: Disabled", "Marker Felt", 26)
|
||||
local item1 = cc.MenuItemLabel:create(label1)
|
||||
local item2 = cc.MenuItemLabel:create(label2)
|
||||
local item = cc.MenuItemToggle:create(item1)
|
||||
item:addSubItem(item2)
|
||||
|
||||
local function toggleItem(sender)
|
||||
-- cclog("toggleItem")
|
||||
local gradient = tolua.cast(ret:getChildByTag(kTagLayer), "cc.LayerGradient")
|
||||
gradient:setCompressedInterpolation(not gradient:isCompressedInterpolation())
|
||||
end
|
||||
|
||||
item:registerScriptTapHandler(toggleItem)
|
||||
|
||||
local menu = cc.Menu:create(item)
|
||||
ret:addChild(menu)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
menu:setPosition(cc.p(s.width / 2, 100))
|
||||
|
||||
local function onTouchesMoved(touches, event)
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local start = touches[1]:getLocation()
|
||||
local movingPos = cc.p(s.width/2,s.height/2)
|
||||
local diff = cc.p(movingPos.x - start.x, movingPos.y - start.y)
|
||||
diff = cc.pNormalize(diff)
|
||||
|
||||
local gradient = tolua.cast(ret:getChildByTag(1), "cc.LayerGradient")
|
||||
gradient:setVector(diff)
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
-- LayerIgnoreAnchorPointPos
|
||||
|
||||
local kLayerIgnoreAnchorPoint = 1000
|
||||
|
||||
local function LayerIgnoreAnchorPointPos()
|
||||
local ret = createLayerDemoLayer("IgnoreAnchorPoint - Position", "Ignoring Anchor Point for position")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local l = cc.LayerColor:create(cc.c4b(255, 0, 0, 255), 150, 150)
|
||||
|
||||
l:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
l:setPosition(cc.p( s.width/2, s.height/2))
|
||||
|
||||
local move = cc.MoveBy:create(2, cc.p(100,2))
|
||||
local back = tolua.cast(move:reverse(), "cc.MoveBy")
|
||||
local seq = cc.Sequence:create(move, back)
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
ret:addChild(l, 0, kLayerIgnoreAnchorPoint)
|
||||
|
||||
local child = cc.Sprite:create("Images/grossini.png")
|
||||
l:addChild(child)
|
||||
local lsize = l:getContentSize()
|
||||
child:setPosition(cc.p(lsize.width/2, lsize.height/2))
|
||||
|
||||
local function onToggle(pObject)
|
||||
local pLayer = ret:getChildByTag(kLayerIgnoreAnchorPoint)
|
||||
local ignore = pLayer:isIgnoreAnchorPointForPosition()
|
||||
pLayer:ignoreAnchorPointForPosition(not ignore)
|
||||
end
|
||||
|
||||
local item = cc.MenuItemFont:create("Toggle ignore anchor point")
|
||||
item:registerScriptTapHandler(onToggle)
|
||||
|
||||
local menu = cc.Menu:create(item)
|
||||
ret:addChild(menu)
|
||||
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerIgnoreAnchorPointRot
|
||||
|
||||
local function LayerIgnoreAnchorPointRot()
|
||||
local ret = createLayerDemoLayer("IgnoreAnchorPoint - Rotation", "Ignoring Anchor Point for rotations")
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local l = cc.LayerColor:create(cc.c4b(255, 0, 0, 255), 200, 200)
|
||||
|
||||
l:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
l:setPosition(cc.p( s.width/2, s.height/2))
|
||||
|
||||
ret:addChild(l, 0, kLayerIgnoreAnchorPoint)
|
||||
|
||||
local rot = cc.RotateBy:create(2, 360)
|
||||
l:runAction(cc.RepeatForever:create(rot))
|
||||
|
||||
|
||||
local child = cc.Sprite:create("Images/grossini.png")
|
||||
l:addChild(child)
|
||||
local lsize = l:getContentSize()
|
||||
child:setPosition(cc.p(lsize.width/2, lsize.height/2))
|
||||
|
||||
local function onToggle(pObject)
|
||||
local pLayer = ret:getChildByTag(kLayerIgnoreAnchorPoint)
|
||||
local ignore = pLayer:isIgnoreAnchorPointForPosition()
|
||||
pLayer:ignoreAnchorPointForPosition(not ignore)
|
||||
end
|
||||
|
||||
local item = cc.MenuItemFont:create("Toogle ignore anchor point")
|
||||
item:registerScriptTapHandler(onToggle)
|
||||
|
||||
local menu = cc.Menu:create(item)
|
||||
ret:addChild(menu)
|
||||
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
return ret
|
||||
end
|
||||
|
||||
-- LayerIgnoreAnchorPointScale
|
||||
local function LayerIgnoreAnchorPointScale()
|
||||
local ret = createLayerDemoLayer("IgnoreAnchorPoint - Scale", "Ignoring Anchor Point for scale")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local l = cc.LayerColor:create(cc.c4b(255, 0, 0, 255), 200, 200)
|
||||
|
||||
l:setAnchorPoint(cc.p(0.5, 1.0))
|
||||
l:setPosition(cc.p( s.width/2, s.height/2))
|
||||
|
||||
|
||||
local scale = cc.ScaleBy:create(2, 2)
|
||||
local back = tolua.cast(scale:reverse(), "cc.ScaleBy")
|
||||
local seq = cc.Sequence:create(scale, back)
|
||||
|
||||
l:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
ret:addChild(l, 0, kLayerIgnoreAnchorPoint)
|
||||
|
||||
local child = cc.Sprite:create("Images/grossini.png")
|
||||
l:addChild(child)
|
||||
local lsize = l:getContentSize()
|
||||
child:setPosition(cc.p(lsize.width/2, lsize.height/2))
|
||||
|
||||
local function onToggle(pObject)
|
||||
local pLayer = ret:getChildByTag(kLayerIgnoreAnchorPoint)
|
||||
local ignore = pLayer:isIgnoreAnchorPointForPosition()
|
||||
pLayer:ignoreAnchorPointForPosition(not ignore)
|
||||
return ret
|
||||
end
|
||||
|
||||
local item = cc.MenuItemFont:create("Toogle ignore anchor point")
|
||||
item:registerScriptTapHandler(onToggle)
|
||||
|
||||
local menu = cc.Menu:create(item)
|
||||
ret:addChild(menu)
|
||||
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
local function LayerExtendedBlendOpacityTest()
|
||||
local ret = createLayerDemoLayer("Extended Blend & Opacity", "You should see 3 layers")
|
||||
local layer1 = cc.LayerGradient:create(cc.c4b(255, 0, 0, 255), cc.c4b(255, 0, 255, 255))
|
||||
layer1:setContentSize(cc.size(80, 80))
|
||||
layer1:setPosition(cc.p(50,50))
|
||||
ret:addChild(layer1)
|
||||
|
||||
local layer2 = cc.LayerGradient:create(cc.c4b(0, 0, 0, 127), cc.c4b(255, 255, 255, 127))
|
||||
layer2:setContentSize(cc.size(80, 80))
|
||||
layer2:setPosition(cc.p(100,90))
|
||||
ret:addChild(layer2)
|
||||
|
||||
local layer3 = cc.LayerGradient:create()
|
||||
layer3:setContentSize(cc.size(80, 80))
|
||||
layer3:setPosition(cc.p(150,140))
|
||||
layer3:setStartColor(cc.c3b(255, 0, 0))
|
||||
layer3:setEndColor(cc.c3b(255, 0, 255))
|
||||
layer3:setStartOpacity(255)
|
||||
layer3:setEndOpacity(255)
|
||||
layer3:setBlendFunc(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA)
|
||||
ret:addChild(layer3)
|
||||
return ret
|
||||
end
|
||||
|
||||
function LayerTestMain()
|
||||
cclog("LayerTestMain")
|
||||
Helper.index = 1
|
||||
cc.Director:getInstance():setDepthTest(true)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
LayerTestCascadingOpacityA,
|
||||
LayerTestCascadingOpacityB,
|
||||
LayerTestCascadingOpacityC,
|
||||
LayerTestCascadingColorA,
|
||||
LayerTestCascadingColorB,
|
||||
LayerTestCascadingColorC,
|
||||
LayerTest1,
|
||||
LayerTest2,
|
||||
LayerTestBlend,
|
||||
LayerGradient,
|
||||
LayerIgnoreAnchorPointPos,
|
||||
LayerIgnoreAnchorPointRot,
|
||||
LayerIgnoreAnchorPointScale,
|
||||
LayerExtendedBlendOpacityTest
|
||||
}
|
||||
scene:addChild(LayerTestCascadingOpacityA())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,162 @@
|
|||
local targetPlatform = cc.Application:getInstance():getTargetPlatform()
|
||||
|
||||
local LINE_SPACE = 40
|
||||
local itemTagBasic = 1000
|
||||
local LuaBridgeTestsName =
|
||||
{
|
||||
"LuaJavaBridge",
|
||||
"LuaObjectCBridge",
|
||||
}
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function LuaBridgeLayer()
|
||||
local layer = cc.Layer:create()
|
||||
local menu = cc.Menu:create()
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
|
||||
local supportObjectCBridge = false
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or (cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
supportObjectCBridge = true
|
||||
end
|
||||
|
||||
local supportJavaBridge = false
|
||||
if (cc.PLATFORM_OS_ANDROID == targetPlatform) then
|
||||
supportJavaBridge = true
|
||||
end
|
||||
|
||||
local function createMenuToBridgeScene()
|
||||
local menuToBridgeScene = cc.Menu:create()
|
||||
local function toBridgeScene()
|
||||
local scene = LuaBridgeMainTest()
|
||||
if scene ~= nil then
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
end
|
||||
--Create BackMneu
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local menuItemFont = cc.MenuItemFont:create("Back")
|
||||
menuItemFont:setPosition(cc.p(VisibleRect:rightBottom().x - 50, VisibleRect:rightBottom().y + 25))
|
||||
menuItemFont:registerScriptTapHandler(toBridgeScene)
|
||||
menuToBridgeScene:addChild(menuItemFont)
|
||||
menuToBridgeScene:setPosition(cc.p(0, 0))
|
||||
return menuToBridgeScene
|
||||
end
|
||||
|
||||
local function newLuaJavaBridge()
|
||||
local newScene = cc.Scene:create()
|
||||
local titleLabel = cc.LabelTTF:create("", "Arial", 28)
|
||||
newScene:addChild(titleLabel, 1)
|
||||
titleLabel:setPosition(s.width / 2, s.height - 50)
|
||||
titleLabel:setString("LuaJavaBridge Test")
|
||||
|
||||
subtitleLabel = cc.LabelTTF:create("", "Thonburi", 16)
|
||||
newScene:addChild(subtitleLabel, 1)
|
||||
subtitleLabel:setPosition(s.width / 2, s.height - 80)
|
||||
subtitleLabel:setString("See the console.")
|
||||
if (cc.PLATFORM_OS_ANDROID == targetPlatform) then
|
||||
local args = { 2 , 3}
|
||||
local sigs = "(II)I"
|
||||
local luaj = require "luaj"
|
||||
local className = "com/cocos2dx/sample/LuaJavaBridgeTest/LuaJavaBridgeTest"
|
||||
local ok,ret = luaj.callStaticMethod(className,"addTwoNumbers",args,sigs)
|
||||
if not ok then
|
||||
print("luaj error:", ret)
|
||||
else
|
||||
print("The ret is:", ret)
|
||||
end
|
||||
|
||||
local function callbackLua(param)
|
||||
if "success" == param then
|
||||
print("java call back success")
|
||||
end
|
||||
end
|
||||
args = { "callbacklua", callbackLua }
|
||||
sigs = "(Ljava/lang/String;I)V"
|
||||
ok = luaj.callStaticMethod(className,"callbackLua",args,sigs)
|
||||
if not ok then
|
||||
print("call callback error")
|
||||
end
|
||||
end
|
||||
return newScene
|
||||
end
|
||||
|
||||
local function newLuaObjectCBridge()
|
||||
local newScene = cc.Scene:create()
|
||||
local titleLabel = cc.LabelTTF:create("", "Arial", 28)
|
||||
newScene:addChild(titleLabel, 1)
|
||||
titleLabel:setPosition(s.width / 2, s.height - 50)
|
||||
titleLabel:setString("LuaObjectCBridge Test")
|
||||
|
||||
subtitleLabel = cc.LabelTTF:create("", "Thonburi", 16)
|
||||
newScene:addChild(subtitleLabel, 1)
|
||||
subtitleLabel:setPosition(s.width / 2, s.height - 80)
|
||||
subtitleLabel:setString("See the console.")
|
||||
if (cc.PLATFORM_OS_IPHONE == targetPlatform) or (cc.PLATFORM_OS_IPAD == targetPlatform) or (cc.PLATFORM_OS_MAC == targetPlatform) then
|
||||
local args = { num1 = 2 , num2 = 3 }
|
||||
local luaoc = require "luaoc"
|
||||
local className = "LuaObjectCBridgeTest"
|
||||
local ok,ret = luaoc.callStaticMethod(className,"addTwoNumbers",args)
|
||||
if not ok then
|
||||
Director:getInstance():resume()
|
||||
else
|
||||
print("The ret is:", ret)
|
||||
end
|
||||
|
||||
local function callback(param)
|
||||
if "success" == param then
|
||||
print("object c call back success")
|
||||
end
|
||||
end
|
||||
luaoc.callStaticMethod(className,"registerScriptHandler", {scriptHandler = callback } )
|
||||
luaoc.callStaticMethod(className,"callbackScriptHandler")
|
||||
end
|
||||
return newScene
|
||||
end
|
||||
|
||||
local function newLuaBridgeScene(idx)
|
||||
if 1 == idx then
|
||||
return newLuaJavaBridge()
|
||||
elseif 2 == idx then
|
||||
return newLuaObjectCBridge()
|
||||
end
|
||||
end
|
||||
|
||||
local function menuCallback(tag, pMenuItem)
|
||||
local scene = nil
|
||||
local nIdx = pMenuItem:getLocalZOrder() - itemTagBasic
|
||||
local newScene = newLuaBridgeScene(nIdx)
|
||||
if nil ~= newScene then
|
||||
newScene:addChild(createMenuToBridgeScene(),10)
|
||||
cc.Director:getInstance():replaceScene(newScene)
|
||||
end
|
||||
end
|
||||
|
||||
for i = 1, table.getn(LuaBridgeTestsName) do
|
||||
local item = cc.MenuItemFont:create(LuaBridgeTestsName[i])
|
||||
item:registerScriptTapHandler(menuCallback)
|
||||
item:setPosition(s.width / 2, s.height - i * LINE_SPACE)
|
||||
menu:addChild(item, itemTagBasic + i)
|
||||
if ((i == 1) and (false == supportJavaBridge))
|
||||
or ((i == 2) and (false == supportObjectCBridge)) then
|
||||
item:setEnabled(false)
|
||||
end
|
||||
end
|
||||
|
||||
layer:addChild(menu)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-------------------------------------
|
||||
-- LuaBridge Test
|
||||
-------------------------------------
|
||||
function LuaBridgeMainTest()
|
||||
local scene = cc.Scene:create()
|
||||
scene:addChild(LuaBridgeLayer())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,594 @@
|
|||
local kTagMenu = 1
|
||||
local kTagMenu0 = 0
|
||||
local kTagMenu1 = 1
|
||||
|
||||
local MID_CALLBACK = 1000
|
||||
local MID_CALLBACK2 = 1001
|
||||
local MID_DISABLED = 1002
|
||||
local MID_ENABLE = 1003
|
||||
local MID_CONFIG = 1004
|
||||
local MID_QUIT = 1005
|
||||
local MID_OPACITY = 1006
|
||||
local MID_ALIGN = 1007
|
||||
local MID_CALLBACK3 = 1008
|
||||
local MID_BACKCALLBACK = 1009
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- MenuLayerMainMenu
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function MenuLayerMainMenu()
|
||||
local m_disabledItem = nil
|
||||
|
||||
local ret = cc.Layer:create()
|
||||
|
||||
-- Font Item
|
||||
local spriteNormal = cc.Sprite:create(s_MenuItem, cc.rect(0,23*2,115,23))
|
||||
local spriteSelected = cc.Sprite:create(s_MenuItem, cc.rect(0,23*1,115,23))
|
||||
local spriteDisabled = cc.Sprite:create(s_MenuItem, cc.rect(0,23*0,115,23))
|
||||
|
||||
local item1 = cc.MenuItemSprite:create(spriteNormal, spriteSelected, spriteDisabled)
|
||||
|
||||
local function menuCallback(sender)
|
||||
cclog("menuCallback...")
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(1)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
-- Image Item
|
||||
local function menuCallback2(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(2)
|
||||
end
|
||||
|
||||
local item2 = cc.MenuItemImage:create(s_SendScore, s_PressSendScore)
|
||||
item2:registerScriptTapHandler(menuCallback2)
|
||||
|
||||
|
||||
local schedulerEntry = nil
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
local function allowTouches(dt)
|
||||
local pDirector = cc.Director:getInstance()
|
||||
--pDirector:getTouchDispatcher():setPriority(cc.MENU_HANDLER_PRIORITY +1, ret)
|
||||
if nil ~= schedulerEntry then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
schedulerEntry = nil
|
||||
end
|
||||
cclog("TOUCHES ALLOWED AGAIN")
|
||||
end
|
||||
|
||||
|
||||
local function menuCallbackDisabled(sender)
|
||||
-- hijack all touch events for 5 seconds
|
||||
local pDirector = cc.Director:getInstance()
|
||||
--pDirector:getTouchDispatcher():setPriority(cc.MENU_HANDLER_PRIORITY -1, ret)
|
||||
schedulerEntry = scheduler:scheduleScriptFunc(allowTouches, 5, false)
|
||||
cclog("TOUCHES DISABLED FOR 5 SECONDS")
|
||||
end
|
||||
|
||||
-- Label Item (LabelAtlas)
|
||||
local labelAtlas = cc.LabelAtlas:_create("0123456789", "fonts/labelatlas.png", 16, 24, string.byte('.'))
|
||||
local item3 = cc.MenuItemLabel:create(labelAtlas)
|
||||
item3:registerScriptTapHandler(menuCallbackDisabled)
|
||||
item3:setDisabledColor( cc.c3b(32,32,64) )
|
||||
item3:setColor( cc.c3b(200,200,255) )
|
||||
|
||||
local function menuCallbackEnable(sender)
|
||||
m_disabledItem:setEnabled(not m_disabledItem:isEnabled() )
|
||||
end
|
||||
|
||||
-- Font Item
|
||||
local item4 = cc.MenuItemFont:create("I toggle enable items")
|
||||
item4:registerScriptTapHandler(menuCallbackEnable)
|
||||
|
||||
item4:setFontSizeObj(20)
|
||||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
|
||||
local function menuCallbackConfig(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(3)
|
||||
end
|
||||
|
||||
-- Label Item (cc.LabelBMFont)
|
||||
local label = cc.LabelBMFont:create("configuration", "fonts/bitmapFontTest3.fnt")
|
||||
local item5 = cc.MenuItemLabel:create(label)
|
||||
item5:registerScriptTapHandler(menuCallbackConfig)
|
||||
|
||||
-- Testing issue #500
|
||||
item5:setScale( 0.8 )
|
||||
|
||||
-- Events
|
||||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
local function menuCallbackBugsTest(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(4)
|
||||
end
|
||||
|
||||
-- Bugs Item
|
||||
local item6 = cc.MenuItemFont:create("Bugs")
|
||||
item6:registerScriptTapHandler(menuCallbackBugsTest)
|
||||
|
||||
local function onQuit(sender)
|
||||
cclog("onQuit item is clicked.")
|
||||
end
|
||||
|
||||
-- Font Item
|
||||
local item7 = cc.MenuItemFont:create("Quit")
|
||||
item7:registerScriptTapHandler(onQuit)
|
||||
|
||||
local function menuMovingCallback(pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(5)
|
||||
end
|
||||
|
||||
local item8 = cc.MenuItemFont:create("Remove menu item when moving")
|
||||
item8:registerScriptTapHandler(menuMovingCallback)
|
||||
|
||||
local color_action = cc.TintBy:create(0.5, 0, -255, -255)
|
||||
local color_back = color_action:reverse()
|
||||
local seq = cc.Sequence:create(color_action, color_back)
|
||||
item7:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
menu:addChild(item1)
|
||||
menu:addChild(item2)
|
||||
menu:addChild(item3)
|
||||
menu:addChild(item4)
|
||||
menu:addChild(item5)
|
||||
menu:addChild(item6)
|
||||
menu:addChild(item7)
|
||||
menu:addChild(item8)
|
||||
|
||||
menu:alignItemsVertically()
|
||||
|
||||
-- elastic effect
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local i = 0
|
||||
local child = nil
|
||||
local pArray = menu:getChildren()
|
||||
local len = table.getn(pArray)
|
||||
local pObject = nil
|
||||
for i = 0, len-1 do
|
||||
pObject = pArray[i + 1]
|
||||
if pObject == nil then
|
||||
break
|
||||
end
|
||||
child = tolua.cast(pObject, "cc.Node")
|
||||
local dstPointX, dstPointY = child:getPosition()
|
||||
local offset = s.width/2 + 50
|
||||
if i % 2 == 0 then
|
||||
offset = 0-offset
|
||||
end
|
||||
child:setPosition( cc.p( dstPointX + offset, dstPointY) )
|
||||
child:runAction( cc.EaseElasticOut:create(cc.MoveBy:create(2, cc.p(dstPointX - offset,0)), 0.35) )
|
||||
end
|
||||
|
||||
m_disabledItem = item3
|
||||
item3:retain()
|
||||
|
||||
m_disabledItem:setEnabled( false )
|
||||
|
||||
ret:addChild(menu)
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
|
||||
-- local schedulerEntry = nil
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
if (schedulerEntry ~= nil) then
|
||||
scheduler:unscheduleScriptEntry(schedulerEntry)
|
||||
end
|
||||
if m_disabledItem ~= nil then
|
||||
-- m_disabledItem:release()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- MenuLayer2
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function MenuLayer2()
|
||||
local ret = cc.Layer:create()
|
||||
local m_centeredMenu = nil
|
||||
local m_alignedH = false
|
||||
|
||||
local function alignMenusH()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
menu:alignItemsHorizontally()
|
||||
local x, y = menu:getPosition()
|
||||
menu:setPosition( cc.pAdd(cc.p(x, y), cc.p(0,30)) )
|
||||
else
|
||||
-- TIP: but padding is configurable
|
||||
menu:alignItemsHorizontallyWithPadding(40)
|
||||
local x, y = menu:getPosition()
|
||||
menu:setPosition( cc.pSub(cc.p(x, y), cc.p(0,30)) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function alignMenusV()
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local menu = tolua.cast(ret:getChildByTag(100+i), "cc.Menu")
|
||||
menu:setPosition( m_centeredMenu )
|
||||
if i==0 then
|
||||
-- TIP: if no padding, padding = 5
|
||||
menu:alignItemsVertically()
|
||||
local x, y = menu:getPosition()
|
||||
menu:setPosition( cc.pAdd(cc.p(x, y), cc.p(100,0)) )
|
||||
else
|
||||
-- TIP: but padding is configurable
|
||||
menu:alignItemsVerticallyWithPadding(40)
|
||||
local x, y = menu:getPosition()
|
||||
menu:setPosition( cc.pSub(cc.p(x, y), cc.p(100,0)) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallbackOpacity(tag, sender)
|
||||
local menu = tolua.cast(sender:getParent(), "cc.Menu")
|
||||
local opacity = menu:getOpacity()
|
||||
if opacity == 128 then
|
||||
menu:setOpacity(255)
|
||||
else
|
||||
menu:setOpacity(128)
|
||||
end
|
||||
end
|
||||
|
||||
local function menuCallbackAlign(sender)
|
||||
m_alignedH = not m_alignedH
|
||||
|
||||
if m_alignedH then
|
||||
alignMenusH()
|
||||
else
|
||||
alignMenusV()
|
||||
end
|
||||
end
|
||||
|
||||
local i = 0
|
||||
for i=0, 1 do
|
||||
local item1 = cc.MenuItemImage:create(s_PlayNormal, s_PlaySelect)
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
|
||||
local item2 = cc.MenuItemImage:create(s_HighNormal, s_HighSelect)
|
||||
item2:registerScriptTapHandler(menuCallbackOpacity)
|
||||
|
||||
local item3 = cc.MenuItemImage:create(s_AboutNormal, s_AboutSelect)
|
||||
item3:registerScriptTapHandler(menuCallbackAlign)
|
||||
|
||||
item1:setScaleX( 1.5 )
|
||||
item2:setScaleX( 0.5 )
|
||||
item3:setScaleX( 0.5 )
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
menu:addChild(item1)
|
||||
menu:addChild(item2)
|
||||
menu:addChild(item3)
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
|
||||
menu:setTag( kTagMenu )
|
||||
|
||||
ret:addChild(menu, 0, 100+i)
|
||||
local x, y = menu:getPosition()
|
||||
m_centeredMenu = cc.p(x, y)
|
||||
end
|
||||
|
||||
m_alignedH = true
|
||||
alignMenusH()
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- MenuLayer3
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function MenuLayer3()
|
||||
local m_disabledItem = nil
|
||||
local ret = cc.Layer:create()
|
||||
local function menuCallback(sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
end
|
||||
|
||||
local function menuCallback2(sender)
|
||||
cclog("Label clicked. Toogling AtlasSprite")
|
||||
m_disabledItem:setEnabled( not m_disabledItem:isEnabled() )
|
||||
m_disabledItem:stopAllActions()
|
||||
end
|
||||
|
||||
local function menuCallback3(sender)
|
||||
cclog("MenuItemSprite clicked")
|
||||
end
|
||||
|
||||
cc.MenuItemFont:setFontName("Marker Felt")
|
||||
cc.MenuItemFont:setFontSize(28)
|
||||
|
||||
local label = cc.LabelBMFont:create("Enable AtlasItem", "fonts/bitmapFontTest3.fnt")
|
||||
local item1 = cc.MenuItemLabel:create(label)
|
||||
item1:registerScriptTapHandler(menuCallback2)
|
||||
|
||||
local item2 = cc.MenuItemFont:create("--- Go Back ---")
|
||||
item2:registerScriptTapHandler(menuCallback)
|
||||
|
||||
local spriteNormal = cc.Sprite:create(s_MenuItem, cc.rect(0,23*2,115,23))
|
||||
local spriteSelected = cc.Sprite:create(s_MenuItem, cc.rect(0,23*1,115,23))
|
||||
local spriteDisabled = cc.Sprite:create(s_MenuItem, cc.rect(0,23*0,115,23))
|
||||
|
||||
|
||||
local item3 = cc.MenuItemSprite:create(spriteNormal, spriteSelected, spriteDisabled)
|
||||
item3:registerScriptTapHandler(menuCallback3)
|
||||
m_disabledItem = item3
|
||||
item3:retain()
|
||||
m_disabledItem:setEnabled( false )
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
menu:addChild(item1)
|
||||
menu:addChild(item2)
|
||||
menu:addChild(item3)
|
||||
|
||||
menu:setPosition( cc.p(0,0) )
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
item1:setPosition( cc.p(s.width/2 - 150, s.height/2) )
|
||||
item2:setPosition( cc.p(s.width/2 - 200, s.height/2) )
|
||||
item3:setPosition( cc.p(s.width/2, s.height/2 - 100) )
|
||||
|
||||
local jump = cc.JumpBy:create(3, cc.p(400,0), 50, 4)
|
||||
item2:runAction( cc.RepeatForever:create(cc.Sequence:create( jump, jump:reverse())))
|
||||
|
||||
local spin1 = cc.RotateBy:create(3, 360)
|
||||
local spin2 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
local spin3 = tolua.cast(spin1:clone(), "cc.ActionInterval")
|
||||
|
||||
item1:runAction( cc.RepeatForever:create(spin1) )
|
||||
item2:runAction( cc.RepeatForever:create(spin2) )
|
||||
item3:runAction( cc.RepeatForever:create(spin3) )
|
||||
|
||||
ret:addChild( menu )
|
||||
|
||||
menu:setPosition(cc.p(0,0))
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
if m_disabledItem ~= nil then
|
||||
--m_disabledItem:release()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- MenuLayer4
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
local function MenuLayer4()
|
||||
local ret = cc.Layer:create()
|
||||
cc.MenuItemFont:setFontName("American Typewriter")
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local title1 = cc.MenuItemFont:create("Sound")
|
||||
title1:setEnabled(false)
|
||||
cc.MenuItemFont:setFontName( "Marker Felt" )
|
||||
cc.MenuItemFont:setFontSize(34)
|
||||
local item1 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "On" ))
|
||||
|
||||
local function menuCallback(tag, sender)
|
||||
cclog("selected item: tag: %d, index:%d", tag, tolua.cast(sender, "cc.MenuItemToggle"):getSelectedIndex() )
|
||||
end
|
||||
|
||||
local function backCallback(tag, sender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
end
|
||||
|
||||
item1:registerScriptTapHandler(menuCallback)
|
||||
item1:addSubItem(cc.MenuItemFont:create( "Off"))
|
||||
|
||||
cc.MenuItemFont:setFontName( "American Typewriter" )
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local title2 = cc.MenuItemFont:create( "Music" )
|
||||
title2:setEnabled(false)
|
||||
cc.MenuItemFont:setFontName( "Marker Felt" )
|
||||
cc.MenuItemFont:setFontSize(34)
|
||||
local item2 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "On" ))
|
||||
item2:registerScriptTapHandler(menuCallback)
|
||||
item2:addSubItem(cc.MenuItemFont:create( "Off"))
|
||||
|
||||
cc.MenuItemFont:setFontName( "American Typewriter" )
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local title3 = cc.MenuItemFont:create( "Quality" )
|
||||
title3:setEnabled( false )
|
||||
cc.MenuItemFont:setFontName( "Marker Felt" )
|
||||
cc.MenuItemFont:setFontSize(34)
|
||||
local item3 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "High" ))
|
||||
item3:registerScriptTapHandler(menuCallback)
|
||||
item3:addSubItem(cc.MenuItemFont:create( "Low" ))
|
||||
|
||||
cc.MenuItemFont:setFontName( "American Typewriter" )
|
||||
cc.MenuItemFont:setFontSize(18)
|
||||
local title4 = cc.MenuItemFont:create( "Orientation" )
|
||||
title4:setEnabled(false)
|
||||
cc.MenuItemFont:setFontName( "Marker Felt" )
|
||||
cc.MenuItemFont:setFontSize(34)
|
||||
local item4 = cc.MenuItemToggle:create(cc.MenuItemFont:create( "Off"),
|
||||
cc.MenuItemFont:create( "33%" ),
|
||||
cc.MenuItemFont:create( "66%" ),
|
||||
cc.MenuItemFont:create( "100%"))
|
||||
item4:registerScriptTapHandler(menuCallback)
|
||||
|
||||
-- you can change the one of the items by doing this
|
||||
item4:setSelectedIndex( 2 )
|
||||
|
||||
cc.MenuItemFont:setFontName( "Marker Felt" )
|
||||
cc.MenuItemFont:setFontSize( 34 )
|
||||
|
||||
local label = cc.LabelBMFont:create( "go back", "fonts/bitmapFontTest3.fnt" )
|
||||
local back = cc.MenuItemLabel:create(label)
|
||||
back:registerScriptTapHandler(backCallback)
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
|
||||
menu:addChild(title1)
|
||||
menu:addChild(title2)
|
||||
menu:addChild(item1 )
|
||||
menu:addChild(item2 )
|
||||
menu:addChild(title3)
|
||||
menu:addChild(title4)
|
||||
menu:addChild(item3 )
|
||||
menu:addChild(item4 )
|
||||
menu:addChild(back )
|
||||
|
||||
menu:alignItemsInColumns(2, 2, 2, 2, 1)
|
||||
|
||||
ret:addChild(menu)
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
return ret
|
||||
end
|
||||
|
||||
-- BugsTest
|
||||
local function BugsTest()
|
||||
local ret = cc.Layer:create()
|
||||
local function issue1410MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
menu:setEnabled(false)
|
||||
menu:setEnabled(true)
|
||||
cclog("NO CRASHES")
|
||||
end
|
||||
|
||||
local function issue1410v2MenuCallback(tag, pSender)
|
||||
local menu = tolua.cast(pSender:getParent(), "cc.Menu")
|
||||
menu:setEnabled(true)
|
||||
menu:setEnabled(false)
|
||||
cclog("NO CRASHES. AND MENU SHOULD STOP WORKING")
|
||||
end
|
||||
|
||||
local function backMenuCallback(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
end
|
||||
|
||||
|
||||
local issue1410 = cc.MenuItemFont:create("Issue 1410")
|
||||
issue1410:registerScriptTapHandler(issue1410MenuCallback)
|
||||
local issue1410_2 = cc.MenuItemFont:create("Issue 1410 #2")
|
||||
issue1410_2:registerScriptTapHandler(issue1410v2MenuCallback)
|
||||
local back = cc.MenuItemFont:create("Back")
|
||||
back:registerScriptTapHandler(backMenuCallback)
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(issue1410)
|
||||
menu:addChild(issue1410_2)
|
||||
menu:addChild(back)
|
||||
ret:addChild(menu)
|
||||
menu:alignItemsVertically()
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
local function RemoveMenuItemWhenMove()
|
||||
local ret = cc.Layer:create()
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local label = cc.LabelTTF:create("click item and move, should not crash", "Arial", 20)
|
||||
label:setPosition(cc.p(s.width/2, s.height - 30))
|
||||
ret:addChild(label)
|
||||
|
||||
local item = cc.MenuItemFont:create("item 1")
|
||||
item:retain()
|
||||
|
||||
local back = cc.MenuItemFont:create("go back")
|
||||
local function goBack(tag, pSender)
|
||||
tolua.cast(ret:getParent(), "cc.LayerMultiplex"):switchTo(0)
|
||||
end
|
||||
|
||||
back:registerScriptTapHandler(goBack)
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(item)
|
||||
menu:addChild(back)
|
||||
|
||||
ret:addChild(menu)
|
||||
menu:alignItemsVertically()
|
||||
|
||||
menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
|
||||
local function onTouchBegan(touch, event)
|
||||
return true
|
||||
end
|
||||
|
||||
local function onTouchMoved(touch, event)
|
||||
if item ~= nil then
|
||||
item:removeFromParent(true)
|
||||
--item:release()
|
||||
--item = nil
|
||||
end
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchOneByOne:create()
|
||||
listener:registerScriptHandler(onTouchBegan,cc.Handler.EVENT_TOUCH_BEGAN )
|
||||
listener:registerScriptHandler(onTouchMoved,cc.Handler.EVENT_TOUCH_MOVED )
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithFixedPriority(listener, -129)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
ret:getEventDispatcher():removeEventListener(listener)
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function MenuTestMain()
|
||||
cclog("MenuTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
local pLayer1 = MenuLayerMainMenu()
|
||||
local pLayer2 = MenuLayer2()
|
||||
|
||||
local pLayer3 = MenuLayer3()
|
||||
local pLayer4 = MenuLayer4()
|
||||
local pLayer5 = BugsTest()
|
||||
local pLayer6 = RemoveMenuItemWhenMove()
|
||||
|
||||
local layer = cc.LayerMultiplex:create(pLayer1,
|
||||
pLayer2,
|
||||
pLayer3,
|
||||
pLayer4,
|
||||
pLayer5,
|
||||
pLayer6 )
|
||||
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,181 @@
|
|||
|
||||
local streak = nil
|
||||
local titleLabel = nil
|
||||
local subtitleLabel = nil
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
|
||||
local firstTick = nil
|
||||
|
||||
local function modeCallback(sender)
|
||||
fastMode = streak:isFastMode()
|
||||
if fastMode == true then
|
||||
streak:setFastMode(false)
|
||||
else
|
||||
streak:setFastMode(true)
|
||||
end
|
||||
end
|
||||
|
||||
local function getBaseLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local itemMode = cc.MenuItemToggle:create(cc.MenuItemFont:create("Use High Quality Mode"))
|
||||
itemMode:addSubItem(cc.MenuItemFont:create("Use Fast Mode"))
|
||||
itemMode:registerScriptTapHandler(modeCallback)
|
||||
local menuMode = cc.Menu:create()
|
||||
menuMode:addChild(itemMode)
|
||||
menuMode:setPosition(cc.p(s.width / 2, s.height / 4))
|
||||
layer:addChild(menuMode)
|
||||
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- MotionStreakTest1
|
||||
-----------------------------------
|
||||
local root = nil
|
||||
local target = nil
|
||||
|
||||
local MotionStreakTest1_entry = nil
|
||||
|
||||
local function MotionStreakTest1_update(dt)
|
||||
if firstTick == true then
|
||||
firstTick = false
|
||||
return
|
||||
end
|
||||
|
||||
streak:setPosition(target:convertToWorldSpace(cc.p(0, 0)))
|
||||
end
|
||||
|
||||
local function MotionStreakTest1_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
MotionStreakTest1_entry = scheduler:scheduleScriptFunc(MotionStreakTest1_update, 0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(MotionStreakTest1_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function MotionStreakTest1()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
root = cc.Sprite:create(s_pPathR1)
|
||||
layer:addChild(root, 1)
|
||||
root:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
|
||||
target = cc.Sprite:create(s_pPathR1)
|
||||
root:addChild(target)
|
||||
target:setPosition(cc.p(s.width / 4, 0))
|
||||
|
||||
streak = cc.MotionStreak:create(2, 3, 32, cc.c3b(0, 255, 0), s_streak)
|
||||
layer:addChild(streak)
|
||||
|
||||
local a1 = cc.RotateBy:create(2, 360)
|
||||
|
||||
local action1 = cc.RepeatForever:create(a1)
|
||||
local motion = cc.MoveBy:create(2, cc.p(100,0))
|
||||
root:runAction(cc.RepeatForever:create(cc.Sequence:create(motion, motion:reverse())))
|
||||
root:runAction(action1)
|
||||
|
||||
local colorAction = cc.RepeatForever:create(cc.Sequence:create(cc.TintTo:create(0.2, 255, 0, 0),
|
||||
cc.TintTo:create(0.2, 0, 255, 0),
|
||||
cc.TintTo:create(0.2, 0, 0, 255),
|
||||
cc.TintTo:create(0.2, 0, 255, 255),
|
||||
cc.TintTo:create(0.2, 255, 255, 0),
|
||||
cc.TintTo:create(0.2, 255, 255, 255)))
|
||||
|
||||
streak:runAction(colorAction)
|
||||
|
||||
firstTick = true
|
||||
layer:registerScriptHandler(MotionStreakTest1_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("MotionStreak test 1")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- MotionStreakTest2
|
||||
-----------------------------------
|
||||
local function MotionStreakTest2()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
streak = cc.MotionStreak:create(3, 3, 64, cc.c3b(255, 255, 255), s_streak)
|
||||
layer:addChild(streak)
|
||||
|
||||
streak:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
|
||||
local function onTouchesMoved(touches, event)
|
||||
streak:setPosition( touches[1]:getLocation() )
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
local eventDispatcher = layer:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, layer)
|
||||
|
||||
Helper.titleLabel:setString("MotionStreak test")
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Issue1358
|
||||
-----------------------------------
|
||||
local Issue1358_entry = nil
|
||||
|
||||
local center = nil
|
||||
local fAngle = nil
|
||||
local fRadius = nil
|
||||
|
||||
local function Issue1358_update(dt)
|
||||
if firstTick == true then
|
||||
firstTick = false
|
||||
return
|
||||
end
|
||||
fAngle = fAngle + 1.0
|
||||
streak:setPosition(
|
||||
cc.p(center.x + math.cos(fAngle / 180 * math.pi) * fRadius, center.y + math.sin(fAngle/ 180 * math.pi) * fRadius))
|
||||
end
|
||||
|
||||
local function Issue1358_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
Issue1358_entry = scheduler:scheduleScriptFunc(Issue1358_update, 0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(Issue1358_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function Issue1358()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
streak = cc.MotionStreak:create(2.0, 1.0, 50.0, cc.c3b(255, 255, 0), "Images/Icon.png")
|
||||
layer:addChild(streak)
|
||||
|
||||
center = cc.p(s.width / 2, s.height / 2)
|
||||
fRadius = s.width / 3
|
||||
fAngle = 0
|
||||
|
||||
firstTick = true
|
||||
layer:registerScriptHandler(Issue1358_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("Issue 1358")
|
||||
Helper.subtitleLabel:setString("The tail should use the texture")
|
||||
return layer
|
||||
end
|
||||
|
||||
function MotionStreakTest()
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
MotionStreakTest1,
|
||||
MotionStreakTest2,
|
||||
Issue1358
|
||||
}
|
||||
|
||||
scene:addChild(MotionStreakTest1())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,708 @@
|
|||
local kTagSprite1 = 1
|
||||
local kTagSprite2 = 2
|
||||
local kTagSprite3 = 3
|
||||
local kTagSlider = 4
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local scheduler = cc.Director:getInstance():getScheduler()
|
||||
|
||||
local function getBaseLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
Helper.initWithLayer(layer)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- CameraCenterTest
|
||||
-----------------------------------
|
||||
local function CameraCenterTest()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
-- LEFT-TOP
|
||||
local sprite = cc.Sprite:create("Images/white-512x512.png")
|
||||
layer:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 5 * 1, s.height / 5 * 1))
|
||||
sprite:setColor(cc.c3b(255, 0, 0))
|
||||
sprite:setTextureRect(cc.rect(0, 0, 120, 50))
|
||||
local orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
-- [sprite setAnchorPoint: cc.p(0,1))
|
||||
|
||||
-- LEFT-BOTTOM
|
||||
sprite = cc.Sprite:create("Images/white-512x512.png")
|
||||
layer:addChild(sprite, 0, 40)
|
||||
sprite:setPosition(cc.p(s.width / 5 * 1, s.height / 5 * 4))
|
||||
sprite:setColor(cc.c3b(0, 0, 255))
|
||||
sprite:setTextureRect(cc.rect(0, 0, 120, 50))
|
||||
orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- RIGHT-TOP
|
||||
sprite = cc.Sprite:create("Images/white-512x512.png")
|
||||
layer:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 5 * 4, s.height / 5 * 1))
|
||||
sprite:setColor(cc.c3b(255, 255, 0))
|
||||
sprite:setTextureRect(cc.rect(0, 0, 120, 50))
|
||||
orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- RIGHT-BOTTOM
|
||||
sprite = cc.Sprite:create("Images/white-512x512.png")
|
||||
layer:addChild(sprite, 0, 40)
|
||||
sprite:setPosition(cc.p(s.width / 5 * 4, s.height / 5 * 4))
|
||||
sprite:setColor(cc.c3b(0, 255, 0))
|
||||
sprite:setTextureRect(cc.rect(0, 0, 120, 50))
|
||||
orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- CENTER
|
||||
sprite = cc.Sprite:create("Images/white-512x512.png")
|
||||
layer:addChild(sprite, 0, 40)
|
||||
sprite:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
sprite:setColor(cc.c3b(255, 255, 255))
|
||||
sprite:setTextureRect(cc.rect(0, 0, 120, 50))
|
||||
orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
Helper.titleLabel:setString("Camera Center test")
|
||||
Helper.subtitleLabel:setString("Sprites should rotate at the same speed")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Test2
|
||||
-----------------------------------
|
||||
local function Test2()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
local sp2 = cc.Sprite:create(s_pPathSister2)
|
||||
local sp3 = cc.Sprite:create(s_pPathSister1)
|
||||
local sp4 = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
sp1:setPosition(cc.p(100, s.height /2))
|
||||
sp2:setPosition(cc.p(380, s.height /2))
|
||||
layer:addChild(sp1)
|
||||
layer:addChild(sp2)
|
||||
|
||||
sp3:setScale(0.25)
|
||||
sp4:setScale(0.25)
|
||||
sp1:addChild(sp3)
|
||||
sp2:addChild(sp4)
|
||||
|
||||
local a1 = cc.RotateBy:create(2, 360)
|
||||
local a2 = cc.ScaleBy:create(2, 2)
|
||||
|
||||
local action1 = cc.RepeatForever:create(cc.Sequence:create(a1, a2, a2:reverse()))
|
||||
local action2 = cc.RepeatForever:create(cc.Sequence:create(a1:clone(), a2:clone(), a2:reverse()))
|
||||
|
||||
sp2:setAnchorPoint(cc.p(0,0))
|
||||
|
||||
sp1:runAction(action1)
|
||||
sp2:runAction(action2)
|
||||
|
||||
Helper.titleLabel:setString("anchorPoint and children")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Test4
|
||||
-----------------------------------
|
||||
local Test4_layer = nil
|
||||
local Test4_delay2Entry = nil
|
||||
local Test4_delay4Entry = nil
|
||||
|
||||
local function delay2(dt)
|
||||
node = Test4_layer:getChildByTag(2)
|
||||
local action1 = cc.RotateBy:create(1, 360)
|
||||
node:runAction(action1)
|
||||
end
|
||||
|
||||
local function delay4(dt)
|
||||
scheduler:unscheduleScriptEntry(Test4_delay4Entry)
|
||||
Test4_layer:removeChildByTag(3, false)
|
||||
end
|
||||
|
||||
local function Test4_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
Test4_delay2Entry = scheduler:scheduleScriptFunc(delay2, 2.0, false)
|
||||
Test4_delay4Entry = scheduler:scheduleScriptFunc(delay4, 4.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(Test4_delay2Entry)
|
||||
scheduler:unscheduleScriptEntry(Test4_delay4Entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function Test4()
|
||||
Test4_layer = getBaseLayer()
|
||||
|
||||
local sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
local sp2 = cc.Sprite:create(s_pPathSister2)
|
||||
sp1:setPosition(cc.p(100, 160))
|
||||
sp2:setPosition(cc.p(380, 160))
|
||||
|
||||
Test4_layer:addChild(sp1, 0, 2)
|
||||
Test4_layer:addChild(sp2, 0, 3)
|
||||
|
||||
Test4_layer:registerScriptHandler(Test4_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("tags")
|
||||
return Test4_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Test5
|
||||
-----------------------------------
|
||||
local Test5_entry = nil
|
||||
local Test5_layer = nil
|
||||
|
||||
local function Test5_addAndRemove(dt)
|
||||
local sp1 = Test5_layer:getChildByTag(kTagSprite1)
|
||||
local sp2 = Test5_layer:getChildByTag(kTagSprite2)
|
||||
|
||||
sp1:retain()
|
||||
sp2:retain()
|
||||
|
||||
Test5_layer:removeChild(sp1, false)
|
||||
Test5_layer:removeChild(sp2, true)
|
||||
|
||||
Test5_layer:addChild(sp1, 0, kTagSprite1)
|
||||
Test5_layer:addChild(sp2, 0, kTagSprite2)
|
||||
|
||||
sp1:release()
|
||||
sp2:release()
|
||||
end
|
||||
|
||||
local function Test5_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
Test5_entry = scheduler:scheduleScriptFunc(Test5_addAndRemove, 2.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(Test5_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function Test5()
|
||||
Test5_layer = getBaseLayer()
|
||||
|
||||
local sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
local sp2 = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
sp1:setPosition(cc.p(100, 160))
|
||||
sp2:setPosition(cc.p(380, 160))
|
||||
|
||||
local rot = cc.RotateBy:create(2, 360)
|
||||
local rot_back = rot:reverse()
|
||||
local forever = cc.RepeatForever:create(cc.Sequence:create(rot, rot_back))
|
||||
|
||||
local rot2 = cc.RotateBy:create(2, 360)
|
||||
local rot2_back = rot2:reverse()
|
||||
local forever2 = cc.RepeatForever:create(cc.Sequence:create(rot2, rot2_back))
|
||||
|
||||
forever:setTag(101)
|
||||
forever2:setTag(102)
|
||||
|
||||
Test5_layer:addChild(sp1, 0, kTagSprite1)
|
||||
Test5_layer:addChild(sp2, 0, kTagSprite2)
|
||||
|
||||
sp1:runAction(forever)
|
||||
sp2:runAction(forever2)
|
||||
|
||||
Test5_layer:registerScriptHandler(Test5_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("remove and cleanup")
|
||||
return Test5_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Test6
|
||||
-----------------------------------
|
||||
local Test6_entry = nil
|
||||
local Test6_layer = nil
|
||||
|
||||
local function Test6_addAndRemove(dt)
|
||||
local sp1 = Test6_layer:getChildByTag(kTagSprite1)
|
||||
local sp2 = Test6_layer:getChildByTag(kTagSprite2)
|
||||
|
||||
sp1:retain()
|
||||
sp2:retain()
|
||||
|
||||
Test6_layer:removeChild(sp1, false)
|
||||
Test6_layer:removeChild(sp2, true)
|
||||
|
||||
Test6_layer:addChild(sp1, 0, kTagSprite1)
|
||||
Test6_layer:addChild(sp2, 0, kTagSprite2)
|
||||
|
||||
sp1:release()
|
||||
sp2:release()
|
||||
end
|
||||
|
||||
local function Test6_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
Test6_entry = scheduler:scheduleScriptFunc(Test6_addAndRemove, 2.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(Test6_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function Test6()
|
||||
Test6_layer = getBaseLayer()
|
||||
|
||||
local sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
local sp11 = cc.Sprite:create(s_pPathSister1)
|
||||
|
||||
local sp2 = cc.Sprite:create(s_pPathSister2)
|
||||
local sp21 = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
sp1:setPosition(cc.p(100, 160))
|
||||
sp2:setPosition(cc.p(380, 160))
|
||||
|
||||
local rot = cc.RotateBy:create(2, 360)
|
||||
local rot_back = rot:reverse()
|
||||
local forever1 = cc.RepeatForever:create(cc.Sequence:create(rot, rot_back))
|
||||
local forever11 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
|
||||
local forever2 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
local forever21 = tolua.cast(forever1:clone(), "cc.RepeatForever")
|
||||
|
||||
Test6_layer:addChild(sp1, 0, kTagSprite1)
|
||||
sp1:addChild(sp11)
|
||||
Test6_layer:addChild(sp2, 0, kTagSprite2)
|
||||
sp2:addChild(sp21)
|
||||
|
||||
sp1:runAction(forever1)
|
||||
sp11:runAction(forever11)
|
||||
sp2:runAction(forever2)
|
||||
sp21:runAction(forever21)
|
||||
|
||||
Test6_layer:registerScriptHandler(Test6_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("remove/cleanup with children")
|
||||
return Test6_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- StressTest1
|
||||
-----------------------------------
|
||||
local StressTest1_entry = nil
|
||||
local StressTest1_layer = nil
|
||||
|
||||
local function removeMe(node)
|
||||
local parent = StressTest1_layer:getParent()
|
||||
parent:removeChild(node, true)
|
||||
Helper.nextAction()
|
||||
end
|
||||
|
||||
local function shouldNotCrash(dt)
|
||||
scheduler:unscheduleScriptEntry(StressTest1_entry)
|
||||
|
||||
-- if the node has timers, it crashes
|
||||
local explosion = cc.ParticleSun:create()
|
||||
explosion:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png"))
|
||||
|
||||
explosion:setPosition(s.width / 2, s.height / 2)
|
||||
|
||||
StressTest1_layer:setAnchorPoint(cc.p(0, 0))
|
||||
local callFunc = cc.CallFunc:create(removeMe)
|
||||
StressTest1_layer:runAction(cc.Sequence:create(cc.RotateBy:create(2, 360), callFunc))
|
||||
|
||||
StressTest1_layer:addChild(explosion)
|
||||
end
|
||||
|
||||
local function StressTest1_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
StressTest1_entry = scheduler:scheduleScriptFunc(shouldNotCrash, 1.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(StressTest1_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function StressTest1()
|
||||
StressTest1_layer = getBaseLayer()
|
||||
|
||||
sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
StressTest1_layer:addChild(sp1, 0, kTagSprite1)
|
||||
|
||||
sp1:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
|
||||
StressTest1_layer:registerScriptHandler(StressTest1_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("stress test #1: no crashes")
|
||||
return StressTest1_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- StressTest2
|
||||
-----------------------------------
|
||||
local StressTest2_entry = nil
|
||||
local StressTest2_layer = nil
|
||||
|
||||
local function shouldNotLeak(dt)
|
||||
scheduler:unscheduleScriptEntry(StressTest2_entry)
|
||||
|
||||
local sublayer = StressTest2_layer:getChildByTag(kTagSprite1)
|
||||
sublayer:removeAllChildrenWithCleanup(true)
|
||||
end
|
||||
|
||||
local function StressTest2_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
StressTest2_entry = scheduler:scheduleScriptFunc(shouldNotLeak, 6.0, false)
|
||||
elseif tag == "exit" then
|
||||
scheduler:unscheduleScriptEntry(StressTest2_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function StressTest2()
|
||||
StressTest2_layer = getBaseLayer()
|
||||
|
||||
sublayer = cc.Layer:create()
|
||||
|
||||
local sp1 = cc.Sprite:create(s_pPathSister1)
|
||||
sp1:setPosition(cc.p(80, s.height / 2))
|
||||
|
||||
local move = cc.MoveBy:create(3, cc.p(350, 0))
|
||||
local move_ease_inout3 = cc.EaseInOut:create(cc.MoveBy:create(3, cc.p(350, 0)), 2.0)
|
||||
local move_ease_inout_back3 = move_ease_inout3:reverse()
|
||||
local seq3 = cc.Sequence:create(move_ease_inout3, move_ease_inout_back3)
|
||||
sp1:runAction(cc.RepeatForever:create(seq3))
|
||||
sublayer:addChild(sp1, 1)
|
||||
|
||||
local fire = cc.ParticleFire:create()
|
||||
fire:setTexture(cc.Director:getInstance():getTextureCache():addImage("Images/fire.png"))
|
||||
fire = tolua.cast(fire, "cc.Node")
|
||||
fire:setPosition(80, s.height / 2 - 50)
|
||||
|
||||
local copy_seq3 = tolua.cast(seq3:clone(), "cc.Sequence")
|
||||
fire:runAction(cc.RepeatForever:create(copy_seq3))
|
||||
sublayer:addChild(fire, 2)
|
||||
|
||||
StressTest2_layer:registerScriptHandler(StressTest2_onEnterOrExit)
|
||||
|
||||
StressTest2_layer:addChild(sublayer, 0, kTagSprite1)
|
||||
|
||||
Helper.titleLabel:setString("stress test #2: no leaks")
|
||||
return StressTest2_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- NodeToWorld
|
||||
-----------------------------------
|
||||
local function NodeToWorld()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
-- This code tests that nodeToParent works OK:
|
||||
-- - It tests different anchor Points
|
||||
-- - It tests different children anchor points
|
||||
|
||||
local back = cc.Sprite:create(s_back3)
|
||||
layer:addChild(back, -10)
|
||||
back:setAnchorPoint(cc.p(0, 0))
|
||||
local backSize = back:getContentSize()
|
||||
|
||||
local item = cc.MenuItemImage:create(s_PlayNormal, s_PlaySelect)
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(item)
|
||||
menu:alignItemsVertically()
|
||||
menu:setPosition(cc.p(backSize.width / 2, backSize.height / 2))
|
||||
back:addChild(menu)
|
||||
|
||||
local rot = cc.RotateBy:create(5, 360)
|
||||
local fe = cc.RepeatForever:create(rot)
|
||||
item:runAction(fe)
|
||||
|
||||
local move = cc.MoveBy:create(3, cc.p(200, 0))
|
||||
local move_back = move:reverse()
|
||||
local seq = cc.Sequence:create(move, move_back)
|
||||
local fe2 = cc.RepeatForever:create(seq)
|
||||
back:runAction(fe2)
|
||||
|
||||
Helper.titleLabel:setString("nodeToParent transform")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- CameraOrbitTest
|
||||
-----------------------------------
|
||||
local function CameraOrbitTest_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION3_D)
|
||||
elseif tag == "exit" then
|
||||
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION2_D)
|
||||
end
|
||||
end
|
||||
|
||||
local function CameraOrbitTest()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
local p = cc.Sprite:create(s_back3)
|
||||
layer:addChild(p, 0)
|
||||
p:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
p:setOpacity(128)
|
||||
|
||||
-- LEFT
|
||||
local s = p:getContentSize()
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
sprite:setScale(0.5)
|
||||
p:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 1, s.height / 2))
|
||||
local orbit = cc.OrbitCamera:create(2, 1, 0, 0, 360, 0, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- CENTER
|
||||
sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
sprite:setScale(1.0)
|
||||
p:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 2, s.height / 2))
|
||||
orbit = cc.OrbitCamera:create(2, 1, 0, 0, 360, 45, 0)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- RIGHT
|
||||
sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
sprite:setScale(2.0)
|
||||
p:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 3, s.height / 2))
|
||||
local ss = sprite:getContentSize()
|
||||
orbit = cc.OrbitCamera:create(2, 1, 0, 0, 360, 90, -45)
|
||||
sprite:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
-- PARENT
|
||||
orbit = cc.OrbitCamera:create(10, 1, 0, 0, 360, 0, 90)
|
||||
p:runAction(cc.RepeatForever:create(orbit))
|
||||
|
||||
layer:setScale(1)
|
||||
|
||||
Helper.titleLabel:setString("Camera Orbit test")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- CameraZoomTest
|
||||
-----------------------------------
|
||||
local z = 0
|
||||
local CameraZoomTest_layer = nil
|
||||
local CameraZoomTest_entry = nil
|
||||
|
||||
local function CameraZoomTest_update(dt)
|
||||
z = z + dt * 100
|
||||
|
||||
local sprite = CameraZoomTest_layer:getChildByTag(20)
|
||||
-- local cam = sprite:getCamera()
|
||||
-- cam:setEye(0, 0, z)
|
||||
|
||||
sprite = CameraZoomTest_layer:getChildByTag(40)
|
||||
-- cam = sprite:getCamera()
|
||||
-- cam:setEye(0, 0, -z)
|
||||
end
|
||||
|
||||
local function CameraZoomTest_onEnterOrExit(tag)
|
||||
if tag == "enter" then
|
||||
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION3_D)
|
||||
CameraZoomTest_entry = scheduler:scheduleScriptFunc(CameraZoomTest_update, 0.0, false)
|
||||
elseif tag == "exit" then
|
||||
cc.Director:getInstance():setProjection(cc.DIRECTOR_PROJECTION2_D)
|
||||
scheduler:unscheduleScriptEntry(CameraZoomTest_entry)
|
||||
end
|
||||
end
|
||||
|
||||
local function CameraZoomTest()
|
||||
CameraZoomTest_layer = getBaseLayer()
|
||||
|
||||
z = 0
|
||||
|
||||
-- LEFT
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
CameraZoomTest_layer:addChild(sprite, 0)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 1, s.height / 2))
|
||||
-- local cam = sprite:getCamera()
|
||||
-- cam:setEye(0, 0, 415 / 2)
|
||||
-- cam:setCenter(0, 0, 0)
|
||||
|
||||
-- CENTER
|
||||
sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
CameraZoomTest_layer:addChild(sprite, 0, 40)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 2, s.height / 2))
|
||||
|
||||
-- RIGHT
|
||||
sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
CameraZoomTest_layer:addChild(sprite, 0, 20)
|
||||
sprite:setPosition(cc.p(s.width / 4 * 3, s.height / 2))
|
||||
|
||||
CameraZoomTest_layer:scheduleUpdateWithPriorityLua(CameraZoomTest_update, 0)
|
||||
CameraZoomTest_layer:registerScriptHandler(CameraZoomTest_onEnterOrExit)
|
||||
|
||||
Helper.titleLabel:setString("Camera Zoom test")
|
||||
return CameraZoomTest_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- ConvertToNode
|
||||
-----------------------------------
|
||||
local ConvertToNode_layer = nil
|
||||
|
||||
local function ConvertToNode()
|
||||
ConvertToNode_layer = getBaseLayer()
|
||||
|
||||
local rotate = cc.RotateBy:create(10, 360)
|
||||
local action = cc.RepeatForever:create(rotate)
|
||||
for i = 0, 2 do
|
||||
local sprite = cc.Sprite:create("Images/grossini.png")
|
||||
sprite:setPosition(cc.p(s.width / 4 * (i + 1), s.height / 2))
|
||||
|
||||
local point = cc.Sprite:create("Images/r1.png")
|
||||
point:setScale(0.25)
|
||||
point:setPosition(sprite:getPosition())
|
||||
ConvertToNode_layer:addChild(point, 10, 100 + i)
|
||||
|
||||
if i == 0 then
|
||||
sprite:setAnchorPoint(cc.p(0, 0))
|
||||
elseif i == 1 then
|
||||
sprite:setAnchorPoint(cc.p(0.5, 0.5))
|
||||
elseif i == 2 then
|
||||
sprite:setAnchorPoint(cc.p(1,1))
|
||||
end
|
||||
|
||||
point:setPosition(sprite:getPosition())
|
||||
|
||||
local copy = tolua.cast(action:clone(), "cc.RepeatForever")
|
||||
sprite:runAction(copy)
|
||||
ConvertToNode_layer:addChild(sprite, i)
|
||||
end
|
||||
|
||||
local function onTouchesEnded(touches, event)
|
||||
local count = table.getn(touches)
|
||||
for i = 1, count do
|
||||
local location = touches[i]:getLocation()
|
||||
for j = 1,3 do
|
||||
local node = ConvertToNode_layer:getChildByTag(100 + i - 1)
|
||||
local p1, p2
|
||||
p1 = node:convertToNodeSpaceAR(location)
|
||||
p2 = node:convertToNodeSpace(location)
|
||||
|
||||
cclog("AR: x=" .. p1.x .. ", y=" .. p1.y .. " -- Not AR: x=" .. p2.x .. ", y=" .. p2.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesEnded,cc.Handler.EVENT_TOUCHES_ENDED )
|
||||
local eventDispatcher = ConvertToNode_layer:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ConvertToNode_layer)
|
||||
|
||||
Helper.titleLabel:setString("Convert To Node Space")
|
||||
Helper.subtitleLabel:setString("testing convertToNodeSpace / AR. Touch and see console")
|
||||
return ConvertToNode_layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- NodeOpaqueTest
|
||||
-----------------------------------
|
||||
local function NodeOpaqueTest()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
for i = 0, 49 do
|
||||
local background = cc.Sprite:create("Images/background1.png")
|
||||
background:setBlendFunc(gl.ONE, gl.ONE_MINUS_SRC_ALPHA)
|
||||
background:setAnchorPoint(cc.p(0, 0))
|
||||
layer:addChild(background)
|
||||
end
|
||||
|
||||
Helper.titleLabel:setString("Node Opaque Test")
|
||||
Helper.subtitleLabel:setString("Node rendered with GL_BLEND disabled")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- NodeNonOpaqueTest
|
||||
-----------------------------------
|
||||
local function NodeNonOpaqueTest()
|
||||
local layer = getBaseLayer()
|
||||
|
||||
for i = 0, 49 do
|
||||
background = cc.Sprite:create("Images/background1.jpg")
|
||||
background:setBlendFunc(gl.ONE, gl.ZERO)
|
||||
background:setAnchorPoint(cc.p(0, 0))
|
||||
layer:addChild(background)
|
||||
end
|
||||
Helper.titleLabel:setString("Node Non Opaque Test")
|
||||
Helper.subtitleLabel:setString("Node rendered with GL_BLEND enabled")
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- NodeGlobalZValueTest
|
||||
-----------------------------------
|
||||
local function NodeGlobalZValueTest()
|
||||
local layer = getBaseLayer()
|
||||
Helper.titleLabel:setString("Global Z Value")
|
||||
Helper.subtitleLabel:setString("Center Sprite should change go from foreground to background")
|
||||
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local zOrderSprite = nil
|
||||
for i = 1,9 do
|
||||
local parent = cc.Node:create()
|
||||
local sprite = nil
|
||||
if i == 5 then
|
||||
sprite = cc.Sprite:create("Images/grossinis_sister2.png")
|
||||
sprite:setGlobalZOrder(-1)
|
||||
zOrderSprite = sprite
|
||||
else
|
||||
sprite = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
end
|
||||
parent:addChild(sprite)
|
||||
layer:addChild(parent)
|
||||
|
||||
local w = sprite:getContentSize().width
|
||||
sprite:setPosition(s.width/2 - w*0.7*(i - 6),s.height / 2)
|
||||
end
|
||||
|
||||
local accum = 0
|
||||
|
||||
local function update(dt)
|
||||
accum = accum + dt
|
||||
if accum > 1 then
|
||||
local z = zOrderSprite:getGlobalZOrder()
|
||||
zOrderSprite:setGlobalZOrder(-z)
|
||||
accum = 0
|
||||
end
|
||||
end
|
||||
|
||||
local function onNodeEvent(tag)
|
||||
if tag == "exit" then
|
||||
layer:unscheduleUpdate()
|
||||
end
|
||||
end
|
||||
layer:scheduleUpdateWithPriorityLua(update,0)
|
||||
layer:registerScriptHandler(onNodeEvent)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
|
||||
|
||||
function CocosNodeTest()
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
CameraCenterTest,
|
||||
Test2,
|
||||
Test4,
|
||||
Test5,
|
||||
Test6,
|
||||
StressTest1,
|
||||
StressTest2,
|
||||
NodeToWorld,
|
||||
CameraOrbitTest,
|
||||
CameraZoomTest,
|
||||
ConvertToNode,
|
||||
NodeOpaqueTest,
|
||||
NodeNonOpaqueTest,
|
||||
NodeGlobalZValueTest,
|
||||
}
|
||||
|
||||
scene:addChild(CameraCenterTest())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,158 @@
|
|||
local kTagNode = 0
|
||||
local kTagGrossini = 1
|
||||
|
||||
local function createParallaxLayer(title, subtitle)
|
||||
local layer = cc.Layer:create()
|
||||
Helper.initWithLayer(layer)
|
||||
local titleStr = title == nil and "No title" or title
|
||||
local subTitleStr = subtitle == nil and "" or subtitle
|
||||
Helper.titleLabel:setString(titleStr)
|
||||
Helper.subtitleLabel:setString(subTitleStr)
|
||||
return layer
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Parallax1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
local function Parallax1()
|
||||
local ret = createParallaxLayer("Parallax: parent and 3 children")
|
||||
-- Top Layer, a simple image
|
||||
local cocosImage = cc.Sprite:create(s_Power)
|
||||
-- scale the image (optional)
|
||||
cocosImage:setScale( 2.5 )
|
||||
-- change the transform anchor point to 0,0 (optional)
|
||||
cocosImage:setAnchorPoint( cc.p(0,0) )
|
||||
|
||||
|
||||
-- Middle layer: a Tile map atlas
|
||||
local tilemap = cc.TileMapAtlas:create(s_TilesPng, s_LevelMapTga, 16, 16)
|
||||
tilemap:releaseMap()
|
||||
|
||||
-- change the transform anchor to 0,0 (optional)
|
||||
tilemap:setAnchorPoint( cc.p(0, 0) )
|
||||
|
||||
-- Anti Aliased images
|
||||
tilemap:getTexture():setAntiAliasTexParameters()
|
||||
|
||||
|
||||
-- background layer: another image
|
||||
local background = cc.Sprite:create(s_back)
|
||||
-- scale the image (optional)
|
||||
background:setScale( 1.5 )
|
||||
-- change the transform anchor point (optional)
|
||||
background:setAnchorPoint( cc.p(0,0) )
|
||||
|
||||
|
||||
-- create a void node, a parent node
|
||||
local voidNode = cc.ParallaxNode:create()
|
||||
|
||||
-- NOW add the 3 layers to the 'void' node
|
||||
|
||||
-- background image is moved at a ratio of 0.4x, 0.5y
|
||||
voidNode:addChild(background, -1, cc.p(0.4,0.5), cc.p(0,0))
|
||||
|
||||
-- tiles are moved at a ratio of 2.2x, 1.0y
|
||||
voidNode:addChild(tilemap, 1, cc.p(2.2,1.0), cc.p(0,-200) )
|
||||
|
||||
-- top image is moved at a ratio of 3.0x, 2.5y
|
||||
voidNode:addChild(cocosImage, 2, cc.p(3.0,2.5), cc.p(200,800) )
|
||||
|
||||
|
||||
-- now create some actions that will move the 'void' node
|
||||
-- and the children of the 'void' node will move at different
|
||||
-- speed, thus, simulation the 3D environment
|
||||
local goUp = cc.MoveBy:create(4, cc.p(0,-500) )
|
||||
local goDown = goUp:reverse()
|
||||
local go = cc.MoveBy:create(8, cc.p(-1000,0) )
|
||||
local goBack = go:reverse()
|
||||
local seq = cc.Sequence:create(goUp, go, goDown, goBack)
|
||||
voidNode:runAction( (cc.RepeatForever:create(seq) ))
|
||||
|
||||
ret:addChild( voidNode )
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- Parallax2
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
local function Parallax2()
|
||||
local ret = createParallaxLayer("Parallax: drag screen")
|
||||
|
||||
-- Top Layer, a simple image
|
||||
local cocosImage = cc.Sprite:create(s_Power)
|
||||
-- scale the image (optional)
|
||||
cocosImage:setScale( 2.5 )
|
||||
-- change the transform anchor point to 0,0 (optional)
|
||||
cocosImage:setAnchorPoint( cc.p(0,0) )
|
||||
|
||||
|
||||
-- Middle layer: a Tile map atlas
|
||||
local tilemap = cc.TileMapAtlas:create(s_TilesPng, s_LevelMapTga, 16, 16)
|
||||
tilemap:releaseMap()
|
||||
|
||||
-- change the transform anchor to 0,0 (optional)
|
||||
tilemap:setAnchorPoint( cc.p(0, 0) )
|
||||
|
||||
-- Anti Aliased images
|
||||
tilemap:getTexture():setAntiAliasTexParameters()
|
||||
|
||||
|
||||
-- background layer: another image
|
||||
local background = cc.Sprite:create(s_back)
|
||||
-- scale the image (optional)
|
||||
background:setScale( 1.5 )
|
||||
-- change the transform anchor point (optional)
|
||||
background:setAnchorPoint( cc.p(0,0) )
|
||||
|
||||
|
||||
-- create a void node, a parent node
|
||||
local voidNode = cc.ParallaxNode:create()
|
||||
|
||||
-- NOW add the 3 layers to the 'void' node
|
||||
|
||||
-- background image is moved at a ratio of 0.4x, 0.5y
|
||||
voidNode:addChild(background, -1, cc.p(0.4,0.5), cc.p(0, 0))
|
||||
|
||||
-- tiles are moved at a ratio of 1.0, 1.0y
|
||||
voidNode:addChild(tilemap, 1, cc.p(1.0,1.0), cc.p(0,-200) )
|
||||
|
||||
-- top image is moved at a ratio of 3.0x, 2.5y
|
||||
voidNode:addChild( cocosImage, 2, cc.p(3.0,2.5), cc.p(200,1000) )
|
||||
ret:addChild(voidNode, 0, kTagNode)
|
||||
|
||||
local function onTouchesMoved(touches, event)
|
||||
local diff = touches[1]:getDelta()
|
||||
|
||||
local node = ret:getChildByTag(kTagNode)
|
||||
local currentPosX, currentPosY = node:getPosition()
|
||||
node:setPosition(cc.p(currentPosX + diff.x, currentPosY + diff.y))
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
function ParallaxTestMain()
|
||||
cclog("ParallaxMain")
|
||||
Helper.index = 1
|
||||
cc.Director:getInstance():setDepthTest(true)
|
||||
local scene = cc.Scene:create()
|
||||
|
||||
Helper.createFunctionTable = {
|
||||
Parallax1,
|
||||
Parallax2
|
||||
}
|
||||
scene:addChild(Parallax1())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,550 @@
|
|||
local kMaxNodes = 50000
|
||||
local kBasicZOrder = 10
|
||||
local kNodesIncrease = 250
|
||||
local TEST_COUNT = 7
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
-----------------------------------
|
||||
-- For test functions
|
||||
-----------------------------------
|
||||
local function performanceActions(sprite)
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
|
||||
local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
|
||||
local rot = cc.RotateBy:create(period, 360.0 * math.random())
|
||||
local rot = cc.RotateBy:create(period, 360.0 * math.random())
|
||||
local permanentRotation = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(rot, rot:reverse()))
|
||||
sprite:runAction(permanentRotation)
|
||||
|
||||
local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
|
||||
local grow = cc.ScaleBy:create(growDuration, 0.5, 0.5)
|
||||
local permanentScaleLoop = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(grow, grow:reverse()))
|
||||
sprite:runAction(permanentScaleLoop)
|
||||
end
|
||||
|
||||
local function performanceActions20(sprite)
|
||||
if math.random() < 0.2 then
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
else
|
||||
sprite:setPosition(cc.p(-1000, -1000))
|
||||
end
|
||||
|
||||
local period = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
|
||||
local rot = cc.RotateBy:create(period, 360.0 * math.random())
|
||||
local permanentRotation = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(rot, rot:reverse()))
|
||||
sprite:runAction(permanentRotation)
|
||||
|
||||
local growDuration = 0.5 + math.mod(math.random(1, 99999999), 1000) / 500.0
|
||||
local grow = cc.ScaleBy:create(growDuration, 0.5, 0.5)
|
||||
local permanentScaleLoop = cc.RepeatForever:create(cc.Sequence:createWithTwoActions(grow, grow:reverse()))
|
||||
sprite:runAction(permanentScaleLoop)
|
||||
end
|
||||
|
||||
local function performanceRotationScale(sprite)
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
sprite:setRotation(math.random() * 360)
|
||||
sprite:setScale(math.random() * 2)
|
||||
end
|
||||
|
||||
local function performancePosition(sprite)
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
end
|
||||
|
||||
local function performanceout20(sprite)
|
||||
if math.random() < 0.2 then
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
else
|
||||
sprite:setPosition(cc.p(-1000, -1000))
|
||||
end
|
||||
end
|
||||
|
||||
local function performanceOut100(sprite)
|
||||
sprite:setPosition(cc.p( -1000, -1000))
|
||||
end
|
||||
|
||||
local function performanceScale(sprite)
|
||||
sprite:setPosition(cc.p(math.mod(math.random(1, 99999999), s.width), math.mod(math.random(1, 99999999), s.height)))
|
||||
sprite:setScale(math.random() * 100 / 50)
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- Subtest
|
||||
-----------------------------------
|
||||
local subtestNumber = 1
|
||||
local batchNode = nil -- cc.SpriteBatchNode
|
||||
local parent = nil -- cc.Node
|
||||
|
||||
local function initWithSubTest(nSubTest, p)
|
||||
subtestNumber = nSubTest
|
||||
parent = p
|
||||
batchNode = nil
|
||||
|
||||
local mgr = cc.Director:getInstance():getTextureCache()
|
||||
-- remove all texture
|
||||
mgr:removeTexture(mgr:addImage("Images/grossinis_sister1.png"))
|
||||
mgr:removeTexture(mgr:addImage("Images/grossini_dance_atlas.png"))
|
||||
mgr:removeTexture(mgr:addImage("Images/spritesheet1.png"))
|
||||
|
||||
if subtestNumber == 2 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
elseif subtestNumber == 3 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/grossinis_sister1.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
elseif subtestNumber == 5 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
elseif subtestNumber == 6 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/grossini_dance_atlas.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
elseif subtestNumber == 8 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
elseif subtestNumber == 9 then
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A4444)
|
||||
batchNode = cc.SpriteBatchNode:create("Images/spritesheet1.png", 100)
|
||||
p:addChild(batchNode, 0)
|
||||
end
|
||||
|
||||
-- todo
|
||||
if batchNode ~= nil then
|
||||
batchNode:retain()
|
||||
end
|
||||
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT)
|
||||
end
|
||||
|
||||
local function createSpriteWithTag(tag)
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
|
||||
local sprite = nil
|
||||
if subtestNumber == 1 then
|
||||
sprite = cc.Sprite:create("Images/grossinis_sister1.png")
|
||||
parent:addChild(sprite, -1, tag + 100)
|
||||
elseif subtestNumber == 2 then
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(0, 0, 52, 139))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
elseif subtestNumber == 3 then
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(0, 0, 52, 139))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
elseif subtestNumber == 4 then
|
||||
local idx = math.floor((math.random() * 1400 / 100)) + 1
|
||||
local num
|
||||
if idx < 10 then
|
||||
num = "0" .. idx
|
||||
else
|
||||
num = idx
|
||||
end
|
||||
local str = "Images/grossini_dance_" .. num .. ".png"
|
||||
sprite = cc.Sprite:create(str)
|
||||
parent:addChild(sprite, -1, tag + 100)
|
||||
elseif subtestNumber == 5 then
|
||||
local y, x
|
||||
local r = math.floor(math.random() * 1400 / 100)
|
||||
y = math.floor(r / 5)
|
||||
x = math.mod(r, 5)
|
||||
x = x * 85
|
||||
y = y * 121
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 85, 121))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
elseif subtestNumber == 6 then
|
||||
local y, x
|
||||
local r = math.floor(math.random() * 1400 / 100)
|
||||
y = math.floor(r / 5)
|
||||
x = math.mod(r, 5)
|
||||
x = x * 85
|
||||
y = y * 121
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 85, 121))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
elseif subtestNumber == 7 then
|
||||
local y, x
|
||||
local r = math.floor(math.random() * 6400 / 100)
|
||||
y = math.floor(r / 8)
|
||||
x = math.mod(r, 8)
|
||||
local str = "Images/sprites_test/sprite-"..x.."-"..y..".png"
|
||||
sprite = cc.Sprite:create(str)
|
||||
parent:addChild(sprite, -1, tag + 100)
|
||||
elseif subtestNumber == 8 then
|
||||
local y, x
|
||||
local r = math.floor(math.random() * 6400 / 100)
|
||||
y = math.floor(r / 8)
|
||||
x = math.mod(r, 8)
|
||||
x = x * 32
|
||||
y = y * 32
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 32, 32))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
elseif subtestNumber == 9 then
|
||||
local y, x
|
||||
local r = math.floor(math.random() * 6400 / 100)
|
||||
y = math.floor(r / 8)
|
||||
x = math.mod(r, 8)
|
||||
x = x * 32
|
||||
y = y * 32
|
||||
sprite = cc.Sprite:createWithTexture(batchNode:getTexture(), cc.rect(x, y, 32, 32))
|
||||
batchNode:addChild(sprite, 0, tag + 100)
|
||||
end
|
||||
|
||||
cc.Texture2D:setDefaultAlphaPixelFormat(cc.TEXTURE_PIXELFORMAT_DEFAULT)
|
||||
|
||||
return sprite
|
||||
end
|
||||
|
||||
local function removeByTag(tag)
|
||||
if subtestNumber == 1 then
|
||||
parent:removeChildByTag(tag + 100, true)
|
||||
elseif subtestNumber == 4 then
|
||||
parent:removeChildByTag(tag + 100, true)
|
||||
elseif subtestNumber == 7 then
|
||||
parent:removeChildByTag(tag + 100, true)
|
||||
else
|
||||
batchNode:removeChildAtIndex(tag, true)
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- PerformBasicLayer
|
||||
-----------------------------------
|
||||
local curCase = 0
|
||||
local maxCases = 7
|
||||
|
||||
local function showThisTest()
|
||||
local scene = CreateSpriteTestScene()
|
||||
cc.Director:getInstance():replaceScene(scene)
|
||||
end
|
||||
|
||||
local function backCallback(sender)
|
||||
subtestNumber = 1
|
||||
curCase = curCase - 1
|
||||
if curCase < 0 then
|
||||
curCase = curCase + maxCases
|
||||
end
|
||||
showThisTest()
|
||||
end
|
||||
|
||||
local function restartCallback(sender)
|
||||
subtestNumber = 1
|
||||
showThisTest()
|
||||
end
|
||||
|
||||
local function nextCallback(sender)
|
||||
subtestNumber = 1
|
||||
curCase = curCase + 1
|
||||
curCase = math.mod(curCase, maxCases)
|
||||
showThisTest()
|
||||
end
|
||||
|
||||
local function toPerformanceMainLayer(sender)
|
||||
cc.Director:getInstance():replaceScene(PerformanceTest())
|
||||
end
|
||||
|
||||
local function initWithLayer(layer, controlMenuVisible)
|
||||
cc.MenuItemFont:setFontName("Arial")
|
||||
cc.MenuItemFont:setFontSize(24)
|
||||
local mainItem = cc.MenuItemFont:create("Back")
|
||||
mainItem:registerScriptTapHandler(toPerformanceMainLayer)
|
||||
mainItem:setPosition(s.width - 50, 25)
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(mainItem)
|
||||
menu:setPosition(cc.p(0, 0))
|
||||
|
||||
if controlMenuVisible == true then
|
||||
local item1 = cc.MenuItemImage:create(s_pPathB1, s_pPathB2)
|
||||
local item2 = cc.MenuItemImage:create(s_pPathR1, s_pPathR2)
|
||||
local item3 = cc.MenuItemImage:create(s_pPathF1, s_pPathF2)
|
||||
item1:registerScriptTapHandler(backCallback)
|
||||
item2:registerScriptTapHandler(restartCallback)
|
||||
item3:registerScriptTapHandler(nextCallback)
|
||||
item1:setPosition(s.width / 2 - 100, 30)
|
||||
item2:setPosition(s.width / 2, 30)
|
||||
item3:setPosition(s.width / 2 + 100, 30)
|
||||
|
||||
menu:addChild(item1, kItemTagBasic)
|
||||
menu:addChild(item2, kItemTagBasic)
|
||||
menu:addChild(item3, kItemTagBasic)
|
||||
end
|
||||
layer:addChild(menu)
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpriteMainScene
|
||||
-----------------------------------
|
||||
local lastRenderedCount = nil
|
||||
local quantityNodes = nil
|
||||
|
||||
local infoLabel = nil
|
||||
local titleLabel = nil
|
||||
|
||||
local function testNCallback(tag)
|
||||
subtestNumber = tag - kBasicZOrder
|
||||
showThisTest()
|
||||
end
|
||||
|
||||
local function updateNodes()
|
||||
if quantityNodes ~= lastRenderedCount then
|
||||
local str = quantityNodes .. " nodes"
|
||||
infoLabel:setString(str)
|
||||
lastRenderedCount = quantityNodes
|
||||
end
|
||||
end
|
||||
|
||||
local function onDecrease(sender)
|
||||
if quantityNodes <= 0 then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 0, kNodesIncrease - 1 do
|
||||
quantityNodes = quantityNodes - 1
|
||||
removeByTag(quantityNodes)
|
||||
end
|
||||
updateNodes()
|
||||
end
|
||||
|
||||
local function onIncrease(sender)
|
||||
if quantityNodes >= kMaxNodes then
|
||||
return
|
||||
end
|
||||
|
||||
for i = 0, kNodesIncrease - 1 do
|
||||
local sprite = createSpriteWithTag(quantityNodes)
|
||||
|
||||
if curCase == 0 then
|
||||
doPerformSpriteTest1(sprite)
|
||||
elseif curCase == 1 then
|
||||
doPerformSpriteTest2(sprite)
|
||||
elseif curCase == 2 then
|
||||
doPerformSpriteTest3(sprite)
|
||||
elseif curCase == 3 then
|
||||
doPerformSpriteTest4(sprite)
|
||||
elseif curCase == 4 then
|
||||
doPerformSpriteTest5(sprite)
|
||||
elseif curCase == 5 then
|
||||
doPerformSpriteTest6(sprite)
|
||||
elseif curCase == 6 then
|
||||
doPerformSpriteTest7(sprite)
|
||||
end
|
||||
|
||||
quantityNodes = quantityNodes + 1
|
||||
end
|
||||
|
||||
updateNodes()
|
||||
end
|
||||
|
||||
local function initWithMainTest(scene, asubtest, nNodes)
|
||||
subtestNumber = asubtest
|
||||
initWithSubTest(asubtest, scene)
|
||||
|
||||
lastRenderedCount = 0
|
||||
quantityNodes = 0
|
||||
|
||||
cc.MenuItemFont:setFontSize(65)
|
||||
local decrease = cc.MenuItemFont:create(" - ")
|
||||
decrease:registerScriptTapHandler(onDecrease)
|
||||
decrease:setColor(cc.c3b(0, 200, 20))
|
||||
local increase = cc.MenuItemFont:create(" + ")
|
||||
increase:registerScriptTapHandler(onIncrease)
|
||||
increase:setColor(cc.c3b(0, 200, 20))
|
||||
|
||||
local menu = cc.Menu:create()
|
||||
menu:addChild(decrease)
|
||||
menu:addChild(increase)
|
||||
menu:alignItemsHorizontally()
|
||||
menu:setPosition(s.width / 2, s.height - 65)
|
||||
scene:addChild(menu, 1)
|
||||
|
||||
infoLabel = cc.LabelTTF:create("0 nodes", "Marker Felt", 30)
|
||||
infoLabel:setColor(cc.c3b(0, 200, 20))
|
||||
infoLabel:setPosition(s.width / 2, s.height - 90)
|
||||
scene:addChild(infoLabel, 1)
|
||||
|
||||
maxCases = TEST_COUNT
|
||||
|
||||
-- Sub Tests
|
||||
cc.MenuItemFont:setFontSize(32)
|
||||
subMenu = cc.Menu:create()
|
||||
for i = 1, 9 do
|
||||
local str = i .. " "
|
||||
local itemFont = cc.MenuItemFont:create(str)
|
||||
itemFont:registerScriptTapHandler(testNCallback)
|
||||
--itemFont:setTag(i)
|
||||
subMenu:addChild(itemFont, kBasicZOrder + i, kBasicZOrder + i)
|
||||
|
||||
if i <= 3 then
|
||||
itemFont:setColor(cc.c3b(200, 20, 20))
|
||||
elseif i <= 6 then
|
||||
itemFont:setColor(cc.c3b(0, 200, 20))
|
||||
else
|
||||
itemFont:setColor(cc.c3b(0, 20, 200))
|
||||
end
|
||||
end
|
||||
|
||||
subMenu:alignItemsHorizontally()
|
||||
subMenu:setPosition(cc.p(s.width / 2, 80))
|
||||
scene:addChild(subMenu, 1)
|
||||
|
||||
-- add title label
|
||||
titleLabel = cc.LabelTTF:create("No title", "Arial", 40)
|
||||
scene:addChild(titleLabel, 1)
|
||||
titleLabel:setPosition(s.width / 2, s.height - 32)
|
||||
titleLabel:setColor(cc.c3b(255, 255, 40))
|
||||
|
||||
while quantityNodes < nNodes do
|
||||
onIncrease()
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest1
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest1(sprite)
|
||||
performancePosition(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer1()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "A (" .. subtestNumber .. ") position"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest2
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest2(sprite)
|
||||
performanceScale(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer2()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "B (" .. subtestNumber .. ") scale"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest3
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest3(sprite)
|
||||
performanceRotationScale(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer3()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "C (" .. subtestNumber .. ") scale + rot"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest4
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest4(sprite)
|
||||
performanceOut100(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer4()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "D (" .. subtestNumber .. ") 100% out"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest5
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest5(sprite)
|
||||
performanceout20(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer5()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "E (" .. subtestNumber .. ") 80% out"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest6
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest6(sprite)
|
||||
performanceActions(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer6()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "F (" .. subtestNumber .. ") actions"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- SpritePerformTest7
|
||||
-----------------------------------
|
||||
function doPerformSpriteTest7(sprite)
|
||||
performanceActions20(sprite)
|
||||
end
|
||||
|
||||
local function SpriteTestLayer7()
|
||||
local layer = cc.Layer:create()
|
||||
initWithLayer(layer, true)
|
||||
|
||||
local str = "G (" .. subtestNumber .. ") actions 80% out"
|
||||
titleLabel:setString(str)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
-----------------------------------
|
||||
-- PerformanceSpriteTest
|
||||
-----------------------------------
|
||||
function CreateSpriteTestScene()
|
||||
local scene = cc.Scene:create()
|
||||
initWithMainTest(scene, subtestNumber, kNodesIncrease)
|
||||
|
||||
if curCase == 0 then
|
||||
scene:addChild(SpriteTestLayer1())
|
||||
elseif curCase == 1 then
|
||||
scene:addChild(SpriteTestLayer2())
|
||||
elseif curCase == 2 then
|
||||
scene:addChild(SpriteTestLayer3())
|
||||
elseif curCase == 3 then
|
||||
scene:addChild(SpriteTestLayer4())
|
||||
elseif curCase == 4 then
|
||||
scene:addChild(SpriteTestLayer5())
|
||||
elseif curCase == 5 then
|
||||
scene:addChild(SpriteTestLayer6())
|
||||
elseif curCase == 6 then
|
||||
scene:addChild(SpriteTestLayer7())
|
||||
end
|
||||
|
||||
return scene
|
||||
end
|
||||
|
||||
function PerformanceSpriteTest()
|
||||
curCase = 0
|
||||
|
||||
return CreateSpriteTestScene()
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,616 @@
|
|||
-- Test #1 by Jason Booth (slipster216)
|
||||
-- Test #3 by David Deaco (ddeaco)
|
||||
|
||||
--/**
|
||||
-- * Impelmentation of RenderTextureSave
|
||||
--*/
|
||||
local function RenderTextureSave()
|
||||
local ret = createTestLayer("Touch the screen",
|
||||
"Press 'Save Image' to create an snapshot of the render texture")
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local target = nil
|
||||
local counter = 0
|
||||
local brushes = {}
|
||||
local function clearImage(tag, pSender)
|
||||
target:clear(math.random(), math.random(), math.random(), math.random())
|
||||
end
|
||||
|
||||
local function saveImage(tag, pSender)
|
||||
local png = string.format("image-%d.png", counter)
|
||||
local jpg = string.format("image-%d.jpg", counter)
|
||||
|
||||
target:saveToFile(png, cc.IMAGE_FORMAT_PNG)
|
||||
target:saveToFile(jpg, cc.IMAGE_FORMAT_JPEG)
|
||||
|
||||
local pImage = target:newImage()
|
||||
|
||||
local tex = cc.Director:getInstance():getTextureCache():addUIImage(pImage, png)
|
||||
|
||||
pImage:release()
|
||||
|
||||
local sprite = cc.Sprite:createWithTexture(tex)
|
||||
|
||||
sprite:setScale(0.3)
|
||||
ret:addChild(sprite)
|
||||
sprite:setPosition(cc.p(40, 40))
|
||||
sprite:setRotation(counter * 3)
|
||||
|
||||
cclog("Image saved %s and %s", png, jpg)
|
||||
counter = counter + 1
|
||||
end
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "exit" then
|
||||
target:release()
|
||||
cc.Director:getInstance():getTextureCache():removeUnusedTextures()
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
|
||||
-- create a render texture, this is what we are going to draw into
|
||||
target = cc.RenderTexture:create(s.width, s.height, cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
target:retain()
|
||||
target:setPosition(cc.p(s.width / 2, s.height / 2))
|
||||
|
||||
-- note that the render texture is a cc.Node, and contains a sprite of its texture for convience,
|
||||
-- so we can just parent it to the scene like any other cc.Node
|
||||
ret:addChild(target, -1)
|
||||
|
||||
local function onTouchesMoved(touches, event)
|
||||
local start = touches[1]:getLocation()
|
||||
local ended = touches[1]:getPreviousLocation()
|
||||
|
||||
target:begin()
|
||||
|
||||
local distance = cc.pGetDistance(start, ended)
|
||||
if distance > 1 then
|
||||
brushes = {}
|
||||
local d = distance
|
||||
local i = 0
|
||||
|
||||
for i = 0,d -1 do
|
||||
-- create a brush image to draw into the texture with
|
||||
local sprite = cc.Sprite:create("Images/fire.png")
|
||||
sprite:setColor(cc.c3b(255, 0, 0))
|
||||
sprite:setOpacity(20)
|
||||
brushes[i + 1] = sprite
|
||||
end
|
||||
|
||||
for i = 0,d -1 do
|
||||
local difx = ended.x - start.x
|
||||
local dify = ended.y - start.y
|
||||
local delta = i / distance
|
||||
brushes[i + 1]:setPosition(cc.p(start.x + (difx * delta), start.y + (dify * delta)))
|
||||
brushes[i + 1]:setRotation(math.random(0, 359))
|
||||
local r = math.random(0, 49) / 50.0 + 0.25
|
||||
brushes[i + 1]:setScale(r)
|
||||
|
||||
-- Use cc.RANDOM_0_1() will cause error when loading libtests.so on android, I don't know why.
|
||||
brushes[i + 1]:setColor(cc.c3b(math.random(0, 126) + 128, 255, 255))
|
||||
-- Call visit to draw the brush, don't call draw..
|
||||
brushes[i + 1]:visit()
|
||||
end
|
||||
end
|
||||
|
||||
-- finish drawing and return context back to the screen
|
||||
target:endToLua()
|
||||
end
|
||||
|
||||
local listener = cc.EventListenerTouchAllAtOnce:create()
|
||||
listener:registerScriptHandler(onTouchesMoved,cc.Handler.EVENT_TOUCHES_MOVED )
|
||||
local eventDispatcher = ret:getEventDispatcher()
|
||||
eventDispatcher:addEventListenerWithSceneGraphPriority(listener, ret)
|
||||
-- Save Image menu
|
||||
cc.MenuItemFont:setFontSize(16)
|
||||
local item1 = cc.MenuItemFont:create("Save Image")
|
||||
item1:registerScriptTapHandler(saveImage)
|
||||
local item2 = cc.MenuItemFont:create("Clear")
|
||||
item2:registerScriptTapHandler(clearImage)
|
||||
local menu = cc.Menu:create(item1, item2)
|
||||
ret:addChild(menu)
|
||||
menu:alignItemsVertically()
|
||||
menu:setPosition(cc.p(VisibleRect:rightTop().x - 80, VisibleRect:rightTop().y - 30))
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
|
||||
--/**
|
||||
-- * Impelmentation of RenderTextureIssue937
|
||||
--*/
|
||||
|
||||
-- local function RenderTextureIssue937()
|
||||
|
||||
-- /*
|
||||
-- * 1 2
|
||||
-- * A: A1 A2
|
||||
-- *
|
||||
-- * B: B1 B2
|
||||
-- *
|
||||
-- * A1: premulti sprite
|
||||
-- * A2: premulti render
|
||||
-- *
|
||||
-- * B1: non-premulti sprite
|
||||
-- * B2: non-premulti render
|
||||
-- */
|
||||
-- local background = cc.LayerColor:create(cc.c4b(200,200,200,255))
|
||||
-- addChild(background)
|
||||
|
||||
-- local spr_premulti = cc.Sprite:create("Images/fire.png")
|
||||
-- spr_premulti:setPosition(cc.p(16,48))
|
||||
|
||||
-- local spr_nonpremulti = cc.Sprite:create("Images/fire.png")
|
||||
-- spr_nonpremulti:setPosition(cc.p(16,16))
|
||||
|
||||
|
||||
|
||||
|
||||
-- /* A2 & B2 setup */
|
||||
-- local rend = cc.RenderTexture:create(32, 64, cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
|
||||
-- if (NULL == rend)
|
||||
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- -- It's possible to modify the RenderTexture blending function by
|
||||
-- -- [[rend sprite] setBlendFunc:(BlendFunc) GL_ONE, GL_ONE_MINUS_SRC_ALPHAend]
|
||||
|
||||
-- rend:begin()
|
||||
-- spr_premulti:visit()
|
||||
-- spr_nonpremulti:visit()
|
||||
-- rend:end()
|
||||
|
||||
-- local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
-- --/* A1: setup */
|
||||
-- spr_premulti:setPosition(cc.p(s.width/2-16, s.height/2+16))
|
||||
-- --/* B1: setup */
|
||||
-- spr_nonpremulti:setPosition(cc.p(s.width/2-16, s.height/2-16))
|
||||
|
||||
-- rend:setPosition(cc.p(s.width/2+16, s.height/2))
|
||||
|
||||
-- addChild(spr_nonpremulti)
|
||||
-- addChild(spr_premulti)
|
||||
-- addChild(rend)
|
||||
-- end
|
||||
|
||||
-- local function title()
|
||||
|
||||
-- return "Testing issue #937"
|
||||
-- end
|
||||
|
||||
-- local function subtitle()
|
||||
|
||||
-- return "All images should be equal..."
|
||||
-- end
|
||||
|
||||
-- local function runThisTest()
|
||||
|
||||
-- local pLayer = nextTestCase()
|
||||
-- addChild(pLayer)
|
||||
|
||||
-- cc.Director:getInstance():replaceScene(this)
|
||||
-- end
|
||||
|
||||
-- --/**
|
||||
-- -- * Impelmentation of RenderTextureZbuffer
|
||||
-- --*/
|
||||
|
||||
-- local function RenderTextureZbuffer()
|
||||
|
||||
-- this:setTouchEnabled(true)
|
||||
-- local size = cc.Director:getInstance():getWinSize()
|
||||
-- local label = cc.LabelTTF:create("vertexZ = 50", "Marker Felt", 64)
|
||||
-- label:setPosition(cc.p(size.width / 2, size.height * 0.25))
|
||||
-- this:addChild(label)
|
||||
|
||||
-- local label2 = cc.LabelTTF:create("vertexZ = 0", "Marker Felt", 64)
|
||||
-- label2:setPosition(cc.p(size.width / 2, size.height * 0.5))
|
||||
-- this:addChild(label2)
|
||||
|
||||
-- local label3 = cc.LabelTTF:create("vertexZ = -50", "Marker Felt", 64)
|
||||
-- label3:setPosition(cc.p(size.width / 2, size.height * 0.75))
|
||||
-- this:addChild(label3)
|
||||
|
||||
-- label:setVertexZ(50)
|
||||
-- label2:setVertexZ(0)
|
||||
-- label3:setVertexZ(-50)
|
||||
|
||||
-- cc.SpriteFrameCache:getInstance():addSpriteFramesWithFile("Images/bugs/circle.plist")
|
||||
-- mgr = cc.SpriteBatchNode:create("Images/bugs/circle.png", 9)
|
||||
-- this:addChild(mgr)
|
||||
-- sp1 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp2 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp3 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp4 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp5 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp6 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp7 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp8 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
-- sp9 = cc.Sprite:createWithSpriteFrameName("circle.png")
|
||||
|
||||
-- mgr:addChild(sp1, 9)
|
||||
-- mgr:addChild(sp2, 8)
|
||||
-- mgr:addChild(sp3, 7)
|
||||
-- mgr:addChild(sp4, 6)
|
||||
-- mgr:addChild(sp5, 5)
|
||||
-- mgr:addChild(sp6, 4)
|
||||
-- mgr:addChild(sp7, 3)
|
||||
-- mgr:addChild(sp8, 2)
|
||||
-- mgr:addChild(sp9, 1)
|
||||
|
||||
-- sp1:setVertexZ(400)
|
||||
-- sp2:setVertexZ(300)
|
||||
-- sp3:setVertexZ(200)
|
||||
-- sp4:setVertexZ(100)
|
||||
-- sp5:setVertexZ(0)
|
||||
-- sp6:setVertexZ(-100)
|
||||
-- sp7:setVertexZ(-200)
|
||||
-- sp8:setVertexZ(-300)
|
||||
-- sp9:setVertexZ(-400)
|
||||
|
||||
-- sp9:setScale(2)
|
||||
-- sp9:setColor(cc.c3b::YELLOW)
|
||||
-- end
|
||||
|
||||
-- local function title()
|
||||
|
||||
-- return "Testing Z Buffer in Render Texture"
|
||||
-- end
|
||||
|
||||
-- local function subtitle()
|
||||
|
||||
-- return "Touch screen. It should be green"
|
||||
-- end
|
||||
|
||||
-- local function ccTouchesBegan(cocos2d:cc.Set *touches, cocos2d:cc.Event *event)
|
||||
|
||||
-- cc.SetIterator iter
|
||||
-- cc.Touch *touch
|
||||
-- for (iter = touches:begin() iter != touches:end() ++iter)
|
||||
|
||||
-- touch = (cc.Touch *)(*iter)
|
||||
-- local location = touch:getLocation()
|
||||
|
||||
-- sp1:setPosition(location)
|
||||
-- sp2:setPosition(location)
|
||||
-- sp3:setPosition(location)
|
||||
-- sp4:setPosition(location)
|
||||
-- sp5:setPosition(location)
|
||||
-- sp6:setPosition(location)
|
||||
-- sp7:setPosition(location)
|
||||
-- sp8:setPosition(location)
|
||||
-- sp9:setPosition(location)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local function ccTouchesMoved(cc.const std::vector<Touch*>& touches, cc.Event* event)
|
||||
|
||||
-- cc.SetIterator iter
|
||||
-- cc.Touch *touch
|
||||
-- for (iter = touches:begin() iter != touches:end() ++iter)
|
||||
|
||||
-- touch = (cc.Touch *)(*iter)
|
||||
-- local location = touch:getLocation()
|
||||
|
||||
-- sp1:setPosition(location)
|
||||
-- sp2:setPosition(location)
|
||||
-- sp3:setPosition(location)
|
||||
-- sp4:setPosition(location)
|
||||
-- sp5:setPosition(location)
|
||||
-- sp6:setPosition(location)
|
||||
-- sp7:setPosition(location)
|
||||
-- sp8:setPosition(location)
|
||||
-- sp9:setPosition(location)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local function ccTouchesEnded(cc.const std::vector<Touch*>& touches, cc.Event* event)
|
||||
|
||||
-- this:renderScreenShot()
|
||||
-- end
|
||||
|
||||
-- local function renderScreenShot()
|
||||
|
||||
-- local texture = cc.RenderTexture:create(512, 512)
|
||||
-- if (NULL == texture)
|
||||
|
||||
-- return
|
||||
-- end
|
||||
-- texture:setAnchorPoint(cc.p(0, 0))
|
||||
-- texture:begin()
|
||||
|
||||
-- this:visit()
|
||||
|
||||
-- texture:end()
|
||||
|
||||
-- local sprite = cc.Sprite:createWithTexture(texture:getSprite():getTexture())
|
||||
|
||||
-- sprite:setPosition(cc.p(256, 256))
|
||||
-- sprite:setOpacity(182)
|
||||
-- sprite:setFlipY(1)
|
||||
-- this:addChild(sprite, 999999)
|
||||
-- sprite:setColor(cc.c3b::GREEN)
|
||||
|
||||
-- sprite:runAction(cc.Sequence:create(cc.FadeTo:create(2, 0),
|
||||
-- cc.Hide:create(),
|
||||
-- NULL))
|
||||
-- end
|
||||
|
||||
-- -- RenderTextureTestDepthStencil
|
||||
|
||||
-- local function RenderTextureTestDepthStencil()
|
||||
|
||||
-- local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
-- local sprite = cc.Sprite:create("Images/fire.png")
|
||||
-- sprite:setPosition(cc.p(s.width * 0.25, 0))
|
||||
-- sprite:setScale(10)
|
||||
-- local rend = cc.RenderTexture:create(s.width, s.height, kcc.Texture2DPixelFormat_RGBA4444, GL_DEPTH24_STENCIL8)
|
||||
|
||||
-- glStencilMask(0xFF)
|
||||
-- rend:beginWithClear(0, 0, 0, 0, 0, 0)
|
||||
|
||||
-- --! mark sprite quad into stencil buffer
|
||||
-- glEnable(GL_STENCIL_TEST)
|
||||
-- glStencilFunc(GL_ALWAYS, 1, 0xFF)
|
||||
-- glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE)
|
||||
-- glColorMask(0, 0, 0, 1)
|
||||
-- sprite:visit()
|
||||
|
||||
-- --! move sprite half width and height, and draw only where not marked
|
||||
-- sprite:setPosition(cc.p__add(sprite:getPosition(), cc.p__mul(cc.p(sprite:getContentSize().width * sprite:getScale(), sprite:getContentSize().height * sprite:getScale()), 0.5)))
|
||||
-- glStencilFunc(GL_NOTEQUAL, 1, 0xFF)
|
||||
-- glColorMask(1, 1, 1, 1)
|
||||
-- sprite:visit()
|
||||
|
||||
-- rend:end()
|
||||
|
||||
-- glDisable(GL_STENCIL_TEST)
|
||||
|
||||
-- rend:setPosition(cc.p(s.width * 0.5, s.height * 0.5))
|
||||
|
||||
-- this:addChild(rend)
|
||||
-- end
|
||||
|
||||
-- local function title()
|
||||
|
||||
-- return "Testing depthStencil attachment"
|
||||
-- end
|
||||
|
||||
-- local function subtitle()
|
||||
|
||||
-- return "Circle should be missing 1/4 of its region"
|
||||
-- end
|
||||
|
||||
-- -- RenderTextureTest
|
||||
-- local function RenderTextureTargetNode()
|
||||
|
||||
-- /*
|
||||
-- * 1 2
|
||||
-- * A: A1 A2
|
||||
-- *
|
||||
-- * B: B1 B2
|
||||
-- *
|
||||
-- * A1: premulti sprite
|
||||
-- * A2: premulti render
|
||||
-- *
|
||||
-- * B1: non-premulti sprite
|
||||
-- * B2: non-premulti render
|
||||
-- */
|
||||
-- local background = cc.LayerColor:create(cc.c4b(40,40,40,255))
|
||||
-- addChild(background)
|
||||
|
||||
-- -- sprite 1
|
||||
-- sprite1 = cc.Sprite:create("Images/fire.png")
|
||||
|
||||
-- -- sprite 2
|
||||
-- sprite2 = cc.Sprite:create("Images/fire_rgba8888.pvr")
|
||||
|
||||
-- local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
-- /* Create the render texture */
|
||||
-- local renderTexture = cc.RenderTexture:create(s.width, s.height, kcc.Texture2DPixelFormat_RGBA4444)
|
||||
-- this:renderTexture = renderTexture
|
||||
|
||||
-- renderTexture:setPosition(cc.p(s.width/2, s.height/2))
|
||||
-- -- [renderTexture setPosition:cc.p(s.width, s.height)]
|
||||
-- -- renderTexture.scale = 2
|
||||
|
||||
-- /* add the sprites to the render texture */
|
||||
-- renderTexture:addChild(sprite1)
|
||||
-- renderTexture:addChild(sprite2)
|
||||
-- renderTexture:setClearColor(cc.c4f(0, 0, 0, 0))
|
||||
-- renderTexture:setClearFlags(GL_COLOR_BUFFER_BIT)
|
||||
|
||||
-- /* add the render texture to the scene */
|
||||
-- addChild(renderTexture)
|
||||
|
||||
-- renderTexture:setAutoDraw(true)
|
||||
|
||||
-- scheduleUpdate()
|
||||
|
||||
-- -- Toggle clear on / off
|
||||
-- local item = cc.MenuItemFont:create("Clear On/Off", this, menu_selector(RenderTextureTargetNode:touched))
|
||||
-- local menu = cc.Menu:create(item, NULL)
|
||||
-- addChild(menu)
|
||||
|
||||
-- menu:setPosition(cc.p(s.width/2, s.height/2))
|
||||
-- end
|
||||
|
||||
-- local function touched(cc.Object* sender)
|
||||
|
||||
-- if (renderTexture:getClearFlags() == 0)
|
||||
|
||||
-- renderTexture:setClearFlags(GL_COLOR_BUFFER_BIT)
|
||||
-- end
|
||||
-- else
|
||||
|
||||
-- renderTexture:setClearFlags(0)
|
||||
-- renderTexture:setClearColor(cc.c4f( cc.RANDOM_0_1(), cc.RANDOM_0_1(), cc.RANDOM_0_1(), 1))
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local function update(float dt)
|
||||
|
||||
-- static float time = 0
|
||||
-- float r = 80
|
||||
-- sprite1:setPosition(cc.p(cosf(time * 2) * r, sinf(time * 2) * r))
|
||||
-- sprite2:setPosition(cc.p(sinf(time * 2) * r, cosf(time * 2) * r))
|
||||
|
||||
-- time += dt
|
||||
-- end
|
||||
|
||||
-- local function title()
|
||||
|
||||
-- return "Testing Render Target Node"
|
||||
-- end
|
||||
|
||||
-- local function subtitle()
|
||||
|
||||
-- return "Sprites should be equal and move with each frame"
|
||||
-- end
|
||||
|
||||
-- -- SpriteRenderTextureBug
|
||||
|
||||
-- local function SimpleSprite() : rt(NULL) {}
|
||||
|
||||
-- local function SimpleSprite* SpriteRenderTextureBug:SimpleSprite:create(const char* filename, const cc.rect &rect)
|
||||
|
||||
-- SimpleSprite *sprite = new SimpleSprite()
|
||||
-- if (sprite && sprite:initWithFile(filename, rect))
|
||||
|
||||
-- sprite:autorelease()
|
||||
-- end
|
||||
-- else
|
||||
|
||||
-- cc._SAFE_DELETE(sprite)
|
||||
-- end
|
||||
|
||||
-- return sprite
|
||||
-- end
|
||||
|
||||
-- local function SimpleSprite:draw()
|
||||
|
||||
-- if (rt == NULL)
|
||||
|
||||
-- local s = cc.Director:getInstance():getWinSize()
|
||||
-- rt = new cc.RenderTexture()
|
||||
-- rt:initWithWidthAndHeight(s.width, s.height, cc.TEXTURE2_D_PIXEL_FORMAT_RGB_A8888)
|
||||
-- end
|
||||
-- rt:beginWithClear(0.0, 0.0, 0.0, 1.0)
|
||||
-- rt:end()
|
||||
|
||||
-- cc._NODE_DRAW_SETUP()
|
||||
|
||||
-- BlendFunc blend = getBlendFunc()
|
||||
-- ccGLBlendFunc(blend.src, blend.dst)
|
||||
|
||||
-- ccGLBindTexture2D(getTexture():getName())
|
||||
|
||||
-- --
|
||||
-- -- Attributes
|
||||
-- --
|
||||
|
||||
-- ccGLEnableVertexAttribs(kcc.VertexAttribFlag_PosColorTex)
|
||||
|
||||
-- #define kQuadSize sizeof(m_sQuad.bl)
|
||||
-- long offset = (long)&m_sQuad
|
||||
|
||||
-- -- vertex
|
||||
-- int diff = offsetof( V3F_C4B_T2F, vertices)
|
||||
-- glVertexAttribPointer(kcc.VertexAttrib_Position, 3, GL_FLOAT, GL_FALSE, kQuadSize, (void*) (offset + diff))
|
||||
|
||||
-- -- texCoods
|
||||
-- diff = offsetof( V3F_C4B_T2F, texCoords)
|
||||
-- glVertexAttribPointer(kcc.VertexAttrib_TexCoords, 2, GL_FLOAT, GL_FALSE, kQuadSize, (void*)(offset + diff))
|
||||
|
||||
-- -- color
|
||||
-- diff = offsetof( V3F_C4B_T2F, colors)
|
||||
-- glVertexAttribPointer(kcc.VertexAttrib_Color, 4, GL_UNSIGNED_BYTE, GL_TRUE, kQuadSize, (void*)(offset + diff))
|
||||
|
||||
-- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4)
|
||||
-- end
|
||||
|
||||
-- local function SpriteRenderTextureBug()
|
||||
|
||||
-- setTouchEnabled(true)
|
||||
|
||||
-- local s = cc.Director:getInstance():getWinSize()
|
||||
-- addNewSpriteWithCoords(cc.p(s.width/2, s.height/2))
|
||||
-- end
|
||||
|
||||
-- local function SimpleSprite* SpriteRenderTextureBug:addNewSpriteWithCoords(const cc.p& p)
|
||||
|
||||
-- int idx = cc.RANDOM_0_1() * 1400 / 100
|
||||
-- int x = (idx%5) * 85
|
||||
-- int y = (idx/5) * 121
|
||||
|
||||
-- SpriteRenderTextureBug:SimpleSprite *sprite = SpriteRenderTextureBug:SimpleSprite:create("Images/grossini_dance_atlas.png",
|
||||
-- cc.rect(x,y,85,121))
|
||||
-- addChild(sprite)
|
||||
|
||||
-- sprite:setPosition(p)
|
||||
|
||||
-- local action = NULL
|
||||
-- float rd = cc.RANDOM_0_1()
|
||||
|
||||
-- if (rd < 0.20)
|
||||
-- action = cc.ScaleBy:create(3, 2)
|
||||
-- else if (rd < 0.40)
|
||||
-- action = cc.RotateBy:create(3, 360)
|
||||
-- else if (rd < 0.60)
|
||||
-- action = cc.Blink:create(1, 3)
|
||||
-- else if (rd < 0.8 )
|
||||
-- action = cc.TintBy:create(2, 0, -255, -255)
|
||||
-- else
|
||||
-- action = cc.FadeOut:create(2)
|
||||
|
||||
-- local action_back = action:reverse()
|
||||
-- local seq = cc.Sequence:create(action, action_back, NULL)
|
||||
|
||||
-- sprite:runAction(cc.RepeatForever:create(seq))
|
||||
|
||||
-- --return sprite
|
||||
-- return NULL
|
||||
-- end
|
||||
|
||||
-- local function ccTouchesEnded(cc.const std::vector<Touch*>& touches, cc.Event* event)
|
||||
|
||||
-- cc.SetIterator iter = touches:begin()
|
||||
-- for( iter != touches:end() ++iter)
|
||||
|
||||
-- local location = ((cc.Touch*)(*iter)):getLocation()
|
||||
-- addNewSpriteWithCoords(location)
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- local function title()
|
||||
|
||||
-- return "SpriteRenderTextureBug"
|
||||
-- end
|
||||
|
||||
-- local function subtitle()
|
||||
|
||||
-- return "Touch the screen. Sprite should appear on under the touch"
|
||||
-- end
|
||||
|
||||
function RenderTextureTestMain()
|
||||
cclog("RenderTextureTestMain")
|
||||
Helper.index = 1
|
||||
local scene = cc.Scene:create()
|
||||
Helper.createFunctionTable = {
|
||||
|
||||
RenderTextureSave,
|
||||
-- RenderTextureIssue937,
|
||||
-- RenderTextureZbuffer,
|
||||
-- RenderTextureTestDepthStencil,
|
||||
-- RenderTextureTargetNode,
|
||||
-- SpriteRenderTextureBug
|
||||
}
|
||||
scene:addChild(RenderTextureSave())
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,123 @@
|
|||
|
||||
local size = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function CreateSpriteLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local x, y
|
||||
x = size.width
|
||||
y = size.height
|
||||
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
local spriteSister1 = cc.Sprite:create(s_pPathSister1)
|
||||
local spriteSister2 = cc.Sprite:create(s_pPathSister2)
|
||||
|
||||
sprite:setScale(1.5)
|
||||
spriteSister1:setScale(1.5)
|
||||
spriteSister2:setScale(1.5)
|
||||
|
||||
sprite:setPosition(cc.p(x / 2, y / 2))
|
||||
spriteSister1:setPosition(cc.p(40, y / 2))
|
||||
spriteSister2:setPosition(cc.p(x - 40, y / 2))
|
||||
|
||||
layer:addChild(sprite)
|
||||
layer:addChild(spriteSister1)
|
||||
layer:addChild(spriteSister2)
|
||||
|
||||
local rot = cc.RotateBy:create(16, -3600)
|
||||
sprite:runAction(rot)
|
||||
|
||||
local jump1 = cc.JumpBy:create(4, cc.p(-400, 0), 100, 4)
|
||||
local jump2 = jump1:reverse()
|
||||
|
||||
local rot1 = cc.RotateBy:create(4, 360 * 2)
|
||||
local rot2 = rot1:reverse()
|
||||
|
||||
local jump3 = cc.JumpBy:create(4, cc.p(-400, 0), 100, 4)
|
||||
local jump4 = jump3:reverse()
|
||||
local rot3 = cc.RotateBy:create(4, 360 * 2)
|
||||
local rot4 = rot3:reverse()
|
||||
|
||||
spriteSister1:runAction(cc.Repeat:create(cc.Sequence:create(jump2, jump1), 5))
|
||||
spriteSister2:runAction(cc.Repeat:create(cc.Sequence:create(jump3, jump4), 5))
|
||||
|
||||
spriteSister1:runAction(cc.Repeat:create(cc.Sequence:create(rot1, rot2), 5))
|
||||
spriteSister2:runAction(cc.Repeat:create(cc.Sequence:create(rot4, rot3), 5))
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local function CreateTestLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local x, y
|
||||
x = size.width
|
||||
y = size.height
|
||||
|
||||
local label = cc.LabelTTF:create("cocos2d", "Tahoma", 64)
|
||||
label:setPosition(x / 2, y / 2)
|
||||
layer:addChild(label)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
local function CreateRotateWorldLayer()
|
||||
local layer = cc.Layer:create()
|
||||
|
||||
local x, y
|
||||
x = size.width
|
||||
y = size.height
|
||||
|
||||
local blue = cc.LayerColor:create(cc.c4b(0,0,255,255))
|
||||
local red = cc.LayerColor:create(cc.c4b(255,0,0,255))
|
||||
local green = cc.LayerColor:create(cc.c4b(0,255,0,255))
|
||||
local white = cc.LayerColor:create(cc.c4b(255,255,255,255))
|
||||
|
||||
blue:setScale(0.5)
|
||||
blue:setPosition(cc.p(- x / 4, - y / 4))
|
||||
blue:addChild(CreateSpriteLayer())
|
||||
|
||||
red:setScale(0.5)
|
||||
red:setPosition(cc.p(x / 4, - y / 4))
|
||||
|
||||
green:setScale(0.5)
|
||||
green:setPosition(cc.p(- x / 4, y / 4))
|
||||
green:addChild(CreateTestLayer())
|
||||
|
||||
white:setScale(0.5)
|
||||
white:setPosition(cc.p(x / 4, y / 4))
|
||||
white:ignoreAnchorPointForPosition(false)
|
||||
white:setPosition(cc.p(x / 4 * 3, y / 4 * 3))
|
||||
|
||||
layer:addChild(blue, -1)
|
||||
layer:addChild(white)
|
||||
layer:addChild(green)
|
||||
layer:addChild(red)
|
||||
|
||||
local rot = cc.RotateBy:create(8, 720)
|
||||
local rot1 = cc.RotateBy:create(8, 720)
|
||||
local rot2 = cc.RotateBy:create(8, 720)
|
||||
local rot3 = cc.RotateBy:create(8, 720)
|
||||
|
||||
blue:runAction(rot)
|
||||
red:runAction(rot1)
|
||||
green:runAction(rot2)
|
||||
white:runAction(rot3)
|
||||
|
||||
return layer
|
||||
end
|
||||
|
||||
--------------------------------
|
||||
-- Rotate World Test
|
||||
--------------------------------
|
||||
function RotateWorldTest()
|
||||
cclog("RotateWorldTest")
|
||||
local scene = cc.Scene:create()
|
||||
local layer = CreateRotateWorldLayer()
|
||||
|
||||
scene:addChild(layer)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
scene:runAction(cc.RotateBy:create(4, -360))
|
||||
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,180 @@
|
|||
local MID_PUSHSCENE = 100
|
||||
local MID_PUSHSCENETRAN = 101
|
||||
local MID_QUIT = 102
|
||||
local MID_REPLACESCENE = 103
|
||||
local MID_REPLACESCENETRAN = 104
|
||||
local MID_GOBACK = 105
|
||||
|
||||
local SceneTestLayer1 = nil
|
||||
local SceneTestLayer2 = nil
|
||||
local SceneTestLayer3 = nil
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- SceneTestLayer1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
SceneTestLayer1 = function()
|
||||
local ret = cc.Layer:create()
|
||||
|
||||
local function onPushScene(tag, pSender)
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SceneTestLayer2()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene( scene )
|
||||
end
|
||||
|
||||
local function onPushSceneTran(tag, pSender)
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SceneTestLayer2()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():pushScene( cc.TransitionSlideInT:create(1, scene) )
|
||||
end
|
||||
|
||||
|
||||
local function onQuit(tag, pSender)
|
||||
cclog("onQuit")
|
||||
end
|
||||
|
||||
local item1 = cc.MenuItemFont:create( "Test pushScene")
|
||||
item1:registerScriptTapHandler(onPushScene)
|
||||
local item2 = cc.MenuItemFont:create( "Test pushScene w/transition")
|
||||
item2:registerScriptTapHandler(onPushSceneTran)
|
||||
local item3 = cc.MenuItemFont:create( "Quit")
|
||||
item3:registerScriptTapHandler(onQuit)
|
||||
|
||||
local menu = cc.Menu:create(item1, item2, item3)
|
||||
menu:alignItemsVertically()
|
||||
|
||||
ret:addChild( menu )
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(sprite)
|
||||
sprite:setPosition( cc.p(s.width-40, s.height/2) )
|
||||
local rotate = cc.RotateBy:create(2, 360)
|
||||
local repeatAction = cc.RepeatForever:create(rotate)
|
||||
sprite:runAction(repeatAction)
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
cclog("SceneTestLayer1#onEnter")
|
||||
elseif event == "enterTransitionFinish" then
|
||||
cclog("SceneTestLayer1#onEnterTransitionDidFinish")
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- SceneTestLayer2
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
SceneTestLayer2 = function()
|
||||
local ret = cc.Layer:create()
|
||||
local m_timeCounter = 0
|
||||
|
||||
local function onGoBack(tag, pSender)
|
||||
cc.Director:getInstance():popScene()
|
||||
end
|
||||
|
||||
local function onReplaceScene(tag, pSender)
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SceneTestLayer3()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():replaceScene( scene )
|
||||
end
|
||||
|
||||
|
||||
local function onReplaceSceneTran(tag, pSender)
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SceneTestLayer3()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
cc.Director:getInstance():replaceScene( cc.TransitionFlipX:create(2, scene) )
|
||||
end
|
||||
|
||||
local item1 = cc.MenuItemFont:create( "replaceScene")
|
||||
item1:registerScriptTapHandler(onReplaceScene)
|
||||
local item2 = cc.MenuItemFont:create( "replaceScene w/transition")
|
||||
item2:registerScriptTapHandler(onReplaceSceneTran)
|
||||
local item3 = cc.MenuItemFont:create( "Go Back")
|
||||
item3:registerScriptTapHandler(onGoBack)
|
||||
local menu = cc.Menu:create(item1, item2, item3)
|
||||
menu:alignItemsVertically()
|
||||
|
||||
ret:addChild( menu )
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(sprite)
|
||||
sprite:setPosition( cc.p(s.width-40, s.height/2) )
|
||||
local rotate = cc.RotateBy:create(2, 360)
|
||||
local repeat_action = cc.RepeatForever:create(rotate)
|
||||
sprite:runAction(repeat_action)
|
||||
|
||||
return ret
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- SceneTestLayer3
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
SceneTestLayer3 = function()
|
||||
local ret = cc.LayerColor:create(cc.c4b(0,0,255,255))
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
|
||||
local function item0Clicked(tag, pSender)
|
||||
local newScene = cc.Scene:create()
|
||||
newScene:addChild(SceneTestLayer3())
|
||||
cc.Director:getInstance():pushScene(cc.TransitionFade:create(0.5, newScene, cc.c3b(0,255,255)))
|
||||
end
|
||||
|
||||
local function item1Clicked(tag, pSender)
|
||||
cc.Director:getInstance():popScene()
|
||||
end
|
||||
|
||||
local function item2Clicked(tag, pSender)
|
||||
cc.Director:getInstance():popToRootScene()
|
||||
end
|
||||
|
||||
local item0 = cc.MenuItemFont:create("Touch to pushScene (self)")
|
||||
item0:registerScriptTapHandler(item0Clicked)
|
||||
local item1 = cc.MenuItemFont:create("Touch to popScene")
|
||||
item1:registerScriptTapHandler(item1Clicked)
|
||||
local item2 = cc.MenuItemFont:create("Touch to popToRootScene")
|
||||
item2:registerScriptTapHandler(item2Clicked)
|
||||
|
||||
local menu = cc.Menu:create(item0, item1, item2)
|
||||
ret:addChild(menu)
|
||||
menu:alignItemsVertically()
|
||||
|
||||
local sprite = cc.Sprite:create(s_pPathGrossini)
|
||||
ret:addChild(sprite)
|
||||
sprite:setPosition( cc.p(s.width/2, 40) )
|
||||
local rotate = cc.RotateBy:create(2, 360)
|
||||
local repeatAction = cc.RepeatForever:create(rotate)
|
||||
sprite:runAction(repeatAction)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
|
||||
function SceneTestMain()
|
||||
cclog("SceneTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SceneTestLayer1()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
|
@ -0,0 +1,82 @@
|
|||
local SpineTestLayer1 = nil
|
||||
|
||||
|
||||
--------------------------------------------------------------------
|
||||
--
|
||||
-- SpineTestLayer1
|
||||
--
|
||||
--------------------------------------------------------------------
|
||||
|
||||
SpineTestLayer1 = function()
|
||||
local ret = cc.Layer:create()
|
||||
|
||||
local s = cc.Director:getInstance():getWinSize()
|
||||
local spineboy
|
||||
|
||||
local addSpineBoy = function()
|
||||
spineboy = sp.SkeletonAnimation:create(s_pPathSpineBoyJson, s_pPathSpineBoyAtlas, 0.8)
|
||||
ret:addChild(spineboy)
|
||||
spineboy:setPosition(cc.p(s.width/2, 20))
|
||||
spineboy:setMix("walk", "jump", 0.2)
|
||||
spineboy:setMix("jump", "walk", 0.4)
|
||||
spineboy:setTimeScale(0.3)
|
||||
spineboy:setDebugBones(true)
|
||||
spineboy:setAnimation(0, 'walk', false)
|
||||
spineboy:addAnimation(0, 'jump', false)
|
||||
spineboy:addAnimation(0, 'walk', true)
|
||||
spineboy:addAnimation(0, 'jump', true, 4)
|
||||
|
||||
spineboy:registerSpineEventHandler(function(event)
|
||||
if event.type == 'start' then
|
||||
print(string.format("[spine] %d start: %s",
|
||||
event.trackIndex,
|
||||
event.animation))
|
||||
elseif event.type == 'end' then
|
||||
print(string.format("[spine] %d end: %s",
|
||||
event.trackIndex,
|
||||
event.animation))
|
||||
elseif event.type == 'complete' then
|
||||
print(string.format("[spine] %d complete: %s, %d",
|
||||
event.trackIndex,
|
||||
event.animation,
|
||||
event.loopCount))
|
||||
elseif event.type == 'event' then
|
||||
print(string.format("[spine] %d event: %s, %s: %d, %f, %s",
|
||||
event.trackIndex,
|
||||
event.animation,
|
||||
event.eventData.name,
|
||||
event.eventData.intValue,
|
||||
event.eventData.floatValue,
|
||||
event.eventData.stringValue))
|
||||
end
|
||||
end)
|
||||
|
||||
spineboy:runAction(cc.RepeatForever:create(cc.Sequence:create(cc.FadeOut:create(1),
|
||||
cc.FadeIn:create(1),
|
||||
cc.DelayTime:create(5))))
|
||||
|
||||
|
||||
end
|
||||
|
||||
local function onNodeEvent(event)
|
||||
if event == "enter" then
|
||||
cclog("SpineTestLayer1#onEnter")
|
||||
addSpineBoy()
|
||||
elseif event == "enterTransitionFinish" then
|
||||
cclog("SceneTestLayer1#onEnterTransitionDidFinish")
|
||||
end
|
||||
end
|
||||
|
||||
ret:registerScriptHandler(onNodeEvent)
|
||||
return ret
|
||||
end
|
||||
|
||||
|
||||
function SpineTestMain()
|
||||
cclog("SpineTestMain")
|
||||
local scene = cc.Scene:create()
|
||||
local layer = SpineTestLayer1()
|
||||
scene:addChild(layer, 0)
|
||||
scene:addChild(CreateBackMenuItem())
|
||||
return scene
|
||||
end
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче