Skip to content

Commit

Permalink
update framework zip
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleiliao committed May 14, 2014
1 parent 104068b commit 38c3ad2
Show file tree
Hide file tree
Showing 14 changed files with 77 additions and 89 deletions.
5 changes: 5 additions & 0 deletions framework/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,11 @@ if LOAD_DEPRECATED_API then
require(cc.PACKAGE_NAME .. ".deprecated")
end

if type(LOAD_SHORTCODES_API) ~= "boolean" then LOAD_SHORTCODES_API = true end
if LOAD_SHORTCODES_API then
require(cc.PACKAGE_NAME .. ".shortcodes")
end

----

local sharedTextureCache = CCTextureCache:sharedTextureCache()
Expand Down
131 changes: 64 additions & 67 deletions framework/shortcodes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ THE SOFTWARE.
local c = cc
local Node = c.Node

----------------------------------------
-- CCNode
----------------------------------------
-- Node

function Node:add(child, zorder, tag)
self:addChild(child, zorder or 0, tag or 0)
Expand Down Expand Up @@ -92,6 +90,69 @@ function Node:zorder(z)
return self
end


-- Sprite

local Sprite = c.Sprite

Sprite.playOnce = Sprite.playAnimationOnce
Sprite.playForever = Sprite.playAnimationForever

function Sprite:displayFrame(frame, index)
if type(frame) == "string" then
self:setDisplayFrame(frame, index or 0)
else
self:setDisplayFrame(frame)
end
return self
end

function Sprite:flipX(b)
self:setFlipX(b)
return self
end

function Sprite:flipY(b)
self:setFlipY(b)
return self
end


-- Layer

local Layer = c.Layer

function Layer:onTouch(listener)
self:addNodeEventListener(c.TOUCH_EVENT, listener)
return self
end

function Layer:enableTouch(enabled)
self:setTouchEnabled(enabled)
return self
end

function Layer:onKeypad(listener)
self:addNodeEventListener(c.KEYPAD_EVENT, listener)
return self
end

function Layer:enableKeypad(enabled)
self:setKeypadEnabled(enabled)
return self
end

function Layer:onAccelerate(listener)
self:addNodeEventListener(c.ACCELERATE_EVENT, listener)
return self
end

function Layer:enableAccelerometer(enabled)
self:setAccelerometerEnabled(enabled)
return self
end


-- actions

function Node:stop()
Expand Down Expand Up @@ -161,67 +222,3 @@ function Node:tintBy(time, r, g, b)
self:runAction(CCTintBy:create(time, r or 0, g or 0, b or 0))
return self
end

----------------------------------------
-- CCSprite
----------------------------------------

local Sprite = c.Sprite

Sprite.playOnce = Sprite.playAnimationOnce
Sprite.playForever = Sprite.playAnimationForever

function Sprite:displayFrame(frame, index)
if type(frame) == "string" then
self:setDisplayFrame(frame, index or 0)
else
self:setDisplayFrame(frame)
end
return self
end

function Sprite:flipX(b)
self:setFlipX(b)
return self
end

function Sprite:flipY(b)
self:setFlipY(b)
return self
end

----------------------------------------
-- CCLayer
----------------------------------------

local Layer = c.Layer

function Layer:onTouch(listener)
self:addNodeEventListener(c.TOUCH_EVENT, listener)
return self
end

function Layer:enableTouch(enabled)
self:setTouchEnabled(enabled)
return self
end

function Layer:onKeypad(listener)
self:addNodeEventListener(c.KEYPAD_EVENT, listener)
return self
end

function Layer:enableKeypad(enabled)
self:setKeypadEnabled(enabled)
return self
end

function Layer:onAccelerate(listener)
self:addNodeEventListener(c.ACCELERATE_EVENT, listener)
return self
end

function Layer:enableAccelerometer(enabled)
self:setAccelerometerEnabled(enabled)
return self
end
Binary file modified lib/framework_precompiled/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/2048/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/chukong_ad/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/cocopush/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/iap4ios/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/luajavabridge/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/umeng_analytics/res/framework_precompiled.zip
Binary file not shown.
Binary file modified samples/umeng_push/res/framework_precompiled.zip
Binary file not shown.
Binary file modified template/PROJECT_TEMPLATE_01/res/framework_precompiled.zip
Binary file not shown.
2 changes: 0 additions & 2 deletions template/PROJECT_TEMPLATE_01/scripts/app/MyApp.lua
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

require("config")
require("framework.init")
require("framework.shortcodes")
require("framework.cc.init")

local MyApp = class("MyApp", cc.mvc.AppBase)

Expand Down
13 changes: 0 additions & 13 deletions template/PROJECT_TEMPLATE_01/scripts/app/scenes/MainScene.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,6 @@ function MainScene:ctor()
end

function MainScene:onEnter()
if device.platform == "android" then
-- avoid unmeant back
self:performWithDelay(function()
-- keypad layer, for android
local layer = display.newLayer()
layer:addKeypadEventListener(function(event)
if event == "back" then app.exit() end
end)
self:addChild(layer)

layer:setKeypadEnabled(true)
end, 0.5)
end
end

function MainScene:onExit()
Expand Down
15 changes: 8 additions & 7 deletions template/PROJECT_TEMPLATE_01/scripts/config.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@

-- 0 - disable debug info, 1 - less debug info, 2 - verbose debug info
DEBUG = 2
DEBUG_FPS = true
DEBUG_MEM = false
DEBUG = 1

-- auto encapsulation C++ object
AUTO_CC = false
-- display FPS stats on screen
DEBUG_FPS = true

-- auto binding short methods when encapsulation C++ object
AUTO_CC_SHORTCODES = true
-- dump memory info every 10 seconds
DEBUG_MEM = false

-- load deprecated API
LOAD_DEPRECATED_API = false

-- load shortcodes API
LOAD_SHORTCODES_API = true

-- screen orientation
CONFIG_SCREEN_ORIENTATION = "__SCREEN_ORIENTATION_L__"

Expand Down

0 comments on commit 38c3ad2

Please sign in to comment.