mirror of https://github.com/axmolengine/axmol.git
Merge pull request #1642 from dumganhar/iss1573-cocosdragonjs
issue #1573: Adding CocosDragonJS project, crash wasn't fixed. :(
This commit is contained in:
commit
14ac15ebda
|
@ -39,6 +39,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoonWarriors", "samples\Moo
|
|||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WatermelonWithMe", "samples\WatermelonWithMe\proj.win32\WatermelonWithMe.vcxproj", "{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CocosDragonJS", "samples\CocosDragonJS\proj.win32\CocosDragonJS.vcxproj", "{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(DPCodeReviewSolutionGUID) = preSolution
|
||||
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
|
||||
|
@ -100,6 +102,10 @@ Global
|
|||
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BE092D9E-95AE-4F86-84CE-F4519E4F3F15}.Release|Win32.Build.0 = Release|Win32
|
||||
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
|
|
@ -71,6 +71,11 @@ CCArray* CCBAnimationManager::getSequences()
|
|||
return mSequences;
|
||||
}
|
||||
|
||||
void CCBAnimationManager::setSequences(CCArray* seq)
|
||||
{
|
||||
mSequences = seq;
|
||||
}
|
||||
|
||||
int CCBAnimationManager::getAutoPlaySequenceId()
|
||||
{
|
||||
return mAutoPlaySequenceId;
|
||||
|
|
|
@ -39,6 +39,7 @@ private:
|
|||
SEL_CallFunc mAnimationCompleteCallbackFunc;
|
||||
CCObject *mTarget;
|
||||
|
||||
|
||||
public:
|
||||
CCBAnimationManager();
|
||||
~CCBAnimationManager();
|
||||
|
@ -46,6 +47,8 @@ public:
|
|||
virtual bool init();
|
||||
|
||||
CCArray* getSequences();
|
||||
void setSequences(CCArray* seq);
|
||||
|
||||
|
||||
int getAutoPlaySequenceId();
|
||||
void setAutoPlaySequenceId(int autoPlaySequenceId);
|
||||
|
|
|
@ -252,6 +252,7 @@ CCNode* CCBReader::readNodeGraphFromData(CCData *pData, CCObject *pOwner, const
|
|||
}
|
||||
|
||||
for(int i = 0; i < mAnimationManagers.size(); ++i) {
|
||||
mAnimationManagers[i].first->setUserObject(mAnimationManagers[i].second);
|
||||
if(jsControlled) {
|
||||
mNodesWithAnimationManagers->addObject(mAnimationManagers[i].first);
|
||||
mAnimationManagerForNodes->addObject(mAnimationManagers[i].second);
|
||||
|
|
|
@ -21,7 +21,7 @@ class CCBSelectorResolver {
|
|||
virtual ~CCBSelectorResolver() {};
|
||||
virtual SEL_MenuHandler onResolveCCBCCMenuItemSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
||||
|
||||
virtual extension::SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
||||
virtual SEL_CCControlHandler onResolveCCBCCControlSelector(CCObject * pTarget, CCString * pSelectorName) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -35,13 +35,13 @@ void CCNodeLoader::parseProperties(CCNode * pNode, CCNode * pParent, CCBReader *
|
|||
{
|
||||
setProp = true;
|
||||
}
|
||||
#ifdef __CC_PLATFORM_IOS
|
||||
if(platform == kCCBPlatformIOS)
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) || (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
|
||||
if(platform == kCCBPlatformIOS)
|
||||
{
|
||||
setProp = true;
|
||||
}
|
||||
#elif defined(__CC_PLATFORM_MAC)
|
||||
if(platform == kCCBPlatformMac)
|
||||
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
||||
if(platform == kCCBPlatformMac)
|
||||
{
|
||||
setProp = true;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,85 @@
|
|||
#include "AppDelegate.h"
|
||||
|
||||
#include "cocos2d.h"
|
||||
#include "SimpleAudioEngine.h"
|
||||
#include "ScriptingCore.h"
|
||||
#include "generated/cocos2dx.hpp"
|
||||
#include "cocos2d_specifics.hpp"
|
||||
#include "js_bindings_chipmunk_registration.h"
|
||||
#include "js_bindings_ccbreader.h"
|
||||
|
||||
USING_NS_CC;
|
||||
using namespace CocosDenshion;
|
||||
|
||||
AppDelegate::AppDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
AppDelegate::~AppDelegate()
|
||||
{
|
||||
CCScriptEngineManager::sharedManager()->purgeSharedManager();
|
||||
}
|
||||
|
||||
bool AppDelegate::applicationDidFinishLaunching()
|
||||
{
|
||||
// initialize director
|
||||
CCDirector *pDirector = CCDirector::sharedDirector();
|
||||
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
|
||||
|
||||
// turn on display FPS
|
||||
pDirector->setDisplayStats(true);
|
||||
|
||||
// set FPS. the default value is 1.0/60 if you don't call this
|
||||
pDirector->setAnimationInterval(1.0 / 60);
|
||||
|
||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
||||
sc->addRegisterCallback(register_all_cocos2dx);
|
||||
sc->addRegisterCallback(register_cocos2dx_js_extensions);
|
||||
sc->addRegisterCallback(register_CCBuilderReader);
|
||||
sc->addRegisterCallback(jsb_register_chipmunk);
|
||||
|
||||
sc->start();
|
||||
|
||||
js_log("RUNNING Main");
|
||||
CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||
ScriptingCore::getInstance()->runScript("main.js");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void handle_signal(int signal) {
|
||||
static int internal_state = 0;
|
||||
ScriptingCore* sc = ScriptingCore::getInstance();
|
||||
// should start everything back
|
||||
CCDirector* director = CCDirector::sharedDirector();
|
||||
if (director->getRunningScene()) {
|
||||
director->popToRootScene();
|
||||
} else {
|
||||
CCPoolManager::sharedPoolManager()->finalize();
|
||||
if (internal_state == 0) {
|
||||
//sc->dumpRoot(NULL, 0, NULL);
|
||||
sc->start();
|
||||
internal_state = 1;
|
||||
} else {
|
||||
sc->runScript("hello.js");
|
||||
internal_state = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
|
||||
void AppDelegate::applicationDidEnterBackground()
|
||||
{
|
||||
CCDirector::sharedDirector()->stopAnimation();
|
||||
SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
|
||||
SimpleAudioEngine::sharedEngine()->pauseAllEffects();
|
||||
}
|
||||
|
||||
// this function will be called when the app is active again
|
||||
void AppDelegate::applicationWillEnterForeground()
|
||||
{
|
||||
CCDirector::sharedDirector()->startAnimation();
|
||||
SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
|
||||
SimpleAudioEngine::sharedEngine()->resumeAllEffects();
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
//
|
||||
// GCTestAppDelegate.h
|
||||
// GCTest
|
||||
//
|
||||
// Created by Rohan Kuruvilla on 06/08/2012.
|
||||
// Copyright __MyCompanyName__ 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef _APP_DELEGATE_H_
|
||||
#define _APP_DELEGATE_H_
|
||||
|
||||
#include "CCApplication.h"
|
||||
/**
|
||||
@brief The cocos2d Application.
|
||||
|
||||
The reason for implement as private inheritance is to hide some interface call by CCDirector.
|
||||
*/
|
||||
class AppDelegate : private cocos2d::CCApplication
|
||||
{
|
||||
public:
|
||||
AppDelegate();
|
||||
virtual ~AppDelegate();
|
||||
|
||||
/**
|
||||
@brief Implement CCDirector and CCScene 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,51 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Controller for the Bomb Object
|
||||
// When the Dragon (hero) touches this object, the Dragon moves downwards.
|
||||
//
|
||||
var Bomb = function()
|
||||
{
|
||||
this.radius = 15;
|
||||
};
|
||||
|
||||
Bomb.prototype.onUpdate = function()
|
||||
{};
|
||||
|
||||
Bomb.prototype.handleCollisionWith = function(gameObjectController)
|
||||
{
|
||||
if (gameObjectController.controllerName == "Dragon")
|
||||
{
|
||||
// Collided with the dragon, remove object and add an exposion instead
|
||||
this.isScheduledForRemove = true;
|
||||
|
||||
cc.AudioEngine.getInstance().playEffect("Explo.caf");
|
||||
|
||||
var explosion = cc.Reader.load("Explosion.ccbi");
|
||||
explosion.setPosition(this.rootNode.getPosition());
|
||||
|
||||
this.rootNode.getParent().addChild(explosion);
|
||||
}
|
||||
};
|
|
@ -0,0 +1,46 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
//
|
||||
// Controller for the Coin Object
|
||||
// When the Dragon (hero) touches this object, the Dragon moves upwards
|
||||
//
|
||||
|
||||
var Coin = function()
|
||||
{
|
||||
this.radius = 15;
|
||||
};
|
||||
|
||||
Coin.prototype.onUpdate = function()
|
||||
{};
|
||||
|
||||
Coin.prototype.handleCollisionWith = function(gameObjectController)
|
||||
{
|
||||
if (gameObjectController.controllerName == "Dragon")
|
||||
{
|
||||
cc.AudioEngine.getInstance().playEffect("Coin.caf");
|
||||
this.isScheduledForRemove = true;
|
||||
}
|
||||
};
|
|
@ -0,0 +1,85 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// controller for the Dragon Object (the Hero)
|
||||
//
|
||||
|
||||
// Constants
|
||||
var CD_START_SPEED = 8;
|
||||
var CD_COIN_SPEED = 8;
|
||||
var CD_START_TARGET = 160;
|
||||
|
||||
var CD_TARGET_FILTER_FACTOR = 0.05;
|
||||
var CD_SLOW_DOWN_FACTOR = 0.995;
|
||||
var CD_GRAVITY_SPEED = 0.1;
|
||||
var CD_GAMEOVER_SPEED = -10;
|
||||
var CD_DELTA_TO_ROTATION_FACTOR = 5;
|
||||
|
||||
var Dragon = function()
|
||||
{
|
||||
this.xTarget = CD_START_TARGET*gScaleFactor;
|
||||
this.ySpeed = CD_START_SPEED;
|
||||
this.radius = 25;
|
||||
};
|
||||
|
||||
Dragon.prototype.onUpdate = function()
|
||||
{
|
||||
// Calculate the new position
|
||||
var oldPosition = cc.pMult(this.rootNode.getPosition(), 1.0/gScaleFactor);
|
||||
|
||||
var xNew = (this.xTarget/gScaleFactor) * CD_TARGET_FILTER_FACTOR + oldPosition.x * (1-CD_TARGET_FILTER_FACTOR);
|
||||
var yNew = oldPosition.y + this.ySpeed;
|
||||
this.rootNode.setPosition(xNew*gScaleFactor, yNew*gScaleFactor);
|
||||
|
||||
// Update the vertical speed
|
||||
this.ySpeed = (this.ySpeed - CD_GRAVITY_SPEED) * CD_SLOW_DOWN_FACTOR;
|
||||
|
||||
// Tilt the dragon
|
||||
var xDelta = xNew - oldPosition.x;
|
||||
this.rootNode.setRotation(xDelta * CD_DELTA_TO_ROTATION_FACTOR);
|
||||
|
||||
// Check for game over
|
||||
if (this.ySpeed < CD_GAMEOVER_SPEED)
|
||||
{
|
||||
sharedGameScene.handleGameOver();
|
||||
}
|
||||
};
|
||||
|
||||
Dragon.prototype.handleCollisionWith = function(gameObjectController)
|
||||
{
|
||||
if (gameObjectController.controllerName == "Coin")
|
||||
{
|
||||
// Took a coin
|
||||
this.ySpeed = CD_COIN_SPEED;
|
||||
sharedGameScene.setScore(sharedGameScene.score+1);
|
||||
}
|
||||
else if (gameObjectController.controllerName == "Bomb")
|
||||
{
|
||||
// Hit a bomb
|
||||
if (this.ySpeed > 0) this.ySpeed = 0;
|
||||
|
||||
this.rootNode.animationManager.runAnimationsForSequenceNamed("Hit");
|
||||
}
|
||||
};
|
|
@ -0,0 +1,45 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Controller for the EndCoin object
|
||||
// When the Dragon (hero) touches this object, the game is won.
|
||||
//
|
||||
var EndCoin = function()
|
||||
{
|
||||
this.radius = 15;
|
||||
};
|
||||
|
||||
EndCoin.prototype.onUpdate = function()
|
||||
{};
|
||||
|
||||
EndCoin.prototype.handleCollisionWith = function(gameObjectController)
|
||||
{
|
||||
if (gameObjectController.controllerName == "Dragon")
|
||||
{
|
||||
cc.AudioEngine.getInstance().playEffect("Coin.caf");
|
||||
this.isScheduledForRemove = true;
|
||||
sharedGameScene.handleLevelComplete();
|
||||
}
|
||||
};
|
|
@ -0,0 +1,49 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Controller for the Bomb Object
|
||||
// This object is run when the Dragon (hero) touches a bomb
|
||||
//
|
||||
|
||||
var Explosion = function()
|
||||
{
|
||||
this.radius = 15;
|
||||
};
|
||||
|
||||
Explosion.prototype.onDidLoadFromCCB = function()
|
||||
{
|
||||
this.rootNode.animationManager.setCompletedAnimationCallback(this, this.onAnimationComplete);
|
||||
};
|
||||
|
||||
Explosion.prototype.onUpdate = function()
|
||||
{};
|
||||
|
||||
Explosion.prototype.handleCollisionWith = function(gameObjectController)
|
||||
{};
|
||||
|
||||
Explosion.prototype.onAnimationComplete = function(animationManager)
|
||||
{
|
||||
this.isScheduledForRemove = true;
|
||||
};
|
|
@ -0,0 +1,71 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
//
|
||||
// Controller for the GameScene Object
|
||||
// This object loads the main Scene
|
||||
//
|
||||
|
||||
var GameScene = function(){};
|
||||
var sharedGameScene;
|
||||
var gLevelOffsetX = 0;
|
||||
|
||||
GameScene.prototype.onDidLoadFromCCB = function()
|
||||
{
|
||||
sharedGameScene = this;
|
||||
|
||||
this.score = 0;
|
||||
|
||||
var level = cc.Reader.load("Level.ccbi");
|
||||
|
||||
// Center the level on Screen
|
||||
gLevelOffsetX = (gWinSize.width-CD_LEVEL_WIDTH*gScaleFactor)/2;
|
||||
|
||||
level.setPosition(cc.p(gLevelOffsetX,0));
|
||||
|
||||
this.rootNode.addChild(level);
|
||||
};
|
||||
|
||||
GameScene.prototype.setScore = function(score)
|
||||
{
|
||||
this.score = score;
|
||||
this.scoreLabel.setString(""+score);
|
||||
};
|
||||
|
||||
GameScene.prototype.getScore = function()
|
||||
{
|
||||
return this.score;
|
||||
};
|
||||
|
||||
GameScene.prototype.handleGameOver = function()
|
||||
{
|
||||
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
};
|
||||
|
||||
GameScene.prototype.handleLevelComplete = function()
|
||||
{
|
||||
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
};
|
|
@ -0,0 +1,166 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
var CD_LEVEL_WIDTH = 320;
|
||||
var CD_SCROLL_FILTER_FACTOR = 0.1;
|
||||
var CD_DRAGON_TARGET_OFFET = 80;
|
||||
|
||||
// Accelerometer
|
||||
var CD_ACCEL_FILTER_FACTOR = 0.25;
|
||||
|
||||
/**
|
||||
* Level is the controller object of the game:
|
||||
* It receives the following events:
|
||||
* - onUpdate
|
||||
* - Input events like touches, mouse and accelerometer
|
||||
*/
|
||||
var Level = function(){
|
||||
this.winSize = cc.Director.getInstance().getWinSize();
|
||||
|
||||
// Used for the low-pass filter on the accelerometer
|
||||
this.prevX = 0;
|
||||
};
|
||||
|
||||
Level.prototype.onDidLoadFromCCB = function()
|
||||
{
|
||||
// Forward relevant touch events to controller (this)
|
||||
this.rootNode.onTouchesBegan = function( touches, event) {
|
||||
this.controller.onTouchesBegan(touches, event);
|
||||
return true;
|
||||
};
|
||||
this.rootNode.onTouchesMoved = function( touches, event) {
|
||||
this.controller.onTouchesMoved(touches, event);
|
||||
return true;
|
||||
};
|
||||
this.rootNode.onMouseDragged = function( event) {
|
||||
this.controller.onMouseDragged(event);
|
||||
return true;
|
||||
};
|
||||
|
||||
this.rootNode.onAccelerometer = function( event) {
|
||||
this.controller.onAccelerometer(event);
|
||||
};
|
||||
|
||||
// Schedule callback
|
||||
this.rootNode.onUpdate = function(dt) {
|
||||
this.controller.onUpdate();
|
||||
};
|
||||
this.rootNode.schedule(this.rootNode.onUpdate);
|
||||
};
|
||||
|
||||
//
|
||||
// Events
|
||||
//
|
||||
Level.prototype.onTouchesBegan = function(touches, event)
|
||||
{
|
||||
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
|
||||
|
||||
var loc = touches[0].getLocation();
|
||||
this.dragon.controller.xTarget = loc.x - gLevelOffsetX;
|
||||
};
|
||||
|
||||
Level.prototype.onTouchesMoved = function(touches, event)
|
||||
{
|
||||
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
|
||||
|
||||
var loc = touches[0].getLocation();
|
||||
this.dragon.controller.xTarget = loc.x - gLevelOffsetX;
|
||||
};
|
||||
|
||||
Level.prototype.onMouseDragged = function(event)
|
||||
{
|
||||
if (gSettingControlType != CD_CONTROLTYPE_TOUCH) return;
|
||||
|
||||
var loc = event.getLocation();
|
||||
this.dragon.controller.xTarget = loc.x;
|
||||
};
|
||||
|
||||
Level.prototype.onAccelerometer = function(accelEvent)
|
||||
{
|
||||
if (gSettingControlType != CD_CONTROLTYPE_TILT) return;
|
||||
|
||||
// low pass filter for accelerometer. This makes the movement softer
|
||||
var accelX = accelEvent.x * CD_ACCEL_FILTER_FACTOR + (1 - CD_ACCEL_FILTER_FACTOR) * this.prevX;
|
||||
this.prevX = accelX;
|
||||
|
||||
var newX = this.winSize.width * accelX + this.winSize.width/2;
|
||||
this.dragon.controller.xTarget = newX;
|
||||
// cc.log('Accel x: '+ accelEvent.x + ' y:' + accelEvent.y + ' z:' + accelEvent.z + ' time:' + accelEvent.timestamp );
|
||||
};
|
||||
|
||||
|
||||
// Game main loop
|
||||
Level.prototype.onUpdate = function(dt)
|
||||
{
|
||||
var i=0;
|
||||
var gameObject = null;
|
||||
var gameObjectController = null;
|
||||
|
||||
// Iterate though all objects in the level layer
|
||||
var children = this.rootNode.getChildren();
|
||||
for (i = 0; i < children.length; i++)
|
||||
{
|
||||
// Check if the child has a controller (only the updatable objects will have one)
|
||||
gameObject = children[i];
|
||||
gameObjectController = gameObject.controller;
|
||||
if (gameObjectController)
|
||||
{
|
||||
// Update all game objects
|
||||
gameObjectController.onUpdate();
|
||||
|
||||
var gameObjectPos = cc.pMult(gameObject.getPosition(), 1.0/gScaleFactor);
|
||||
var dragonPos = cc.pMult(this.dragon.getPosition(), 1.0/gScaleFactor);
|
||||
|
||||
// Check for collisions with dragon
|
||||
if (gameObject !== this.dragon)
|
||||
{
|
||||
if (cc.pDistance(gameObjectPos, dragonPos) < gameObjectController.radius + this.dragon.controller.radius)
|
||||
{
|
||||
gameObjectController.handleCollisionWith(this.dragon.controller);
|
||||
this.dragon.controller.handleCollisionWith(gameObjectController);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for objects to remove
|
||||
for (i = children.length-1; i >=0; i--)
|
||||
{
|
||||
gameObject = children[i];
|
||||
gameObjectController = gameObject.controller;
|
||||
if (gameObjectController && gameObjectController.isScheduledForRemove)
|
||||
{
|
||||
this.rootNode.removeChild(gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
// Adjust position of the layer so dragon is visible
|
||||
var yTarget = CD_DRAGON_TARGET_OFFET - this.dragon.getPosition().y;
|
||||
var oldLayerPosition = this.rootNode.getPosition();
|
||||
|
||||
var xNew = oldLayerPosition.x;
|
||||
var yNew = yTarget * CD_SCROLL_FILTER_FACTOR + oldLayerPosition.y * (1 - CD_SCROLL_FILTER_FACTOR);
|
||||
|
||||
this.rootNode.setPosition(xNew, yNew);
|
||||
};
|
|
@ -0,0 +1,104 @@
|
|||
/* http://www.cocosbuilder.com
|
||||
* http://www.cocos2d-iphone.org
|
||||
*
|
||||
* Copyright (c) 2012 Zynga, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
var CD_CONTROLTYPE_TOUCH = 0;
|
||||
var CD_CONTROLTYPE_TILT = 1;
|
||||
|
||||
// Setup global variables
|
||||
var gSettingMusicEnabled = true;
|
||||
var gSettingControlType = CD_CONTROLTYPE_TOUCH;
|
||||
|
||||
var gWinSize = cc.Director.getInstance().getWinSize();
|
||||
|
||||
var gScaleFactor;
|
||||
if (gWinSize.width <= 320) gScaleFactor = 1;
|
||||
else gScaleFactor = 2;
|
||||
|
||||
// Start playing looped background music
|
||||
cc.AudioEngine.getInstance().setEffectsVolume(0.2);
|
||||
cc.AudioEngine.getInstance().playMusic("Music.mp3");
|
||||
|
||||
//
|
||||
// MainMenuScene class
|
||||
//
|
||||
|
||||
var MainMenuScene = function(){};
|
||||
|
||||
MainMenuScene.prototype.updateSettingsDisplay = function()
|
||||
{
|
||||
// Music on/off
|
||||
this.sprtMusicOff.setVisible(!gSettingMusicEnabled);
|
||||
|
||||
// Controls
|
||||
if (gSettingControlType == CD_CONTROLTYPE_TOUCH)
|
||||
{
|
||||
this.sprtControlTouch.setVisible(true);
|
||||
this.sprtControlTilt.setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.sprtControlTouch.setVisible(false);
|
||||
this.sprtControlTilt.setVisible(true);
|
||||
}
|
||||
};
|
||||
|
||||
MainMenuScene.prototype.onDidLoadFromCCB = function()
|
||||
{
|
||||
this.updateSettingsDisplay();
|
||||
};
|
||||
|
||||
MainMenuScene.prototype.onPressedPlay = function()
|
||||
{
|
||||
var scene = cc.Reader.loadAsScene("GameScene.ccbi");
|
||||
cc.Director.getInstance().replaceScene(scene);
|
||||
};
|
||||
|
||||
MainMenuScene.prototype.onPressedMusic = function()
|
||||
{
|
||||
gSettingMusicEnabled = !gSettingMusicEnabled;
|
||||
|
||||
if (gSettingMusicEnabled)
|
||||
{
|
||||
cc.AudioEngine.getInstance().playMusic("Music.mp3");
|
||||
}
|
||||
else
|
||||
{
|
||||
cc.AudioEngine.getInstance().stopMusic();
|
||||
}
|
||||
|
||||
this.updateSettingsDisplay();
|
||||
};
|
||||
|
||||
MainMenuScene.prototype.onPressedControl = function()
|
||||
{
|
||||
if (gSettingControlType == CD_CONTROLTYPE_TOUCH)
|
||||
{
|
||||
gSettingControlType = CD_CONTROLTYPE_TILT;
|
||||
}
|
||||
else
|
||||
{
|
||||
gSettingControlType = CD_CONTROLTYPE_TOUCH;
|
||||
}
|
||||
this.updateSettingsDisplay();
|
||||
};
|
|
@ -0,0 +1 @@
|
|||
5783809fbb118e460886314c5da4429ea1f6577d
|
|
@ -0,0 +1,22 @@
|
|||
// Autogenerated main.js file
|
||||
|
||||
require("jsb_constants.js");
|
||||
require("Bomb.js");
|
||||
require("Coin.js");
|
||||
require("Dragon.js");
|
||||
require("EndCoin.js");
|
||||
require("Explosion.js");
|
||||
require("GameScene.js");
|
||||
require("Level.js");
|
||||
require("MainMenuScene.js");
|
||||
|
||||
function main()
|
||||
{
|
||||
var scene = cc.Reader.loadAsScene("MainMenuScene.ccbi");
|
||||
var director = cc.Director.getInstance();
|
||||
var runningScene = director.getRunningScene();
|
||||
if (runningScene === null) director.runWithScene(scene);
|
||||
else director.replaceScene(scene);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1 @@
|
|||
b0c5e740238e0eb308fa7c7d919b955788ce98db
|
|
@ -0,0 +1 @@
|
|||
b0c5e740238e0eb308fa7c7d919b955788ce98db
|
|
@ -0,0 +1 @@
|
|||
6e1a684f77d5fceff75f93f9e269576d0f88c06f
|
|
@ -0,0 +1 @@
|
|||
373c2b2260c711a02a90ad3b68abd7a1853a0527
|
|
@ -0,0 +1 @@
|
|||
af983ed63f13ab325322da1bbb6917290b6142f2
|
|
@ -0,0 +1 @@
|
|||
74cec9c4c8844fed81ea1f0323eb57df1737a1a3
|
|
@ -0,0 +1 @@
|
|||
969548df813b9d834bdce8848a34d20b69995612
|
|
@ -0,0 +1,9 @@
|
|||
//
|
||||
// Javascript Bindigns helper file
|
||||
//
|
||||
|
||||
// DO NOT ALTER THE ORDER
|
||||
require('jsb_constants_cocos2d.js');
|
||||
require('jsb_constants_chipmunk.js');
|
||||
require('jsb_constants_gl.js');
|
||||
require('jsb_constants_cocosbuilder.js');
|
|
@ -0,0 +1,275 @@
|
|||
//
|
||||
// Chipmunk defines
|
||||
//
|
||||
|
||||
cp.v = cc.p;
|
||||
cp._v = cc._p;
|
||||
cp.vzero = cp.v(0,0);
|
||||
|
||||
// Vector: Compatibility with Chipmunk-JS
|
||||
cp.v.add = cp.vadd;
|
||||
cp.v.clamp = cp.vclamp;
|
||||
cp.v.cross = cp.vcross;
|
||||
cp.v.dist = cp.vdist;
|
||||
cp.v.distsq = cp.vdistsq;
|
||||
cp.v.dot = cp.vdot;
|
||||
cp.v.eql = cp.veql;
|
||||
cp.v.forangle = cp.vforangle;
|
||||
cp.v.len = cp.vlength;
|
||||
cp.v.lengthsq = cp.vlengthsq;
|
||||
cp.v.lerp = cp.vlerp;
|
||||
cp.v.lerpconst = cp.vlerpconst;
|
||||
cp.v.mult = cp.vmult;
|
||||
cp.v.near = cp.vnear;
|
||||
cp.v.neg = cp.vneg;
|
||||
cp.v.normalize = cp.vnormalize;
|
||||
cp.v.normalize_safe = cp.vnormalize_safe;
|
||||
cp.v.perp = cp.vperp;
|
||||
cp.v.project = cp.vproject;
|
||||
cp.v.rotate = cp.vrotate;
|
||||
cp.v.rperp = cp.vrperp;
|
||||
cp.v.slerp = cp.vslerp;
|
||||
cp.v.slerpconst = cp.vslerpconst;
|
||||
cp.v.sub = cp.vsub;
|
||||
cp.v.toangle = cp.vtoangle;
|
||||
cp.v.unrotate = cp.vunrotate;
|
||||
|
||||
|
||||
|
||||
/// Initialize an offset box shaped polygon shape.
|
||||
cp.BoxShape2 = function(body, box)
|
||||
{
|
||||
var verts = [
|
||||
box.l, box.b,
|
||||
box.l, box.t,
|
||||
box.r, box.t,
|
||||
box.r, box.b
|
||||
];
|
||||
|
||||
return new cp.PolyShape(body, verts, cp.vzero);
|
||||
};
|
||||
|
||||
/// Initialize a box shaped polygon shape.
|
||||
cp.BoxShape = function(body, width, height)
|
||||
{
|
||||
var hw = width/2;
|
||||
var hh = height/2;
|
||||
|
||||
return cp.BoxShape2(body, new cp.BB(-hw, -hh, hw, hh));
|
||||
};
|
||||
|
||||
|
||||
/// Initialize an static body
|
||||
cp.StaticBody = function()
|
||||
{
|
||||
return new cp.Body(Infinity, Infinity);
|
||||
};
|
||||
|
||||
|
||||
// "Bounding Box" compatibility with Chipmunk-JS
|
||||
cp.BB = function(l, b, r, t)
|
||||
{
|
||||
return {l:l, b:b, r:r, t:t};
|
||||
};
|
||||
|
||||
// helper function to create a BB
|
||||
cp.bb = function(l, b, r, t) {
|
||||
return new cp.BB(l, b, r, t);
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// Some properties
|
||||
//
|
||||
// "handle" needed in some cases
|
||||
Object.defineProperties(cp.Base.prototype,
|
||||
{
|
||||
"handle" : {
|
||||
get : function(){
|
||||
return this.getHandle();
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
}
|
||||
});
|
||||
|
||||
// Properties, for Chipmunk-JS compatibility
|
||||
// Space properties
|
||||
Object.defineProperties(cp.Space.prototype,
|
||||
{
|
||||
"gravity" : {
|
||||
get : function(){
|
||||
return this.getGravity();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setGravity(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"iterations" : {
|
||||
get : function(){
|
||||
return this.getIterations();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setIterations(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"damping" : {
|
||||
get : function(){
|
||||
return this.getDamping();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setDamping(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"staticBody" : {
|
||||
get : function(){
|
||||
return this.getStaticBody();
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"idleSpeedThreshold" : {
|
||||
get : function(){
|
||||
return this.getIdleSpeedThreshold();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setIdleSpeedThreshold(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"sleepTimeThreshold": {
|
||||
get : function(){
|
||||
return this.getSleepTimeThreshold();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setSleepTimeThreshold(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"collisionSlop": {
|
||||
get : function(){
|
||||
return this.getCollisionSlop();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setCollisionSlop(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"collisionBias": {
|
||||
get : function(){
|
||||
return this.getCollisionBias();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setCollisionBias(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"collisionPersistence": {
|
||||
get : function(){
|
||||
return this.getCollisionPersistence();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setCollisionPersistence(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"enableContactGraph": {
|
||||
get : function(){
|
||||
return this.getEnableContactGraph();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setEnableContactGraph(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
}
|
||||
});
|
||||
|
||||
// Body properties
|
||||
Object.defineProperties(cp.Body.prototype,
|
||||
{
|
||||
"a" : {
|
||||
get : function(){
|
||||
return this.getAngle();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setAngle(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"w" : {
|
||||
get : function(){
|
||||
return this.getAngVel();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setAngVel(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"p" : {
|
||||
get : function(){
|
||||
return this.getPos();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setPos(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"v" : {
|
||||
get : function(){
|
||||
return this.getVel();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setVel(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"i" : {
|
||||
get : function(){
|
||||
return this.getMoment();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setMoment(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// Shape properties
|
||||
Object.defineProperties(cp.Shape.prototype,
|
||||
{
|
||||
"body" : {
|
||||
get : function(){
|
||||
return this.getBody();
|
||||
},
|
||||
set : function(newValue){
|
||||
this.setBody(newValue);
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
},
|
||||
"collision_type" : {
|
||||
get : function(){
|
||||
return this.getCollisionType();
|
||||
},
|
||||
enumerable : true,
|
||||
configurable : true
|
||||
}
|
||||
});
|
|
@ -0,0 +1,493 @@
|
|||
//
|
||||
// cocos2d constants
|
||||
//
|
||||
cc.DIRECTOR_PROJECTION_2D = 0;
|
||||
cc.DIRECTOR_PROJECTION_3D = 1;
|
||||
|
||||
cc.TEXTURE_PIXELFORMAT_RGBA8888 = 0;
|
||||
cc.TEXTURE_PIXELFORMAT_RGB888 = 1;
|
||||
cc.TEXTURE_PIXELFORMAT_RGB565 = 2;
|
||||
cc.TEXTURE_PIXELFORMAT_A8 = 3;
|
||||
cc.TEXTURE_PIXELFORMAT_I8 = 4;
|
||||
cc.TEXTURE_PIXELFORMAT_AI88 = 5;
|
||||
cc.TEXTURE_PIXELFORMAT_RGBA4444 = 6;
|
||||
cc.TEXTURE_PIXELFORMAT_RGB5A1 = 7;
|
||||
cc.TEXTURE_PIXELFORMAT_PVRTC4 = 8;
|
||||
cc.TEXTURE_PIXELFORMAT_PVRTC4 = 9;
|
||||
cc.TEXTURE_PIXELFORMAT_DEFAULT = cc.TEXTURE_PIXELFORMAT_RGBA8888;
|
||||
|
||||
cc.TEXT_ALIGNMENT_LEFT = 0;
|
||||
cc.TEXT_ALIGNMENT_CENTER = 1;
|
||||
cc.TEXT_ALIGNMENT_RIGHT = 2;
|
||||
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_TOP = 0;
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_CENTER = 1;
|
||||
cc.VERTICAL_TEXT_ALIGNMENT_BOTTOM = 2;
|
||||
|
||||
cc.IMAGE_FORMAT_JPEG = 0;
|
||||
cc.IMAGE_FORMAT_PNG = 0;
|
||||
|
||||
cc.PROGRESS_TIMER_TYPE_RADIAL = 0;
|
||||
cc.PROGRESS_TIMER_TYPE_BAR = 1;
|
||||
|
||||
cc.PARTICLE_TYPE_FREE = 0;
|
||||
cc.PARTICLE_TYPE_RELATIVE = 1;
|
||||
cc.PARTICLE_TYPE_GROUPED = 2;
|
||||
cc.PARTICLE_DURATION_INFINITY = -1;
|
||||
cc.PARTICLE_MODE_GRAVITY = 0;
|
||||
cc.PARTICLE_MODE_RADIUS = 1;
|
||||
cc.PARTICLE_START_SIZE_EQUAL_TO_END_SIZE = -1;
|
||||
cc.PARTICLE_START_RADIUS_EQUAL_TO_END_RADIUS = -1;
|
||||
|
||||
cc.TOUCH_ALL_AT_ONCE = 0;
|
||||
cc.TOUCH_ONE_BY_ONE = 1;
|
||||
|
||||
cc.TMX_TILE_HORIZONTAL_FLAG = 0x80000000;
|
||||
cc.TMX_TILE_VERTICAL_FLAG = 0x40000000;
|
||||
cc.TMX_TILE_DIAGONAL_FLAG = 0x20000000;
|
||||
|
||||
cc.TRANSITION_ORIENTATION_LEFT_OVER = 0;
|
||||
cc.TRANSITION_ORIENTATION_RIGHT_OVER = 1;
|
||||
cc.TRANSITION_ORIENTATION_UP_OVER = 0;
|
||||
cc.TRANSITION_ORIENTATION_DOWN_OVER = 1;
|
||||
|
||||
cc.RED = {r:255, g:0, b:0};
|
||||
cc.GREEN = {r:0, g:255, b:0};
|
||||
cc.BLUE = {r:0, g:0, b:255};
|
||||
cc.BLACK = {r:0, g:0, b:0};
|
||||
cc.WHITE = {r:255, g:255, b:255};
|
||||
|
||||
cc.POINT_ZERO = {x:0, y:0};
|
||||
|
||||
// XXX: This definition is different than cocos2d-html5
|
||||
cc.REPEAT_FOREVER = - 1;
|
||||
|
||||
// reusable objects
|
||||
cc._reuse_p = [ {x:0, y:0}, {x:0,y:0}, {x:0,y:0}, {x:0,y:0} ];
|
||||
cc._reuse_p_index = 0;
|
||||
cc._reuse_size = {width:0, height:0};
|
||||
cc._reuse_rect = {x:0, y:0, width:0, height:0};
|
||||
cc._reuse_color3b = {r:255, g:255, b:255 };
|
||||
cc._reuse_color4b = {r:255, g:255, b:255, a:255 };
|
||||
|
||||
//
|
||||
// Point
|
||||
//
|
||||
cc.p = function( x, y )
|
||||
{
|
||||
return {x:x, y:y};
|
||||
};
|
||||
|
||||
cc.g = cc.g || cc.p;
|
||||
cc._reuse_grid = cc.g(0,0);
|
||||
|
||||
cc.log = cc.log || log;
|
||||
|
||||
//
|
||||
// Color 3B
|
||||
//
|
||||
cc.c3b = function( r, g, b )
|
||||
{
|
||||
return {r:r, g:g, b:b };
|
||||
};
|
||||
cc._c3b = function( r, g, b )
|
||||
{
|
||||
cc._reuse_color3b.r = r;
|
||||
cc._reuse_color3b.g = g;
|
||||
cc._reuse_color3b.b = b;
|
||||
return cc._reuse_color3b;
|
||||
};
|
||||
|
||||
//
|
||||
// Color 4B
|
||||
//
|
||||
cc.c4b = function( r, g, b, a )
|
||||
{
|
||||
return {r:r, g:g, b:b, a:a };
|
||||
};
|
||||
cc._c4b = function( r, g, b, a )
|
||||
{
|
||||
cc._reuse_color4b.r = r;
|
||||
cc._reuse_color4b.g = g;
|
||||
cc._reuse_color4b.b = b;
|
||||
cc._reuse_color4b.a = a;
|
||||
return cc._reuse_color4b;
|
||||
};
|
||||
// compatibility
|
||||
cc.c4 = cc.c4b;
|
||||
cc._c4 = cc._c4b;
|
||||
|
||||
//
|
||||
// Color 4F
|
||||
//
|
||||
cc.c4f = function( r, g, b, a )
|
||||
{
|
||||
return {r:r, g:g, b:b, a:a };
|
||||
};
|
||||
|
||||
//
|
||||
// Point
|
||||
//
|
||||
|
||||
cc._p = function( x, y )
|
||||
{
|
||||
if( cc._reuse_p_index == cc._reuse_p.length )
|
||||
cc._reuse_p_index = 0;
|
||||
|
||||
var p = cc._reuse_p[ cc._reuse_p_index];
|
||||
cc._reuse_p_index++;
|
||||
p.x = x;
|
||||
p.y = y;
|
||||
return p;
|
||||
};
|
||||
|
||||
cc.pointEqualToPoint = function (point1, point2) {
|
||||
return ((point1.x == point2.x) && (point1.y == point2.y));
|
||||
};
|
||||
|
||||
//
|
||||
// Grid
|
||||
//
|
||||
cc._g = function( x, y )
|
||||
{
|
||||
cc._reuse_grid.x = x;
|
||||
cc._reuse_grid.y = y;
|
||||
return cc._reuse_grid;
|
||||
};
|
||||
|
||||
//
|
||||
// Size
|
||||
//
|
||||
cc.size = function(w,h)
|
||||
{
|
||||
return {width:w, height:h};
|
||||
};
|
||||
cc._size = function(w,h)
|
||||
{
|
||||
cc._reuse_size.width = w;
|
||||
cc._reuse_size.height = h;
|
||||
return cc._reuse_size;
|
||||
};
|
||||
cc.sizeEqualToSize = function (size1, size2)
|
||||
{
|
||||
return ((size1.width == size2.width) && (size1.height == size2.height));
|
||||
};
|
||||
|
||||
//
|
||||
// Rect
|
||||
//
|
||||
cc.rect = function(x,y,w,h)
|
||||
{
|
||||
return {x:x, y:y, width:w, height:h};
|
||||
};
|
||||
cc._rect = function(x,y,w,h)
|
||||
{
|
||||
cc._reuse_rect.x = x;
|
||||
cc._reuse_rect.y = y;
|
||||
cc._reuse_rect.width = w;
|
||||
cc._reuse_rect.height = h;
|
||||
return cc._reuse_rect;
|
||||
};
|
||||
cc.rectEqualToRect = function (rect1, rect2) {
|
||||
return ( rect1.x==rect2.x && rect1.y==rect2.y && rect1.width==rect2.width && rect1.height==rect2.height);
|
||||
};
|
||||
|
||||
cc.rectContainsRect = function (rect1, rect2) {
|
||||
if ((rect1.x >= rect2.x) || (rect1.y >= rect2.y) ||
|
||||
( rect1.x + rect1.width <= rect2.x + rect2.width) ||
|
||||
( rect1.y + rect1.height <= rect2.y + rect2.height))
|
||||
return false;
|
||||
return true;
|
||||
};
|
||||
|
||||
cc.rectGetMaxX = function (rect) {
|
||||
return (rect.x + rect.width);
|
||||
};
|
||||
|
||||
cc.rectGetMidX = function (rect) {
|
||||
return (rect.x + rect.width / 2.0);
|
||||
};
|
||||
|
||||
cc.rectGetMinX = function (rect) {
|
||||
return rect.x;
|
||||
};
|
||||
|
||||
cc.rectGetMaxY = function (rect) {
|
||||
return(rect.y + rect.height);
|
||||
};
|
||||
|
||||
cc.rectGetMidY = function (rect) {
|
||||
return rect.y + rect.height / 2.0;
|
||||
};
|
||||
|
||||
cc.rectGetMinY = function (rect) {
|
||||
return rect.y;
|
||||
};
|
||||
|
||||
cc.rectContainsPoint = function (rect, point) {
|
||||
var ret = false;
|
||||
if (point.x >= rect.x && point.x <= rect.x + rect.width &&
|
||||
point.y >= rect.y && point.y <= rect.y + rect.height) {
|
||||
ret = true;
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
cc.rectIntersectsRect = function( rectA, rectB )
|
||||
{
|
||||
var bool = ! ( rectA.x > rectB.x + rectB.width ||
|
||||
rectA.x + rectA.width < rectB.x ||
|
||||
rectA.y > rectB.y +rectB.height ||
|
||||
rectA.y + rectA.height < rectB.y );
|
||||
|
||||
return bool;
|
||||
};
|
||||
|
||||
cc.rectUnion = function (rectA, rectB) {
|
||||
var rect = cc.rect(0, 0, 0, 0);
|
||||
rect.x = Math.min(rectA.x, rectB.x);
|
||||
rect.y = Math.min(rectA.y, rectB.y);
|
||||
rect.width = Math.max(rectA.x + rectA.width, rectB.x + rectB.width) - rect.x;
|
||||
rect.height = Math.max(rectA.y + rectA.height, rectB.y + rectB.height) - rect.y;
|
||||
return rect;
|
||||
};
|
||||
|
||||
cc.rectIntersection = function (rectA, rectB) {
|
||||
var intersection = cc.rect(
|
||||
Math.max(rectA.x, rectB.x),
|
||||
Math.max(rectA.y, rectB.y),
|
||||
0, 0);
|
||||
|
||||
intersection.width = Math.min(rectA.x+rectA.width, rectB.x+rectB.width) - intersection.x;
|
||||
intersection.height = Math.min(rectA.y+rectA.height, rectB.y+rectB.height) - intersection.y;
|
||||
return intersection;
|
||||
};
|
||||
|
||||
//
|
||||
// Array: for cocos2d-html5 compatibility
|
||||
//
|
||||
cc.ArrayRemoveObject = function (arr, delObj) {
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (arr[i] == delObj) {
|
||||
arr.splice(i, 1);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// Helpers
|
||||
//
|
||||
cc.dump = function(obj)
|
||||
{
|
||||
for( var i in obj )
|
||||
cc.log( i + " = " + obj[i] );
|
||||
};
|
||||
|
||||
// dump config info, but only in debug mode
|
||||
cc.dumpConfig = function()
|
||||
{
|
||||
if( cc.config.debug )
|
||||
cc.dump(cc.config);
|
||||
};
|
||||
|
||||
//
|
||||
// Bindings Overrides
|
||||
//
|
||||
// MenuItemToggle
|
||||
cc.MenuItemToggle.create = function( /* var args */) {
|
||||
|
||||
var n = arguments.length;
|
||||
|
||||
if (typeof arguments[n-2] === 'function' || typeof arguments[n-1] === 'function') {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
var obj = null;
|
||||
if( typeof arguments[n-2] === 'function' )
|
||||
obj = args.pop();
|
||||
|
||||
var func = args.pop();
|
||||
|
||||
// create it with arguments,
|
||||
var item = cc.MenuItemToggle._create.apply(this, args);
|
||||
|
||||
// then set the callback
|
||||
if( obj !== null )
|
||||
item.setCallback(func, obj);
|
||||
else
|
||||
item.setCallback(func);
|
||||
return item;
|
||||
} else {
|
||||
return cc.MenuItemToggle._create.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
// LabelAtlas
|
||||
cc.LabelAtlas.create = function( a,b,c,d,e ) {
|
||||
|
||||
var n = arguments.length;
|
||||
|
||||
if ( n == 5) {
|
||||
return cc.LabelAtlas._create(a,b,c,d,e.charCodeAt(0));
|
||||
} else {
|
||||
return cc.LabelAtlas._create.apply(this, arguments);
|
||||
}
|
||||
};
|
||||
|
||||
// PhysicsDebugNode
|
||||
cc.PhysicsDebugNode.create = function( space ) {
|
||||
var s = space;
|
||||
if( space.handle !== undefined )
|
||||
s = space.handle;
|
||||
return cc.PhysicsDebugNode._create( s );
|
||||
};
|
||||
cc.PhysicsDebugNode.prototype.setSpace = function( space ) {
|
||||
var s = space;
|
||||
if( space.handle !== undefined )
|
||||
s = space.handle;
|
||||
return this._setSpace( s );
|
||||
};
|
||||
|
||||
// PhysicsSprite
|
||||
cc.PhysicsSprite.prototype.setBody = function( body ) {
|
||||
var b = body;
|
||||
if( body.handle !== undefined )
|
||||
b = body.handle;
|
||||
return this._setBody( b );
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Associates a base class with a native superclass
|
||||
* @function
|
||||
* @param {object} jsobj subclass
|
||||
* @param {object} klass superclass
|
||||
*/
|
||||
cc.associateWithNative = function( jsobj, superclass_or_instance ) {
|
||||
|
||||
try {
|
||||
// Used when subclassing using the "extend" method
|
||||
var native = new superclass_or_instance();
|
||||
__associateObjWithNative( jsobj, native );
|
||||
} catch(err) {
|
||||
// Used when subclassing using the goog.inherits method
|
||||
__associateObjWithNative( jsobj, superclass_or_instance );
|
||||
}
|
||||
};
|
||||
|
||||
//
|
||||
// JSB supports 2 official ways to create subclasses
|
||||
//
|
||||
// 1) Google "subclasses" borrowed from closure library
|
||||
// This is the recommended way to do it
|
||||
//
|
||||
cc.inherits = function (childCtor, parentCtor) {
|
||||
/** @constructor */
|
||||
function tempCtor() {};
|
||||
tempCtor.prototype = parentCtor.prototype;
|
||||
childCtor.superClass_ = parentCtor.prototype;
|
||||
childCtor.prototype = new tempCtor();
|
||||
childCtor.prototype.constructor = childCtor;
|
||||
|
||||
// Copy "static" method, but doesn't generate subclasses.
|
||||
// for( var i in parentCtor ) {
|
||||
// childCtor[ i ] = parentCtor[ i ];
|
||||
// }
|
||||
};
|
||||
cc.base = function(me, opt_methodName, var_args) {
|
||||
var caller = arguments.callee.caller;
|
||||
if (caller.superClass_) {
|
||||
// This is a constructor. Call the superclass constructor.
|
||||
ret = caller.superClass_.constructor.apply( me, Array.prototype.slice.call(arguments, 1));
|
||||
return ret;
|
||||
}
|
||||
|
||||
var args = Array.prototype.slice.call(arguments, 2);
|
||||
var foundCaller = false;
|
||||
for (var ctor = me.constructor;
|
||||
ctor; ctor = ctor.superClass_ && ctor.superClass_.constructor) {
|
||||
if (ctor.prototype[opt_methodName] === caller) {
|
||||
foundCaller = true;
|
||||
} else if (foundCaller) {
|
||||
return ctor.prototype[opt_methodName].apply(me, args);
|
||||
}
|
||||
}
|
||||
|
||||
// If we did not find the caller in the prototype chain,
|
||||
// then one of two things happened:
|
||||
// 1) The caller is an instance method.
|
||||
// 2) This method was not called by the right caller.
|
||||
if (me[opt_methodName] === caller) {
|
||||
return me.constructor.prototype[opt_methodName].apply(me, args);
|
||||
} else {
|
||||
throw Error(
|
||||
'cc.base called from a method of one name ' +
|
||||
'to a method of a different name');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//
|
||||
// 2) Using "extend" subclassing
|
||||
// Simple JavaScript Inheritance By John Resig http://ejohn.org/
|
||||
//
|
||||
cc.Class = function(){};
|
||||
cc.Class.extend = function (prop) {
|
||||
var _super = this.prototype;
|
||||
|
||||
// Instantiate a base class (but only create the instance,
|
||||
// don't run the init constructor)
|
||||
initializing = true;
|
||||
var prototype = new this();
|
||||
initializing = false;
|
||||
fnTest = /xyz/.test(function(){xyz;}) ? /\b_super\b/ : /.*/;
|
||||
|
||||
// Copy the properties over onto the new prototype
|
||||
for (var name in prop) {
|
||||
// Check if we're overwriting an existing function
|
||||
prototype[name] = typeof prop[name] == "function" &&
|
||||
typeof _super[name] == "function" && fnTest.test(prop[name]) ?
|
||||
(function (name, fn) {
|
||||
return function () {
|
||||
var tmp = this._super;
|
||||
|
||||
// Add a new ._super() method that is the same method
|
||||
// but on the super-class
|
||||
this._super = _super[name];
|
||||
|
||||
// The method only need to be bound temporarily, so we
|
||||
// remove it when we're done executing
|
||||
var ret = fn.apply(this, arguments);
|
||||
this._super = tmp;
|
||||
|
||||
return ret;
|
||||
};
|
||||
})(name, prop[name]) :
|
||||
prop[name];
|
||||
}
|
||||
|
||||
// The dummy class constructor
|
||||
function Class() {
|
||||
// All construction is actually done in the init method
|
||||
if (!initializing && this.ctor)
|
||||
this.ctor.apply(this, arguments);
|
||||
}
|
||||
|
||||
// Populate our constructed prototype object
|
||||
Class.prototype = prototype;
|
||||
|
||||
// Enforce the constructor to be what we expect
|
||||
Class.prototype.constructor = Class;
|
||||
|
||||
// And make this class extendable
|
||||
Class.extend = arguments.callee;
|
||||
|
||||
return Class;
|
||||
};
|
||||
|
||||
cc.Node.prototype.ctor = function() {};
|
||||
cc.Node.extend = cc.Class.extend;
|
||||
cc.Layer.extend = cc.Class.extend;
|
||||
cc.LayerGradient.extend = cc.Class.extend;
|
||||
cc.LayerColor.extend = cc.Class.extend;
|
||||
cc.Sprite.extend = cc.Class.extend;
|
||||
cc.MenuItemFont.extend = cc.Class.extend;
|
||||
cc.Scene.extend = cc.Class.extend;
|
|
@ -0,0 +1,118 @@
|
|||
//
|
||||
// CocosBuilder definitions
|
||||
//
|
||||
|
||||
cc.Reader = {};
|
||||
|
||||
var _ccbGlobalContext = this;
|
||||
|
||||
cc.Reader.load = function(file, owner, parentSize)
|
||||
{
|
||||
// Load the node graph using the correct function
|
||||
var reader = cc._Reader.create();
|
||||
var node;
|
||||
|
||||
if (owner && parentSize)
|
||||
{
|
||||
node = reader.load(file, owner, parentSize);
|
||||
}
|
||||
else if (owner)
|
||||
{
|
||||
node = reader.load(file,owner);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = reader.load(file);
|
||||
}
|
||||
|
||||
// Assign owner callbacks & member variables
|
||||
if (owner)
|
||||
{
|
||||
// Callbacks
|
||||
var ownerCallbackNames = reader.getOwnerCallbackNames();
|
||||
var ownerCallbackNodes = reader.getOwnerCallbackNodes();
|
||||
|
||||
for (var i = 0; i < ownerCallbackNames.length; i++)
|
||||
{
|
||||
var callbackName = ownerCallbackNames[i];
|
||||
var callbackNode = ownerCallbackNodes[i];
|
||||
|
||||
callbackNode.setCallback(owner[callbackName], owner);
|
||||
}
|
||||
|
||||
// Variables
|
||||
var ownerOutletNames = reader.getOwnerOutletNames();
|
||||
var ownerOutletNodes = reader.getOwnerOutletNodes();
|
||||
|
||||
for (var i = 0; i < ownerOutletNames.length; i++)
|
||||
{
|
||||
var outletName = ownerOutletNames[i];
|
||||
var outletNode = ownerOutletNodes[i];
|
||||
|
||||
owner[outletName] = outletNode;
|
||||
}
|
||||
}
|
||||
|
||||
var nodesWithAnimationManagers = reader.getNodesWithAnimationManagers();
|
||||
var animationManagersForNodes = reader.getAnimationManagersForNodes();
|
||||
|
||||
// Attach animation managers to nodes and assign root node callbacks and member variables
|
||||
for (var i = 0; i < nodesWithAnimationManagers.length; i++)
|
||||
{
|
||||
var innerNode = nodesWithAnimationManagers[i];
|
||||
var animationManager = animationManagersForNodes[i];
|
||||
|
||||
innerNode.animationManager = animationManager;
|
||||
|
||||
var documentControllerName = animationManager.getDocumentControllerName();
|
||||
if (!documentControllerName) continue;
|
||||
|
||||
// Create a document controller
|
||||
var controller = new _ccbGlobalContext[documentControllerName]();
|
||||
controller.controllerName = documentControllerName;
|
||||
|
||||
innerNode.controller = controller;
|
||||
controller.rootNode = innerNode;
|
||||
|
||||
// Callbacks
|
||||
var documentCallbackNames = animationManager.getDocumentCallbackNames();
|
||||
var documentCallbackNodes = animationManager.getDocumentCallbackNodes();
|
||||
|
||||
for (var j = 0; j < documentCallbackNames.length; j++)
|
||||
{
|
||||
var callbackName = documentCallbackNames[j];
|
||||
var callbackNode = documentCallbackNodes[j];
|
||||
|
||||
callbackNode.setCallback(controller[callbackName], controller);
|
||||
}
|
||||
|
||||
|
||||
// Variables
|
||||
var documentOutletNames = animationManager.getDocumentOutletNames();
|
||||
var documentOutletNodes = animationManager.getDocumentOutletNodes();
|
||||
|
||||
for (var j = 0; j < documentOutletNames.length; j++)
|
||||
{
|
||||
var outletName = documentOutletNames[j];
|
||||
var outletNode = documentOutletNodes[j];
|
||||
|
||||
controller[outletName] = outletNode;
|
||||
}
|
||||
|
||||
if (typeof(controller.onDidLoadFromCCB) == "function")
|
||||
{
|
||||
controller.onDidLoadFromCCB();
|
||||
}
|
||||
}
|
||||
|
||||
return node;
|
||||
}
|
||||
|
||||
cc.Reader.loadAsScene = function(file, owner, parentSize)
|
||||
{
|
||||
var node = cc.Reader.load(file, owner, parentSize);
|
||||
var scene = cc.Scene.create();
|
||||
scene.addChild( node );
|
||||
|
||||
return scene;
|
||||
}
|
|
@ -0,0 +1,23 @@
|
|||
//
|
||||
// OpenGL defines
|
||||
//
|
||||
|
||||
var gl = gl || {};
|
||||
gl.NEAREST = 0x2600;
|
||||
gl.LINEAR = 0x2601;
|
||||
gl.REPEAT = 0x2901;
|
||||
gl.CLAMP_TO_EDGE = 0x812F;
|
||||
gl.CLAMP_TO_BORDER = 0x812D;
|
||||
gl.LINEAR_MIPMAP_NEAREST = 0x2701;
|
||||
gl.NEAREST_MIPMAP_NEAREST = 0x2700;
|
||||
gl.ZERO = 0;
|
||||
gl.ONE = 1;
|
||||
gl.SRC_COLOR = 0x0300;
|
||||
gl.ONE_MINUS_SRC_COLOR = 0x0301;
|
||||
gl.SRC_ALPHA = 0x0302;
|
||||
gl.ONE_MINUS_SRC_ALPHA = 0x0303;
|
||||
gl.DST_ALPHA = 0x0304;
|
||||
gl.ONE_MINUS_DST_ALPHA = 0x0305;
|
||||
gl.DST_COLOR = 0x0306;
|
||||
gl.ONE_MINUS_DST_COLOR = 0x0307;
|
||||
gl.SRC_ALPHA_SATURATE = 0x0308;
|
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="gen"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
|
||||
<classpathentry kind="con" path="com.android.ide.eclipse.adt.LIBRARIES"/>
|
||||
<classpathentry kind="output" path="bin/classes"/>
|
||||
</classpath>
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>CocosDragonJS</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>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.cocos2dx.cocosdragonjs"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<uses-sdk android:minSdkVersion="8"/>
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:debuggable="true"
|
||||
android:icon="@drawable/icon">
|
||||
|
||||
<activity android:name=".CocosDragonJS"
|
||||
android:label="@string/app_name"
|
||||
android:screenOrientation="portrait"
|
||||
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
|
||||
android:configChanges="orientation">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
<supports-screens android:largeScreens="true"
|
||||
android:smallScreens="true"
|
||||
android:anyDensity="true"
|
||||
android:normalScreens="true"/>
|
||||
</manifest>
|
|
@ -0,0 +1 @@
|
|||
aapt.ignore.assets="!*.pvr.gz:!*.gz:!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"
|
|
@ -0,0 +1,92 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="CocosDragonJS" 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" />
|
||||
|
||||
<!-- if sdk.dir was not set from one of the property file, then
|
||||
get it from the ANDROID_HOME env var.
|
||||
This must be done before we load project.properties since
|
||||
the proguard config can use sdk.dir -->
|
||||
<property environment="env" />
|
||||
<condition property="sdk.dir" value="${env.ANDROID_HOME}">
|
||||
<isset property="env.ANDROID_HOME" />
|
||||
</condition>
|
||||
|
||||
<!-- 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 the ANDROID_HOME environment variable."
|
||||
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,84 @@
|
|||
#NDK_ROOT="/opt/android/android-ndk"
|
||||
APPNAME="CocosDragonJS"
|
||||
|
||||
# options
|
||||
|
||||
buildexternalsfromsource=
|
||||
PARALLEL_BUILD_FLAG=
|
||||
|
||||
usage(){
|
||||
cat << EOF
|
||||
usage: $0 [options]
|
||||
|
||||
Build C/C++ code for $APPNAME using Android NDK
|
||||
|
||||
OPTIONS:
|
||||
-s Build externals from source
|
||||
-p Run make with -j8 option to take advantage of multiple processors
|
||||
-h this help
|
||||
EOF
|
||||
}
|
||||
|
||||
while getopts "sph" OPTION; do
|
||||
case "$OPTION" in
|
||||
s)
|
||||
buildexternalsfromsource=1
|
||||
;;
|
||||
p)
|
||||
PARALLEL_BUILD_FLAG=\-j8
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# exit this script if any commmand fails
|
||||
set -e
|
||||
|
||||
# paths
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ];then
|
||||
echo "please define NDK_ROOT"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
|
||||
echo
|
||||
echo "Paths"
|
||||
echo " NDK_ROOT = $NDK_ROOT"
|
||||
echo " COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo " APP_ROOT = $APP_ROOT"
|
||||
echo " APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo
|
||||
|
||||
# Debug
|
||||
set -x
|
||||
|
||||
# make sure assets is exist
|
||||
if [ -d "$APP_ANDROID_ROOT"/assets ]; then
|
||||
rm -rf "$APP_ANDROID_ROOT"/assets
|
||||
fi
|
||||
|
||||
mkdir "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy "Resources" into "assets"
|
||||
cp -rf "$APP_ROOT"/Resources/* "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
# copy bindings/*.js into assets' root
|
||||
cp -f "$APP_ROOT"/bindings/*.js "$APP_ANDROID_ROOT"/assets
|
||||
|
||||
echo "Using prebuilt externals"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"$NDK_ROOT"/ndk-build $PARALLEL_BUILD_FLAG -C "$APP_ANDROID_ROOT" $* \
|
||||
"NDK_MODULE_PATH=${COCOS2DX_ROOT}:${COCOS2DX_ROOT}/cocos2dx/platform/third_party/android/prebuilt" \
|
||||
NDK_LOG=0 V=0
|
|
@ -0,0 +1,28 @@
|
|||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := cocosdragonjs_shared
|
||||
|
||||
LOCAL_MODULE_FILENAME := libcocosdragonjs
|
||||
|
||||
LOCAL_SRC_FILES := cocosdragonjs/main.cpp \
|
||||
../../Classes/AppDelegate.cpp
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes
|
||||
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += cocosdenshion_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += chipmunk_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += spidermonkey_static
|
||||
LOCAL_WHOLE_STATIC_LIBRARIES += scriptingcore-spidermonkey
|
||||
|
||||
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
$(call import-module,cocos2dx)
|
||||
$(call import-module,CocosDenshion/android)
|
||||
$(call import-module,external/chipmunk)
|
||||
$(call import-module,scripting/javascript/spidermonkey-android)
|
||||
$(call import-module,scripting/javascript/bindings)
|
|
@ -0,0 +1,3 @@
|
|||
APP_STL := gnustl_static
|
||||
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1
|
||||
APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 -DCC_ENABLE_CHIPMUNK_INTEGRATION=1
|
|
@ -0,0 +1,45 @@
|
|||
#include "AppDelegate.h"
|
||||
#include "cocos2d.h"
|
||||
#include "platform/android/jni/JniHelper.h"
|
||||
#include "CCEventType.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;
|
||||
|
||||
extern "C"
|
||||
{
|
||||
|
||||
jint JNI_OnLoad(JavaVM *vm, void *reserved)
|
||||
{
|
||||
JniHelper::setJavaVM(vm);
|
||||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
|
||||
void Java_org_cocos2dx_lib_Cocos2dxRenderer_nativeInit(JNIEnv* env, jobject thiz, jint w, jint h)
|
||||
{
|
||||
if (!CCDirector::sharedDirector()->getOpenGLView())
|
||||
{
|
||||
CCEGLView *view = CCEGLView::sharedOpenGLView();
|
||||
view->setFrameSize(w, h);
|
||||
|
||||
AppDelegate *pAppDelegate = new AppDelegate();
|
||||
CCApplication::sharedApplication()->run();
|
||||
}
|
||||
else
|
||||
{
|
||||
ccDrawInit();
|
||||
ccGLInvalidateStateCache();
|
||||
|
||||
CCShaderCache::sharedShaderCache()->reloadDefaultShaders();
|
||||
CCTextureCache::reloadAllTextures();
|
||||
CCNotificationCenter::sharedNotificationCenter()->postNotification(EVNET_COME_TO_FOREGROUND, NULL);
|
||||
CCDirector::sharedDirector()->setGLDefaultValues();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
APPNAME="CocosDragonJS"
|
||||
APP_ANDROID_NAME="org.cocos2dx.cocosdragonjs"
|
||||
|
||||
if [ -z "${SDK_ROOT+aaa}" ]; then
|
||||
# ... if SDK_ROOT is not set, use "$HOME/bin/android-sdk"
|
||||
SDK_ROOT="$HOME/bin/android-sdk"
|
||||
fi
|
||||
|
||||
if [ -z "${NDK_ROOT+aaa}" ]; then
|
||||
# ... if NDK_ROOT is not set, use "$HOME/bin/android-ndk"
|
||||
NDK_ROOT="$HOME/bin/android-ndk"
|
||||
fi
|
||||
|
||||
if [ -z "${COCOS2DX_ROOT+aaa}" ]; then
|
||||
# ... if COCOS2DX_ROOT is not set
|
||||
# ... find current working directory
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
# ... use paths relative to current directory
|
||||
COCOS2DX_ROOT="$DIR/../../.."
|
||||
APP_ROOT="$DIR/.."
|
||||
APP_ANDROID_ROOT="$DIR"
|
||||
else
|
||||
APP_ROOT="$COCOS2DX_ROOT/samples/$APPNAME"
|
||||
APP_ANDROID_ROOT="$COCOS2DX_ROOT/samples/$APPNAME/proj.android"
|
||||
fi
|
||||
|
||||
echo "NDK_ROOT = $NDK_ROOT"
|
||||
echo "SDK_ROOT = $SDK_ROOT"
|
||||
echo "COCOS2DX_ROOT = $COCOS2DX_ROOT"
|
||||
echo "APP_ROOT = $APP_ROOT"
|
||||
echo "APP_ANDROID_ROOT = $APP_ANDROID_ROOT"
|
||||
echo "APP_ANDROID_NAME = $APP_ANDROID_NAME"
|
||||
|
||||
echo
|
||||
echo "Killing and restarting ${APP_ANDROID_NAME}"
|
||||
echo
|
||||
|
||||
set -x
|
||||
|
||||
"${SDK_ROOT}"/platform-tools/adb shell am force-stop "${APP_ANDROID_NAME}"
|
||||
|
||||
NDK_MODULE_PATH="${COCOS2DX_ROOT}":"${COCOS2DX_ROOT}"/cocos2dx/platform/third_party/android/prebuilt \
|
||||
"${NDK_ROOT}"/ndk-gdb \
|
||||
--adb="${SDK_ROOT}"/platform-tools/adb \
|
||||
--verbose \
|
||||
--start \
|
||||
--force
|
|
@ -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-8
|
||||
|
||||
android.library.reference.1=../../../cocos2dx/platform/android/java
|
|
@ -0,0 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">CocosDragonJS</string>
|
||||
</resources>
|
|
@ -0,0 +1,39 @@
|
|||
/****************************************************************************
|
||||
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 org.cocos2dx.cocosdragonjs;
|
||||
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
public class CocosDragonJS extends Cocos2dxActivity{
|
||||
|
||||
protected void onCreate(Bundle savedInstanceState){
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("cocosdragonjs");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
//
|
||||
// testjsAppController.h
|
||||
// testjs
|
||||
//
|
||||
// Created by Rolando Abarca on 3/19/12.
|
||||
// Copyright __MyCompanyName__ 2012. All rights reserved.
|
||||
//
|
||||
|
||||
@class RootViewController;
|
||||
|
||||
@interface AppController : NSObject <UIAccelerometerDelegate, UIAlertViewDelegate, UITextFieldDelegate,UIApplicationDelegate> {
|
||||
UIWindow *window;
|
||||
RootViewController *viewController;
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
//
|
||||
// testjsAppController.mm
|
||||
// testjs
|
||||
//
|
||||
// Created by Rolando Abarca on 3/19/12.
|
||||
// Copyright __MyCompanyName__ 2012. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
#import "AppController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "EAGLView.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]];
|
||||
EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
|
||||
pixelFormat: kEAGLColorFormatRGBA8
|
||||
depthFormat: GL_DEPTH_COMPONENT16 //_OES
|
||||
preserveBackbuffer: NO
|
||||
sharegroup: nil
|
||||
multiSampling: NO
|
||||
numberOfSamples: 0 ];
|
||||
|
||||
// Use RootViewController manage EAGLView
|
||||
viewController = [[RootViewController alloc] initWithNibName:nil bundle:nil];
|
||||
viewController.wantsFullScreenLayout = YES;
|
||||
viewController.view = __glView;
|
||||
|
||||
// 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];
|
||||
|
||||
cocos2d::CCApplication::sharedApplication()->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::CCDirector::sharedDirector()->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::CCDirector::sharedDirector()->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::CCApplication::sharedApplication()->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::CCApplication::sharedApplication()->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::CCDirector::sharedDirector()->purgeCachedData();
|
||||
}
|
||||
|
||||
|
||||
- (void)dealloc {
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
|
@ -0,0 +1 @@
|
|||
3f35a7aa4c2d8c7b89f27eac3b7154ff7b300e48
|
|
@ -0,0 +1 @@
|
|||
66c6d1cead373b45218424f6a82f370897e443e4
|
|
@ -0,0 +1 @@
|
|||
84689888a14a2123d2b39f7f2f61be8c15207479
|
|
@ -0,0 +1,8 @@
|
|||
//
|
||||
// Prefix header for all source files of the 'testjs' target in the 'testjs' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
#endif
|
|
@ -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 {
|
||||
|
||||
}
|
||||
|
||||
@end
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// testjsAppController.h
|
||||
// testjs
|
||||
//
|
||||
// Created by Rolando Abarca on 3/19/12.
|
||||
// Copyright __MyCompanyName__ 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
- (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,17 @@
|
|||
//
|
||||
// main.m
|
||||
// testjs
|
||||
//
|
||||
// Created by Rolando Abarca on 3/19/12.
|
||||
// Copyright __MyCompanyName__ 2012. All rights reserved.
|
||||
//
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
|
||||
int retVal = UIApplicationMain(argc, argv, nil, @"AppController");
|
||||
[pool release];
|
||||
return retVal;
|
||||
}
|
|
@ -0,0 +1,209 @@
|
|||
<?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>{68ED0B4E-2BCA-45D2-9648-CEABEBD3B9D7}</ProjectGuid>
|
||||
<RootNamespace>CocosDragonJS</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration).win32\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration).win32\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration).win32\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
||||
<TypeLibraryName>$(IntDir)testjs.tlb</TypeLibraryName>
|
||||
<HeaderFileName>testjs.h</HeaderFileName>
|
||||
<DllDataFileName>
|
||||
</DllDataFileName>
|
||||
<InterfaceIdentifierFileName>testjs_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>testjs_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PreLinkEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*.*" "$(OutDir)"
|
||||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
if exist "$(OutDir)\CocosDragonJSRes" rd /s /q "$(OutDir)\CocosDragonJSRes"
|
||||
mkdir "$(OutDir)\CocosDragonJSRes"
|
||||
xcopy "$(ProjectDir)..\bindings\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
|
||||
xcopy "$(ProjectDir)..\Resources" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Copy js and resource files.</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<GenerateStublessProxies>true</GenerateStublessProxies>
|
||||
<TypeLibraryName>$(IntDir)testjs.tlb</TypeLibraryName>
|
||||
<HeaderFileName>testjs.h</HeaderFileName>
|
||||
<DllDataFileName>
|
||||
</DllDataFileName>
|
||||
<InterfaceIdentifierFileName>testjs_i.c</InterfaceIdentifierFileName>
|
||||
<ProxyFileName>testjs_p.c</ProxyFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;CC_ENABLE_CHIPMUNK_INTEGRATION=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>
|
||||
</DebugInformationFormat>
|
||||
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
</ResourceCompile>
|
||||
<PreLinkEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
xcopy /Y /Q "$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\lib\*.*" "$(OutDir)"
|
||||
</Command>
|
||||
</PreLinkEvent>
|
||||
<Link>
|
||||
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>if not exist "$(OutDir)" mkdir "$(OutDir)"
|
||||
if exist "$(OutDir)\CocosDragonJSRes" rd /s /q "$(OutDir)\CocosDragonJSRes"
|
||||
mkdir "$(OutDir)\CocosDragonJSRes"
|
||||
xcopy "$(ProjectDir)..\bindings\*.js" "$(OutDir)\CocosDragonJSRes" /e /Y
|
||||
xcopy "$(ProjectDir)..\Resources" "$(OutDir)\CocosDragonJSRes\" /e /Y</Command>
|
||||
<Message>Copy js and resource files.</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_registration.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_core.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.cpp" />
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp" />
|
||||
<ClCompile Include="main.cpp" />
|
||||
<ClCompile Include="..\Classes\AppDelegate.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes_registration.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_registration.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_config.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_core.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\ScriptingCore.h" />
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h" />
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="..\Classes\AppDelegate.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\testjs.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="testjs.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\cocos2dx\proj.win32\cocos2d.vcxproj">
|
||||
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\CocosDenshion\proj.win32\CocosDenshion.vcxproj">
|
||||
<Project>{f8edd7fa-9a51-4e80-baeb-860825d2eac6}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -0,0 +1,125 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="bindings">
|
||||
<UniqueIdentifier>{58ebb5df-595d-4e27-8c01-555be6f1c625}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="resource">
|
||||
<UniqueIdentifier>{ca9c9e15-d942-43a1-aa7a-5f0b74ca1afd}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;png;manifest</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="win32">
|
||||
<UniqueIdentifier>{ccb2323b-1cfa-41ea-bcf4-ba5f07309396}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Classes">
|
||||
<UniqueIdentifier>{e93a77e1-af1e-4400-87d3-504b62ebdbb0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="bindings\generated">
|
||||
<UniqueIdentifier>{146f26cf-13e1-4106-891b-4b0118ceac2b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.cpp">
|
||||
<Filter>win32</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Classes\AppDelegate.cpp">
|
||||
<Filter>Classes</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp">
|
||||
<Filter>bindings\generated</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_registration.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_bindings_core.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>win32</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Classes\AppDelegate.h">
|
||||
<Filter>Classes</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp">
|
||||
<Filter>bindings\generated</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_ccbreader.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_auto_classes_registration.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_functions.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_manual.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_chipmunk_registration.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_config.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_bindings_core.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\js_manual_conversions.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\ScriptingCore.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h">
|
||||
<Filter>bindings</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\testjs.ico">
|
||||
<Filter>resource</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="testjs.rc">
|
||||
<Filter>resource</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(OutDir)\CocosDragonJSRes</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LocalDebuggerWorkingDirectory>$(OutDir)\CocosDragonJSRes</LocalDebuggerWorkingDirectory>
|
||||
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,37 @@
|
|||
#include "main.h"
|
||||
#include "AppDelegate.h"
|
||||
#include "CCEGLView.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;
|
||||
CCEGLView* eglView = CCEGLView::sharedOpenGLView();
|
||||
eglView->setFrameSize(320, 480);
|
||||
|
||||
int ret = CCApplication::sharedApplication()->run();
|
||||
|
||||
#ifdef USE_WIN32_CONSOLE
|
||||
FreeConsole();
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
}
|
|
@ -0,0 +1,13 @@
|
|||
#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>
|
||||
|
||||
// C RunTime Header Files
|
||||
#include "CCStdC.h"
|
||||
|
||||
#endif // __WINMAIN_H__
|
Binary file not shown.
After Width: | Height: | Size: 46 KiB |
|
@ -0,0 +1,20 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by testjs.RC
|
||||
//
|
||||
|
||||
#define IDS_PROJNAME 100
|
||||
#define IDR_TESTJS 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,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\\testjs.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", "testjs Module\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 1\0"
|
||||
VALUE "InternalName", "testjs\0"
|
||||
VALUE "LegalCopyright", "Copyright \0"
|
||||
VALUE "OriginalFilename", "testjs.exe\0"
|
||||
VALUE "ProductName", "testjs 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)
|
|
@ -42,6 +42,7 @@ bool AppDelegate::applicationDidFinishLaunching()
|
|||
CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
|
||||
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
|
||||
ScriptingCore::getInstance()->runScript("js/MoonWarriors-native.js");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)extensions;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -107,7 +107,7 @@ xcopy /Y /Q "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(O
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>.;..\Classes;$(SolutionDir)scripting\javascript\spidermonkey-win32\include;$(SolutionDir)external\chipmunk\include\chipmunk;$(SolutionDir)scripting\javascript\bindings;$(SolutionDir)extensions;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx\kazmath\include;$(SolutionDir)cocos2dx\platform\win32;$(SolutionDir)cocos2dx\platform\third_party\win32;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;$(SolutionDir)CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -119,7 +119,7 @@ xcopy "$(ProjectDir)..\cocos2d-js-tests\src" "$(OutDir)\TestJavascriptRes\src\"
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
|
|
@ -64,7 +64,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;DEBUG;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>true</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
|
@ -121,7 +121,7 @@ copy "$(ProjectDir)..\*.js" "$(OutDir)\WatermelonWithMeRes\" /Y
|
|||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(ProjectDir)..\..\..\scripting\javascript\spidermonkey-win32\include;$(ProjectDir)..\..\..\external\chipmunk\include\chipmunk;$(ProjectDir)..\..\..\extensions;$(ProjectDir)..\..\..\scripting\javascript\bindings;$(ProjectDir)..\..\..\cocos2dx;$(ProjectDir)..\..\..\cocos2dx\include;$(ProjectDir)..\..\..\cocos2dx\kazmath\include;$(ProjectDir)..\..\..\cocos2dx\platform\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32;$(ProjectDir)..\..\..\cocos2dx\platform\third_party\win32\OGLES;$(ProjectDir)..\..\..\CocosDenshion\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;CC_ENABLE_CHIPMUNK_INTEGRATION=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ExceptionHandling>
|
||||
</ExceptionHandling>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
|
|
@ -10,11 +10,11 @@ LOCAL_SRC_FILES := ScriptingCore.cpp \
|
|||
cocos2d_specifics.cpp \
|
||||
js_manual_conversions.cpp \
|
||||
cocosjs_manual_conversions.cpp \
|
||||
js_bindings_ccbreader.cpp \
|
||||
js_bindings_chipmunk_manual.cpp \
|
||||
js_bindings_chipmunk_functions.cpp \
|
||||
js_bindings_chipmunk_auto_classes.cpp \
|
||||
js_bindings_chipmunk_registration.cpp \
|
||||
js_bindings_ccbreader.cpp \
|
||||
js_bindings_core.cpp \
|
||||
generated/cocos2dx.cpp
|
||||
|
||||
|
|
|
@ -457,7 +457,7 @@ JSBool ScriptingCore::runScript(const char *path, JSObject* global, JSContext* c
|
|||
JSAutoCompartment ac(cx, global);
|
||||
evaluatedOK = JS_ExecuteScript(cx, global, script, &rval);
|
||||
if (JS_FALSE == evaluatedOK) {
|
||||
fprintf(stderr, "(evaluatedOK == JS_FALSE)\n");
|
||||
CCLog("(evaluatedOK == JS_FALSE)");
|
||||
}
|
||||
}
|
||||
return evaluatedOK;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
/* Define to 1 if SpiderMonkey should support the ability to perform
|
||||
entirely too much GC. */
|
||||
/* #undef JS_GC_ZEAL */
|
||||
#define JS_GC_ZEAL 1
|
||||
|
||||
/* Define to 1 if the <endian.h> header is present and
|
||||
useable. See jscpucfg.h. */
|
||||
|
@ -60,7 +60,7 @@
|
|||
|
||||
/* Some mozilla code uses JS-friend APIs that depend on JS_METHODJIT being
|
||||
correct. */
|
||||
/* #undef JS_METHODJIT */
|
||||
#define JS_METHODJIT 1
|
||||
|
||||
/* Define to 1 to enable support for E4X (ECMA-357), 0 to disable it. */
|
||||
#define JS_HAS_XML_SUPPORT 1
|
||||
|
|
|
@ -1 +1 @@
|
|||
da504065669dce359843f03a46e60f49be6d156b
|
||||
addb99612208912260540ce3f0c83c10691113ee
|
|
@ -1 +1 @@
|
|||
93e1d9a90e40ffa0608ad24dff1ba734d8413375
|
||||
779037ed47868bd3ac30b54b6609721f40b669eb
|
|
@ -96,7 +96,7 @@ skip = CCNode::[.*Transform convertToWindowSpace getChildren setPosition getGrid
|
|||
CCCardinalSpline.*::[create actionWithDuration setPoints],
|
||||
CCScheduler::[pause resume unscheduleAllSelectorsForTarget],
|
||||
CCTextureCache::[addPVRTCImage],
|
||||
CCTimer::[getSelector],
|
||||
CCTimer::[getSelector],
|
||||
CC.*Loader$::[*],
|
||||
*::[copyWith.* onEnter.* onExit.* description getObjectType .*RGB.* .*HSV.*]
|
||||
|
||||
|
@ -124,8 +124,6 @@ rename_functions = CCDirector::[sharedDirector=getInstance],
|
|||
CCTMXTiledMap::[layerNamed=getLayer objectGroupNamed=getObjectGroup propertyNamed=getProperty],
|
||||
CCUserDefault::[sharedUserDefault=getInstance]
|
||||
|
||||
|
||||
|
||||
rename_classes = CCParticleSystemQuad::CCParticleSystem,
|
||||
SimpleAudioEngine::AudioEngine,
|
||||
CCBReader::CC_Reader,
|
||||
|
|
Loading…
Reference in New Issue