Skip to content

add games for cocosruntime v2 #373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions games/MoonWarriors-Runtime/boot-html5.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
/****************************************************************************
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

(function () {
var d = document;
var c = {
COCOS2D_DEBUG: 2, //0 to turn debug off, 1 for basic debug, and 2 for full debug
showFPS: true,
loadExtension: true,
frameRate: 60,
renderMode: 1, //Choose of RenderMode: 0(default), 1(Canvas only), 2(WebGL only)
tag: 'gameCanvas', //the dom element to run cocos2d on
engineDir: '../../../cocos2d/',
//SingleEngineFile:'game.min.js',
appFiles: [
'src/Resource.js',
'src/config/GameConfig.js',
'src/config/EnemyType.js',
'src/config/Level.js',
'src/Effect.js',
'src/Bullet.js',
'src/Enemy.js',
'src/Explosion.js',
'src/Ship.js',
'src/LevelManager.js',
'src/GameController.js',
'src/GameControlMenu.js',
'src/GameLayer.js',
'src/GameOver.js',
'src/AboutLayer.js',
'src/SettingsLayer.js',
'src/SysMenu.js',
'src/HitEffect.js',
'src/SparkEffect.js',
'src/Background.js'
]
};

if (!d.createElement('canvas').getContext) {
var s = d.createElement('div');
s.innerHTML = '<h2>Your browser does not support HTML5 canvas!</h2>' +
'<p>Google Chrome is a browser that combines a minimal design with sophisticated technology to make the web faster, safer, and easier.Click the logo to download.</p>' +
'<a href="http://www.google.com/chrome" target="_blank"><img src="http://www.google.com/intl/zh-CN/chrome/assets/common/images/chrome_logo_2x.png" border="0"/></a>';
var p = d.getElementById(c.tag).parentNode;
p.insertBefore(s);
return;
}


//first load engine file if specified
var s = d.createElement('script');
/*********Delete this section if you have packed all files into one*******/
if (c.SingleEngineFile && !c.engineDir) {
s.src = c.SingleEngineFile;
}
else if (c.engineDir && !c.SingleEngineFile) {
s.src = c.engineDir + 'jsloader.js';
}
else {
alert('You must specify either the single engine file OR the engine directory in "cocos2d.js"');
}
/*********Delete this section if you have packed all files into one*******/

//s.src = 'Packed_Release_File.js'; //IMPORTANT: Un-comment this line if you have packed all files into one

