Merge pull request #1438 from dumganhar/iss1469-moonwarriors

issue #1469: Adding MoonWarriors sample game.
This commit is contained in:
James Chen 2012-10-10 07:22:05 -07:00
commit fbfc7c0123
67 changed files with 4472 additions and 4 deletions

View File

@ -53,6 +53,12 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\TestLua\
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoonWarriors", "samples\MoonWarriors\proj.win32\MoonWarriors.vcproj", "{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}"
ProjectSection(ProjectDependencies) = postProject
{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection
EndProject
Global Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
@ -106,6 +112,10 @@ Global
{B53D3C68-96DA-4806-BB26-94888B52191A}.Debug|Win32.Build.0 = Debug|Win32 {B53D3C68-96DA-4806-BB26-94888B52191A}.Debug|Win32.Build.0 = Debug|Win32
{B53D3C68-96DA-4806-BB26-94888B52191A}.Release|Win32.ActiveCfg = Release|Win32 {B53D3C68-96DA-4806-BB26-94888B52191A}.Release|Win32.ActiveCfg = Release|Win32
{B53D3C68-96DA-4806-BB26-94888B52191A}.Release|Win32.Build.0 = Release|Win32 {B53D3C68-96DA-4806-BB26-94888B52191A}.Release|Win32.Build.0 = Release|Win32
{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}.Debug|Win32.ActiveCfg = Debug|Win32
{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}.Debug|Win32.Build.0 = Debug|Win32
{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}.Release|Win32.ActiveCfg = Release|Win32
{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -35,6 +35,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestLua", "samples\TestLua\
{F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6} = {F8EDD7FA-9A51-4E80-BAEB-860825D2EAC6}
EndProjectSection EndProjectSection
EndProject EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MoonWarriors", "samples\MoonWarriors\proj.win32\MoonWarriors.vcxproj", "{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}"
EndProject
Global Global
GlobalSection(DPCodeReviewSolutionGUID) = preSolution GlobalSection(DPCodeReviewSolutionGUID) = preSolution
DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000}
@ -88,6 +90,10 @@ Global
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Debug|Win32.Build.0 = Debug|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.ActiveCfg = Release|Win32
{4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32 {4E6A7A0E-DDD8-4BAA-8B22-C964069364ED}.Release|Win32.Build.0 = Release|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Debug|Win32.ActiveCfg = Debug|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Debug|Win32.Build.0 = Debug|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Release|Win32.ActiveCfg = Release|Win32
{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -233,7 +233,7 @@ THE SOFTWARE.
NS_CC_BEGIN NS_CC_BEGIN
const char* cocos2dVersion(); CC_DLL const char* cocos2dVersion();
NS_CC_END NS_CC_END

View File

@ -0,0 +1,82 @@
#include "AppDelegate.h"
#include "cocos2d.h"
#include "SimpleAudioEngine.h"
#include "ScriptingCore.h"
#include "generated/cocos2dx.hpp"
#include "cocos2d_specifics.hpp"
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());
CCEGLView::sharedOpenGLView()->setDesignResolutionSize(320, 480, kResolutionShowAll);
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
// pDirector->enableRetinaDisplay(true);
// 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->start();
CCScriptEngineProtocol *pEngine = ScriptingCore::getInstance();
CCScriptEngineManager::sharedManager()->setScriptEngine(pEngine);
ScriptingCore::getInstance()->runScript("js/MoonWarriors-native.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();
}

View File

@ -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_

View File

@ -0,0 +1,47 @@
var AboutLayer = cc.Layer.extend({
ctor:function () {
cc.associateWithNative( this, cc.Layer );
},
init:function () {
var bRet = false;
if (this._super()) {
var sp = cc.Sprite.create(s_loading);
sp.setAnchorPoint(cc.p(0,0));
this.addChild(sp, 0, 1);
var cacheImage = cc.TextureCache.getInstance().addImage(s_menuTitle);
var title = cc.Sprite.createWithTexture(cacheImage, cc.rect(0, 36, 100, 34));
title.setPosition(cc.p(winSize.width / 2, winSize.height - 60));
this.addChild(title);
// There is a bug in LabelTTF native. Apparently it fails with some unicode chars.
// var about = cc.LabelTTF.create(" This showcase utilizes many features from Cocos2d-html5 engine, including: Parallax background, tilemap, actions, ease, frame animation, schedule, Labels, keyboard Dispatcher, Scene Transition. \n Art and audio is copyrighted by Enigmata Genus Revenge, you may not use any copyrigted material without permission. This showcase is licensed under GPL. \n \n Programmer: \n Shengxiang Chen (陈升想) \n Dingping Lv (吕定平) \n Effects animation: Hao Wu(吴昊)\n Quality Assurance: Sean Lin(林顺)", "Arial", 14, cc.size(winSize.width * 0.85, 100), cc.TEXT_ALIGNMENT_LEFT );
var about = cc.LabelTTF.create(" This showcase utilizes many features from Cocos2d-html5 engine, including: Parallax background, tilemap, actions, ease, frame animation, schedule, Labels, keyboard Dispatcher, Scene Transition. \n Art and audio is copyrighted by Enigmata Genus Revenge, you may not use any copyrigted material without permission. This showcase is licensed under GPL. \n\nProgrammer: \n Shengxiang Chen\n Dingping Lv \n Effects animation: Hao Wu\n Quality Assurance: Sean Lin", "Arial", 14, cc.size(winSize.width * 0.85, 320), cc.TEXT_ALIGNMENT_LEFT );
about.setPosition(cc.p(winSize.width / 2, winSize.height/2 -20) );
about.setAnchorPoint( cc.p(0.5, 0.5));
this.addChild(about);
var label = cc.LabelTTF.create("Go back", "Arial", 14);
var back = cc.MenuItemLabel.create(label, this, this.backCallback);
var menu = cc.Menu.create(back);
menu.setPosition(cc.p(winSize.width / 2, 40));
this.addChild(menu);
bRet = true;
}
return bRet;
},
backCallback:function (pSender) {
var scene = cc.Scene.create();
scene.addChild(SysMenu.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
}
});
AboutLayer.create = function () {
var sg = new AboutLayer();
if (sg && sg.init()) {
return sg;
}
return null;
};

View File

@ -0,0 +1,62 @@
//bullet
var Bullet = cc.Sprite.extend({
active:true,
xVelocity:0,
yVelocity:200,
power:1,
HP:1,
moveType:null,
zOrder:3000,
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
parentType:MW.BULLET_TYPE.PLAYER,
ctor:function (bulletSpeed, weaponType, attackMode) {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Sprite );
this.yVelocity = -bulletSpeed;
this.attackMode = attackMode;
cc.SpriteFrameCache.getInstance().addSpriteFrames(s_bullet_plist);
this.initWithSpriteFrameName(weaponType);
this.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
/*var tmpAction;
switch (this.attackMode) {
case MW.ENEMY_MOVE_TYPE.NORMAL:
tmpAction = cc.MoveBy.create(2, cc.p(this.getPosition().x, 400));
break;
case MW.ENEMY_ATTACK_MODE.TSUIHIKIDAN:
tmpAction = cc.MoveTo.create(2, GameLayer.create()._ship.getPosition());
break;
}
this.runAction(tmpAction);*/
},
update:function (dt) {
var p = this.getPosition();
p.x -= this.xVelocity * dt;
p.y -= this.yVelocity * dt;
this.setPosition( p );
if (this.HP <= 0) {
this.active = false;
}
},
destroy:function () {
var explode = cc.Sprite.create(s_hit);
explode.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
explode.setPosition(this.getPosition());
explode.setRotation(Math.random()*360);
explode.setScale(0.75);
this.getParent().addChild(explode,9999);
cc.ArrayRemoveObject(MW.CONTAINER.ENEMY_BULLETS,this);
cc.ArrayRemoveObject(MW.CONTAINER.PLAYER_BULLETS,this);
this.removeFromParentAndCleanup(true);
var removeExplode = cc.CallFunc.create(explode,explode.removeFromParentAndCleanup);
explode.runAction(cc.ScaleBy.create(0.3, 2,2));
explode.runAction(cc.Sequence.create(cc.FadeOut.create(0.3), removeExplode));
},
hurt:function () {
this.HP--;
},
collideRect:function(){
var p = this.getPosition();
return cc.rect(p.x - 3, p.y - 3, 6, 6);
}
});

View File

@ -0,0 +1,78 @@
var flareEffect = function (parent, target, callback) {
var flare = cc.Sprite.create(s_flare);
flare.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
parent.addChild(flare, 10);
flare.setOpacity(0);
flare.setPosition(cc.p(-30, 297));
flare.setRotation(-120);
flare.setScale(0.2);
var opacityAnim = cc.FadeTo.create(0.5, 255);
var opacDim = cc.FadeTo.create(1, 0);
var biggeAnim = cc.ScaleBy.create(0.7, 1.2, 1.2);
var biggerEase = cc.EaseSineOut.create(biggeAnim);
var moveAnim = cc.MoveBy.create(0.5, cc.p(328, 0));
var easeMove = cc.EaseSineOut.create(moveAnim);
var rotateAnim = cc.RotateBy.create(2.5, 90);
var rotateEase = cc.EaseExponentialOut.create(rotateAnim);
var bigger = cc.ScaleTo.create(0.5, 1);
var onComplete = cc.CallFunc.create(target, callback);
var killflare = cc.CallFunc.create(flare, function () {
this.getParent().removeChild(this,true);
});
flare.runAction(cc.Sequence.create(opacityAnim, biggerEase, opacDim, killflare, onComplete));
flare.runAction(easeMove);
flare.runAction(rotateEase);
flare.runAction(bigger);
};
var removeFromParent = function( sprite )
{
sprite.removeFromParentAndCleanup( true );
};
var spark = function (ccpoint, parent, scale, duration) {
scale = scale || 0.3;
duration = duration || 0.5;
var one = cc.Sprite.create(s_explode1);
var two = cc.Sprite.create(s_explode2);
var three = cc.Sprite.create(s_explode3);
one.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
two.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
three.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
one.setPosition(ccpoint);
two.setPosition(ccpoint);
three.setPosition(ccpoint);
//parent.addChild(one);
parent.addChild(two);
parent.addChild(three);
one.setScale(scale);
two.setScale(scale);
three.setScale(scale);
three.setRotation(Math.random() * 360);
var left = cc.RotateBy.create(duration, -45);
var right = cc.RotateBy.create(duration, 45);
var scaleBy = cc.ScaleBy.create(duration, 3, 3);
var fadeOut = cc.FadeOut.create(duration);
var remove = cc.CallFunc.create(this, removeFromParent );
var seq = cc.Sequence.create( fadeOut, remove );
one.runAction(left);
two.runAction(right);
one.runAction(scaleBy);
two.runAction(scaleBy.copy());
three.runAction(scaleBy.copy());
one.runAction(seq);
two.runAction(seq.copy() );
three.runAction(seq.copy());
};

View File

@ -0,0 +1,75 @@
var Enemy = cc.Sprite.extend({
eID:0,
active:true,
speed:200,
bulletSpeed:-200,
HP:15,
bulletPowerValue:1,
moveType:null,
scoreValue:200,
zOrder:1000,
delayTime:1 + 1.2 * Math.random(),
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
_hurtColorLife:0,
ctor:function (arg) {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Sprite );
this.HP = arg.HP;
this.moveType = arg.moveType;
this.scoreValue = arg.scoreValue;
this.attackMode = arg.attackMode;
this.initWithSpriteFrameName(arg.textureName);
this.schedule(this.shoot, this.delayTime);
},
_timeTick:0,
update:function (dt) {
if (this.HP <= 0) {
this.active = false;
}
this._timeTick += dt;
if (this._timeTick > 0.1) {
this._timeTick = 0;
if (this._hurtColorLife > 0) {
this._hurtColorLife--;
}
if (this._hurtColorLife == 1) {
this.setColor( cc.WHITE );
}
}
},
destroy:function () {
MW.SCORE += this.scoreValue;
var a = new Explosion();
a.setPosition(this.getPosition());
this.getParent().addChild(a);
spark(this.getPosition(),this.getParent(), 1.2, 0.7);
cc.ArrayRemoveObject(MW.CONTAINER.ENEMIES,this);
this.removeFromParentAndCleanup(true);
if(MW.SOUND){
cc.AudioEngine.getInstance().playEffect(s_explodeEffect);
}
},
shoot:function () {
var p = this.getPosition();
var b = new Bullet(this.bulletSpeed, "W2.png", this.attackMode);
MW.CONTAINER.ENEMY_BULLETS.push(b);
this.getParent().addChild(b, b.zOrder, MW.UNIT_TAG.ENMEY_BULLET);
b.setPosition(cc.p(p.x, p.y - this.getContentSize().height * 0.2));
},
hurt:function () {
this._hurtColorLife = 2;
this.HP--;
this.setColor( cc.RED );
},
collideRect:function(){
var a = this.getContentSize();
var p = this.getPosition();
return cc.rect(p.x - a.width/2, p.y - a.height/4,a.width,a.height/2);
}
});
Enemy.sharedEnemy = function(){
cc.SpriteFrameCache.getInstance().addSpriteFrames(s_Enemy_plist, s_Enemy);
};

View File

@ -0,0 +1,38 @@
var Explosion = cc.Sprite.extend({
tmpWidth:0,
tmpHeight:0,
ctor:function () {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Sprite );
var pFrame = cc.SpriteFrameCache.getInstance().getSpriteFrame("explosion_01.png");
this.initWithSpriteFrame(pFrame);
var cs = this.getContentSize();
this.tmpWidth = cs.width;
this.tmpHeight = cs.height;
var animation = cc.AnimationCache.getInstance().getAnimation("Explosion");
this.runAction(cc.Sequence.create(
cc.Animate.create(animation),
cc.CallFunc.create(this, this.destroy)
));
this.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
},
destroy:function () {
this.getParent().removeChild(this,true);
}
});
Explosion.sharedExplosion = function () {
cc.SpriteFrameCache.getInstance().addSpriteFrames(s_explosion_plist);
var animFrames = [];
var str = "";
for (var i = 1; i < 35; i++) {
str = "explosion_" + (i < 10 ? ("0" + i) : i) + ".png";
var frame = cc.SpriteFrameCache.getInstance().getSpriteFrame(str);
animFrames.push(frame);
}
var animation = cc.Animation.create(animFrames, 0.04);
cc.AnimationCache.getInstance().addAnimation(animation, "Explosion");
};

