Axmol Engine – A Multi-platform Engine for Desktop, XBOX (UWP) and Mobile games. (A radical fork of Cocos2d-x-4.0)
Go to file
YuLei Liao 6be1e0a8d6 * change CCLuaEngine::executeFunctionByRefID() to public 2011-12-08 00:29:22 +08:00
Box2D fixed #580: update Box2d for vs2010 2011-12-01 10:08:15 +08:00
CocosDenshion fixed #781: Add functions for effects 2011-11-29 09:27:44 +08:00
HelloLua fixed #885: make SimpleAudioEngine::setEffectVolume() take effect immediately on android 2011-12-01 12:12:14 +08:00
HelloWorld modify helloworld .cproject, use xcopy /y /s to copy resource 2011-12-01 17:02:11 +08:00
chipmunk add bada1.0 pthread support 2011-11-24 00:07:50 +08:00
cocos2dx * add CCNode:getPositionLua(), return CCPoint 2011-12-04 11:35:55 +08:00
doxygen changelog of 0.10.0 2011-12-02 10:36:58 +08:00
licenses add two license used for bada port 2011-12-01 19:26:03 +08:00
lua * change CCLuaEngine::executeFunctionByRefID() to public 2011-12-08 00:29:22 +08:00
template Merge remote-tracking branch 'refs/remotes/upstream/master' 2011-12-01 22:00:21 +08:00
tests Merge pull request #602 from minggo/master 2011-12-01 00:28:17 -08:00
tools * add CCApplication, CCFileUtils to Lua support 2011-12-05 13:57:43 +08:00
.gitignore Merge branch 'master' into bada 2011-10-21 09:28:29 +08:00
AUTHORS Update AUTHORS 2011-11-01 13:43:52 +02:00
CHANGELOG changelog of 0.10.0 2011-12-02 10:36:58 +08:00
README.mdown * update README 2011-11-30 21:55:40 +08:00
build-linux.sh * format some files 2011-11-18 20:35:35 +08:00
build-win32.bat parallel build 2011-07-28 21:03:30 +03:00
build-wophone.sh [wophone]fixed #386,Resolve the compile conflict on wophone sdk.Modify the makefiles for wophone. 2011-03-10 14:24:13 +08:00
cocos2d-win32.vc2008.sln comment some applog 2011-11-07 00:28:09 +08:00
cocos2d-win32.vc2010.sln all tests works ok on vs2010 & fix a bug that HelloLua may crashed on win32 when it eixt 2011-08-17 18:24:36 +08:00
cocos2d-wophone.sln [wophone]fixed #377,Replace the word "uphone" with "wophone". 2011-03-09 17:28:35 +08:00
create-android-project.bat fixed #838: android template support x86 2011-11-23 16:43:52 +08:00
create-android-project.sh * format some files 2011-11-18 20:35:35 +08:00
create-bada-project.bat modify project configure 2011-10-25 14:12:42 +08:00
create-linux-android-project.sh * format some files 2011-11-18 20:35:35 +08:00
install-templates-msvc.bat Seprate wizard install script from build-win32.bat to install-templates-msvc.bat 2011-03-15 15:59:22 +08:00
install-templates-xcode.sh * merge upstream/master to master 2011-11-30 21:38:20 +08:00

README.mdown

cocos2d-x multiplatform

cocos2d-x is a multi-platform 2D game engine in C++, based on cocos2d-iphone and licensed under MIT. Now this engine has been ported to WOPhone, iOS 4.1, Android 2.1 and higher, WindowsXP & Windows7.

Multi Platform

  • cocos2d-iphone-cpp: tested on iPhone 3.2, 4.1 & 4.2 SDK
  • cocos2d-android-ndk: based on ndk-r4(crystax.net version) & ndk-r5, tested on Android 2.1, 2.2, 2.3 emulator, HTC G2, G3, G6, G7 device
  • cocos2d-wophone: well tested on WOPhone of ChinaUnicom, both emulator & device.
  • cocos2d-win32: well tested on WindowsXP & Windows7. It depends on PowerVR OpenGL ES 1.1 libraries for win32 system

Document

Contact us

Lua Support FIX Readme

  • CCScheduler support local function
  • Support autorelease C++ object
  • When C++ object deleted, set Lua object userdata to nil
  • Add CCNode:setPosition(x, y), CCNode::getPosition(), huge performance boost
  • Remove needless class and functions from tolua++ .pkg files, improved performance
  • CCMenuItem support script function
  • CCScene script callback
  • CCLayer touch & multi-touches events handler

How to use:

-- use CCSchedule::scheduleScriptFunc()

local scheduler = CCScheduler:sharedScheduler()

local handle    -- save script callback handle

local frameCount = 0
local function onEnterFrame(dt)
    print("onEnterFrame:", frameCount, dt)
    frameCount = frameCount + 1
    if frameCount >= 60 then
        -- remove script callback
        scheduler:unscheduleScriptFunc(handle)
    end
end

handle = scheduler:scheduleScriptFunc(onEnterFrame, 1.0 / 60, false)

-- use CCMenuItem:registerScriptHandler()

local function onMenuItemTap(menuItemTag)
    print(menuItemTag) -- output "1"
end

local menuItem = CCMenuItemImage:itemFromNormalImage("button.png", "button.png")
menuItem:registerScriptHandler(onMenuItemTap)

local menu = CCMenu:node()
menu:addChild(menuItem)
menuItem:setTag(1) -- menuItemTag

scene:addChild(menu)

-- use CCScene script callback

local function newScene()
    local scene = CCScene:node()

    local function sceneEventHandler(isOnEnter)
        if isOnEnter then
            if scene.onEnter then scene:onEnter() end
        else
            if scene.onExit then scene:onExit() end
            scene:unregisterScriptEventsHandler()
        end
    end

    scene:registerScriptEventsHandler(sceneEventHandler)
    return scene
end

local myScene = newScene("MyScene")
function myScene:onEnter()
    print("MyScene:onEnter()")
end

function myScene:onExit()
    print("MyScene:onExit()")
end

CCDirector:sharedDirector():runWithScene(myScene)

-- use CCLayer touch event handler

local layer = CCLayer:node()
local function onTouch(event, x, y)
    -- event: CCTOUCHBEGAN, CCTOUCHMOVED, CCTOUCHENDED, CCTOUCHCANCELLED
    print(event, x, y)
    if event == CCTOUCHBEGAN then return true end
end

layer:registerScriptTouchHandler(onTouch, false)

-- use CCLayer multi-touches event handler

local layer = CCLayer:node()
local function onTouches(event, points)
    -- event: CCTOUCHBEGAN, CCTOUCHMOVED, CCTOUCHENDED, CCTOUCHCANCELLED
    print(event)

    for i = 1, #points, 2 do
        print(string.format("x: 0.2f, y: 0.2f", points[i], points[i + 1]))
    end
end

layer:registerScriptTouchHandler(onTouches, true)

TODO:

  • When C++ object deleted, remove Lua object userdata