d.body.appendChild(s);
document.ccConfig = c;
s.id = 'cocos2d-html5';
//else if single file specified, load singlefile
})();
73 changes: 73 additions & 0 deletions games/MoonWarriors-Runtime/boot-jsb.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/****************************************************************************
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("script/jsb.js");

var MW = MW || {};

var appFiles = [
'src/Resource.js',
'src/config/GameConfig.js',
'src/config/EnemyType.js',
'src/config/Level.js',
'src/Effect.js',
'src/Bullet.js',
'src/Enemy.js',
'src/Explosion.js',
'src/Ship.js',
'src/LevelManager.js',
'src/GameController.js',
'src/GameControlMenu.js',
'src/GameLayer.js',
'src/GameOver.js',
'src/AboutLayer.js',
'src/SettingsLayer.js',
'src/SysMenu.js',
'src/SparkEffect.js',
'src/HitEffect.js',
'src/Background.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);

155 changes: 155 additions & 0 deletions games/MoonWarriors-Runtime/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
<?xml version="1.0"?>
<project name="Javascript compress project" basedir="." default="compile_test_advanced">

<taskdef name="jscomp" classname="com.google.javascript.jscomp.ant.CompileTask"
classpath="${basedir}/../../../tools/google-js-compiler/compiler.jar"/>


<target name="compile_test_advanced">
<jscomp compilationLevel="advanced" warning="quiet"
debug="false" output="game.min.js">
<!--sourceMapOutputFile="sourcemap"
sourceMapFormat="V3">-->
<externs dir="${basedir}/../../../frameworks/cocos2d-html5-v2.2.3/cocos2d">
<file name="core/cocos2d_externs.js"/>
</externs>
<sources dir="${basedir}/../../../frameworks/cocos2d-html5-v2.2.3/cocos2d">
<file name="core/platform/CCClass.js"/>
<file name="core/cocoa/CCGeometry.js"/>
<file name="core/platform/Sys.js"/>
<file name="core/platform/CCConfig.js"/>
<file name="core/platform/miniFramework.js"/>
<file name="core/platform/CCCommon.js"/>
<file name="core/platform/CCMacro.js"/>
<file name="core/platform/CCFileUtils.js"/>
<file name="core/platform/CCTypes.js"/>
<file name="core/platform/CCEGLView.js"/>
<file name="core/platform/CCScreen.js"/>
<file name="core/platform/CCVisibleRect.js"/>
<file name="core/cocoa/CCAffineTransform.js"/>
<file name="core/support/CCPointExtension.js"/>
<file name="core/support/CCVertex.js"/>
<file name="core/support/TransformUtils.js"/>
<file name="core/base_nodes/CCNode.js"/>
<file name="core/base_nodes/CCAtlasNode.js"/>
<file name="core/textures/CCTexture2D.js"/>
<file name="core/textures/CCTextureCache.js"/>
<file name="core/textures/CCTextureAtlas.js"/>
<file name="core/scenes_nodes/CCScene.js"/>
<file name="core/layers_nodes/CCLayer.js"/>
<file name="core/sprite_nodes/CCSprite.js"/>
<file name="core/sprite_nodes/CCAnimation.js"/>
<file name="core/sprite_nodes/CCAnimationCache.js"/>
<file name="core/sprite_nodes/CCSpriteFrame.js"/>
<file name="core/sprite_nodes/CCSpriteFrameCache.js"/>
<file name="core/sprite_nodes/CCSpriteBatchNode.js"/>
<file name="core/CCConfiguration.js"/>
<file name="core/CCDirector.js"/>
<file name="core/CCCamera.js"/>
<file name="core/CCScheduler.js"/>
<file name="core/CCLoader.js"/>
<file name="core/layers_nodes/CCLoaderLayer.js"/>
<!--<file name="core/CCDrawingPrimitives.js"/> -->
<file name="core/platform/CCApplication.js"/>
<file name="core/platform/CCSAXParser.js"/>
<file name="core/platform/AppControl.js"/>
<file name="core/labelTTF/CCLabelTTF.js"/>
<file name="core/CCActionManager.js"/>
<!--<file name="kazmath/utility.js"/>
<file name="kazmath/vec2.js"/>
<file name="kazmath/vec3.js"/>
<file name="kazmath/vec4.js"/>
<file name="kazmath/ray2.js"/>
<file name="kazmath/mat3.js"/>
<file name="kazmath/mat4.js"/>
<file name="kazmath/plane.js"/>
<file name="kazmath/quaternion.js"/>
<file name="kazmath/aabb.js"/>
<file name="kazmath/GL/mat4stack.js"/>
<file name="kazmath/GL/matrix.js"/>
<file name="shaders/CCShaders.js"/>
<file name="shaders/CCShaderCache.js"/>
<file name="shaders/CCGLProgram.js"/>
<file name="shaders/CCGLStateCache.js"/>
<file name="render_texture/CCRenderTexture.js"/>
<file name="motion_streak/CCMotionStreak.js"/>
<file name="clipping_nodes/CCClippingNode.js"/>
<file name="effects/CCGrid.js"/>
<file name="effects/CCGrabber.js"/>
<file name="shape_nodes/CCDrawNode.js"/>-->
<file name="actions/CCAction.js"/>
<file name="actions/CCActionInterval.js"/>
<file name="actions/CCActionInstant.js"/>
<file name="actions/CCActionCamera.js"/>
<file name="actions/CCActionEase.js"/>
<file name="actions/CCActionCatmullRom.js"/>
<file name="actions/CCActionTween.js"/>
<!--<file name="actions3d/CCActionGrid.js"/>
<file name="actions3d/CCActionGrid3D.js"/>
<file name="actions3d/CCActionTiledGrid.js"/>
<file name="actions3d/CCActionPageTurn3D.js"/>
<file name="progress_timer/CCProgressTimer.js"/>
<file name="progress_timer/CCActionProgressTimer.js"/>-->
<file name="transitions_nodes/CCTransition.js"/>
<file name="transitions_nodes/CCTransitionProgress.js"/>
<file name="transitions_nodes/CCTransitionPageTurn.js"/>
<file name="label_nodes/CCLabelAtlas.js"/>
<file name="label_nodes/CCLabelBMFont.js"/>
<!--<file name="compress/ZipUtils.js"/>
<file name="compress/base64.js"/>
<file name="compress/gzip.js"/>
<file name="compress/zlib.min.js"/>
<file name="particle_nodes/CCPNGReader.js"/>
<file name="particle_nodes/CCTIFFReader.js"/>
<file name="particle_nodes/CCParticleSystem.js"/>
<file name="particle_nodes/CCParticleExamples.js"/>
<file name="particle_nodes/CCParticleBatchNode.js"/>
<file name="physics_nodes/CCPhysicsDebugNode.js"/>
<file name="physics_nodes/CCPhysicsSprite.js"/>-->
<file name="touch_dispatcher/CCTouchDelegateProtocol.js"/>
<file name="touch_dispatcher/CCTouchHandler.js"/>
<file name="touch_dispatcher/CCTouchDispatcher.js"/>
<file name="touch_dispatcher/CCMouseDispatcher.js"/>
<file name="keyboard_dispatcher/CCKeyboardDelegate.js"/>
<file name="keyboard_dispatcher/CCKeyboardDispatcher.js"/>
<!--<file name="accelerometer/CCAccelerometer.js"/>
<file name="text_input_node/CCIMEDispatcher.js"/>
<file name="text_input_node/CCTextFieldTTF.js"/>-->
<file name="menu_nodes/CCMenuItem.js"/>
<file name="menu_nodes/CCMenu.js"/>
<!--<file name="tileMap_nodes/CCTGAlib.js"/>
<file name="tileMap_nodes/CCTMXTiledMap.js"/>
<file name="tileMap_nodes/CCTMXXMLParser.js"/>
<file name="tileMap_nodes/CCTMXObjectGroup.js"/>
<file name="tileMap_nodes/CCTMXLayer.js"/>
<file name="parallax_nodes/CCParallaxNode.js"/>-->
<file name="audio/SimpleAudioEngine.js"/>
<!--<file name="CCUserDefault.js"/>
<file name="CCImage.js"/>-->
</sources>
<sources dir="${basedir}">
<file name="src/Resource.js"/>
<file name="src/config/GameConfig.js"/>
<file name="src/config/EnemyType.js"/>
<file name="src/config/Level.js"/>
<file name="src/Effect.js"/>
<file name="src/Bullet.js"/>
<file name="src/Enemy.js"/>
<file name="src/Explosion.js"/>
<file name="src/Ship.js"/>
<file name="src/LevelManager.js"/>
<file name="src/GameController.js"/>
<file name="src/GameControlMenu.js"/>
<file name="src/GameLayer.js"/>
<file name="src/GameOver.js"/>
<file name="src/AboutLayer.js"/>
<file name="src/SettingsLayer.js"/>
<file name="src/SysMenu.js"/>
<file name="src/HitEffect.js"/>
<file name="src/SparkEffect.js"/>
<file name="src/Background.js"/>
<file name="main.js"/>
</sources>
</jscomp>
</target>
</project>
19 changes: 19 additions & 0 deletions games/MoonWarriors-Runtime/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"game_name": "月亮战士v2",
"package_name": "org.cocos2dx.moonwarriors.v2",
"version_name": "1.0.2",
"version_code": 2,
"runtime_version": "2.2.6.4",
"description": "这是灰常好玩的打飞机游戏!",
"orientation": "portrait",
"entry_file": "main.js",
"game_type": "offline",
"design_resolution": {
"width": 320,
"height": 480,
"policy": "SHOW_ALL"
},
"security": {
"password":"moonwarriors"
}
}
Loading