View File

@ -0,0 +1,35 @@
var GameControlMenu = cc.Layer.extend({
ctor:function() {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Layer);
},
init:function () {
var bRet = false;
if (this._super()) {
cc.MenuItemFont.setFontSize(18);
cc.MenuItemFont.setFontName("Arial");
var systemMenu = cc.MenuItemFont.create("Main Menu", this, this.sysMenu);
var menu = cc.Menu.create(systemMenu);
menu.setPosition(cc.p(0, 0));
systemMenu.setAnchorPoint(cc.p(0, 0));
systemMenu.setPosition(cc.p(winSize.width-95, 5));
this.addChild(menu, 1, 2);
bRet = true;
}
return bRet;
},
sysMenu:function (pSender) {
var scene = cc.Scene.create();
scene.addChild(SysMenu.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2,scene));
}
});
GameControlMenu.create = function () {
var sg = new GameControlMenu();
if (sg && sg.init()) {
return sg;
}
return null;
};

View File

@ -0,0 +1,70 @@
/**
* Cocos2d-html5 show case : Moon Warriors
*
* @Licensed:
* This showcase is licensed under GPL.
*
* @Authors:
* Programmer: Shengxiang Chen (陈升想), Dingping Lv (吕定平), Ricardo Quesada
* Effects animation: Hao Wu (吴昊)
* Quality Assurance: Sean Lin (林顺)
*
* @Links:
* http://www.cocos2d-x.org
* http://bbs.html5china.com
*
*/
MW.GameController = cc.Class.extend({
_curScene:null,
_gameState:MW.GAME_STATE.HOME,
_isNewGame:true,
_curLevel:MW.LEVEL.STAGE1,
_selectLevel:MW.LEVEL.STAGE1,
init:function () {
return true;
},
setCurScene:function (s) {
if (this._curScene != s) {
if (this._curScene !== null) {
this._curScene.onExit();
}
this._curScene = s;
if (this._curScene) {
this._curScene.onEnter();
cc.Director.getInstance().replaceScene(s);
}
}
},
getCurScene:function () {
return this._curScene;
},
runGame:function () {
},
newGame:function () {
},
option:function () {
},
about:function () {
}
});
MW.GameController.getInstance = function () {
cc.Assert(this._sharedGame, "Havn't call setSharedGame");
if (!this._sharedGame) {
this._sharedGame = new MW.GameController();
if (this._sharedGame.init()) {
return this._sharedGame;
}
} else {
return this._sharedGame;
}
return null;
};
MW.GameController._sharedGame = null;

View File

@ -0,0 +1,315 @@
//
// MoonWarriors
//
// Handles the Game Logic
//
STATE_PLAYING = 0;
STATE_GAMEOVER = 1;
var GameLayer = cc.Layer.extend({
_time:null,
_ship:null,
_backSky:null,
_backSkyHeight:0,
_backSkyRe:null,
_backTileMap:null,
_backTileMapHeight:0,
_backTileMapRe:null,
_levelManager:null,
_tmpScore:0,
_isBackSkyReload:false,
_isBackTileReload:false,
lbScore:null,
screenRect:null,
explosionAnimation:[],
_beginPos:cc.p(0, 0),
_state:STATE_PLAYING,
ctor:function () {
cc.associateWithNative( this, cc.Layer );
},
init:function () {
var bRet = false;
if (this._super()) {
// reset global values
MW.CONTAINER.ENEMIES = [];
MW.CONTAINER.ENEMY_BULLETS = [];
MW.CONTAINER.PLAYER_BULLETS = [];
MW.SCORE = 0;
MW.LIFE = 4;
this._state = STATE_PLAYING;
Explosion.sharedExplosion();
Enemy.sharedEnemy();
winSize = cc.Director.getInstance().getWinSize();
this._levelManager = new LevelManager(this);
this.initBackground();
this.screenRect = cc.rect(0, 0, winSize.width, winSize.height + 10);
// score
this.lbScore = cc.LabelBMFont.create("Score: 0", s_arial14_fnt);
this.lbScore.setAnchorPoint( cc.p(1,0) );
this.lbScore.setAlignment( cc.TEXT_ALIGNMENT_RIGHT );
this.addChild(this.lbScore, 1000);
this.lbScore.setPosition(cc.p(winSize.width - 5 , winSize.height - 30));
// ship life
var shipTexture = cc.TextureCache.getInstance().addImage(s_ship01);
var life = cc.Sprite.createWithTexture(shipTexture, cc.rect(0, 0, 60, 38));
life.setScale(0.6);
life.setPosition(cc.p(30, 460));
this.addChild(life, 1, 5);
// ship Life count
this._lbLife = cc.LabelTTF.create("0", "Arial", 20);
this._lbLife.setPosition(cc.p(60, 463));
this._lbLife.setColor(cc.RED);
this.addChild(this._lbLife, 1000);
// ship
this._ship = new Ship();
this.addChild(this._ship, this._ship.zOrder, MW.UNIT_TAG.PLAYER);
// accept touch now!
var t = cc.config.deviceType;
if( t == 'browser' ) {
this.setTouchEnabled(true);
this.setKeyboardEnabled(true);
} else if( t == 'desktop' ) {
this.setMouseEnabled(true);
} else if( t == 'mobile' ) {
this.setTouchEnabled(true);
}
// schedule
this.scheduleUpdate();
this.schedule(this.scoreCounter, 1);
if (MW.SOUND) {
cc.AudioEngine.getInstance().playBackgroundMusic(s_bgMusic, true);
}
bRet = true;
}
return bRet;
},
scoreCounter:function () {
if( this._state == STATE_PLAYING ) {
this._time++;
var minute = 0 | (this._time / 60);
var second = this._time % 60;
minute = minute > 9 ? minute : "0" + minute;
second = second > 9 ? second : "0" + second;
var curTime = minute + ":" + second;
this._levelManager.loadLevelResource(this._time);
}
},
onTouchesMoved:function (touches, event) {
this.processEvent( touches[0] );
},
onMouseDragged:function( event ) {
this.processEvent( event );
},
processEvent:function( event ) {
if( this._state == STATE_PLAYING ) {
var delta = event.getDelta();
var curPos = this._ship.getPosition();
curPos= cc.pAdd( curPos, delta );
curPos = cc.pClamp(curPos, cc.POINT_ZERO, cc.p(winSize.width, winSize.height) );
this._ship.setPosition( curPos );
}
},
onKeyDown:function (e) {
MW.KEYS[e] = true;
},
onKeyUp:function (e) {
MW.KEYS[e] = false;
},
update:function (dt) {
if( this._state == STATE_PLAYING ) {
this.checkIsCollide();
this.removeInactiveUnit(dt);
this.checkIsReborn();
this.updateUI();
}
if( cc.config.deviceType == 'browser' )
cc.$("#cou").innerHTML = "Ship:" + 1 + ", Enemy: " + MW.CONTAINER.ENEMIES.length + ", Bullet:" + MW.CONTAINER.ENEMY_BULLETS.length + "," + MW.CONTAINER.PLAYER_BULLETS.length + " all:" + this.getChildren().length;
},
checkIsCollide:function () {
var selChild, bulletChild;
//check collide
var i =0;
for (i = 0; i < MW.CONTAINER.ENEMIES.length; i++) {
selChild = MW.CONTAINER.ENEMIES[i];
for (var j = 0; j < MW.CONTAINER.PLAYER_BULLETS.length; j++) {
bulletChild = MW.CONTAINER.PLAYER_BULLETS[j];
if (this.collide(selChild, bulletChild)) {
bulletChild.hurt();
selChild.hurt();
}
if (!cc.rectIntersectsRect(this.screenRect, bulletChild.getBoundingBox() )) {
bulletChild.destroy();
}
}
if (this.collide(selChild, this._ship)) {
if (this._ship.active) {
selChild.hurt();
this._ship.hurt();
}
}
if (!cc.rectIntersectsRect(this.screenRect, selChild.getBoundingBox() )) {
selChild.destroy();
}
}
for (i = 0; i < MW.CONTAINER.ENEMY_BULLETS.length; i++) {
selChild = MW.CONTAINER.ENEMY_BULLETS[i];
if (this.collide(selChild, this._ship)) {
if (this._ship.active) {
selChild.hurt();
this._ship.hurt();
}
}
if (!cc.rectIntersectsRect(this.screenRect, selChild.getBoundingBox() )) {
selChild.destroy();
}
}
},
removeInactiveUnit:function (dt) {
var selChild, layerChildren = this.getChildren();
for (var i in layerChildren) {
selChild = layerChildren[i];
if (selChild) {
if( typeof selChild.update == 'function' ) {
selChild.update(dt);
var tag = selChild.getTag();
if ((tag == MW.UNIT_TAG.PLAYER) || (tag == MW.UNIT_TAG.PLAYER_BULLET) ||
(tag == MW.UNIT_TAG.ENEMY) || (tag == MW.UNIT_TAG.ENMEY_BULLET)) {
if (selChild && !selChild.active) {
selChild.destroy();
}
}
}
}
}
},
checkIsReborn:function () {
if (MW.LIFE > 0 && !this._ship.active) {
// ship
this._ship = new Ship();
this.addChild(this._ship, this._ship.zOrder, MW.UNIT_TAG.PLAYER);
}
else if (MW.LIFE <= 0 && !this._ship.active) {
this._state = STATE_GAMEOVER;
// XXX: needed for JS bindings.
this._ship = null;
this.runAction(cc.Sequence.create(
cc.DelayTime.create(0.2),
cc.CallFunc.create(this, this.onGameOver)));
}
},
updateUI:function () {
if (this._tmpScore < MW.SCORE) {
this._tmpScore += 5;
}
this._lbLife.setString(MW.LIFE);
this.lbScore.setString("Score: " + this._tmpScore);
},
collide:function (a, b) {
var aRect = a.collideRect();
var bRect = b.collideRect();
if (cc.rectIntersectsRect(aRect, bRect)) {
return true;
}
},
initBackground:function () {
// bg
this._backSky = cc.Sprite.create(s_bg01);
this._backSky.setAnchorPoint(cc.p(0, 0));
this._backSkyHeight = this._backSky.getContentSize().height;
this.addChild(this._backSky, -10);
//tilemap
this._backTileMap = cc.TMXTiledMap.create(s_level01);
this.addChild(this._backTileMap, -9);
this._backTileMapHeight = this._backTileMap.getMapSize().height * this._backTileMap.getTileSize().height;
this._backSkyHeight -= 48;
this._backTileMapHeight -= 200;
this._backSky.runAction(cc.MoveBy.create(3, cc.p(0, -48)));
this._backTileMap.runAction(cc.MoveBy.create(3, cc.p(0, -200)));
this.schedule(this.movingBackground, 3);
},
movingBackground:function () {
this._backSky.runAction(cc.MoveBy.create(3, cc.p(0, -48)));
this._backTileMap.runAction(cc.MoveBy.create(3, cc.p(0, -200)));
this._backSkyHeight -= 48;
this._backTileMapHeight -= 200;
if (this._backSkyHeight <= winSize.height) {
if (!this._isBackSkyReload) {
this._backSkyRe = cc.Sprite.create(s_bg01);
this._backSkyRe.setAnchorPoint(cc.p(0, 0));
this.addChild(this._backSkyRe, -10);
this._backSkyRe.setPosition(cc.p(0, winSize.height));
this._isBackSkyReload = true;
}
this._backSkyRe.runAction(cc.MoveBy.create(3, cc.p(0, -48)));
}
if (this._backSkyHeight <= 0) {
this._backSkyHeight = this._backSky.getContentSize().height;
this.removeChild(this._backSky, true);
this._backSky = this._backSkyRe;
this._backSkyRe = null;
this._isBackSkyReload = false;
}
if (this._backTileMapHeight <= winSize.height) {
if (!this._isBackTileReload) {
this._backTileMapRe = cc.TMXTiledMap.create(s_level01);
this.addChild(this._backTileMapRe, -9);
this._backTileMapRe.setPosition(cc.p(0, winSize.height));
this._isBackTileReload = true;
}
this._backTileMapRe.runAction(cc.MoveBy.create(3, cc.p(0, -200)));
}
if (this._backTileMapHeight <= 0) {
this._backTileMapHeight = this._backTileMapRe.getMapSize().height * this._backTileMapRe.getTileSize().height;
this.removeChild(this._backTileMap, true);
this._backTileMap = this._backTileMapRe;
this._backTileMapRe = null;
this._isBackTileReload = false;
}
},
onGameOver:function () {
var scene = cc.Scene.create();
scene.addChild(GameOver.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
}
});
GameLayer.create = function () {
var sg = new GameLayer();
if (sg && sg.init()) {
return sg;
}
return null;
};
GameLayer.scene = function () {
var scene = cc.Scene.create();
var layer = GameLayer.create();
scene.addChild(layer, 1);
return scene;
};

View File

@ -0,0 +1,83 @@
var GameOver = cc.Layer.extend({
_ship:null,
_lbScore:0,
ctor:function() {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Layer);
},
init:function () {
var bRet = false;
if (this._super()) {
var sp = cc.Sprite.create(s_loading);
sp.setAnchorPoint( cc.p(0,0) );
this.addChild(sp, 0, 1);
var logo = cc.Sprite.create(s_gameOver);
logo.setAnchorPoint(cc.p(0,0));
logo.setPosition(cc.p(0,300));
this.addChild(logo,10,1);
var playAgainNormal = cc.Sprite.create(s_menu, cc.rect(378, 0, 126, 33));
var playAgainSelected = cc.Sprite.create(s_menu, cc.rect(378, 33, 126, 33));
var playAgainDisabled = cc.Sprite.create(s_menu, cc.rect(378, 33 * 2, 126, 33));
var cocos2dhtml5 = cc.Sprite.create(s_cocos2dhtml5);
cocos2dhtml5.setPosition(cc.p(160,150));
this.addChild(cocos2dhtml5,10);
var playAgain = cc.MenuItemSprite.create(playAgainNormal, playAgainSelected, playAgainDisabled, this, function(){
flareEffect(this,this,this.onPlayAgain);
});
var menu = cc.Menu.create(playAgain);
this.addChild(menu, 1, 2);
menu.setPosition(cc.p(winSize.width / 2, 220));
var lbScore = cc.LabelTTF.create("Your Score:"+MW.SCORE,"Arial Bold",16);
lbScore.setPosition(cc.p(160,280));
lbScore.setColor(cc.c3b(250,179,0));
this.addChild(lbScore,10);
var b1 = cc.LabelTTF.create("Download Cocos2d-html5","Arial",14);
var b2 = cc.LabelTTF.create("Download This Sample","Arial",14);
var menu1 = cc.MenuItemLabel.create(b1,this,function(){
window.location.href = "http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-html5";
});
var menu2 = cc.MenuItemLabel.create(b2,this,function(){
window.location.href = "https://github.com/ShengxiangChen/MoonWarriors";
});
var cocos2dMenu = cc.Menu.create(menu1,menu2);
cocos2dMenu.alignItemsVerticallyWithPadding(10);
cocos2dMenu.setPosition(cc.p(160,80));
this.addChild(cocos2dMenu);
if(MW.SOUND){
cc.AudioEngine.getInstance().playBackgroundMusic(s_mainMainMusic);
}
bRet = true;
}
return bRet;
},
onPlayAgain:function (pSender) {
var scene = cc.Scene.create();
scene.addChild(GameLayer.create());
scene.addChild(GameControlMenu.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2,scene));
}
});
GameOver.create = function () {
var sg = new GameOver();
if (sg && sg.init()) {
return sg;
}
return null;
};
GameOver.scene = function () {
var scene = cc.Scene.create();
var layer = GameOver.create();
scene.addChild(layer);
return scene;
};

