Update the FastTileMapTest and VideoPlayerTest

This commit is contained in:
samuele3hu 2014-07-17 12:55:28 +08:00
parent 6f109f330f
commit eb8d1d70f7
4 changed files with 95 additions and 32 deletions

View File

@ -1,7 +1,7 @@
ccexprimental = ccexprimental or {}
ccexp = ccexp or {}
ccexprimental.VideoPlayerEvent = {
ccexp.VideoPlayerEvent = {
PLAYING = 0,
PAUSED = 1,
STOPPED= 2,

View File

@ -144,7 +144,7 @@ local function TMXOrthoTest()
--local color = cc.LayerColor:create( cc.c4b(64,64,64,255) )
--addChild(color, -1)
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test2.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test2.tmx")
layer:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -178,7 +178,7 @@ end
local function TMXOrthoTest2()
local layer = createTileDemoLayer("TMX Ortho test2")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test1.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test1.tmx")
layer:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -195,7 +195,7 @@ end
--------------------------------------------------------------------
local function TMXOrthoTest3()
local layer = createTileDemoLayer("TMX anchorPoint test")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test3.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test3.tmx")
layer:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -214,7 +214,7 @@ end
--------------------------------------------------------------------
local function TMXOrthoTest4()
local ret = createTileDemoLayer("TMX width/height test")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test4.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test4.tmx")
ret:addChild(map, 0, kTagTileMap)
local s1 = map:getContentSize()
@ -277,7 +277,7 @@ local function TMXReadWriteTest()
local ret = createTileDemoLayer("TMX Read/Write test")
local m_gid = 0
local m_gid2 = 0
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test2.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test2.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -437,7 +437,7 @@ local function TMXIsoTest()
local color = cc.LayerColor:create( cc.c4b(64,64,64,255) )
ret:addChild(color, -1)
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test.tmx")
ret:addChild(map, 0, kTagTileMap)
-- move map to the center of the screen
@ -457,7 +457,7 @@ local function TMXIsoTest1()
local color = cc.LayerColor:create( cc.c4b(64,64,64,255) )
ret:addChild(color, -1)
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test1.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test1.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -477,7 +477,7 @@ local function TMXIsoTest2()
local color = cc.LayerColor:create( cc.c4b(64,64,64,255) )
ret:addChild(color, -1)
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test2.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test2.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -500,7 +500,7 @@ local function TMXUncompressedTest()
local color = cc.LayerColor:create( cc.c4b(64,64,64,255) )
ret:addChild(color, -1)
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test2-uncompressed.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test2-uncompressed.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -521,7 +521,7 @@ end
--------------------------------------------------------------------
local function TMXTilesetTest()
local ret = createTileDemoLayer("TMX Tileset test")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test5.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test5.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -537,7 +537,7 @@ end
--------------------------------------------------------------------
local function TMXOrthoObjectsTest()
local ret = createTileDemoLayer("TMX Ortho object test", "You should see a white box around the 3 platforms")
local map = cc.FastTMXTiledMap:create("TileMaps/ortho-objects.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/ortho-objects.tmx")
ret:addChild(map, -1, kTagTileMap)
local s = map:getContentSize()
@ -610,7 +610,7 @@ end
local function TMXIsoObjectsTest()
local ret = createTileDemoLayer("TMX Iso object test", "You need to parse them manually. See bug #810")
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test-objectgroup.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test-objectgroup.tmx")
ret:addChild(map, -1, kTagTileMap)
local s = map:getContentSize()
@ -679,7 +679,7 @@ end
local function TMXResizeTest()
local ret = createTileDemoLayer("TMX resize test", "Should not crash. Testing issue #740")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test5.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test5.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -705,7 +705,7 @@ end
local function TMXIsoZorder()
local m_tamara = nil
local ret = createTileDemoLayer("TMX Iso Zorder", "Sprite should hide behind the trees")
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test-zorder.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test-zorder.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -765,7 +765,7 @@ end
local function TMXOrthoZorder()
local m_tamara = nil
local ret = createTileDemoLayer("TMX Ortho Zorder", "Sprite should hide behind the trees")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test-zorder.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test-zorder.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -823,7 +823,7 @@ end
local function TMXIsoVertexZ()
local m_tamara = nil
local ret = createTileDemoLayer("TMX Iso VertexZ", "Sprite should hide behind the trees")
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test-vertexz.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test-vertexz.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -878,7 +878,7 @@ end
local function TMXOrthoVertexZ()
local m_tamara = nil
local ret = createTileDemoLayer("TMX Ortho vertexZ", "Sprite should hide behind the trees")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test-vertexz.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test-vertexz.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -932,7 +932,7 @@ end
--------------------------------------------------------------------
local function TMXIsoMoveLayer()
local ret = createTileDemoLayer("TMX Iso Move Layer", "Trees should be horizontally aligned")
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test-movelayer.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test-movelayer.tmx")
ret:addChild(map, 0, kTagTileMap)
map:setPosition(cc.p(-700,-50))
@ -950,7 +950,7 @@ end
--------------------------------------------------------------------
local function TMXOrthoMoveLayer()
local ret = createTileDemoLayer("TMX Ortho Move Layer", "Trees should be horizontally aligned")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test-movelayer.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test-movelayer.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -983,7 +983,7 @@ end
local function TMXOrthoFlipTest()
local ret = createTileDemoLayer("TMX tile flip test")
local map = cc.FastTMXTiledMap:create("TileMaps/ortho-rotation-test.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/ortho-rotation-test.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -1002,7 +1002,7 @@ end
local function TMXOrthoFlipRunTimeTest()
local ret = createTileDemoLayer("TMX tile flip run time test", "in 2 sec bottom left tiles will flip")
local map = cc.FastTMXTiledMap:create("TileMaps/ortho-rotation-test.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/ortho-rotation-test.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -1076,7 +1076,7 @@ local function TMXOrthoFromXMLTest()
cclog("Unable to open file")
end
local map = cc.FastTMXTiledMap:createWithXML(str ,resources)
local map = ccexp.FastTMXTiledMap:createWithXML(str ,resources)
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -1096,7 +1096,7 @@ end
local function TMXOrthoXMLFormatTest()
local ret = createTileDemoLayer("you should see blue, green and yellow in console.")
local map = cc.FastTMXTiledMap:create("TileMaps/xml-test.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/xml-test.tmx")
ret:addChild(map, 0, kTagTileMap)
local s = map:getContentSize()
@ -1118,7 +1118,7 @@ end
--------------------------------------------------------------------
local function TMXBug987()
local ret = createTileDemoLayer("TMX Bug 987", "You should see an square")
local map = cc.FastTMXTiledMap:create("TileMaps/orthogonal-test6.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/orthogonal-test6.tmx")
ret:addChild(map, 0, kTagTileMap)
local s1 = map:getContentSize()
@ -1137,7 +1137,7 @@ end
--------------------------------------------------------------------
local function TMXBug787()
local ret = createTileDemoLayer("TMX Bug 787", "You should see a map")
local map = cc.FastTMXTiledMap:create("TileMaps/iso-test-bug787.tmx")
local map = ccexp.FastTMXTiledMap:create("TileMaps/iso-test-bug787.tmx")
ret:addChild(map, 0, kTagTileMap)
map:setScale(0.25)
return ret

View File

@ -21,18 +21,18 @@ local function VideoPlayerTest()
layer:addChild(videoStateLabel)
local function onVideoEventCallback(sener, eventType)
if eventType == ccexprimental.VideoPlayerEvent.PLAYING then
if eventType == ccexp.VideoPlayerEvent.PLAYING then
videoStateLabel:setString("PLAYING")
elseif eventType == ccexprimental.VideoPlayerEvent.PAUSED then
elseif eventType == ccexp.VideoPlayerEvent.PAUSED then
videoStateLabel:setString("PAUSED")
elseif eventType == ccexprimental.VideoPlayerEvent.STOPPED then
elseif eventType == ccexp.VideoPlayerEvent.STOPPED then
videoStateLabel:setString("STOPPED")
elseif eventType == ccexprimental.VideoPlayerEvent.COMPLETED then
elseif eventType == ccexp.VideoPlayerEvent.COMPLETED then
videoStateLabel:setString("COMPLETED")
end
end
local widgetSize = widget:getContentSize()
local videoPlayer = ccexprimental.VideoPlayer:create()
local videoPlayer = ccexp.VideoPlayer:create()
videoPlayer:setPosition(centerPos)
videoPlayer:setAnchorPoint(cc.p(0.5, 0.5))
videoPlayer:setContentSize(cc.size(widgetSize.width * 0.4,widgetSize.height * 0.4))

View File

@ -0,0 +1,63 @@
[cocos2dx_experimental]
# the prefix to be added to the generated functions. You might or might not use this in your own
# templates
prefix = cocos2dx_experimental
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
# all classes will be embedded in that namespace
target_namespace = ccexp
macro_judgement = #if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID || CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.8/include
android_flags = -D_SIZE_T_DEFINED_
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
clang_flags = -nostdinc -x c++ -std=c++11
cocos_headers = -I%(cocosdir)s/cocos -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s/cocos/platform/android
cocos_flags = -DANDROID
cxxgenerator_headers =
# extra arguments for clang
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
# what headers to parse
headers = %(cocosdir)s/cocos/ui/UIVideoPlayer.h %(cocosdir)s/cocos/2d/CCFastTMXLayer.h %(cocosdir)s/cocos/2d/CCFastTMXTiledMap.h
# what classes to produce code for. You can use regular expressions here. When testing the regular
# expression, it will be enclosed in "^$", like this: "^Menu*$".
classes = VideoPlayer FastTMXLayer FastTMXTiledMap
# what should we skip? in the format ClassName::[function function]
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
# functions from all classes.
skip = VideoPlayer::[addEventListener],
FastTMXLayer::[(g|s)etTiles getTileGIDAt]
rename_functions =
rename_classes =
# for all class names, should we remove something when registering in the target VM?
remove_prefix =
# classes for which there will be no "parent" lookup
classes_have_no_parents =
# base classes which will be skipped when their sub-classes found them.
base_classes_to_skip =
# classes that create no constructor
# Set is special and we will use a hand-written constructor
abstract_classes =
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
script_control_cpp = no