View File

@ -0,0 +1,99 @@
var LevelManager = cc.Class.extend({
_currentLevel:null,
_gameLayer:null,
ctor:function(gameLayer){
if(!gameLayer){
throw "gameLayer must be non-nil";
}
this._currentLevel = Level1;
this._gameLayer = gameLayer;
this.setLevel(this._currentLevel);
},
setLevel:function(level){
for(var i = 0; i< level.enemies.length; i++){
this._currentLevel.enemies[i].ShowTime = this._minuteToSecond(this._currentLevel.enemies[i].ShowTime);
}
},
_minuteToSecond:function(minuteStr){
if(!minuteStr)
return 0;
if(typeof(minuteStr) != "number"){
var mins = minuteStr.split(':');
if(mins.length == 1){
return parseInt(mins[0],10);
}else {
return parseInt(mins[0],10 )* 60 + parseInt(mins[1],10);
}
}
return minuteStr;
},
loadLevelResource:function(deltaTime){
//load enemy
for(var i = 0; i< this._currentLevel.enemies.length; i++){
var selEnemy = this._currentLevel.enemies[i];
if(selEnemy){
if(selEnemy.ShowType == "Once"){
if(selEnemy.ShowTime == deltaTime){
for(var tIndex = 0; tIndex < selEnemy.Types.length;tIndex++ ){
this.addEnemyToGameLayer(selEnemy.Types[tIndex]);
}
}
}else if(selEnemy.ShowType == "Repeate"){
if(deltaTime % selEnemy.ShowTime === 0){
for(var rIndex = 0; rIndex < selEnemy.Types.length;rIndex++ ){
this.addEnemyToGameLayer(selEnemy.Types[rIndex]);
}
}
}
}
}
},
addEnemyToGameLayer:function(enemyType){
var addEnemy = new Enemy(EnemyType[enemyType]);
var enemypos = cc.p( 80 + (winSize.width - 160) * Math.random(), winSize.height);
var enemycs = addEnemy.getContentSize();
addEnemy.setPosition( enemypos );
var offset, tmpAction;
var a0=0;
var a1=0;
switch (addEnemy.moveType) {
case MW.ENEMY_MOVE_TYPE.ATTACK:
offset = this._gameLayer._ship.getPosition();
tmpAction = cc.MoveTo.create(1, offset);
break;
case MW.ENEMY_MOVE_TYPE.VERTICAL:
offset = cc.p(0, -winSize.height - enemycs.height);
tmpAction = cc.MoveBy.create(4, offset);
break;
case MW.ENEMY_MOVE_TYPE.HORIZONTAL:
offset = cc.p(0, -100 - 200 * Math.random());
a0 = cc.MoveBy.create(0.5, offset);
a1 = cc.MoveBy.create(1, cc.p(-50 - 100 * Math.random(), 0));
var onComplete = cc.CallFunc.create(addEnemy, function (pSender) {
var a2 = cc.DelayTime.create(1);
var a3 = cc.MoveBy.create(1, cc.p(100 + 100 * Math.random(), 0));
pSender.runAction(cc.RepeatForever.create(
cc.Sequence.create(a2, a3, a2.copy(), a3.reverse())
));
});
tmpAction = cc.Sequence.create(a0, a1, onComplete);
break;
case MW.ENEMY_MOVE_TYPE.OVERLAP:
var newX = (enemypos.x <= winSize.width / 2) ? 320 : -320;
a0 = cc.MoveBy.create(4, cc.p(newX, -240));
a1 = cc.MoveBy.create(4,cc.p(-newX,-320));
tmpAction = cc.Sequence.create(a0,a1);
break;
}
this._gameLayer.addChild(addEnemy, addEnemy.zOrder, MW.UNIT_TAG.ENEMY);
MW.CONTAINER.ENEMIES.push(addEnemy);
addEnemy.runAction(tmpAction);
}
});

View File

@ -0,0 +1,69 @@
/****************************************************************************
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.
****************************************************************************/
// boot code needed for cocos2d-html5
// Not needed by cocos2d + JS bindings
var MW = MW || {};
(function () {
var d = document;
var c = {
menuType:'canvas', //whether to use canvas mode menu or dom menu
COCOS2D_DEBUG:2, //0 to turn debug off, 1 for basic debug, and 2 for full debug
showFPS:true,
frameRate:60,
tag:'gameCanvas', //the dom element to run cocos2d on
engineDir:'libs/cocos2d/',
appFiles:[
'MoonWarriors/src/Resource.js',
'MoonWarriors/src/config/GameConfig.js',
'MoonWarriors/src/config/EnemyType.js',
'MoonWarriors/src/config/Level.js',
'MoonWarriors/src/Effect.js',
'MoonWarriors/src/Bullet.js',
'MoonWarriors/src/Enemy.js',
'MoonWarriors/src/Explosion.js',
'MoonWarriors/src/Ship.js',
'MoonWarriors/src/LevelManager.js',
'MoonWarriors/src/GameController.js',
'MoonWarriors/src/GameControlMenu.js',
'MoonWarriors/src/GameLayer.js',
'MoonWarriors/src/GameOver.js',
'MoonWarriors/src/AboutLayer.js',
'MoonWarriors/src/SettingsLayer.js',
'MoonWarriors/src/SysMenu.js'
]
};
window.addEventListener('DOMContentLoaded', function () {
//first load engine file if specified
var s = d.createElement('script');
s.src = c.engineDir + 'platform/jsloader.js';
d.body.appendChild(s);
s.c = c;
s.id = 'cocos2d-html5';
//else if single file specified, load singlefile
});
})();

View File

@ -0,0 +1,69 @@
/****************************************************************************
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.
****************************************************************************/
// boot code needed for cocos2d + JS bindings.
// Not needed by cocos2d-html5
require("js/helper/jsb_constants.js");
var MW = MW || {};
var appFiles = [
'js/Resource.js',
'js/config/GameConfig.js',
'js/config/EnemyType.js',
'js/config/Level.js',
'js/Effect.js',
'js/Bullet.js',
'js/Enemy.js',
'js/Explosion.js',
'js/Ship.js',
'js/LevelManager.js',
'js/GameControlMenu.js',
'js/GameLayer.js',
'js/GameOver.js',
'js/AboutLayer.js',
'js/SettingsLayer.js',
'js/SysMenu.js'
];
cc.dumpConfig();
for( var i=0; i < appFiles.length; i++) {
require( appFiles[i] );
}
var director = cc.Director.getInstance();
director.setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
director.setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
var mainScene = SysMenu.scene();
// run
director.runWithScene(mainScene);

View File

@ -0,0 +1,94 @@
var dirImg = "";
var dirMusic = "";
var musicSuffix = ".mp3";
if( cc.config.deviceType == 'browser') {
dirImg = "res/";
dirMusic = "res/Music/";
musicSuffix = "";
}
else if( cc.config.engine == 'cocos2d-x') {
dirImg = "res/";
dirMusic = "res/Music/";
musicSuffix = ".mp3";
}
//image
var s_bg01 = dirImg + "bg01.jpg";
var s_loading = dirImg + "loading.png";
var s_ship01 = dirImg + "ship01.png";
var s_menu = dirImg + "menu.png";
var s_logo = dirImg + "logo.png";
var s_cocos2dhtml5 = dirImg + "cocos2d-html5.png";
var s_gameOver = dirImg + "gameOver.png";
var s_menuTitle = dirImg + "menuTitle.png";
var s_Enemy = dirImg + "Enemy.png";
var s_flare = dirImg + "flare.jpg";
var s_bullet = dirImg + "bullet.png";
var s_explosion = dirImg + "explosion.png";
var s_explode1 = dirImg + "explode1.jpg";
var s_explode2= dirImg + "explode2.jpg";
var s_explode3 = dirImg + "explode3.jpg";
var s_hit = dirImg + "hit.jpg";
var s_arial14 = dirImg + "arial-14.png";
var s_arial14_fnt = dirImg + "arial-14.fnt";
//music
var s_bgMusic = dirMusic + "bgMusic" + musicSuffix;
var s_mainMainMusic = dirMusic + "mainMainMusic" + musicSuffix;
//effect
var s_buttonEffect = dirMusic + "buttonEffet" + musicSuffix;
var s_explodeEffect = dirMusic + "explodeEffect" + musicSuffix;
var s_fireEffect = dirMusic + "fireEffect" + musicSuffix;
var s_shipDestroyEffect = dirMusic + "shipDestroyEffect" + musicSuffix;
//tmx
var s_level01 = dirImg + "level01.tmx";
//plist
var s_Enemy_plist = dirImg + "Enemy.plist";
var s_explosion_plist = dirImg + "explosion.plist";
var s_bullet_plist = dirImg + "bullet.plist";
var g_ressources = [
//image
{type:"image", src:s_bg01},
{type:"image", src:s_loading},
{type:"image", src:s_ship01},
{type:"image", src:s_menu},
{type:"image", src:s_logo},
{type:"image", src:s_cocos2dhtml5},
{type:"image", src:s_gameOver},
{type:"image", src:s_menuTitle},
{type:"image", src:s_Enemy},
{type:"image", src:s_flare},
{type:"image", src:s_bullet},
{type:"image", src:s_explosion},
{type:"image", src:s_explode1},
{type:"image", src:s_explode2},
{type:"image", src:s_explode3},
{type:"image", src:s_hit},
{type:"image", src:s_arial14},
//tmx
{type:"tmx", src:s_level01},
//plist
{type:"plist", src:s_Enemy_plist},
{type:"plist", src:s_explosion_plist},
{type:"plist", src:s_bullet_plist},
//music
{type:"bgm", src:s_bgMusic},
{type:"bgm", src:s_mainMainMusic},
//effect
{type:"effect", src:s_buttonEffect},
{type:"effect", src:s_explodeEffect},
{type:"effect", src:s_fireEffect},
{type:"effect", src:s_shipDestroyEffect},
// FNT
{type:"fnt", src:s_arial14_fnt}
];

View File

@ -0,0 +1,85 @@
var SettingsLayer = cc.Layer.extend({
ctor:function () {
cc.associateWithNative( this, cc.Layer );
},
init:function () {
var bRet = false;
if (this._super()) {
var sp = cc.Sprite.create(s_loading);
sp.setAnchorPoint(cc.p(0,0));
this.addChild(sp, 0, 1);
var cacheImage = cc.TextureCache.getInstance().addImage(s_menuTitle);
var title = cc.Sprite.createWithTexture(cacheImage, cc.rect(0, 0, 134, 34));
title.setPosition(cc.p(winSize.width / 2, winSize.height - 120));
this.addChild(title);
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(18);
var title1 = cc.MenuItemFont.create("Sound");
title1.setEnabled(false);
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(26);
var item1 = cc.MenuItemToggle.create(
cc.MenuItemFont.create("On"),
cc.MenuItemFont.create("Off") );
item1.setCallback(this, this.soundControl );
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(18);
var title2 = cc.MenuItemFont.create("Mode");
title2.setEnabled(false);
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(26);
var item2 = cc.MenuItemToggle.create(
cc.MenuItemFont.create("Easy"),
cc.MenuItemFont.create("Normal"),
cc.MenuItemFont.create("Hard"));
item2.setCallback( this, this.modeControl );
cc.MenuItemFont.setFontName("Arial");
cc.MenuItemFont.setFontSize(26);
var label = cc.LabelTTF.create("Go back", "Arial", 20);
var back = cc.MenuItemLabel.create(label, this, this.backCallback);
back.setScale(0.8);
var menu = cc.Menu.create(title1, title2, item1, item2, back);
menu.alignItemsInColumns(2, 2, 1);
this.addChild(menu);
var cp_back = back.getPosition();
cp_back.y -= 50.0;
back.setPosition(cp_back);
bRet = true;
}
return bRet;
},
backCallback:function (pSender) {
var scene = cc.Scene.create();
scene.addChild(SysMenu.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
},
soundControl:function(){
MW.SOUND = MW.SOUND ? false : true;
if(!MW.SOUND){
cc.AudioEngine.getInstance().stopBackgroundMusic();
}
},
modeControl:function(){
}
});
SettingsLayer.create = function () {
var sg = new SettingsLayer();
if (sg && sg.init()) {
return sg;
}
return null;
};

View File

@ -0,0 +1,128 @@
var Ship = cc.Sprite.extend({
speed:220,
bulletSpeed:900,
HP:5,
bulletTypeValue:1,
bulletPowerValue:1,
throwBombing:false,
canBeAttack:true,
isThrowingBomb:false,
zOrder:3000,
maxBulletPowerValue:4,
appearPosition:cc.p(160, 60),
_hurtColorLife:0,
active:true,
ctor:function () {
// needed for JS-Bindings compatibility
cc.associateWithNative( this, cc.Sprite );
//init life
var shipTexture = cc.TextureCache.getInstance().addImage(s_ship01);
this.initWithTexture(shipTexture, cc.rect(0, 0, 60, 38));
this.setTag(this.zOrder);
this.setPosition(this.appearPosition);
// set frame
var frame0 = cc.SpriteFrame.createWithTexture(shipTexture, cc.rect(0, 0, 60, 38));
var frame1 = cc.SpriteFrame.createWithTexture(shipTexture, cc.rect(60, 0, 60, 38));
var animFrames = [];
animFrames.push(frame0);
animFrames.push(frame1);
// ship animate
var animation = cc.Animation.create(animFrames, 0.1);
var animate = cc.Animate.create(animation);
this.runAction(cc.RepeatForever.create(animate));
this.schedule(this.shoot, 1 / 6);
//revive effect
this.canBeAttack = false;
var ghostSprite = cc.Sprite.createWithTexture(shipTexture, cc.rect(0, 45, 60, 38));
ghostSprite.setBlendFunc(gl.SRC_ALPHA, gl.ONE);
ghostSprite.setScale(8);
ghostSprite.setPosition(cc.p(this.getContentSize().width / 2, 12));
this.addChild(ghostSprite, 3000, 99999);
ghostSprite.runAction(cc.ScaleTo.create(0.5, 1, 1));
var blinks = cc.Blink.create(3, 9);
var makeBeAttack = cc.CallFunc.create(this, function (t) {
t.canBeAttack = true;
t.setVisible(true);
t.removeChild(ghostSprite,true);
});
this.runAction(cc.Sequence.create(cc.DelayTime.create(0.5), blinks, makeBeAttack));
},
update:function (dt) {
// Keys are only enabled on the browser
if( cc.config.deviceType == 'browser' ) {
var pos = this.getPosition();
if ((MW.KEYS[cc.KEY.w] || MW.KEYS[cc.KEY.up]) && pos.y <= winSize.height) {
pos.y += dt * this.speed;
}
if ((MW.KEYS[cc.KEY.s] || MW.KEYS[cc.KEY.down]) && pos.y >= 0) {
pos.y -= dt * this.speed;
}
if ((MW.KEYS[cc.KEY.a] || MW.KEYS[cc.KEY.left]) && pos.x >= 0) {
pos.x -= dt * this.speed;
}
if ((MW.KEYS[cc.KEY.d] || MW.KEYS[cc.KEY.right]) && pos.x <= winSize.width) {
pos.x += dt * this.speed;
}
this.setPosition( pos );
}
if (this.HP <= 0) {
this.active = false;
}
this._timeTick += dt;
if (this._timeTick > 0.1) {
this._timeTick = 0;
if (this._hurtColorLife > 0) {
this._hurtColorLife--;
}
if (this._hurtColorLife == 1) {
this.setColor(cc.WHITE);
}
}
},
shoot:function (dt) {
//this.shootEffect();
var offset = 13;
var p = this.getPosition();
var cs = this.getContentSize();
var a = new Bullet(this.bulletSpeed, "W1.png", MW.ENEMY_MOVE_TYPE.NORMAL);
MW.CONTAINER.PLAYER_BULLETS.push(a);
this.getParent().addChild(a, a.zOrder, MW.UNIT_TAG.PLAYER_BULLET);
a.setPosition(cc.p(p.x + offset, p.y + 3 + cs.height * 0.3));
var b = new Bullet(this.bulletSpeed, "W1.png", MW.ENEMY_MOVE_TYPE.NORMAL);
MW.CONTAINER.PLAYER_BULLETS.push(b);
this.getParent().addChild(b, b.zOrder, MW.UNIT_TAG.PLAYER_BULLET);
b.setPosition(cc.p(p.x - offset, p.y + 3 + cs.height * 0.3));
},
destroy:function () {
MW.LIFE--;
var p = this.getPosition();
var myParent = this.getParent();
myParent.addChild( new Explosion(p) );
myParent.removeChild(this,true);
if (MW.SOUND) {
cc.AudioEngine.getInstance().playEffect(s_shipDestroyEffect);
}
},
hurt:function () {
if (this.canBeAttack) {
this._hurtColorLife = 2;
this.HP--;
this.setColor(cc.RED);
}
},
collideRect:function(){
var p = this.getPosition();
var a = this.getContentSize();
var r = new cc.rect(p.x - a.width/2, p.y - a.height/2, a.width, a.height/2);
return r;
}
});

View File

@ -0,0 +1,110 @@
cc.dumpConfig();
var SysMenu = cc.Layer.extend({
_ship:null,
ctor:function () {
cc.associateWithNative( this, cc.Layer );
},
init:function () {
var bRet = false;
if (this._super()) {
winSize = cc.Director.getInstance().getWinSize();
var sp = cc.Sprite.create(s_loading);
sp.setAnchorPoint(cc.p(0,0));
this.addChild(sp, 0, 1);
var logo = cc.Sprite.create(s_logo);
logo.setAnchorPoint(cc.p(0, 0));
logo.setPosition(cc.p(0, 250));
this.addChild(logo, 10, 1);
var newGameNormal = cc.Sprite.create(s_menu, cc.rect(0, 0, 126, 33));
var newGameSelected = cc.Sprite.create(s_menu, cc.rect(0, 33, 126, 33));
var newGameDisabled = cc.Sprite.create(s_menu, cc.rect(0, 33 * 2, 126, 33));
var gameSettingsNormal = cc.Sprite.create(s_menu, cc.rect(126, 0, 126, 33));
var gameSettingsSelected = cc.Sprite.create(s_menu, cc.rect(126, 33, 126, 33));
var gameSettingsDisabled = cc.Sprite.create(s_menu, cc.rect(126, 33 * 2, 126, 33));
var aboutNormal = cc.Sprite.create(s_menu, cc.rect(252, 0, 126, 33));
var aboutSelected = cc.Sprite.create(s_menu, cc.rect(252, 33, 126, 33));
var aboutDisabled = cc.Sprite.create(s_menu, cc.rect(252, 33 * 2, 126, 33));
var newGame = cc.MenuItemSprite.create(newGameNormal, newGameSelected, newGameDisabled, this, function () {
this.onButtonEffect();
flareEffect(this, this, this.onNewGame);
});
var gameSettings = cc.MenuItemSprite.create(gameSettingsNormal, gameSettingsSelected, gameSettingsDisabled, this, this.onSettings);
var about = cc.MenuItemSprite.create(aboutNormal, aboutSelected, aboutDisabled, this, this.onAbout);
var menu = cc.Menu.create(newGame, gameSettings, about);
menu.alignItemsVerticallyWithPadding(10);
this.addChild(menu, 1, 2);
menu.setPosition(cc.p(winSize.width / 2, winSize.height / 2 - 80));
this.schedule(this.update, 0.1);
var tmp = cc.TextureCache.getInstance().addImage(s_ship01);
this._ship = cc.Sprite.createWithTexture(tmp,cc.rect(0, 45, 60, 38));
this.addChild(this._ship, 0, 4);
var pos = cc.p(Math.random() * winSize.width, 0);
this._ship.setPosition( pos );
this._ship.runAction(cc.MoveBy.create(2, cc.p(Math.random() * winSize.width, pos.y + winSize.height + 100)));
if (MW.SOUND) {
cc.AudioEngine.getInstance().setBackgroundMusicVolume(0.7);
cc.AudioEngine.getInstance().playBackgroundMusic(s_mainMainMusic, true);
}
bRet = true;
}
return bRet;
},
onNewGame:function (pSender) {
var scene = cc.Scene.create();
scene.addChild(GameLayer.create());
scene.addChild(GameControlMenu.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
},
onSettings:function (pSender) {
this.onButtonEffect();
var scene = cc.Scene.create();
scene.addChild(SettingsLayer.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
},
onAbout:function (pSender) {
this.onButtonEffect();
var scene = cc.Scene.create();
scene.addChild(AboutLayer.create());
cc.Director.getInstance().replaceScene(cc.TransitionFade.create(1.2, scene));
},
update:function () {
if (this._ship.getPosition().y > 480) {
var pos = cc.p(Math.random() * winSize.width, 10);
this._ship.setPosition( pos );
this._ship.runAction( cc.MoveBy.create(
parseInt(5 * Math.random(), 10),
cc.p(Math.random() * winSize.width, pos.y + 480)));
}
},
onButtonEffect:function(){
if (MW.SOUND) {
var s = cc.AudioEngine.getInstance().playEffect(s_buttonEffect);
}
}
});
SysMenu.create = function () {
var sg = new SysMenu();
if (sg && sg.init()) {
return sg;
}
return null;
};
SysMenu.scene = function () {
var scene = cc.Scene.create();
var layer = SysMenu.create();
scene.addChild(layer);
return scene;
};

View File

@ -0,0 +1,56 @@
var EnemyType = [
{
type:0,
textureName:"E0.png",
bulletType:"W2.png",
HP:1,
moveType:MW.ENEMY_MOVE_TYPE.ATTACK,
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
scoreValue:15
},
{
type:1,
textureName:"E1.png",
bulletType:"W2.png",
HP:2,
moveType:MW.ENEMY_MOVE_TYPE.ATTACK,
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
scoreValue:40
},
{
type:2,
textureName:"E2.png",
bulletType:"W2.png",
HP:4,
moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
attackMode:MW.ENEMY_ATTACK_MODE.TSUIHIKIDAN,
scoreValue:60
},
{
type:3,
textureName:"E3.png",
bulletType:"W2.png",
HP:6,
moveType:MW.ENEMY_MOVE_TYPE.OVERLAP,
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
scoreValue:80
},
{
type:4,
textureName:"E4.png",
bulletType:"W2.png",
HP:10,
moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
attackMode:MW.ENEMY_ATTACK_MODE.TSUIHIKIDAN,
scoreValue:150
},
{
type:5,
textureName:"E5.png",
bulletType:"W2.png",
HP:15,
moveType:MW.ENEMY_MOVE_TYPE.HORIZONTAL,
attackMode:MW.ENEMY_MOVE_TYPE.NORMAL,
scoreValue:200
}
];

View File

@ -0,0 +1,94 @@
/**
* Cocos2d-html5 show case : Moon Warriors
*
* @Licensed:
* This showcase is licensed under GPL.
*
* @Authors:
* Programmer: Shengxiang Chen (陈升想), Dingping Lv (吕定平), Ricardo Quesada
* Effects animation: Hao Wu (吴昊)
* Quality Assurance: Sean Lin (林顺)
*
* @Links:
* http://www.cocos2d-x.org
* http://bbs.html5china.com
*
*/
//game state
MW.GAME_STATE = {
HOME:0,
PLAY:1,
OVER:2
};
//keys
MW.KEYS = [];
//level
MW.LEVEL = {
STAGE1:1,
STAGE2:2,
STAGE3:3
};
//life
MW.LIFE = 4;
//score
MW.SCORE = 0;
//sound
MW.SOUND = true;
//enemy move type
MW.ENEMY_MOVE_TYPE = {
ATTACK:0,
VERTICAL:1,
HORIZONTAL:2,
OVERLAP:3
};
//delta x
MW.DELTA_X = -100;
//offset x
MW.OFFSET_X = -24;
//rot
MW.ROT = -5.625;
//bullet type
MW.BULLET_TYPE = {
PLAYER:1,
ENEMY:2
};
//weapon type
MW.WEAPON_TYPE = {
ONE:1
};
//unit tag
MW.UNIT_TAG = {
ENMEY_BULLET:900,
PLAYER_BULLET:901,
ENEMY:1000,
PLAYER:1000
};
//attack mode
MW.ENEMY_ATTACK_MODE = {
NORMAL:1,
TSUIHIKIDAN:2
};
//life up sorce
MW.LIFEUP_SORCE = [50000, 100000, 150000, 200000, 250000, 300000];
//container
MW.CONTAINER = {
ENEMIES:[],
ENEMY_BULLETS:[],
PLAYER_BULLETS:[]
};

View File

@ -0,0 +1,49 @@
var Level1 = {
enemies:[
{
ShowType:"Repeate",
ShowTime:"00:02",
Types:[0,1,2]
},
{
ShowType:"Repeate",
ShowTime:"00:05",
Types:[3,4,5]
}
/*{
ShowType:"Repeate",
ShowTime:"00:08",
Types:[0,4,3,5]
},
{
ShowType:"Once",
ShowTime:"00:6",
Types:[0,2,4,3]
},
{
ShowType:"Once",
ShowTime:"00:16",
Types:[0,2,5,4,3]
},
{
ShowType:"Once",
ShowTime:"00:25",
Types:[0,3,5,4,3]
},
{
ShowType:"Once",
ShowTime:"00:35",
Types:[4,5,3,1,3]
},
{
ShowType:"Once",
ShowTime:"00:50",
Types:[0,3,2,1,0,3]
},
{
ShowType:"Once",
ShowTime:"01:15",
Types:[4,5,2,1,0]
}*/
]
};

View File

@ -0,0 +1,475 @@
require('js/helper/jsb_constants_gl.js');
// cocos2d Helper
cc.c3 = cc.c3 || function (r, g, b) {
return {r: r, g: g, b: b};
};
cc.c3b = cc.c3;
cc.c4 = cc.c4 || function (r, g, b, o) {
return {r: r, g: g, b: b, a: o};
};
cc.c4b = cc.c4;
cc.c4f = cc.c4f || function (r, g, b, o) {
return {r: r, g: g, b: b, a: o};
};
cc.p = cc.p || function( x, y )
{
return {x:x, y:y};
};
cc.g = cc.g || cc.p;
cc.log = cc.log || log;
//
// cocos2d constants
//
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.RED = cc.c3(255,0,0);
cc.GREEN = cc.c3(0,255,0);
cc.BLUE = cc.c3(0,0,255);
cc.BLACK = cc.c3(0,0,0);
cc.WHITE = cc.c3(255,255,255);
cc.POINT_ZERO = {x:0, y:0};
cc._reuse_p0 = {x:0, y:0};
cc._reuse_p1 = {x:0, y:0};
cc._reuse_p_index = 0;
cc._reuse_color3b = cc.c3(255, 255, 255 );
cc._reuse_color4b = cc.c4(255, 255, 255, 255 );
cc._reuse_grid = cc.g(0,0);
// dump config info, but only in debug mode
cc.dumpConfig = function()
{
if( cc.config.debug ) {
for(var i in cc.config)
cc.log( i + " = " + cc.config[i] );
}
};
//
// Point
//
cc._p = function( x, y )
{
if( cc._reuse_p_index === 0 ) {
cc._reuse_p0.x = x;
cc._reuse_p0.y = y;
cc._reuse_p_index = 1;
return cc._reuse_p0;
} else {
cc._reuse_p1.x = x;
cc._reuse_p1.y = y;
cc._reuse_p_index = 0;
return cc._reuse_p1;
}
};
cc._to_p = function( point )
{
return point;
};
cc._from_p = function( size )
{
return size;
};
//
// Grid
//
cc._g = function( x, y )
{
cc._reuse_grid.x = x;
cc._reuse_grid.y = y;
return cc._reuse_grid;
}
//
// Color
//
//
// 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;
};
// compatibility
cc.c3 = cc.c3b;
cc._c3 = cc._c3b;
//
// 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;
//
// Size
//
cc.size = function(w,h)
{
return {width:w, height:h};
}
cc._to_size = function( size )
{
return size;
}
cc._from_size = function( size )
{
return size;
}
//
// Rect
//
cc.rect = function(x,y,w,h)
{
return {x:x, y:y, width:w, height:h};
}
cc._to_rect = function( rect )
{
return rect;
}
cc._from_rect = function( rect )
{
return rect;
}
// XXX Should be done in native
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;
}
// point functions
cc.pAdd = cc.pAdd || function (p1, p2) {
return {x: p1.x + p2.x, y: p1.y + p2.y};
};
cc.pSub = cc.pSub || function (p1, p2) {
return {x: p1.x - p2.x, y: p1.y - p2.y};
}
cc.pMult = cc.pMult || function (p1, s) {
return {x: p1.x * s, y: p1.y * s};
};
/**
* Calculates dot product of two points.
* @param {cc.Point} v1
* @param {cc.Point} v2
* @return {Number}
*/
cc.pDot = function (v1, v2) {
return v1.x * v2.x + v1.y * v2.y;
};
/**
* Calculates the square length of a cc.Point (not calling sqrt() )
* @param {cc.Point} v
*@return {cc.pDot}
*/
cc.pLengthSQ = function (v) {
return cc.pDot(v, v);
};
/**
* Calculates distance between point an origin
* @param {cc.Point} v
* @return {Number}
*/
cc.pLength = function (v) {
return Math.sqrt(cc.pLengthSQ(v));
};
/**
* Calculates the distance between two points
* @param {cc.Point} v1
* @param {cc.Point} v2
* @return {cc.pLength}
*/
cc.pDistance = function (v1, v2) {
return cc.pLength(cc.pSub(v1, v2));
};
/**
* Clamp a value between from and to.
* @param {Number} value
* @param {Number} min_inclusive
* @param {Number} max_inclusive
* @return {Number}
*/
cc.clampf = function (value, min_inclusive, max_inclusive) {
if (min_inclusive > max_inclusive) {
var temp = min_inclusive;
min_inclusive = max_inclusive;
max_inclusive = temp;
}
return value < min_inclusive ? min_inclusive : value < max_inclusive ? value : max_inclusive;
};
/**
* Clamp a point between from and to.
* @param {Number} p
* @param {Number} min_inclusive
* @param {Number} max_inclusive
* @return {cc.Point}
*/
cc.pClamp = function (p, min_inclusive, max_inclusive) {
return cc.p(cc.clampf(p.x, min_inclusive.x, max_inclusive.x), cc.clampf(p.y, min_inclusive.y, max_inclusive.y));
};
/**
* returns a random float between 0 and 1
* @return {Number}
* @function
*/
cc.RANDOM_0_1 = function () {
return Math.random();
};
/**
* Associates a base class with a native superclass
* @function
* @param {object} jsobj subclass
* @param {object} klass superclass
*/
cc.associateWithNative = function( jsobj, superclass ) {
var native = new superclass();
__associateObjWithNative( jsobj, native );
};
//
// Array: for cocos2d-hmtl5 compatibility
//
cc.ArrayRemoveObject = function (arr, delObj) {
for (var i = 0; i < arr.length; i++) {
if (arr[i] == delObj) {
arr.splice(i, 1);
}
}
};
//
// Google "subclasses"
// borrowed from closure library
//
var goog = goog || {}; // Check to see if already defined in current scope
goog.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 ];
// }
};
goog.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));
// XXX: SpiderMonkey bindings extensions
// __associateObjWithNative( me, ret );
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(
'goog.base called from a method of one name ' +
'to a method of a different name');
}
};
//
// Simple subclass
//
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.Layer.extend = cc.Class.extend;
cc.Scene.extend = cc.Class.extend;
cc.LayerGradient.extend = cc.Class.extend;
cc.Sprite.extend = cc.Class.extend;
cc.MenuItemFont.extend = cc.Class.extend;
//
// Chipmunk helpers
//
var cp = cp || {};
cp.v = cc.p;
cp._v = cc._p;
cp.vzero = cp.v(0,0);
//
// OpenGL Helpers
//
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;

View File

@ -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;

View File

@ -0,0 +1 @@
59362b16ba4da187e064648be4d0bcb1c09b504d

View File

@ -0,0 +1 @@
c0488f23a6a785893f4845b7fadc59ed892ceedc

View File

@ -0,0 +1 @@
46f10a6bf5c63f03ddf8566f392aa7a8f258d7e8

View File

@ -0,0 +1 @@
97bca7d49fb6ec5c330f6ab6f5f49d335601a669

View File

@ -0,0 +1 @@
ca7905a1a07e2be3e02fbf329772c2c361400af7

View File

@ -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>

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MoonWarriors</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>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.cocos2dx.moonwarriors"
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=".MoonWarriors"
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>

View File

@ -0,0 +1 @@
aapt.ignore.assets="!*.pvr.gz:!*.gz:!.svn:!.git:.*:<dir>_*:!CVS:!thumbs.db:!picasa.ini:!*.scc:*~"

View File

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="MoonWarriors" 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>

View File

@ -0,0 +1,100 @@
APPNAME="MoonWarriors"
# 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
# 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
for file in "$APP_ROOT"/Resources/*
do
if [ -d "$file" ]; then
cp -rf "$file" "$APP_ANDROID_ROOT"/assets
fi
if [ -f "$file" ]; then
cp "$file" "$APP_ANDROID_ROOT"/assets
fi
done
rm -f "$APP_ANDROID_ROOT"/assets/Images/landscape-1024x1024-rgba8888.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_a8.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgb888.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_1021x1024_rgba8888.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/test_image_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/texture1024x1024_rgba4444.pvr.gz
rm -f "$APP_ANDROID_ROOT"/assets/Images/PlanetCute-1024x1024-rgba4444.pvr.gz
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=1 V=1

View File

@ -0,0 +1,28 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := moonwarriors_shared
LOCAL_MODULE_FILENAME := libmoonwarriors
LOCAL_SRC_FILES := moonwarriors/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)

View File

@ -0,0 +1,3 @@
APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCOCOS2D_JAVASCRIPT=1
APP_CPPFLAGS += -DCOCOS2D_DEBUG=2

View File

@ -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();
}
}
}

View File

@ -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 *;
#}

View File

@ -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

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">MoonWarriors</string>
</resources>

View File

@ -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.moonwarriors;
import org.cocos2dx.lib.Cocos2dxActivity;
import android.os.Bundle;
public class MoonWarriors extends Cocos2dxActivity{
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
}
static {
System.loadLibrary("moonwarriors");
}
}

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
66c6d1cead373b45218424f6a82f370897e443e4

View File

@ -0,0 +1 @@
84689888a14a2123d2b39f7f2f61be8c15207479

View File

@ -0,0 +1,562 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
1A1D97421625AFB400D5E31D /* js in Resources */ = {isa = PBXBuildFile; fileRef = 1A1D97401625AFB400D5E31D /* js */; };
1A1D97431625AFB400D5E31D /* res in Resources */ = {isa = PBXBuildFile; fileRef = 1A1D97411625AFB400D5E31D /* res */; };
1A7CC34016257DF6006B3D18 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */; };
1A7CC34216257DF6006B3D18 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34116257DF6006B3D18 /* OpenGLES.framework */; };
1A7CC34416257DF6006B3D18 /* OpenAL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34316257DF6006B3D18 /* OpenAL.framework */; };
1A7CC34616257DF6006B3D18 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */; };
1A7CC34816257DF6006B3D18 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34716257DF6006B3D18 /* AVFoundation.framework */; };
1A7CC34A16257DF6006B3D18 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34916257DF6006B3D18 /* UIKit.framework */; };
1A7CC34C16257DF6006B3D18 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34B16257DF6006B3D18 /* Foundation.framework */; };
1A7CC34E16257DF6006B3D18 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */; };
1A7CC72116258056006B3D18 /* AppDelegate.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC71F16258056006B3D18 /* AppDelegate.cpp */; };
1A7CC72816258081006B3D18 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72416258081006B3D18 /* AppController.mm */; };
1A7CC72916258081006B3D18 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72516258081006B3D18 /* main.m */; };
1A7CC72A16258081006B3D18 /* RootViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC72716258081006B3D18 /* RootViewController.mm */; };
1A7CC75F16258252006B3D18 /* Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC75D16258252006B3D18 /* Info.plist */; };
1A7CC76716258283006B3D18 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76016258283006B3D18 /* Default-568h@2x.png */; };
1A7CC76816258283006B3D18 /* Default.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76116258283006B3D18 /* Default.png */; };
1A7CC76916258283006B3D18 /* Default@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76216258283006B3D18 /* Default@2x.png */; };
1A7CC76A16258283006B3D18 /* Icon-57.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76316258283006B3D18 /* Icon-57.png */; };
1A7CC76B16258283006B3D18 /* Icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76416258283006B3D18 /* Icon-72.png */; };
1A7CC76C16258283006B3D18 /* Icon-114.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76516258283006B3D18 /* Icon-114.png */; };
1A7CC76D16258283006B3D18 /* Icon-144.png in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC76616258283006B3D18 /* Icon-144.png */; };
1A7CC77C16258754006B3D18 /* cocos2d_specifics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */; };
1A7CC77D16258754006B3D18 /* cocos2dx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77116258754006B3D18 /* cocos2dx.cpp */; };
1A7CC77E16258754006B3D18 /* cocos2dxapi.js in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77316258754006B3D18 /* cocos2dxapi.js */; };
1A7CC77F16258754006B3D18 /* README in Resources */ = {isa = PBXBuildFile; fileRef = 1A7CC77416258754006B3D18 /* README */; };
1A7CC78016258754006B3D18 /* js_manual_conversions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */; };
1A7CC78116258754006B3D18 /* ScriptingCore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC77816258754006B3D18 /* ScriptingCore.cpp */; };
1A7CC782162587E0006B3D18 /* libcocos2dx.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 1A7CC71D16257E75006B3D18 /* libcocos2dx.a */; };
1A7CC79216258828006B3D18 /* CDAudioManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78916258828006B3D18 /* CDAudioManager.m */; };
1A7CC79316258828006B3D18 /* CDOpenALSupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */; };
1A7CC79416258828006B3D18 /* CocosDenshion.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78E16258828006B3D18 /* CocosDenshion.m */; };
1A7CC79516258828006B3D18 /* SimpleAudioEngine.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */; };
1A7CC79616258828006B3D18 /* SimpleAudioEngine_objc.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
1A7CC71C16257E75006B3D18 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */;
proxyType = 2;
remoteGlobalIDString = 1551A33F158F2AB200E66CFE;
remoteInfo = cocos2dx;
};
1A7CC730162580CE006B3D18 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */;
proxyType = 1;
remoteGlobalIDString = 1551A33E158F2AB200E66CFE;
remoteInfo = cocos2dx;
};
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
1A1D97401625AFB400D5E31D /* js */ = {isa = PBXFileReference; lastKnownFileType = folder; name = js; path = ../Resources/js; sourceTree = "<group>"; };
1A1D97411625AFB400D5E31D /* res */ = {isa = PBXFileReference; lastKnownFileType = folder; name = res; path = ../Resources/res; sourceTree = "<group>"; };
1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = MoonWarriors.app; sourceTree = BUILT_PRODUCTS_DIR; };
1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; };
1A7CC34116257DF6006B3D18 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; };
1A7CC34316257DF6006B3D18 /* OpenAL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenAL.framework; path = System/Library/Frameworks/OpenAL.framework; sourceTree = SDKROOT; };
1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
1A7CC34716257DF6006B3D18 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; };
1A7CC34916257DF6006B3D18 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
1A7CC34B16257DF6006B3D18 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = cocos2dx.xcodeproj; path = ../../../cocos2dx/proj.ios/cocos2dx.xcodeproj; sourceTree = "<group>"; };
1A7CC71F16258056006B3D18 /* AppDelegate.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AppDelegate.cpp; sourceTree = "<group>"; };
1A7CC72016258056006B3D18 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
1A7CC72316258081006B3D18 /* AppController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppController.h; sourceTree = "<group>"; };
1A7CC72416258081006B3D18 /* AppController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppController.mm; sourceTree = "<group>"; };
1A7CC72516258081006B3D18 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
1A7CC72616258081006B3D18 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = "<group>"; };
1A7CC72716258081006B3D18 /* RootViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RootViewController.mm; sourceTree = "<group>"; };
1A7CC75D16258252006B3D18 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1A7CC75E16258252006B3D18 /* Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Prefix.pch; sourceTree = "<group>"; };
1A7CC76016258283006B3D18 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
1A7CC76116258283006B3D18 /* Default.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Default.png; sourceTree = "<group>"; };
1A7CC76216258283006B3D18 /* Default@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x.png"; sourceTree = "<group>"; };
1A7CC76316258283006B3D18 /* Icon-57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-57.png"; sourceTree = "<group>"; };
1A7CC76416258283006B3D18 /* Icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-72.png"; sourceTree = "<group>"; };
1A7CC76516258283006B3D18 /* Icon-114.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-114.png"; sourceTree = "<group>"; };
1A7CC76616258283006B3D18 /* Icon-144.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Icon-144.png"; sourceTree = "<group>"; };
1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2d_specifics.cpp; sourceTree = "<group>"; };
1A7CC76F16258754006B3D18 /* cocos2d_specifics.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2d_specifics.hpp; sourceTree = "<group>"; };
1A7CC77116258754006B3D18 /* cocos2dx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cocos2dx.cpp; sourceTree = "<group>"; };
1A7CC77216258754006B3D18 /* cocos2dx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = cocos2dx.hpp; sourceTree = "<group>"; };
1A7CC77316258754006B3D18 /* cocos2dxapi.js */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.javascript; path = cocos2dxapi.js; sourceTree = "<group>"; };
1A7CC77416258754006B3D18 /* README */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README; sourceTree = "<group>"; };
1A7CC77516258754006B3D18 /* js_bindings_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_bindings_config.h; sourceTree = "<group>"; };
1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = js_manual_conversions.cpp; sourceTree = "<group>"; };
1A7CC77716258754006B3D18 /* js_manual_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = js_manual_conversions.h; sourceTree = "<group>"; };
1A7CC77816258754006B3D18 /* ScriptingCore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScriptingCore.cpp; sourceTree = "<group>"; };
1A7CC77916258754006B3D18 /* ScriptingCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScriptingCore.h; sourceTree = "<group>"; };
1A7CC77A16258754006B3D18 /* spidermonkey_specifics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spidermonkey_specifics.h; sourceTree = "<group>"; };
1A7CC77B16258754006B3D18 /* uthash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = uthash.h; sourceTree = "<group>"; };
1A7CC78516258828006B3D18 /* Export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Export.h; sourceTree = "<group>"; };
1A7CC78616258828006B3D18 /* SimpleAudioEngine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine.h; sourceTree = "<group>"; };
1A7CC78816258828006B3D18 /* CDAudioManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDAudioManager.h; sourceTree = "<group>"; };
1A7CC78916258828006B3D18 /* CDAudioManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDAudioManager.m; sourceTree = "<group>"; };
1A7CC78A16258828006B3D18 /* CDConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDConfig.h; sourceTree = "<group>"; };
1A7CC78B16258828006B3D18 /* CDOpenALSupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CDOpenALSupport.h; sourceTree = "<group>"; };
1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CDOpenALSupport.m; sourceTree = "<group>"; };
1A7CC78D16258828006B3D18 /* CocosDenshion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CocosDenshion.h; sourceTree = "<group>"; };
1A7CC78E16258828006B3D18 /* CocosDenshion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CocosDenshion.m; sourceTree = "<group>"; };
1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SimpleAudioEngine.mm; sourceTree = "<group>"; };
1A7CC79016258828006B3D18 /* SimpleAudioEngine_objc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SimpleAudioEngine_objc.h; sourceTree = "<group>"; };
1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SimpleAudioEngine_objc.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
1A7CC33816257DF5006B3D18 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
1A7CC782162587E0006B3D18 /* libcocos2dx.a in Frameworks */,
1A7CC34016257DF6006B3D18 /* QuartzCore.framework in Frameworks */,
1A7CC34216257DF6006B3D18 /* OpenGLES.framework in Frameworks */,
1A7CC34416257DF6006B3D18 /* OpenAL.framework in Frameworks */,
1A7CC34616257DF6006B3D18 /* AudioToolbox.framework in Frameworks */,
1A7CC34816257DF6006B3D18 /* AVFoundation.framework in Frameworks */,
1A7CC34A16257DF6006B3D18 /* UIKit.framework in Frameworks */,
1A7CC34C16257DF6006B3D18 /* Foundation.framework in Frameworks */,
1A7CC34E16257DF6006B3D18 /* CoreGraphics.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
1A7CC33016257DF5006B3D18 = {
isa = PBXGroup;
children = (
1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */,
1A7CC732162580F9006B3D18 /* bindings */,
1A7CC71E16258056006B3D18 /* Classes */,
1A7CC78316258819006B3D18 /* CocosDenshion */,
1A7CC33E16257DF5006B3D18 /* Frameworks */,
1A7CC7221625806F006B3D18 /* ios */,
1A7CC33C16257DF5006B3D18 /* Products */,
1A7CC72B162580AD006B3D18 /* Resources */,
);
sourceTree = "<group>";
};
1A7CC33C16257DF5006B3D18 /* Products */ = {
isa = PBXGroup;
children = (
1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */,
);
name = Products;
sourceTree = "<group>";
};
1A7CC33E16257DF5006B3D18 /* Frameworks */ = {
isa = PBXGroup;
children = (
1A7CC33F16257DF6006B3D18 /* QuartzCore.framework */,
1A7CC34116257DF6006B3D18 /* OpenGLES.framework */,
1A7CC34316257DF6006B3D18 /* OpenAL.framework */,
1A7CC34516257DF6006B3D18 /* AudioToolbox.framework */,
1A7CC34716257DF6006B3D18 /* AVFoundation.framework */,
1A7CC34916257DF6006B3D18 /* UIKit.framework */,
1A7CC34B16257DF6006B3D18 /* Foundation.framework */,
1A7CC34D16257DF6006B3D18 /* CoreGraphics.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
1A7CC71616257E74006B3D18 /* Products */ = {
isa = PBXGroup;
children = (
1A7CC71D16257E75006B3D18 /* libcocos2dx.a */,
);
name = Products;
sourceTree = "<group>";
};
1A7CC71E16258056006B3D18 /* Classes */ = {
isa = PBXGroup;
children = (
1A7CC71F16258056006B3D18 /* AppDelegate.cpp */,
1A7CC72016258056006B3D18 /* AppDelegate.h */,
);
name = Classes;
path = ../Classes;
sourceTree = "<group>";
};
1A7CC7221625806F006B3D18 /* ios */ = {
isa = PBXGroup;
children = (
1A7CC75D16258252006B3D18 /* Info.plist */,
1A7CC75E16258252006B3D18 /* Prefix.pch */,
1A7CC72316258081006B3D18 /* AppController.h */,
1A7CC72416258081006B3D18 /* AppController.mm */,
1A7CC72516258081006B3D18 /* main.m */,
1A7CC72616258081006B3D18 /* RootViewController.h */,
1A7CC72716258081006B3D18 /* RootViewController.mm */,
);
name = ios;
sourceTree = "<group>";
};
1A7CC72B162580AD006B3D18 /* Resources */ = {
isa = PBXGroup;
children = (
1A1D97401625AFB400D5E31D /* js */,
1A1D97411625AFB400D5E31D /* res */,
1A7CC76016258283006B3D18 /* Default-568h@2x.png */,
1A7CC76116258283006B3D18 /* Default.png */,
1A7CC76216258283006B3D18 /* Default@2x.png */,
1A7CC76316258283006B3D18 /* Icon-57.png */,
1A7CC76416258283006B3D18 /* Icon-72.png */,
1A7CC76516258283006B3D18 /* Icon-114.png */,
1A7CC76616258283006B3D18 /* Icon-144.png */,
);
name = Resources;
sourceTree = "<group>";
};
1A7CC732162580F9006B3D18 /* bindings */ = {
isa = PBXGroup;
children = (
1A7CC76E16258754006B3D18 /* cocos2d_specifics.cpp */,
1A7CC76F16258754006B3D18 /* cocos2d_specifics.hpp */,
1A7CC77016258754006B3D18 /* generated */,
1A7CC77516258754006B3D18 /* js_bindings_config.h */,
1A7CC77616258754006B3D18 /* js_manual_conversions.cpp */,
1A7CC77716258754006B3D18 /* js_manual_conversions.h */,
1A7CC77816258754006B3D18 /* ScriptingCore.cpp */,
1A7CC77916258754006B3D18 /* ScriptingCore.h */,
1A7CC77A16258754006B3D18 /* spidermonkey_specifics.h */,
1A7CC77B16258754006B3D18 /* uthash.h */,
);
name = bindings;
path = ../../../scripting/javascript/bindings;
sourceTree = "<group>";
};
1A7CC77016258754006B3D18 /* generated */ = {
isa = PBXGroup;
children = (
1A7CC77116258754006B3D18 /* cocos2dx.cpp */,
1A7CC77216258754006B3D18 /* cocos2dx.hpp */,
1A7CC77316258754006B3D18 /* cocos2dxapi.js */,
1A7CC77416258754006B3D18 /* README */,
);
path = generated;
sourceTree = "<group>";
};
1A7CC78316258819006B3D18 /* CocosDenshion */ = {
isa = PBXGroup;
children = (
1A7CC78416258828006B3D18 /* include */,
1A7CC78716258828006B3D18 /* ios */,
);
name = CocosDenshion;
sourceTree = "<group>";
};
1A7CC78416258828006B3D18 /* include */ = {
isa = PBXGroup;
children = (
1A7CC78516258828006B3D18 /* Export.h */,
1A7CC78616258828006B3D18 /* SimpleAudioEngine.h */,
);
name = include;
path = ../../../CocosDenshion/include;
sourceTree = "<group>";
};
1A7CC78716258828006B3D18 /* ios */ = {
isa = PBXGroup;
children = (
1A7CC78816258828006B3D18 /* CDAudioManager.h */,
1A7CC78916258828006B3D18 /* CDAudioManager.m */,
1A7CC78A16258828006B3D18 /* CDConfig.h */,
1A7CC78B16258828006B3D18 /* CDOpenALSupport.h */,
1A7CC78C16258828006B3D18 /* CDOpenALSupport.m */,
1A7CC78D16258828006B3D18 /* CocosDenshion.h */,
1A7CC78E16258828006B3D18 /* CocosDenshion.m */,
1A7CC78F16258828006B3D18 /* SimpleAudioEngine.mm */,
1A7CC79016258828006B3D18 /* SimpleAudioEngine_objc.h */,
1A7CC79116258828006B3D18 /* SimpleAudioEngine_objc.m */,
);
name = ios;
path = ../../../CocosDenshion/ios;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
1A7CC33A16257DF5006B3D18 /* MoonWarriors */ = {
isa = PBXNativeTarget;
buildConfigurationList = 1A7CC70D16257E02006B3D18 /* Build configuration list for PBXNativeTarget "MoonWarriors" */;
buildPhases = (
1A7CC33716257DF5006B3D18 /* Sources */,
1A7CC33816257DF5006B3D18 /* Frameworks */,
1A7CC33916257DF5006B3D18 /* Resources */,
);
buildRules = (
);
dependencies = (
1A7CC731162580CE006B3D18 /* PBXTargetDependency */,
);
name = MoonWarriors;
productName = MoonWarriors;
productReference = 1A7CC33B16257DF5006B3D18 /* MoonWarriors.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
1A7CC33216257DF5006B3D18 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
};
buildConfigurationList = 1A7CC33516257DF5006B3D18 /* Build configuration list for PBXProject "MoonWarriors" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = 1A7CC33016257DF5006B3D18;
productRefGroup = 1A7CC33C16257DF5006B3D18 /* Products */;
projectDirPath = "";
projectReferences = (
{
ProductGroup = 1A7CC71616257E74006B3D18 /* Products */;
ProjectRef = 1A7CC71516257E74006B3D18 /* cocos2dx.xcodeproj */;
},
);
projectRoot = "";
targets = (
1A7CC33A16257DF5006B3D18 /* MoonWarriors */,
);
};
/* End PBXProject section */
/* Begin PBXReferenceProxy section */
1A7CC71D16257E75006B3D18 /* libcocos2dx.a */ = {
isa = PBXReferenceProxy;
fileType = archive.ar;
path = libcocos2dx.a;
remoteRef = 1A7CC71C16257E75006B3D18 /* PBXContainerItemProxy */;
sourceTree = BUILT_PRODUCTS_DIR;
};
/* End PBXReferenceProxy section */
/* Begin PBXResourcesBuildPhase section */
1A7CC33916257DF5006B3D18 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1A7CC75F16258252006B3D18 /* Info.plist in Resources */,
1A7CC76716258283006B3D18 /* Default-568h@2x.png in Resources */,
1A7CC76816258283006B3D18 /* Default.png in Resources */,
1A7CC76916258283006B3D18 /* Default@2x.png in Resources */,
1A7CC76A16258283006B3D18 /* Icon-57.png in Resources */,
1A7CC76B16258283006B3D18 /* Icon-72.png in Resources */,
1A7CC76C16258283006B3D18 /* Icon-114.png in Resources */,
1A7CC76D16258283006B3D18 /* Icon-144.png in Resources */,
1A7CC77F16258754006B3D18 /* README in Resources */,
1A1D97421625AFB400D5E31D /* js in Resources */,
1A1D97431625AFB400D5E31D /* res in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
1A7CC33716257DF5006B3D18 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
1A7CC72116258056006B3D18 /* AppDelegate.cpp in Sources */,
1A7CC72816258081006B3D18 /* AppController.mm in Sources */,
1A7CC72916258081006B3D18 /* main.m in Sources */,
1A7CC72A16258081006B3D18 /* RootViewController.mm in Sources */,
1A7CC77C16258754006B3D18 /* cocos2d_specifics.cpp in Sources */,
1A7CC77D16258754006B3D18 /* cocos2dx.cpp in Sources */,
1A7CC77E16258754006B3D18 /* cocos2dxapi.js in Sources */,
1A7CC78016258754006B3D18 /* js_manual_conversions.cpp in Sources */,
1A7CC78116258754006B3D18 /* ScriptingCore.cpp in Sources */,
1A7CC79216258828006B3D18 /* CDAudioManager.m in Sources */,
1A7CC79316258828006B3D18 /* CDOpenALSupport.m in Sources */,
1A7CC79416258828006B3D18 /* CocosDenshion.m in Sources */,
1A7CC79516258828006B3D18 /* SimpleAudioEngine.mm in Sources */,
1A7CC79616258828006B3D18 /* SimpleAudioEngine_objc.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin PBXTargetDependency section */
1A7CC731162580CE006B3D18 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
name = cocos2dx;
targetProxy = 1A7CC730162580CE006B3D18 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */
/* Begin XCBuildConfiguration section */
1A7CC70B16257E02006B3D18 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
DEBUG,
"COCOS2D_DEBUG=1",
USE_FILE32API,
TARGET_OS_IPHONE,
COCOS2D_JAVASCRIPT,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"",
"\"$(PROJECT_NAME)/libs/cocos2dx\"",
"\"$(PROJECT_NAME)/libs/CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/include\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
SDKROOT = iphoneos;
};
name = Debug;
};
1A7CC70C16257E02006B3D18 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = (
NDEBUG,
USE_FILE32API,
TARGET_OS_IPHONE,
COCOS2D_JAVASCRIPT,
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"\"$(PROJECT_NAME)/libs/cocos2dx/kazmath/include\"",
"\"$(PROJECT_NAME)/libs/cocos2dx\"",
"\"$(PROJECT_NAME)/libs/CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/include\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/platform/third_party/ios\"",
"\"$(PROJECT_NAME)/libs/cocos2dx/platform/ios\"",
);
IPHONEOS_DEPLOYMENT_TARGET = 6.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
SDKROOT = iphoneos;
};
name = Release;
};
1A7CC70E16257E02006B3D18 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
"GCC_THUMB_SUPPORT[arch=armv6]" = "";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../cocos2dx\"",
"\"$(SRCROOT)/../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"\"$(SRCROOT)/../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/ios\"",
"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include",
"$(SRCROOT)/../../../scripting/javascript/bindings",
);
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\"";
OTHER_LDFLAGS = (
"-lxml2",
"-lz",
"-ljs_static",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
WRAPPER_EXTENSION = app;
};
name = Debug;
};
1A7CC70F16257E02006B3D18 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
COPY_PHASE_STRIP = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Prefix.pch;
"GCC_THUMB_SUPPORT[arch=armv6]" = "";
HEADER_SEARCH_PATHS = (
"\"$(SRCROOT)/../../../cocos2dx/kazmath/include\"",
"\"$(SRCROOT)/../../../cocos2dx\"",
"\"$(SRCROOT)/../../../CocosDenshion/include\"",
"\"$(SDKROOT)/usr/include/libxml2\"",
"\"$(SRCROOT)/../../../cocos2dx/include\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/third_party/ios\"",
"\"$(SRCROOT)/../../../cocos2dx/platform/ios\"",
"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/include",
"$(SRCROOT)/../../../scripting/javascript/bindings",
);
INFOPLIST_FILE = Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 5.1;
LIBRARY_SEARCH_PATHS = "\"$(SRCROOT)/../../../scripting/javascript/spidermonkey-ios/lib\"";
OTHER_LDFLAGS = (
"-lxml2",
"-lz",
"-ljs_static",
);
PRODUCT_NAME = "$(TARGET_NAME)";
TARGETED_DEVICE_FAMILY = "1,2";
USER_HEADER_SEARCH_PATHS = "";
VALIDATE_PRODUCT = YES;
WRAPPER_EXTENSION = app;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
1A7CC33516257DF5006B3D18 /* Build configuration list for PBXProject "MoonWarriors" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1A7CC70B16257E02006B3D18 /* Debug */,
1A7CC70C16257E02006B3D18 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
1A7CC70D16257E02006B3D18 /* Build configuration list for PBXNativeTarget "MoonWarriors" */ = {
isa = XCConfigurationList;
buildConfigurations = (
1A7CC70E16257E02006B3D18 /* Debug */,
1A7CC70F16257E02006B3D18 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 1A7CC33216257DF5006B3D18 /* Project object */;
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -0,0 +1,295 @@
<?xml version="1.0" encoding="gb2312"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Name="MoonWarriors"
ProjectGUID="{A0EA54FA-6F12-45EC-AD5C-D139AA3CD528}"
RootNamespace="MoonWarriors"
TargetFrameworkVersion="196613"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName).win32"
IntermediateDirectory="$(ConfigurationName).win32"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/testjs.tlb"
HeaderFileName="testjs.h"
DLLDataFileName=""
InterfaceIdentifierFileName="testjs_i.c"
ProxyFileName="testjs_p.c"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)extensions&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;DEBUG;_DEBUG;TRACING;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="4"
DisableSpecificWarnings="4267;4251;4244"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine="if not exist &quot;$(OutDir)&quot; mkdir &quot;$(OutDir)&quot;&#x0D;&#x0A;xcopy /Y /Q &quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*&quot; &quot;$(OutDir)&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib opengl32.lib glew32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(OutDir)&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName).win32"
IntermediateDirectory="$(ConfigurationName).win32"
ConfigurationType="1"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="false"
TargetEnvironment="1"
GenerateStublessProxies="true"
TypeLibraryName="$(IntDir)/testjs.tlb"
HeaderFileName="testjs.h"
DLLDataFileName=""
InterfaceIdentifierFileName="testjs_i.c"
ProxyFileName="testjs_p.c"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalIncludeDirectories=".;..\Classes;&quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\include&quot;;&quot;$(SolutionDir)scripting\javascript\bindings&quot;;&quot;$(SolutionDir)external\chipmunk\include\chipmunk&quot;;&quot;$(SolutionDir)extensions&quot;;&quot;$(SolutionDir)cocos2dx&quot;;&quot;$(SolutionDir)cocos2dx\include&quot;;&quot;$(SolutionDir)cocos2dx\kazmath\include&quot;;&quot;$(SolutionDir)cocos2dx\platform\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32&quot;;&quot;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES&quot;;&quot;$(SolutionDir)CocosDenshion\include&quot;"
PreprocessorDefinitions="WIN32;_WINDOWS;STRICT;NDEBUG;COCOS2D_JAVASCRIPT;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS"
ExceptionHandling="0"
RuntimeLibrary="2"
UsePrecompiledHeader="0"
WarningLevel="3"
DebugInformationFormat="0"
DisableSpecificWarnings="4267;4251;4244"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCPreLinkEventTool"
CommandLine="if not exist &quot;$(OutDir)&quot; mkdir &quot;$(OutDir)&quot;&#x0D;&#x0A;xcopy /Y /Q &quot;$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*&quot; &quot;$(OutDir)&quot;&#x0D;&#x0A;"
/>
<Tool
Name="VCLinkerTool"
AdditionalDependencies="libcocos2d.lib libCocosDenshion.lib libchipmunk.lib mozjs.lib opengl32.lib glew32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="$(OutDir)"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="bindings"
>
<File
RelativePath="..\..\..\scripting\javascript\bindings\cocos2d_specifics.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\cocos2d_specifics.hpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\cocosjs_manual_conversions.h"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\js_bindings_config.h"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\js_manual_conversions.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\js_manual_conversions.h"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\ScriptingCore.h"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\spidermonkey_specifics.h"
>
</File>
<Filter
Name="generated"
>
<File
RelativePath="..\..\..\scripting\javascript\bindings\generated\cocos2dx.cpp"
>
</File>
<File
RelativePath="..\..\..\scripting\javascript\bindings\generated\cocos2dx.hpp"
>
</File>
</Filter>
</Filter>
<Filter
Name="resource"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;jpg;jpeg;jpe;png;manifest"
>
<File
RelativePath=".\res\testjs.ico"
>
</File>
<File
RelativePath=".\testjs.rc"
>
</File>
</Filter>
<Filter
Name="win32"
>
<File
RelativePath=".\main.cpp"
>
</File>
<File
RelativePath=".\main.h"
>
</File>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Classes"
>
<File
RelativePath="..\Classes\AppDelegate.cpp"
>
</File>
<File
RelativePath="..\Classes\AppDelegate.h"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="gb2312"?>
<VisualStudioUserFile
ProjectType="Visual C++"
Version="9.00"
ShowAllFiles="false"
>
<Configurations>
<Configuration
Name="Debug|Win32"
>
<DebugSettings
WorkingDirectory="$(ProjectDir)..\Resources"
/>
</Configuration>
<Configuration
Name="Release|Win32"
>
<DebugSettings
WorkingDirectory="$(ProjectDir)..\Resources"
/>
</Configuration>
</Configurations>
</VisualStudioUserFile>

View File

@ -0,0 +1,178 @@
<?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>{1DB7C0FC-46FF-4A1B-82E0-C6244EEEC4C2}</ProjectGuid>
<RootNamespace>MoonWarriors</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>.;..\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>
<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 "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(OutDir)"
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</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>.;..\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>
<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 "$(SolutionDir)scripting\javascript\spidermonkey-win32\lib\*.*" "$(OutDir)"
</Command>
</PreLinkEvent>
<Link>
<AdditionalDependencies>libcocos2d.lib;libExtensions.lib;opengl32.lib;glew32.lib;libCocosDenshion.lib;libchipmunk.lib;mozjs.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<SubSystem>Windows</SubSystem>
<TargetMachine>MachineX86</TargetMachine>
</Link>
</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_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_config.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>

View File

@ -0,0 +1,86 @@
<?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\js_manual_conversions.cpp">
<Filter>bindings</Filter>
</ClCompile>
<ClCompile Include="..\..\..\scripting\javascript\bindings\ScriptingCore.cpp">
<Filter>bindings</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\generated\cocos2dx.cpp">
<Filter>bindings\generated</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\js_bindings_config.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>
<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\generated\cocos2dx.hpp">
<Filter>bindings\generated</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>

View File

@ -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>$(ProjectDir)..\Resources</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerWorkingDirectory>$(ProjectDir)..\Resources</LocalDebuggerWorkingDirectory>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

View File

@ -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;
}

View File

@ -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

View File

@ -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

View File

@ -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)

View File

@ -165,10 +165,102 @@ void js_log(const char *format, ...) {
} }
} }
#define JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES 1
void jsb_register_cocos2d_config( JSContext *_cx, JSObject *cocos2d)
{
// Config Object
JSObject *ccconfig = JS_NewObject(_cx, NULL, NULL, NULL);
// config.os: The Operating system
// osx, ios, android, windows, linux, etc..
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
JSString *str = JS_InternString(_cx, "ios");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
JSString *str = JS_InternString(_cx, "android");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32)
JSString *str = JS_InternString(_cx, "windows");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MARMALADE)
JSString *str = JS_InternString(_cx, "marmalade");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
JSString *str = JS_InternString(_cx, "linux");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_BADA)
JSString *str = JS_InternString(_cx, "bada");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_BLACKBERRY)
JSString *str = JS_InternString(_cx, "blackberry");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
JSString *str = JS_InternString(_cx, "osx");
#else
JSString *str = JS_InternString(_cx, "unknown");
#endif
JS_DefineProperty(_cx, ccconfig, "os", STRING_TO_JSVAL(str), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.deviceType: Device Type
// 'mobile' for any kind of mobile devices, 'desktop' for PCs, 'browser' for Web Browsers
// #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
// str = JS_InternString(_cx, "desktop");
// #else
str = JS_InternString(_cx, "mobile");
// #endif
JS_DefineProperty(_cx, ccconfig, "deviceType", STRING_TO_JSVAL(str), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.engine: Type of renderer
// 'cocos2d', 'cocos2d-x', 'cocos2d-html5/canvas', 'cocos2d-html5/webgl', etc..
str = JS_InternString(_cx, "cocos2d-x");
JS_DefineProperty(_cx, ccconfig, "engine", STRING_TO_JSVAL(str), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.arch: CPU Architecture
// i386, ARM, x86_64, web
#ifdef __LP64__
str = JS_InternString(_cx, "x86_64");
#elif defined(__arm__) || defined(__ARM_NEON__)
str = JS_InternString(_cx, "arm");
#else
str = JS_InternString(_cx, "i386");
#endif
JS_DefineProperty(_cx, ccconfig, "arch", STRING_TO_JSVAL(str), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.version: Version of cocos2d + renderer
str = JS_InternString(_cx, cocos2dVersion() );
JS_DefineProperty(_cx, ccconfig, "version", STRING_TO_JSVAL(str), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.usesTypedArrays
#if JSB_COMPATIBLE_WITH_COCOS2D_HTML5_BASIC_TYPES
JSBool b = JS_FALSE;
#else
JSBool b = JS_TRUE;
#endif
JS_DefineProperty(_cx, ccconfig, "usesTypedArrays", BOOLEAN_TO_JSVAL(b), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// config.debug: Debug build ?
#if COCOS2D_DEBUG > 0
b = JS_TRUE;
#else
b = JS_FALSE;
#endif
JS_DefineProperty(_cx, ccconfig, "debug", BOOLEAN_TO_JSVAL(b), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
// Add "config" to "cc"
JS_DefineProperty(_cx, cocos2d, "config", OBJECT_TO_JSVAL(ccconfig), NULL, NULL, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_PERMANENT);
}
void registerDefaultClasses(JSContext* cx, JSObject* global) { void registerDefaultClasses(JSContext* cx, JSObject* global) {
if (!JS_InitStandardClasses(cx, global)) { if (!JS_InitStandardClasses(cx, global)) {
js_log("error initializing the standard classes"); js_log("error initializing the standard classes");
} }
// first, try to get the ns
jsval nsval;
JSObject *ns;
JS_GetProperty(cx, global, "cc", &nsval);
if (nsval == JSVAL_VOID) {
ns = JS_NewObject(cx, NULL, NULL, NULL);
nsval = OBJECT_TO_JSVAL(ns);
JS_SetProperty(cx, global, "cc", &nsval);
} else {
JS_ValueToObject(cx, nsval, &ns);
}
jsb_register_cocos2d_config(cx, ns);
// //
// Javascript controller (__jsc__) // Javascript controller (__jsc__)

View File

@ -392,7 +392,7 @@ JSBool js_cocos2dx_CCAnimation_create(JSContext *cx, uint32_t argc, jsval *vp)
if (argc > 0) { if (argc > 0) {
arg0 = jsval_to_ccarray(cx, argv[0]); arg0 = jsval_to_ccarray(cx, argv[0]);
} }
cocos2d::CCAnimation* ret; cocos2d::CCAnimation* ret = NULL;
double arg1 = 0.0f; double arg1 = 0.0f;
if (argc > 0 && argc == 2) { if (argc > 0 && argc == 2) {
if (argc == 2) { if (argc == 2) {
@ -834,6 +834,72 @@ extern JSObject* js_cocos2dx_CCAnimation_prototype;
extern JSObject* js_cocos2dx_CCMenuItem_prototype; extern JSObject* js_cocos2dx_CCMenuItem_prototype;
extern JSObject* js_cocos2dx_CCSpriteFrame_prototype; extern JSObject* js_cocos2dx_CCSpriteFrame_prototype;
extern JSObject* js_cocos2dx_CCSet_prototype; extern JSObject* js_cocos2dx_CCSet_prototype;
extern JSObject* js_cocos2dx_CCSprite_prototype;
extern JSObject* js_cocos2dx_CCSpriteBatchNode_prototype;
//extern JSObject* js_cocos2dx_CCMotionStreak_prototype;
extern JSObject* js_cocos2dx_CCAtlasNode_prototype;
extern JSObject* js_cocos2dx_CCParticleBatchNode_prototype;
extern JSObject* js_cocos2dx_CCLayerColor_prototype;
extern JSObject* js_cocos2dx_CCParticleSystem_prototype;
// setBlendFunc
template<class T>
JSBool js_cocos2dx_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
jsval *argv = JS_ARGV(cx, vp);
JSObject *obj;
T* cobj;
obj = JS_THIS_OBJECT(cx, vp);
js_proxy_t *proxy; JS_GET_NATIVE_PROXY(proxy, obj);
cobj = (T*)(proxy ? proxy->ptr : NULL);
TEST_NATIVE_OBJECT(cx, cobj)
if (argc == 2)
{
GLenum src, dst;
JS_ValueToInt32(cx, argv[0], (int32_t*)&src);
JS_ValueToInt32(cx, argv[1], (int32_t*)&dst);
ccBlendFunc blendFunc = {src, dst};
cobj->setBlendFunc(blendFunc);
return JS_TRUE;
}
JS_ReportError(cx, "wrong number of arguments: %d, was expecting %d", argc, 2);
return JS_FALSE;
}
JSBool js_cocos2dx_CCSprite_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCSprite>(cx, argc, vp);
}
JSBool js_cocos2dx_CCSpriteBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCSpriteBatchNode>(cx, argc, vp);
}
// JSBool js_cocos2dx_CCMotionStreak_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
// {
// return js_cocos2dx_setBlendFunc<CCMotionStreak>(cx, argc, vp);
// }
JSBool js_cocos2dx_CCAtlasNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCAtlasNode>(cx, argc, vp);
}
JSBool js_cocos2dx_CCParticleBatchNode_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCParticleBatchNode>(cx, argc, vp);
}
JSBool js_cocos2dx_CCLayerColor_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCLayerColor>(cx, argc, vp);
}
JSBool js_cocos2dx_CCParticleSystem_setBlendFunc(JSContext *cx, uint32_t argc, jsval *vp)
{
return js_cocos2dx_setBlendFunc<CCParticleSystem>(cx, argc, vp);
}
void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global) void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global)
{ {
@ -860,10 +926,17 @@ void register_cocos2dx_js_extensions(JSContext* cx, JSObject* global)
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "schedule", js_CCNode_schedule, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "schedule", js_CCNode_schedule, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "scheduleOnce", js_CCNode_scheduleOnce, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "scheduleOnce", js_CCNode_scheduleOnce, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "unschedule", js_CCNode_unschedule, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "unschedule", js_CCNode_unschedule, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCNode_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCSprite_prototype, "setBlendFunc", js_cocos2dx_CCSprite_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCSpriteBatchNode_prototype, "setBlendFunc", js_cocos2dx_CCSpriteBatchNode_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
//JS_DefineFunction(cx, js_cocos2dx_CCMotionStreak_prototype, "setBlendFunc", js_cocos2dx_CCMotionStreak_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCAtlasNode_prototype, "setBlendFunc", js_cocos2dx_CCAtlasNode_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCParticleBatchNode_prototype, "setBlendFunc", js_cocos2dx_CCParticleBatchNode_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCLayerColor_prototype, "setBlendFunc", js_cocos2dx_CCLayerColor_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCParticleSystem_prototype, "setBlendFunc", js_cocos2dx_CCParticleSystem_setBlendFunc, 2, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "copy", js_cocos2dx_CCNode_copy, 1, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "copy", js_cocos2dx_CCNode_copy, 1, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "retain", js_cocos2dx_retain, 0, JSPROP_READONLY | JSPROP_PERMANENT);
JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineFunction(cx, js_cocos2dx_CCAction_prototype, "release", js_cocos2dx_release, 0, JSPROP_READONLY | JSPROP_PERMANENT);

View File

@ -36,6 +36,12 @@ classes = CCSprite.* CCScene CCNode CCDirector CCLayer.* CCMenu.* CCTouch CC.*Ac
# functions from all classes. # functions from all classes.
skip = CCNode::[.*Transform convertToWindowSpace getChildren getGrid setGLServerState description getCamera getShaderProgram getUserObject .*UserData getGLServerState], skip = CCNode::[.*Transform convertToWindowSpace getChildren getGrid setGLServerState description getCamera getShaderProgram getUserObject .*UserData getGLServerState],
CCSprite::[getQuad displayFrame getTexture getBlendFunc setBlendFunc getTextureAtlas setSpriteBatchNode getSpriteBatchNode], CCSprite::[getQuad displayFrame getTexture getBlendFunc setBlendFunc getTextureAtlas setSpriteBatchNode getSpriteBatchNode],
CCSpriteBatchNode::[getBlendFunc setBlendFunc],
CCMotionStreak::[getBlendFunc setBlendFunc],
CCAtlasNode::[getBlendFunc setBlendFunc],
CCParticleBatchNode::[getBlendFunc setBlendFunc],
CCLayerColor::[getBlendFunc setBlendFunc],
CCParticleSystem::[getBlendFunc setBlendFunc],
CCDirector::[getAccelerometer getKeypadDispatcher getTouchDispatcher setWatcherCallbackFun getOpenGLView getScheduler getProjection], CCDirector::[getAccelerometer getKeypadDispatcher getTouchDispatcher setWatcherCallbackFun getOpenGLView getScheduler getProjection],
CCLayer.*::[didAccelerate (g|s)etBlendFunc], CCLayer.*::[didAccelerate (g|s)etBlendFunc],
CCMenu.*::[.*Target getSubItems create alignItemsInColumns initWithItems alignItemsInRows], CCMenu.*::[.*Target getSubItems create alignItemsInColumns initWithItems alignItemsInRows],
@ -94,6 +100,7 @@ rename_functions = CCDirector::[sharedDirector=getInstance],
CCAnimation::[addSpriteFrameWithFileName=addSpriteFrameWithFilename], CCAnimation::[addSpriteFrameWithFileName=addSpriteFrameWithFilename],
CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation], CCAnimationCache::[sharedAnimationCache=getInstance addAnimationsWithFile=addAnimations animationByName=getAnimation],
CCLayerGradient::[initWithColor=init], CCLayerGradient::[initWithColor=init],
CCNode::[boundingBox=getBoundingBox],
SimpleAudioEngine::[sharedEngine=getInstance] SimpleAudioEngine::[sharedEngine=getInstance]
rename_classes = CCParticleSystemQuad::CCParticleSystem rename_classes = CCParticleSystemQuad::CCParticleSystem