├── .cocos-project.json ├── .gitignore ├── CMakeLists.txt ├── Classes ├── AppDelegate.cpp ├── AppDelegate.h ├── HelloWorldScene.cpp ├── HelloWorldScene.h ├── event │ ├── EventSuperGunFire.cpp │ ├── EventSuperGunFire.h │ ├── EventSupplyGot.cpp │ └── EventSupplyGot.h ├── factory │ ├── RoleFactory.cpp │ └── RoleFactory.h ├── main.cpp ├── role │ ├── Config.h │ ├── Role.cpp │ ├── Role.h │ ├── RoleBulletBlue.cpp │ ├── RoleBulletBlue.h │ ├── RoleBulletYellow.cpp │ ├── RoleBulletYellow.h │ ├── RoleEnemyBig.cpp │ ├── RoleEnemyBig.h │ ├── RoleEnemyMiddle.cpp │ ├── RoleEnemyMiddle.h │ ├── RoleEnemySmall.cpp │ ├── RoleEnemySmall.h │ ├── RoleHeroPlane.cpp │ ├── RoleHeroPlane.h │ ├── RoleManager.cpp │ ├── RoleManager.h │ ├── RoleSupplyDoubleGun.cpp │ ├── RoleSupplyDoubleGun.h │ ├── RoleSupplySupperGun.cpp │ └── RoleSupplySupperGun.h ├── sceneGame │ ├── LayerOfBg.cpp │ ├── LayerOfBg.h │ ├── LayerOfControl.cpp │ ├── LayerOfControl.h │ ├── LayerOfRole.cpp │ ├── LayerOfRole.h │ ├── SceneGame.cpp │ └── SceneGame.h ├── sceneLoading │ ├── LayerLoading.cpp │ ├── LayerLoading.h │ ├── SceneLoading.cpp │ └── SceneLoading.h ├── sceneScore │ ├── LayerScore.cpp │ ├── LayerScore.h │ ├── SceneScore.cpp │ └── SceneScore.h └── score │ ├── ScoreManager.cpp │ └── ScoreManager.h ├── LICENSE ├── README.md ├── Resources ├── CloseNormal.png ├── CloseSelected.png ├── HelloWorld.png ├── font │ ├── font.fnt │ └── font.png ├── fonts │ ├── Marker Felt.ttf │ └── arial.ttf ├── fps_images-hd.png ├── fps_images-ipadhd.png ├── fps_images.png ├── res │ └── .gitkeep ├── sound │ ├── achievement.mp3 │ ├── big_spaceship_flying.mp3 │ ├── bullet.mp3 │ ├── button.mp3 │ ├── enemy1_down.mp3 │ ├── enemy2_down.mp3 │ ├── enemy3_down.mp3 │ ├── game_music.mp3 │ ├── game_over.mp3 │ ├── get_bomb.mp3 │ ├── get_double_laser.mp3 │ ├── out_porp.mp3 │ └── use_bomb.mp3 └── ui │ ├── shoot.plist │ ├── shoot.png │ ├── shoot_background.plist │ └── shoot_background.png ├── proj.android-studio ├── .gitignore ├── app │ ├── .gitignore │ ├── AndroidManifest.xml │ ├── build.gradle │ ├── jni │ │ ├── Android.mk │ │ ├── Application.mk │ │ └── hellocpp │ │ │ └── main.cpp │ ├── proguard-rules.pro │ ├── project.properties │ ├── res │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ └── values │ │ │ └── strings.xml │ └── src │ │ └── org │ │ └── cocos2dx │ │ └── cpp │ │ └── AppActivity.java ├── build-cfg.json ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── proj.android ├── .classpath ├── .cproject ├── .externalToolBuilders │ └── org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch ├── .project ├── .settings │ ├── org.eclipse.cdt.codan.core.prefs │ ├── org.eclipse.cdt.core.prefs │ └── org.eclipse.ltk.core.refactoring.prefs ├── AndroidManifest.xml ├── ant.properties ├── build-cfg.json ├── build.xml ├── build_native.py ├── jni │ ├── Android.mk │ ├── Application.mk │ └── hellocpp │ │ └── main.cpp ├── proguard-project.txt ├── project.properties ├── res │ ├── drawable-hdpi │ │ └── icon.png │ ├── drawable-ldpi │ │ └── icon.png │ ├── drawable-mdpi │ │ └── icon.png │ └── values │ │ └── strings.xml └── src │ └── org │ └── cocos2dx │ └── cpp │ └── AppActivity.java ├── proj.ios_mac ├── AirWar.xcodeproj │ └── project.pbxproj ├── ios │ ├── AppController.h │ ├── AppController.mm │ ├── Default-568h@2x.png │ ├── Default-667h@2x.png │ ├── Default-736h@3x.png │ ├── Default.png │ ├── Default@2x.png │ ├── Icon-100.png │ ├── Icon-114.png │ ├── Icon-120.png │ ├── Icon-144.png │ ├── Icon-152.png │ ├── Icon-29.png │ ├── Icon-40.png │ ├── Icon-50.png │ ├── Icon-57.png │ ├── Icon-58.png │ ├── Icon-72.png │ ├── Icon-76.png │ ├── Icon-80.png │ ├── Info.plist │ ├── RootViewController.h │ ├── RootViewController.mm │ └── main.m └── mac │ ├── Icon.icns │ ├── Info.plist │ └── main.cpp ├── proj.linux └── main.cpp ├── proj.win10 ├── AirWar.sln └── App │ ├── AirWar.vcxproj │ ├── AirWar.vcxproj.filters │ ├── AirWar_TemporaryKey.pfx │ ├── App.xaml │ ├── App.xaml.cpp │ ├── App.xaml.h │ ├── Assets │ ├── LockScreenLogo.scale-200.png │ ├── SplashScreen.scale-200.png │ ├── Square150x150Logo.scale-200.png │ ├── Square44x44Logo.scale-200.png │ ├── Square44x44Logo.targetsize-24_altform-unplated.png │ ├── StoreLogo.png │ └── Wide310x150Logo.scale-200.png │ ├── Cocos2dEngine │ ├── Cocos2dRenderer.cpp │ ├── Cocos2dRenderer.h │ ├── OpenGLES.cpp │ ├── OpenGLES.h │ ├── OpenGLESPage.xaml │ ├── OpenGLESPage.xaml.cpp │ └── OpenGLESPage.xaml.h │ ├── Package.appxmanifest │ ├── pch.cpp │ ├── pch.h │ └── resources.props ├── proj.win32 ├── AirWar.sln ├── AirWar.vcxproj ├── AirWar.vcxproj.filters ├── AirWar.vcxproj.user ├── build-cfg.json ├── game.rc ├── main.cpp ├── main.h ├── res │ └── game.ico └── resource.h ├── proj.win8.1-universal ├── AirWar.sln ├── App.Shared │ ├── AirWar.Shared.vcxitems │ ├── AirWar.Shared.vcxitems.filters │ ├── App.xaml │ ├── App.xaml.cpp │ ├── App.xaml.h │ ├── Cocos2dRenderer.cpp │ ├── Cocos2dRenderer.h │ ├── OpenGLES.cpp │ ├── OpenGLES.h │ ├── OpenGLESPage.xaml │ ├── OpenGLESPage.xaml.cpp │ ├── OpenGLESPage.xaml.h │ ├── pch.cpp │ └── pch.h ├── App.Windows │ ├── AirWar.Windows.vcxproj │ ├── AirWar.Windows.vcxproj.filters │ ├── AirWar.Windows_TemporaryKey.pfx │ ├── Assets │ │ ├── Logo.scale-100.png │ │ ├── SmallLogo.scale-100.png │ │ ├── SplashScreen.scale-100.png │ │ └── StoreLogo.scale-100.png │ └── Package.appxmanifest └── App.WindowsPhone │ ├── AirWar.WindowsPhone.vcxproj │ ├── AirWar.WindowsPhone.vcxproj.filters │ ├── Assets │ ├── Logo.scale-240.png │ ├── SmallLogo.scale-240.png │ ├── SplashScreen.scale-240.png │ ├── Square71x71Logo.scale-240.png │ ├── StoreLogo.scale-240.png │ └── WideLogo.scale-240.png │ └── Package.appxmanifest └── raw ├── AirWar.uml ├── AirWar.xmind ├── AirWar_Architecture.png ├── can_hit.png ├── class.jpg ├── icon.png ├── physical param.xlsx └── physics_body.png /.cocos-project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine_version": "cocos2d-x-3.8", 3 | "project_type": "cpp" 4 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled Object files 2 | *.slo 3 | *.lo 4 | *.o 5 | *.obj 6 | 7 | # Precompiled Headers 8 | *.gch 9 | *.pch 10 | 11 | # Compiled Dynamic libraries 12 | *.so 13 | *.dylib 14 | *.dll 15 | 16 | # Fortran module files 17 | *.mod 18 | 19 | # Compiled Static libraries 20 | *.lai 21 | *.la 22 | *.a 23 | *.lib 24 | 25 | # Executables 26 | *.exe 27 | *.out 28 | *.app 29 | -------------------------------------------------------------------------------- /Classes/AppDelegate.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "HelloWorldScene.h" 3 | #include "sceneLoading/SceneLoading.h" 4 | USING_NS_CC; 5 | 6 | static cocos2d::Size designResolutionSize = cocos2d::Size(480, 500); 7 | static cocos2d::Size smallResolutionSize = cocos2d::Size(480, 320); 8 | static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024, 768); 9 | static cocos2d::Size largeResolutionSize = cocos2d::Size(2048, 1536); 10 | 11 | AppDelegate::AppDelegate() { 12 | 13 | } 14 | 15 | AppDelegate::~AppDelegate() 16 | { 17 | } 18 | 19 | //if you want a different context,just modify the value of glContextAttrs 20 | //it will takes effect on all platforms 21 | void AppDelegate::initGLContextAttrs() 22 | { 23 | //set OpenGL context attributions,now can only set six attributions: 24 | //red,green,blue,alpha,depth,stencil 25 | GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; 26 | 27 | GLView::setGLContextAttrs(glContextAttrs); 28 | } 29 | 30 | // If you want to use packages manager to install more packages, 31 | // don't modify or remove this function 32 | static int register_all_packages() 33 | { 34 | return 0; //flag for packages manager 35 | } 36 | 37 | bool AppDelegate::applicationDidFinishLaunching() { 38 | // initialize director 39 | auto director = Director::getInstance(); 40 | auto glview = director->getOpenGLView(); 41 | if(!glview) { 42 | #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) 43 | glview = GLViewImpl::createWithRect("AirWar", Rect(0, 0, designResolutionSize.width, designResolutionSize.height)); 44 | #else 45 | glview = GLViewImpl::create("AirWar"); 46 | #endif 47 | director->setOpenGLView(glview); 48 | } 49 | 50 | // turn on display FPS 51 | director->setDisplayStats(true); 52 | 53 | // set FPS. the default value is 1.0/60 if you don't call this 54 | director->setAnimationInterval(1.0 / 60); 55 | 56 | // Set the design resolution 57 | glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER); 58 | Size frameSize = glview->getFrameSize(); 59 | // if the frame's height is larger than the height of medium size. 60 | if (frameSize.height > mediumResolutionSize.height) 61 | { 62 | director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width)); 63 | } 64 | // if the frame's height is larger than the height of small size. 65 | else if (frameSize.height > smallResolutionSize.height) 66 | { 67 | director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width)); 68 | } 69 | // if the frame's height is smaller than the height of medium size. 70 | else 71 | { 72 | director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width)); 73 | } 74 | director->setContentScaleFactor(1); 75 | register_all_packages(); 76 | 77 | // create a scene. it's an autorelease object 78 | auto scene = SceneLoading::create(); 79 | 80 | // run 81 | director->runWithScene(scene); 82 | 83 | return true; 84 | } 85 | 86 | // This function will be called when the app is inactive. When comes a phone call,it's be invoked too 87 | void AppDelegate::applicationDidEnterBackground() { 88 | Director::getInstance()->stopAnimation(); 89 | 90 | // if you use SimpleAudioEngine, it must be pause 91 | // SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); 92 | } 93 | 94 | // this function will be called when the app is active again 95 | void AppDelegate::applicationWillEnterForeground() { 96 | Director::getInstance()->startAnimation(); 97 | 98 | // if you use SimpleAudioEngine, it must resume here 99 | // SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); 100 | } 101 | -------------------------------------------------------------------------------- /Classes/AppDelegate.h: -------------------------------------------------------------------------------- 1 | #ifndef _APP_DELEGATE_H_ 2 | #define _APP_DELEGATE_H_ 3 | 4 | #include "cocos2d.h" 5 | 6 | /** 7 | @brief The cocos2d Application. 8 | 9 | The reason for implement as private inheritance is to hide some interface call by Director. 10 | */ 11 | class AppDelegate : private cocos2d::Application 12 | { 13 | public: 14 | AppDelegate(); 15 | virtual ~AppDelegate(); 16 | 17 | virtual void initGLContextAttrs(); 18 | 19 | /** 20 | @brief Implement Director and Scene init code here. 21 | @return true Initialize success, app continue. 22 | @return false Initialize failed, app terminate. 23 | */ 24 | virtual bool applicationDidFinishLaunching(); 25 | 26 | /** 27 | @brief The function be called when the application enter background 28 | @param the pointer of the application 29 | */ 30 | virtual void applicationDidEnterBackground(); 31 | 32 | /** 33 | @brief The function be called when the application enter foreground 34 | @param the pointer of the application 35 | */ 36 | virtual void applicationWillEnterForeground(); 37 | }; 38 | 39 | #endif // _APP_DELEGATE_H_ 40 | 41 | -------------------------------------------------------------------------------- /Classes/HelloWorldScene.cpp: -------------------------------------------------------------------------------- 1 | #include "HelloWorldScene.h" 2 | 3 | USING_NS_CC; 4 | 5 | Scene* HelloWorld::createScene() 6 | { 7 | // 'scene' is an autorelease object 8 | auto scene = Scene::create(); 9 | 10 | // 'layer' is an autorelease object 11 | auto layer = HelloWorld::create(); 12 | 13 | // add layer as a child to scene 14 | scene->addChild(layer); 15 | 16 | // return the scene 17 | return scene; 18 | } 19 | 20 | // on "init" you need to initialize your instance 21 | bool HelloWorld::init() 22 | { 23 | ////////////////////////////// 24 | // 1. super init first 25 | if ( !Layer::init() ) 26 | { 27 | return false; 28 | } 29 | 30 | Size visibleSize = Director::getInstance()->getVisibleSize(); 31 | Vec2 origin = Director::getInstance()->getVisibleOrigin(); 32 | 33 | ///////////////////////////// 34 | // 2. add a menu item with "X" image, which is clicked to quit the program 35 | // you may modify it. 36 | 37 | // add a "close" icon to exit the progress. it's an autorelease object 38 | auto closeItem = MenuItemImage::create( 39 | "CloseNormal.png", 40 | "CloseSelected.png", 41 | CC_CALLBACK_1(HelloWorld::menuCloseCallback, this)); 42 | 43 | closeItem->setPosition(Vec2(origin.x + visibleSize.width - closeItem->getContentSize().width/2 , 44 | origin.y + closeItem->getContentSize().height/2)); 45 | 46 | // create menu, it's an autorelease object 47 | auto menu = Menu::create(closeItem, NULL); 48 | menu->setPosition(Vec2::ZERO); 49 | this->addChild(menu, 1); 50 | 51 | ///////////////////////////// 52 | // 3. add your codes below... 53 | 54 | // add a label shows "Hello World" 55 | // create and initialize a label 56 | 57 | auto label = Label::createWithTTF("Hello World", "fonts/Marker Felt.ttf", 24); 58 | 59 | // position the label on the center of the screen 60 | label->setPosition(Vec2(origin.x + visibleSize.width/2, 61 | origin.y + visibleSize.height - label->getContentSize().height)); 62 | 63 | // add the label as a child to this layer 64 | this->addChild(label, 1); 65 | 66 | // add "HelloWorld" splash screen" 67 | auto sprite = Sprite::create("HelloWorld.png"); 68 | 69 | // position the sprite on the center of the screen 70 | sprite->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); 71 | 72 | // add the sprite as a child to this layer 73 | this->addChild(sprite, 0); 74 | 75 | return true; 76 | } 77 | 78 | 79 | void HelloWorld::menuCloseCallback(Ref* pSender) 80 | { 81 | Director::getInstance()->end(); 82 | 83 | #if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS) 84 | exit(0); 85 | #endif 86 | } 87 | -------------------------------------------------------------------------------- /Classes/HelloWorldScene.h: -------------------------------------------------------------------------------- 1 | #ifndef __HELLOWORLD_SCENE_H__ 2 | #define __HELLOWORLD_SCENE_H__ 3 | 4 | #include "cocos2d.h" 5 | 6 | class HelloWorld : public cocos2d::Layer 7 | { 8 | public: 9 | static cocos2d::Scene* createScene(); 10 | 11 | virtual bool init(); 12 | 13 | // a selector callback 14 | void menuCloseCallback(cocos2d::Ref* pSender); 15 | 16 | // implement the "static create()" method manually 17 | CREATE_FUNC(HelloWorld); 18 | }; 19 | 20 | #endif // __HELLOWORLD_SCENE_H__ 21 | -------------------------------------------------------------------------------- /Classes/event/EventSuperGunFire.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * EventSuperGunFire.cpp 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #include "EventSuperGunFire.h" 9 | 10 | EventSuperGunFire::EventSuperGunFire() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | EventSuperGunFire::~EventSuperGunFire() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/event/EventSuperGunFire.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EventSuperGunFire.h 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef EVENTSUPERGUNFIRE_H_ 9 | #define EVENTSUPERGUNFIRE_H_ 10 | 11 | class EventSuperGunFire { 12 | public: 13 | EventSuperGunFire(); 14 | virtual ~EventSuperGunFire(); 15 | }; 16 | 17 | #endif /* EVENTSUPERGUNFIRE_H_ */ 18 | -------------------------------------------------------------------------------- /Classes/event/EventSupplyGot.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * EventSupplyGot.cpp 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #include "EventSupplyGot.h" 9 | 10 | EventSupplyGot::EventSupplyGot() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | EventSupplyGot::~EventSupplyGot() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/event/EventSupplyGot.h: -------------------------------------------------------------------------------- 1 | /* 2 | * EventSupplyGot.h 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef EVENTSUPPLYGOT_H_ 9 | #define EVENTSUPPLYGOT_H_ 10 | 11 | class EventSupplyGot { 12 | public: 13 | EventSupplyGot(); 14 | virtual ~EventSupplyGot(); 15 | }; 16 | 17 | #endif /* EVENTSUPPLYGOT_H_ */ 18 | -------------------------------------------------------------------------------- /Classes/factory/RoleFactory.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleFactory.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleFactory.h" 9 | 10 | RoleFactory::RoleFactory() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | RoleFactory::~RoleFactory() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/factory/RoleFactory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleFactory.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEFACTORY_H_ 9 | #define ROLEFACTORY_H_ 10 | 11 | class RoleFactory { 12 | public: 13 | RoleFactory(); 14 | virtual ~RoleFactory(); 15 | }; 16 | 17 | #endif /* ROLEFACTORY_H_ */ 18 | -------------------------------------------------------------------------------- /Classes/main.cpp: -------------------------------------------------------------------------------- 1 | //============================================================================ 2 | // Name : AirplainRole.cpp 3 | // Author : hsy 4 | // Version : 5 | // Copyright : Your copyright notice 6 | // Description : Hello World in C, Ansi-style 7 | //============================================================================ 8 | 9 | #include 10 | #include 11 | 12 | int main(void) { 13 | puts("Hello World!!!"); 14 | return EXIT_SUCCESS; 15 | } 16 | -------------------------------------------------------------------------------- /Classes/role/Config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Config.h 3 | * 4 | * Created on: 2015-11-5 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef CONFIG_H_ 9 | #define CONFIG_H_ 10 | 11 | 12 | // TAGs 13 | const int TAG_ENEMY = 100; 14 | const int TAG_HERO = 200; 15 | const int TAG_BULLET = 300; 16 | const int TAG_SUPPLY = 500; 17 | 18 | // Physical related 19 | const int PHYSICAL_BODY_HERO_GROUP = -1; 20 | const int PHYSICAL_BODY_HERO_BITMASK_CATEGORY = 1; 21 | const int PHYSICAL_BODY_HERO_BITMASK_CONTACT_TEST = 12; 22 | const int PHYSICAL_BODY_HERO_BITMASK_COLLISION = 12; 23 | 24 | const int PHYSICAL_BODY_BULLET_GROUP = -2; 25 | const int PHYSICAL_BODY_BULLET_BITMASK_CATEGORY = 2; 26 | const int PHYSICAL_BODY_BULLET_BITMASK_CONTACT_TEST = 8; 27 | const int PHYSICAL_BODY_BULLET_BITMASK_COLLISION = 8; 28 | 29 | const int PHYSICAL_BODY_SUPPLY_GROUP = -3; 30 | const int PHYSICAL_BODY_SUPPLY_BITMASK_CATEGORY = 4; 31 | const int PHYSICAL_BODY_SUPPLY_BITMASK_CONTACT_TEST = 1; 32 | const int PHYSICAL_BODY_SUPPLY_BITMASK_COLLISION = 1; 33 | 34 | const int PHYSICAL_BODY_ENEMY_GROUP = -4; 35 | const int PHYSICAL_BODY_ENEMY_BITMASK_CATEGORY = 8; 36 | const int PHYSICAL_BODY_ENEMY_BITMASK_CONTACT_TEST = 3; 37 | const int PHYSICAL_BODY_ENEMY_BITMASK_COLLISION = 3; 38 | 39 | // Supply related 40 | const int SUPPLY_DOUBLE_GUN = 1; 41 | const int SUPPLY_SUPPER_GUN = 2; 42 | 43 | #endif /* CONFIG_H_ */ 44 | -------------------------------------------------------------------------------- /Classes/role/Role.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Role.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "Role.h" 9 | 10 | Role::Role() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | Role::~Role() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/role/Role.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Role.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLE_H_ 9 | #define ROLE_H_ 10 | 11 | #include "cocos2d.h" 12 | #include "Config.h" 13 | 14 | USING_NS_CC; 15 | 16 | class Role { 17 | public: 18 | virtual ~Role(){} 19 | 20 | virtual void hit(Role* target) = 0; 21 | virtual void gotDamage(int damage)= 0; 22 | virtual void gotSupply(int supply)= 0; 23 | virtual void down()= 0; 24 | }; 25 | 26 | #endif /* ROLE_H_ */ 27 | -------------------------------------------------------------------------------- /Classes/role/RoleBulletBlue.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleBulletBlue.cpp 3 | * 4 | * Created on: 2015-11-6 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleBulletBlue.h" 9 | 10 | RoleBulletBlue::RoleBulletBlue() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | RoleBulletBlue::~RoleBulletBlue() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | RoleBulletBlue* RoleBulletBlue::create(float x, float y) { 20 | RoleBulletBlue *pRet = new (std::nothrow) RoleBulletBlue(); 21 | if (pRet && pRet->init(x, y)) { 22 | pRet->autorelease(); 23 | return pRet; 24 | } else { 25 | delete pRet; 26 | pRet = NULL; 27 | return NULL; 28 | } 29 | } 30 | 31 | bool RoleBulletBlue::init(float x, float y) { 32 | bool bRet = false; 33 | do { 34 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("bullet2.png")); 35 | 36 | // set physical body 37 | auto body = PhysicsBody::createBox(getContentSize()); 38 | body->setGroup(PHYSICAL_BODY_BULLET_GROUP); 39 | body->setCategoryBitmask(PHYSICAL_BODY_BULLET_BITMASK_CATEGORY); 40 | body->setContactTestBitmask(PHYSICAL_BODY_BULLET_BITMASK_CONTACT_TEST); 41 | body->setCollisionBitmask(PHYSICAL_BODY_BULLET_BITMASK_COLLISION); 42 | setPhysicsBody(body); 43 | 44 | // set position 45 | Point bulletPosition = Point(x, y); 46 | setPosition(bulletPosition); 47 | 48 | // run action 49 | float length = Director::getInstance()->getWinSize().height 50 | + getContentSize().height / 2 - bulletPosition.y; 51 | float velocity = 420 / 1; //420pixel/sec 52 | float realMoveDuration = length / velocity; 53 | 54 | auto actionMove = MoveTo::create(realMoveDuration, 55 | Point(bulletPosition.x, 56 | Director::getInstance()->getWinSize().height 57 | + getContentSize().height / 2)); 58 | auto actionDone = RemoveSelf::create(true); 59 | auto sequence = Sequence::create(actionMove, actionDone, nullptr); 60 | runAction(sequence); 61 | 62 | bRet = true; 63 | } while (0); 64 | 65 | return bRet; 66 | } 67 | 68 | void RoleBulletBlue::hit(Role* target) { 69 | int force = 100; 70 | target->gotDamage(force); 71 | } 72 | 73 | void RoleBulletBlue::gotDamage(int damage) { 74 | down(); 75 | } 76 | 77 | void RoleBulletBlue::gotSupply(int supply) { 78 | } 79 | 80 | void RoleBulletBlue::down() { 81 | auto actionDone = RemoveSelf::create(true); 82 | runAction(actionDone); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Classes/role/RoleBulletBlue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleBulletBlue.h 3 | * 4 | * Created on: 2015-11-6 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEBULLETBLUE_H_ 9 | #define ROLEBULLETBLUE_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleBulletBlue: public Role, public Sprite { 14 | public: 15 | RoleBulletBlue(); 16 | virtual ~RoleBulletBlue(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(float x, float y); 25 | static RoleBulletBlue* create(float x, float y); 26 | }; 27 | 28 | #endif /* ROLEBULLETBLUE_H_ */ 29 | -------------------------------------------------------------------------------- /Classes/role/RoleBulletYellow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleBulletYellow.cpp 3 | * 4 | * Created on: 2015-11-6 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleBulletYellow.h" 9 | 10 | RoleBulletYellow::RoleBulletYellow() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | RoleBulletYellow::~RoleBulletYellow() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | RoleBulletYellow* RoleBulletYellow::create(float x, float y) { 20 | RoleBulletYellow *pRet = new (std::nothrow) RoleBulletYellow(); 21 | if (pRet && pRet->init(x, y)) { 22 | pRet->autorelease(); 23 | return pRet; 24 | } else { 25 | delete pRet; 26 | pRet = NULL; 27 | return NULL; 28 | } 29 | } 30 | 31 | bool RoleBulletYellow::init(float x, float y) { 32 | bool bRet = false; 33 | do { 34 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("bullet1.png")); 35 | 36 | // set physical body 37 | auto body = PhysicsBody::createBox(getContentSize()); 38 | body->setGroup(PHYSICAL_BODY_BULLET_GROUP); 39 | body->setCategoryBitmask(PHYSICAL_BODY_BULLET_BITMASK_CATEGORY); 40 | body->setContactTestBitmask(PHYSICAL_BODY_BULLET_BITMASK_CONTACT_TEST); 41 | body->setCollisionBitmask(PHYSICAL_BODY_BULLET_BITMASK_COLLISION); 42 | setPhysicsBody(body); 43 | 44 | // set position 45 | Point bulletPosition = Point(x, y); 46 | setPosition(bulletPosition); 47 | 48 | // run action 49 | float length = Director::getInstance()->getWinSize().height 50 | + getContentSize().height / 2 - bulletPosition.y; 51 | float velocity = 320 / 1; //320pixel/sec 52 | float realMoveDuration = length / velocity; 53 | 54 | auto actionMove = MoveTo::create(realMoveDuration, 55 | Point(bulletPosition.x, 56 | Director::getInstance()->getWinSize().height 57 | + getContentSize().height / 2)); 58 | auto actionDone = RemoveSelf::create(true); 59 | auto sequence = Sequence::create(actionMove, actionDone, nullptr); 60 | runAction(sequence); 61 | 62 | bRet = true; 63 | } while (0); 64 | 65 | return bRet; 66 | } 67 | 68 | void RoleBulletYellow::hit(Role* target) { 69 | int force = 100; 70 | target->gotDamage(force); 71 | } 72 | 73 | void RoleBulletYellow::gotDamage(int damage) { 74 | down(); 75 | } 76 | 77 | void RoleBulletYellow::gotSupply(int supply) { 78 | } 79 | 80 | void RoleBulletYellow::down() { 81 | auto actionDone = RemoveSelf::create(true); 82 | runAction(actionDone); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /Classes/role/RoleBulletYellow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleBulletYellow.h 3 | * 4 | * Created on: 2015-11-6 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEBULLETYELLOW_H_ 9 | #define ROLEBULLETYELLOW_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleBulletYellow: public Role, public Sprite { 14 | public: 15 | RoleBulletYellow(); 16 | virtual ~RoleBulletYellow(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(float x, float y); 25 | static RoleBulletYellow* create(float x, float y); 26 | }; 27 | 28 | #endif /* ROLEBULLETYELLOW_H_ */ 29 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemyBig.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemyBig.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleEnemyBig.h" 9 | #include "SimpleAudioEngine.h" 10 | 11 | RoleEnemyBig::RoleEnemyBig() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | RoleEnemyBig::~RoleEnemyBig() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | bool RoleEnemyBig::init() { 21 | bool bRet = false; 22 | do { 23 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("enemy3_n1.png")); 24 | 25 | // set physical body 26 | auto body = PhysicsBody::createBox(getContentSize()); 27 | body->setGroup(PHYSICAL_BODY_ENEMY_GROUP); 28 | body->setCategoryBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CATEGORY); 29 | body->setContactTestBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CONTACT_TEST); 30 | body->setCollisionBitmask(PHYSICAL_BODY_ENEMY_BITMASK_COLLISION); 31 | setPhysicsBody(body); 32 | 33 | // set position 34 | auto enemy1Size = getContentSize(); 35 | auto winSize = Director::getInstance()->getWinSize(); 36 | int minX = enemy1Size.width / 2; 37 | int maxX = winSize.width - enemy1Size.width / 2; 38 | int rangeX = maxX - minX; 39 | int actualX = (rand() % rangeX) + minX; 40 | setPosition(Point(actualX, winSize.height + enemy1Size.height / 2)); 41 | 42 | // run action 43 | float minDuration, maxDuration; 44 | minDuration = 2.0f; 45 | maxDuration = 4.0f; 46 | 47 | int rangeDuration = maxDuration - minDuration; 48 | int actualDuration = (rand() % rangeDuration) + minDuration; 49 | 50 | auto actionMove = MoveTo::create(actualDuration, 51 | Point(actualX, 0 - getContentSize().height / 2)); 52 | auto actionDone = RemoveSelf::create(true); 53 | auto sequence = Sequence::create(actionMove, actionDone, nullptr); 54 | runAction(sequence); 55 | 56 | auto enemy3SpriteFrame_1 = 57 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 58 | "enemy3_n1.png"); 59 | auto enemy3SpriteFrame_2 = 60 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 61 | "enemy3_n2.png"); 62 | auto animation = Animation::create(); 63 | animation->setDelayPerUnit(0.2f); 64 | animation->addSpriteFrame(enemy3SpriteFrame_1); 65 | animation->addSpriteFrame(enemy3SpriteFrame_2); 66 | auto animate = Animate::create(animation); 67 | runAction(RepeatForever::create(animate)); 68 | 69 | bRet = true; 70 | } while (0); 71 | 72 | return bRet; 73 | } 74 | 75 | void RoleEnemyBig::hit(Role* target) { 76 | target->gotDamage(100); 77 | } 78 | 79 | void RoleEnemyBig::gotDamage(int damage) { 80 | down(); 81 | } 82 | 83 | void RoleEnemyBig::gotSupply(int supply) { 84 | } 85 | 86 | void RoleEnemyBig::down() { 87 | CocosDenshion::SimpleAudioEngine::getInstance()->playEffect( 88 | "sound/enemy3_down.mp3"); 89 | auto animation = AnimationCache::getInstance()->getAnimation( 90 | "Enemy3Blowup"); 91 | auto animate = Animate::create(animation); 92 | auto actionDone = RemoveSelf::create(true); 93 | auto sequence = Sequence::create(animate, actionDone, nullptr); 94 | runAction(sequence); 95 | } 96 | 97 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemyBig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemyBig.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEENEMYBIG_H_ 9 | #define ROLEENEMYBIG_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleEnemyBig: public Role, public Sprite { 14 | public: 15 | RoleEnemyBig(); 16 | virtual ~RoleEnemyBig(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleEnemyBig); 26 | }; 27 | 28 | #endif /* ROLEENEMYBIG_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemyMiddle.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemyMiddle.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleEnemyMiddle.h" 9 | #include "SimpleAudioEngine.h" 10 | 11 | RoleEnemyMiddle::RoleEnemyMiddle() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | RoleEnemyMiddle::~RoleEnemyMiddle() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | bool RoleEnemyMiddle::init() { 21 | bool bRet = false; 22 | do { 23 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("enemy2.png")); 24 | 25 | // set physical body 26 | auto body = PhysicsBody::createBox(getContentSize()); 27 | body->setGroup(PHYSICAL_BODY_ENEMY_GROUP); 28 | body->setCategoryBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CATEGORY); 29 | body->setContactTestBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CONTACT_TEST); 30 | body->setCollisionBitmask(PHYSICAL_BODY_ENEMY_BITMASK_COLLISION); 31 | setPhysicsBody(body); 32 | 33 | // set position 34 | auto enemy1Size = getContentSize(); 35 | auto winSize = Director::getInstance()->getWinSize(); 36 | int minX = enemy1Size.width / 2; 37 | int maxX = winSize.width - enemy1Size.width / 2; 38 | int rangeX = maxX - minX; 39 | int actualX = (rand() % rangeX) + minX; 40 | setPosition(Point(actualX, winSize.height + enemy1Size.height / 2)); 41 | 42 | // run action 43 | float minDuration, maxDuration; 44 | minDuration = 2.0f; 45 | maxDuration = 4.0f; 46 | 47 | int rangeDuration = maxDuration - minDuration; 48 | int actualDuration = (rand() % rangeDuration) + minDuration; 49 | 50 | auto actionMove = MoveTo::create(actualDuration, 51 | Point(actualX, 0 - getContentSize().height / 2)); 52 | auto actionDone = RemoveSelf::create(true); 53 | auto sequence = Sequence::create(actionMove, actionDone, nullptr); 54 | runAction(sequence); 55 | 56 | bRet = true; 57 | } while (0); 58 | 59 | return bRet; 60 | } 61 | 62 | void RoleEnemyMiddle::hit(Role* target) { 63 | target->gotDamage(100); 64 | } 65 | 66 | void RoleEnemyMiddle::gotDamage(int damage) { 67 | down(); 68 | } 69 | 70 | void RoleEnemyMiddle::gotSupply(int supply) { 71 | } 72 | 73 | void RoleEnemyMiddle::down() { 74 | CocosDenshion::SimpleAudioEngine::getInstance()->playEffect( 75 | "sound/enemy2_down.mp3"); 76 | auto animation = AnimationCache::getInstance()->getAnimation( 77 | "Enemy2Blowup"); 78 | auto animate = Animate::create(animation); 79 | auto actionDone = RemoveSelf::create(true); 80 | auto sequence = Sequence::create(animate, actionDone, nullptr); 81 | runAction(sequence); 82 | } 83 | 84 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemyMiddle.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemyMiddle.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEENEMYMIDDLE_H_ 9 | #define ROLEENEMYMIDDLE_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleEnemyMiddle: public Role, public Sprite { 14 | public: 15 | RoleEnemyMiddle(); 16 | virtual ~RoleEnemyMiddle(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleEnemyMiddle); 26 | }; 27 | 28 | #endif /* ROLEENEMYMIDDLE_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemySmall.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemySmall.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleEnemySmall.h" 9 | #include "SimpleAudioEngine.h" 10 | 11 | RoleEnemySmall::RoleEnemySmall() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | RoleEnemySmall::~RoleEnemySmall() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | bool RoleEnemySmall::init() { 21 | bool bRet = false; 22 | do { 23 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("enemy1.png")); 24 | 25 | // set physical body 26 | auto body = PhysicsBody::createBox(getContentSize()); 27 | body->setGroup(PHYSICAL_BODY_ENEMY_GROUP); 28 | body->setCategoryBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CATEGORY); 29 | body->setContactTestBitmask(PHYSICAL_BODY_ENEMY_BITMASK_CONTACT_TEST); 30 | body->setCollisionBitmask(PHYSICAL_BODY_ENEMY_BITMASK_COLLISION); 31 | setPhysicsBody(body); 32 | 33 | // set position 34 | auto enemy1Size = getContentSize(); 35 | auto winSize = Director::getInstance()->getWinSize(); 36 | int minX = enemy1Size.width / 2; 37 | int maxX = winSize.width - enemy1Size.width / 2; 38 | int rangeX = maxX - minX; 39 | int actualX = (rand() % rangeX) + minX; 40 | setPosition(Point(actualX, winSize.height + enemy1Size.height / 2)); 41 | 42 | // run action 43 | float minDuration, maxDuration; 44 | minDuration = 2.0f; 45 | maxDuration = 4.0f; 46 | 47 | int rangeDuration = maxDuration - minDuration; 48 | int actualDuration = (rand() % rangeDuration) + minDuration; 49 | 50 | auto actionMove = MoveTo::create(actualDuration, 51 | Point(actualX, 0 - getContentSize().height / 2)); 52 | auto actionDone = RemoveSelf::create(true); 53 | auto sequence = Sequence::create(actionMove, actionDone, nullptr); 54 | runAction(sequence); 55 | 56 | bRet = true; 57 | } while (0); 58 | 59 | return bRet; 60 | } 61 | 62 | void RoleEnemySmall::hit(Role* target) { 63 | target->gotDamage(100); 64 | } 65 | 66 | void RoleEnemySmall::gotDamage(int damage) { 67 | down(); 68 | } 69 | 70 | void RoleEnemySmall::gotSupply(int supply) { 71 | } 72 | 73 | void RoleEnemySmall::down() { 74 | CocosDenshion::SimpleAudioEngine::getInstance()->playEffect( 75 | "sound/enemy1_down.mp3"); 76 | auto animation = AnimationCache::getInstance()->getAnimation( 77 | "Enemy1Blowup"); 78 | auto animate = Animate::create(animation); 79 | auto actionDone = RemoveSelf::create(true); 80 | auto sequence = Sequence::create(animate, actionDone, nullptr); 81 | runAction(sequence); 82 | } 83 | 84 | 85 | -------------------------------------------------------------------------------- /Classes/role/RoleEnemySmall.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleEnemySmall.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEENEMYSMALL_H_ 9 | #define ROLEENEMYSMALL_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleEnemySmall: public Role, public Sprite { 14 | public: 15 | RoleEnemySmall(); 16 | virtual ~RoleEnemySmall(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleEnemySmall); 26 | }; 27 | 28 | #endif /* ROLEENEMYSMALL_H_ */ 29 | 30 | 31 | -------------------------------------------------------------------------------- /Classes/role/RoleHeroPlane.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleHeroPlane.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleHeroPlane.h" 9 | 10 | RoleHeroPlane::RoleHeroPlane() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | RoleHeroPlane::~RoleHeroPlane() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | bool RoleHeroPlane::init() { 20 | bool bRet = false; 21 | do { 22 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("hero1.png")); 23 | 24 | // set physical body 25 | auto body = PhysicsBody::createBox(getContentSize()); 26 | body->setGroup(PHYSICAL_BODY_HERO_GROUP); 27 | body->setCategoryBitmask(PHYSICAL_BODY_HERO_BITMASK_CATEGORY); 28 | body->setContactTestBitmask(PHYSICAL_BODY_HERO_BITMASK_CONTACT_TEST); 29 | body->setCollisionBitmask(PHYSICAL_BODY_HERO_BITMASK_COLLISION); 30 | setPhysicsBody(body); 31 | 32 | // set position 33 | auto winSize = Director::getInstance()->getWinSize(); 34 | setPosition(Point(winSize.width / 2, getContentSize().height / 2)); 35 | 36 | // run action 37 | auto blink = Blink::create(1, 3); 38 | auto animation = Animation::create(); 39 | animation->setDelayPerUnit(0.1f); 40 | animation->addSpriteFrame( 41 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 42 | "hero1.png")); 43 | animation->addSpriteFrame( 44 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 45 | "hero2.png")); 46 | auto animate = Animate::create(animation); 47 | 48 | runAction(blink); 49 | runAction(RepeatForever::create(animate)); 50 | 51 | bRet = true; 52 | } while (0); 53 | 54 | return bRet; 55 | } 56 | 57 | void RoleHeroPlane::hit(Role* target) { 58 | int force = 100; 59 | target->gotDamage(force); 60 | } 61 | 62 | void RoleHeroPlane::gotDamage(int damage) { 63 | // int life = 100;// TODO life and force settings will be consider after the main process is ready 64 | // if(life - damage <= 0){ 65 | // life = 0; 66 | // down(); 67 | // } 68 | down(); 69 | } 70 | 71 | void RoleHeroPlane::gotSupply(int supply) { 72 | log("hero got suppy "); 73 | } 74 | 75 | void RoleHeroPlane::down() { 76 | auto animation = Animation::create(); 77 | animation->setDelayPerUnit(0.2f); 78 | animation->addSpriteFrame( 79 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 80 | "hero_blowup_n1.png")); 81 | animation->addSpriteFrame( 82 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 83 | "hero_blowup_n2.png")); 84 | animation->addSpriteFrame( 85 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 86 | "hero_blowup_n3.png")); 87 | animation->addSpriteFrame( 88 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 89 | "hero_blowup_n4.png")); 90 | 91 | auto animate = Animate::create(animation); 92 | auto actionDone = RemoveSelf::create(true); 93 | auto sequence = Sequence::create(animate, actionDone, nullptr); 94 | stopAllActions(); 95 | runAction(sequence); 96 | } 97 | 98 | -------------------------------------------------------------------------------- /Classes/role/RoleHeroPlane.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleHeroPlane.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEHEROPLANE_H_ 9 | #define ROLEHEROPLANE_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleHeroPlane: public Role, public Sprite { 14 | public: 15 | RoleHeroPlane(); 16 | virtual ~RoleHeroPlane(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleHeroPlane); 26 | }; 27 | 28 | #endif /* ROLEHEROPLANE_H_ */ 29 | 30 | 31 | -------------------------------------------------------------------------------- /Classes/role/RoleManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleManager.h 3 | * 4 | * Created on: 2015-11-9 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLEMANAGER_H_ 9 | #define ROLEMANAGER_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | USING_NS_CC; 14 | 15 | class RoleManager: public Ref { 16 | public: 17 | RoleManager(); 18 | virtual ~RoleManager(); 19 | 20 | public: 21 | /** 22 | * start to add all role 23 | */ 24 | void startAddAll(); 25 | 26 | /* 27 | * stop to add all role 28 | */ 29 | void stopAddAll(); 30 | 31 | /** 32 | * register the layer, in which the role will be add into 33 | */ 34 | void registerLayer(Layer* layer); 35 | 36 | /** 37 | * unregister the layer 38 | */ 39 | void unRegisterLayer(Layer* layer); 40 | 41 | /** 42 | * start to add hero 43 | */ 44 | void startAddHero(); 45 | 46 | /** 47 | * stop to add hero 48 | */ 49 | void stopAddHero(); 50 | 51 | /** 52 | * start to add enemy small 53 | */ 54 | void startAddEnemySmall(); 55 | 56 | /** 57 | * stop to add enemy small 58 | */ 59 | void stopAddEnemySmall(); 60 | 61 | /** 62 | * start to add enemy middle 63 | */ 64 | void startAddEnemyMiddle(); 65 | 66 | /** 67 | * stop to add enemy middle 68 | */ 69 | void stopAddEnemyMiddle(); 70 | 71 | /** 72 | * start to add enemy big 73 | */ 74 | void startAddEnemyBig(); 75 | 76 | /** 77 | * stop to add enemy big 78 | */ 79 | void stopAddEnemyBig(); 80 | 81 | /** 82 | * start to add supply double gun 83 | */ 84 | void startAddSupplyDoubleGun(); 85 | 86 | /** 87 | * stop to add supply double gun 88 | */ 89 | void stopAddSupplyDoubleGun(); 90 | 91 | /** 92 | * start to add supply supper gun 93 | */ 94 | void startAddSupplySuperGun(); 95 | 96 | /** 97 | * stop to add supper gun 98 | */ 99 | void stopAddSupplySuperGun(); 100 | 101 | /** 102 | * start to add bullet blue 103 | */ 104 | void startAddBulletBlue(); 105 | 106 | /** 107 | * stop to add bullet blue 108 | */ 109 | void stopAddBulletBlue(); 110 | 111 | /** 112 | * start to add bullet yellow 113 | */ 114 | void startAddBulletYellow(); 115 | 116 | /** 117 | * stop to add bullet yellow 118 | */ 119 | void stopAddBulletYellow(); 120 | 121 | private: 122 | void doAddHero(float dt); 123 | 124 | void doAddEnemySmall(float dt); 125 | void doAddAddEnemyMiddle(float dt); 126 | void doAddEnemyBig(float dt); 127 | 128 | void doAddSupplyDoubleGun(float dt); 129 | void doAddSupplySuperGun(float dt); 130 | 131 | void doAddBulletBlue(float dt); 132 | void doAddBulletYellow(float dt); 133 | 134 | private: 135 | Layer* mLayer; 136 | Sprite* mHero; 137 | }; 138 | 139 | #endif /* ROLEMANAGER_H_ */ 140 | -------------------------------------------------------------------------------- /Classes/role/RoleSupplyDoubleGun.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleSupplyDoubleGun.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleSupplyDoubleGun.h" 9 | 10 | RoleSupplyDoubleGun::RoleSupplyDoubleGun() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | RoleSupplyDoubleGun::~RoleSupplyDoubleGun() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | bool RoleSupplyDoubleGun::init() { 20 | bool bRet = false; 21 | do { 22 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("ufo1.png")); 23 | 24 | // set physical body 25 | auto body = PhysicsBody::createBox(getContentSize()); 26 | body->setGroup(PHYSICAL_BODY_SUPPLY_GROUP); 27 | body->setCategoryBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_CATEGORY); 28 | body->setContactTestBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_CONTACT_TEST); 29 | body->setCollisionBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_COLLISION); 30 | setPhysicsBody(body); 31 | 32 | // set position 33 | auto bigBoomSize = getContentSize(); 34 | auto winSize = Director::getInstance()->getWinSize(); 35 | int minX = bigBoomSize.width/2; 36 | int maxX = winSize.width-bigBoomSize.width/2; 37 | int rangeX = maxX-minX; 38 | int actualX = (rand()%rangeX)+minX; 39 | setPosition(Point(actualX, winSize.height+bigBoomSize.height/2)); 40 | 41 | // run action 42 | auto move1 = MoveBy::create(0.5, Point(0, -150)); 43 | auto move2 = MoveBy::create(0.3, Point(0, 100)); 44 | auto move3 = MoveBy::create(1.0, Point(0, 0-winSize.height-bigBoomSize.height/2)); 45 | auto actionDone = RemoveSelf::create(true); 46 | auto sequence = Sequence::create(move1, move2, move3, actionDone, nullptr); 47 | runAction(sequence); 48 | 49 | bRet = true; 50 | } while (0); 51 | 52 | return bRet; 53 | } 54 | 55 | void RoleSupplyDoubleGun::hit(Role* target) { 56 | target->gotSupply(SUPPLY_SUPPER_GUN); 57 | } 58 | 59 | void RoleSupplyDoubleGun::gotDamage(int damage) { 60 | down(); 61 | } 62 | 63 | void RoleSupplyDoubleGun::gotSupply(int supply) { 64 | } 65 | 66 | void RoleSupplyDoubleGun::down() { 67 | auto actionDone = RemoveSelf::create(true); 68 | runAction(actionDone); 69 | } 70 | 71 | 72 | -------------------------------------------------------------------------------- /Classes/role/RoleSupplyDoubleGun.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleSupplyDoubleGun.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLESUPPLYDOUBLEGUN_H_ 9 | #define ROLESUPPLYDOUBLEGUN_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleSupplyDoubleGun: public Role, public Sprite { 14 | public: 15 | RoleSupplyDoubleGun(); 16 | virtual ~RoleSupplyDoubleGun(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleSupplyDoubleGun); 26 | }; 27 | 28 | #endif /* ROLESUPPLYDOUBLEGUN_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /Classes/role/RoleSupplySupperGun.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleSupplySupperGun.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "RoleSupplySupperGun.h" 9 | #include "SimpleAudioEngine.h" 10 | 11 | RoleSupplySupperGun::RoleSupplySupperGun() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | RoleSupplySupperGun::~RoleSupplySupperGun() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | 21 | bool RoleSupplySupperGun::init() { 22 | bool bRet = false; 23 | do { 24 | CC_BREAK_IF(!Sprite::initWithSpriteFrameName("ufo2.png")); 25 | 26 | // set physical body 27 | auto body = PhysicsBody::createBox(getContentSize()); 28 | body->setGroup(PHYSICAL_BODY_SUPPLY_GROUP); 29 | body->setCategoryBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_CATEGORY); 30 | body->setContactTestBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_CONTACT_TEST); 31 | body->setCollisionBitmask(PHYSICAL_BODY_SUPPLY_BITMASK_COLLISION); 32 | setPhysicsBody(body); 33 | 34 | // set position 35 | auto bigBoomSize = getContentSize(); 36 | auto winSize = Director::getInstance()->getWinSize(); 37 | int minX = bigBoomSize.width/2; 38 | int maxX = winSize.width-bigBoomSize.width/2; 39 | int rangeX = maxX-minX; 40 | int actualX = (rand()%rangeX)+minX; 41 | setPosition(Point(actualX, winSize.height+bigBoomSize.height/2)); 42 | 43 | // run action 44 | auto move1 = MoveBy::create(0.5, Point(0, -150)); 45 | auto move2 = MoveBy::create(0.3, Point(0, 100)); 46 | auto move3 = MoveBy::create(1.0, Point(0, 0-winSize.height-bigBoomSize.height/2)); 47 | auto actionDone = RemoveSelf::create(true); 48 | auto sequence = Sequence::create(move1, move2, move3, actionDone, nullptr); 49 | runAction(sequence); 50 | 51 | bRet = true; 52 | } while (0); 53 | 54 | return bRet; 55 | } 56 | 57 | void RoleSupplySupperGun::hit(Role* target) { 58 | target->gotSupply(SUPPLY_SUPPER_GUN); 59 | } 60 | 61 | void RoleSupplySupperGun::gotDamage(int damage) { 62 | down(); 63 | } 64 | 65 | void RoleSupplySupperGun::gotSupply(int supply) { 66 | } 67 | 68 | void RoleSupplySupperGun::down() { 69 | auto actionDone = RemoveSelf::create(true); 70 | runAction(actionDone); 71 | } 72 | 73 | -------------------------------------------------------------------------------- /Classes/role/RoleSupplySupperGun.h: -------------------------------------------------------------------------------- 1 | /* 2 | * RoleSupplySupperGun.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef ROLESUPPLYSUPPERGUN_H_ 9 | #define ROLESUPPLYSUPPERGUN_H_ 10 | 11 | #include "Role.h" 12 | 13 | class RoleSupplySupperGun: public Role, public Sprite { 14 | public: 15 | RoleSupplySupperGun(); 16 | virtual ~RoleSupplySupperGun(); 17 | 18 | // from Role 19 | virtual void hit(Role* target); 20 | virtual void gotDamage(int damage); 21 | virtual void gotSupply(int supply); 22 | virtual void down(); 23 | 24 | virtual bool init(); 25 | CREATE_FUNC (RoleSupplySupperGun); 26 | }; 27 | 28 | #endif /* ROLESUPPLYSUPPERGUN_H_ */ 29 | 30 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfBg.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfBg.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "LayerOfBg.h" 9 | 10 | LayerOfBg::LayerOfBg() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | LayerOfBg::~LayerOfBg() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | bool LayerOfBg::init() { 20 | bool bRet = false; 21 | do { 22 | CC_BREAK_IF(!Layer::init()); 23 | 24 | mBg1 = Sprite::createWithSpriteFrameName("background.png"); 25 | mBg1->setAnchorPoint(Point::ZERO); 26 | mBg1->setPosition(Point::ZERO); 27 | mBg1->getTexture()->setAliasTexParameters(); 28 | this->addChild(mBg1); 29 | 30 | mBg2 = Sprite::createWithSpriteFrameName("background.png"); 31 | mBg2->setAnchorPoint(Point::ZERO); 32 | mBg2->setPosition(Point(0, mBg2->getContentSize().height - 2)); 33 | mBg2->getTexture()->setAliasTexParameters(); 34 | this->addChild(mBg2); 35 | 36 | this->schedule(schedule_selector(LayerOfBg::updateBg), 0.01f); 37 | 38 | bRet = true; 39 | } while (0); 40 | 41 | return bRet; 42 | } 43 | 44 | void LayerOfBg::updateBg(float dt) { 45 | mBg1->setPositionY(int(mBg1->getPositionY()) - 2); 46 | mBg2->setPositionY( 47 | int(mBg1->getPositionY()) + int(mBg1->getContentSize().height) - 2); 48 | if (mBg2->getPositionY() == 0) { 49 | mBg1->setPositionY(0); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfBg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfBg.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef LAYEROFBG_H_ 9 | #define LAYEROFBG_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | USING_NS_CC; 14 | 15 | class LayerOfBg : public cocos2d::Layer { 16 | public: 17 | LayerOfBg(); 18 | virtual ~LayerOfBg(); 19 | 20 | virtual bool init(); 21 | CREATE_FUNC(LayerOfBg); 22 | 23 | void updateBg(float dt); 24 | 25 | private: 26 | Sprite* mBg1; 27 | Sprite* mBg2; 28 | }; 29 | 30 | #endif /* LAYEROFBG_H_ */ 31 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfControl.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfControl.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "LayerOfControl.h" 9 | #include "SimpleAudioEngine.h" 10 | 11 | LayerOfControl::LayerOfControl() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | LayerOfControl::~LayerOfControl() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | bool LayerOfControl::init() { 21 | bool bRet = false; 22 | do { 23 | CC_BREAK_IF(!Layer::init()); 24 | auto winSize = Director::getInstance()->getWinSize(); 25 | 26 | auto normalPause = Sprite::createWithSpriteFrameName( 27 | "game_pause_nor.png"); 28 | auto pressedPause = Sprite::createWithSpriteFrameName( 29 | "game_pause_pressed.png"); 30 | pPauseItem = MenuItemSprite::create(normalPause, pressedPause, 31 | CC_CALLBACK_1(LayerOfControl::menuPauseCallback, this)); 32 | pPauseItem->setPosition( 33 | Point(normalPause->getContentSize().width / 2 + 10, 34 | winSize.height 35 | - normalPause->getContentSize().height / 2 36 | - 10)); 37 | auto menuPause = Menu::create(pPauseItem, nullptr); 38 | menuPause->setPosition(Point::ZERO); 39 | this->addChild(menuPause, 101); 40 | 41 | scoreItem = Label::createWithBMFont("font/font.fnt", "0"); 42 | scoreItem->setColor(Color3B(143, 146, 147)); 43 | scoreItem->setAnchorPoint(Point::ANCHOR_MIDDLE_LEFT); 44 | scoreItem->setPosition( 45 | Point( 46 | pPauseItem->getPositionX() 47 | + normalPause->getContentSize().width / 2 + 5, 48 | pPauseItem->getPositionY())); 49 | this->addChild(scoreItem); 50 | bRet = true; 51 | } while (0); 52 | 53 | return bRet; 54 | } 55 | 56 | void LayerOfControl::menuPauseCallback(Ref* pSender) { 57 | CocosDenshion::SimpleAudioEngine::getInstance()->playEffect("sound/button.mp3"); 58 | if (!CCDirector::getInstance()->isPaused()) { 59 | pPauseItem->setNormalImage( 60 | Sprite::createWithSpriteFrameName("game_resume_nor.png")); 61 | pPauseItem->setSelectedImage( 62 | Sprite::createWithSpriteFrameName("game_resume_pressed.png")); 63 | CocosDenshion::SimpleAudioEngine::getInstance()->pauseBackgroundMusic(); 64 | CocosDenshion::SimpleAudioEngine::getInstance()->stopAllEffects(); 65 | Director::getInstance()->pause(); 66 | } else { 67 | pPauseItem->setNormalImage( 68 | Sprite::createWithSpriteFrameName("game_pause_nor.png")); 69 | pPauseItem->setSelectedImage( 70 | Sprite::createWithSpriteFrameName("game_pause_pressed.png")); 71 | CocosDenshion::SimpleAudioEngine::getInstance()->resumeBackgroundMusic(); 72 | Director::getInstance()->resume(); 73 | } 74 | } 75 | 76 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfControl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfControl.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef LAYEROFCONTROL_H_ 9 | #define LAYEROFCONTROL_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | USING_NS_CC; 14 | 15 | class LayerOfControl: public cocos2d::Layer { 16 | public: 17 | LayerOfControl(); 18 | virtual ~LayerOfControl(); 19 | 20 | virtual bool init(); 21 | CREATE_FUNC (LayerOfControl); 22 | 23 | private: 24 | void menuPauseCallback(Ref* pSender); 25 | 26 | private: 27 | Label* scoreItem; 28 | MenuItemSprite* pPauseItem; 29 | }; 30 | 31 | #endif /* LAYEROFCONTROL_H_ */ 32 | 33 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfRole.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfRole.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "LayerOfRole.h" 9 | #include "../role/Role.h" 10 | //#include "../role/RoleHeroPlane.h" 11 | //#include "../role/RoleEnemySmall.h" 12 | //#include "../role/RoleEnemyMiddle.h" 13 | //#include "../role/RoleEnemyBig.h" 14 | //#include "../role/RoleSupplySupperGun.h" 15 | //#include "../role/RoleSupplyDoubleGun.h" 16 | //#include "../role/RoleBulletBlue.h" 17 | //#include "../role/RoleBulletYellow.h" 18 | #include "../role/RoleManager.h" 19 | 20 | LayerOfRole::LayerOfRole() { 21 | mRoleManager = new (std::nothrow) RoleManager(); 22 | if (mRoleManager != nullptr) { 23 | mRoleManager->registerLayer(this); 24 | } 25 | } 26 | 27 | LayerOfRole::~LayerOfRole() { 28 | if (mRoleManager != nullptr) { 29 | mRoleManager->unRegisterLayer(this); 30 | mRoleManager->release(); 31 | mRoleManager = nullptr; 32 | } 33 | } 34 | 35 | bool LayerOfRole::init() { 36 | bool bRet = false; 37 | do { 38 | CC_BREAK_IF(!Layer::init()); 39 | 40 | registerPhysicalEventListener(); 41 | cacheAnimation(); 42 | 43 | if (mRoleManager != nullptr) { 44 | mRoleManager->startAddAll(); 45 | } 46 | //auto hero = RoleHeroPlane::create(); 47 | //addChild(hero); 48 | 49 | //auto enemySmall = RoleEnemySmall::create(); 50 | //addChild(enemySmall); 51 | 52 | //auto enemyMiddle = RoleEnemyMiddle::create(); 53 | //addChild(enemyMiddle); 54 | 55 | //auto enemyBig = RoleEnemyBig::create(); 56 | //addChild(enemyBig); 57 | 58 | //auto supplySupper = RoleSupplySupperGun::create(); 59 | //addChild(supplySupper); 60 | 61 | //auto supplyDouble = RoleSupplyDoubleGun::create(); 62 | //addChild(supplyDouble); 63 | 64 | //auto winSize = Director::getInstance()->getWinSize(); 65 | //auto bulletYellow = RoleBulletYellow::create(winSize.width / 2, 66 | // getContentSize().height / 2); 67 | //addChild(bulletYellow); 68 | // 69 | //auto bulletBlue = RoleBulletBlue::create(winSize.width / 2 + 20, 70 | // getContentSize().height / 2); 71 | //addChild(bulletBlue); 72 | 73 | bRet = true; 74 | } while (0); 75 | 76 | return bRet; 77 | } 78 | 79 | void LayerOfRole::registerPhysicalEventListener() { 80 | auto listener = EventListenerPhysicsContact::create(); 81 | listener->onContactBegin = 82 | [](PhysicsContact& contact) 83 | { 84 | Role* a = dynamic_cast(contact.getShapeA()->getBody()->getNode()); 85 | Role* b = dynamic_cast(contact.getShapeB()->getBody()->getNode()); 86 | if(a && b) { 87 | a->hit(b); 88 | b->hit(a); 89 | } 90 | 91 | return true; 92 | }; 93 | 94 | listener->onContactPreSolve = [] (PhysicsContact& contact, 95 | PhysicsContactPreSolve& solve) { 96 | return true; 97 | }; 98 | 99 | listener->onContactPostSolve = [] (PhysicsContact& contact, 100 | const PhysicsContactPostSolve& solve) { 101 | }; 102 | 103 | listener->onContactSeparate = [](PhysicsContact& contact) { 104 | }; 105 | 106 | Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority( 107 | listener, 1); 108 | } 109 | 110 | void LayerOfRole::cacheAnimation() { 111 | 112 | auto animation1 = Animation::create(); 113 | animation1->setDelayPerUnit(0.1f); 114 | animation1->addSpriteFrame( 115 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 116 | "enemy1_down1.png")); 117 | animation1->addSpriteFrame( 118 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 119 | "enemy1_down2.png")); 120 | animation1->addSpriteFrame( 121 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 122 | "enemy1_down3.png")); 123 | animation1->addSpriteFrame( 124 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 125 | "enemy1_down4.png")); 126 | 127 | auto animation2 = Animation::create(); 128 | animation2->setDelayPerUnit(0.1f); 129 | animation2->addSpriteFrame( 130 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 131 | "enemy2_down1.png")); 132 | animation2->addSpriteFrame( 133 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 134 | "enemy2_down2.png")); 135 | animation2->addSpriteFrame( 136 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 137 | "enemy2_down3.png")); 138 | animation2->addSpriteFrame( 139 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 140 | "enemy2_down4.png")); 141 | 142 | auto animation3 = Animation::create(); 143 | animation3->setDelayPerUnit(0.1f); 144 | animation3->addSpriteFrame( 145 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 146 | "enemy3_down1.png")); 147 | animation3->addSpriteFrame( 148 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 149 | "enemy3_down2.png")); 150 | animation3->addSpriteFrame( 151 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 152 | "enemy3_down3.png")); 153 | animation3->addSpriteFrame( 154 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 155 | "enemy3_down4.png")); 156 | animation3->addSpriteFrame( 157 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 158 | "enemy3_down5.png")); 159 | animation3->addSpriteFrame( 160 | SpriteFrameCache::getInstance()->getSpriteFrameByName( 161 | "enemy3_down6.png")); 162 | 163 | AnimationCache::getInstance()->addAnimation(animation1, "Enemy1Blowup"); 164 | AnimationCache::getInstance()->addAnimation(animation2, "Enemy2Blowup"); 165 | AnimationCache::getInstance()->addAnimation(animation3, "Enemy3Blowup"); 166 | 167 | } 168 | 169 | 170 | -------------------------------------------------------------------------------- /Classes/sceneGame/LayerOfRole.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerOfRole.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef LAYEROFROLE_H_ 9 | #define LAYEROFROLE_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | USING_NS_CC; 14 | 15 | class RoleManager; 16 | 17 | class LayerOfRole: public cocos2d::Layer { 18 | public: 19 | LayerOfRole(); 20 | virtual ~LayerOfRole(); 21 | 22 | virtual bool init(); 23 | CREATE_FUNC (LayerOfRole); 24 | 25 | private: 26 | void registerPhysicalEventListener(); 27 | void cacheAnimation(); 28 | 29 | RoleManager* mRoleManager; 30 | }; 31 | 32 | #endif /* LAYEROFROLE_H_ */ 33 | 34 | 35 | -------------------------------------------------------------------------------- /Classes/sceneGame/SceneGame.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneGame.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "SceneGame.h" 9 | #include "LayerOfBg.h" 10 | #include "LayerOfRole.h" 11 | #include "LayerOfControl.h" 12 | 13 | USING_NS_CC; 14 | 15 | SceneGame::SceneGame() { 16 | // TODO Auto-generated constructor stub 17 | 18 | } 19 | 20 | SceneGame::~SceneGame() { 21 | // TODO Auto-generated destructor stub 22 | } 23 | 24 | Scene* SceneGame::create() { 25 | auto scene = Scene::createWithPhysics(); 26 | 27 | scene->getPhysicsWorld()->setDebugDrawMask(PhysicsWorld::DEBUGDRAW_ALL); 28 | 29 | auto visibleSize = Director::getInstance()->getVisibleSize(); 30 | auto body = PhysicsBody::createEdgeBox(visibleSize, 31 | PHYSICSBODY_MATERIAL_DEFAULT, 5.0f); 32 | auto edgeNode = Node::create(); 33 | edgeNode->setPosition(Vec2(visibleSize.width / 2, visibleSize.height / 2)); 34 | edgeNode->setPhysicsBody(body); 35 | scene->addChild(edgeNode); 36 | Vect gravity = Vect(0.0f, 0.0f); 37 | scene->getPhysicsWorld()->setGravity(gravity); 38 | 39 | auto layerBg = LayerOfBg::create(); 40 | scene->addChild(layerBg, 10); 41 | 42 | auto layerRole = LayerOfRole::create(); 43 | scene->addChild(layerRole, 20); 44 | 45 | auto layerCtrl = LayerOfControl::create(); 46 | scene->addChild(layerCtrl, 50); 47 | 48 | return scene; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /Classes/sceneGame/SceneGame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneGame.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef SCENEGAME_H_ 9 | #define SCENEGAME_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | USING_NS_CC; 14 | 15 | class SceneGame { 16 | public: 17 | SceneGame(); 18 | virtual ~SceneGame(); 19 | 20 | static Scene* create(); 21 | }; 22 | 23 | #endif /* SCENEGAME_H_ */ 24 | -------------------------------------------------------------------------------- /Classes/sceneLoading/LayerLoading.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerLoading.cpp 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #include "LayerLoading.h" 9 | USING_NS_CC; 10 | 11 | LayerLoading::LayerLoading() { 12 | // TODO Auto-generated constructor stub 13 | 14 | } 15 | 16 | LayerLoading::~LayerLoading() { 17 | // TODO Auto-generated destructor stub 18 | } 19 | 20 | bool LayerLoading::init(){ 21 | bool bRet=false; 22 | do 23 | { 24 | CC_BREAK_IF(!Layer::init()); 25 | 26 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui/shoot_background.plist"); 27 | SpriteFrameCache::getInstance()->addSpriteFramesWithFile("ui/shoot.plist"); 28 | 29 | auto winSize = Director::getInstance()->getWinSize(); 30 | 31 | auto background = Sprite::createWithSpriteFrameName("background.png"); 32 | background->setPosition(Point(winSize.width/2,winSize.height/2)); 33 | this->addChild(background); 34 | 35 | auto copyright = Sprite::createWithSpriteFrameName("shoot_copyright.png"); 36 | copyright->setAnchorPoint(Point::ANCHOR_MIDDLE_BOTTOM); 37 | copyright->setPosition(Point(winSize.width/2,winSize.height/2)); 38 | this->addChild(copyright); 39 | 40 | auto loading = Sprite::createWithSpriteFrameName("game_loading1.png"); 41 | loading->setPosition(Point(winSize.width/2,winSize.height/2-40)); 42 | this->addChild(loading); 43 | 44 | auto animation = Animation::create(); 45 | animation->setDelayPerUnit(0.2f); 46 | animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("game_loading1.png")); 47 | animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("game_loading2.png")); 48 | animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("game_loading3.png")); 49 | animation->addSpriteFrame(SpriteFrameCache::getInstance()->getSpriteFrameByName("game_loading4.png")); 50 | 51 | auto animate = Animate::create(animation); 52 | auto repeat = RepeatForever::create(animate); 53 | loading->runAction(repeat); 54 | 55 | bRet = true; 56 | } while (0); 57 | 58 | return bRet; 59 | } 60 | -------------------------------------------------------------------------------- /Classes/sceneLoading/LayerLoading.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerLoading.h 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef LAYERLOADING_H_ 9 | #define LAYERLOADING_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | class LayerLoading : public cocos2d::Layer { 14 | public: 15 | LayerLoading(); 16 | virtual ~LayerLoading(); 17 | virtual bool init(); 18 | CREATE_FUNC(LayerLoading); 19 | }; 20 | 21 | #endif /* LAYERLOADING_H_ */ 22 | -------------------------------------------------------------------------------- /Classes/sceneLoading/SceneLoading.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneLoading.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "SceneLoading.h" 9 | #include "LayerLoading.h" 10 | #include "../sceneGame/SceneGame.h" 11 | #include "SimpleAudioEngine.h" 12 | 13 | USING_NS_CC; 14 | 15 | SceneLoading::SceneLoading() { 16 | // TODO Auto-generated constructor stub 17 | mIsMusicReady = false; 18 | } 19 | 20 | SceneLoading::~SceneLoading() { 21 | // TODO Auto-generated destructor stub 22 | } 23 | 24 | bool SceneLoading::init() { 25 | bool bRet = false; 26 | do { 27 | CC_BREAK_IF(!Scene::init()); 28 | auto layerLoading = LayerLoading::create(); 29 | CC_BREAK_IF(!layerLoading); 30 | this->addChild(layerLoading); 31 | 32 | auto preLoadAudioThread = std::thread(&SceneLoading::preloadMusic, 33 | this); 34 | preLoadAudioThread.detach(); 35 | 36 | schedule(schedule_selector(SceneLoading::checkMusicReady), 1.0f); 37 | bRet = true; 38 | } while (0); 39 | 40 | return bRet; 41 | } 42 | 43 | void SceneLoading::preloadMusic() { 44 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadBackgroundMusic( 45 | "sound/game_music.mp3"); 46 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 47 | "sound/bullet.mp3"); 48 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 49 | "sound/enemy1_down.mp3"); 50 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 51 | "sound/enemy2_down.mp3"); 52 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 53 | "sound/enemy3_down.mp3"); 54 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 55 | "sound/game_over.mp3"); 56 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 57 | "sound/get_bomb.mp3"); 58 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 59 | "sound/get_double_laser.mp3"); 60 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 61 | "sound/use_bomb.mp3"); 62 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 63 | "sound/big_spaceship_flying.mp3"); 64 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 65 | "sound/achievement.mp3"); 66 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 67 | "sound/out_porp.mp3"); 68 | CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect( 69 | "sound/button.mp3"); 70 | 71 | CocosDenshion::SimpleAudioEngine::getInstance()->playBackgroundMusic( 72 | "sound/game_music.mp3", true); 73 | 74 | // Set flag 75 | mIsMusicReady = true; 76 | } 77 | 78 | void SceneLoading::checkMusicReady(float dt) { 79 | if (mIsMusicReady) { 80 | mIsMusicReady = false;// Anti-reentrant 81 | auto sceneGame = SceneGame::create(); 82 | auto animateScene = TransitionMoveInB::create(0.5f,sceneGame); 83 | Director::getInstance()->replaceScene(animateScene); 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /Classes/sceneLoading/SceneLoading.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneLoading.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef SCENELOADING_H_ 9 | #define SCENELOADING_H_ 10 | 11 | #include "cocos2d.h" 12 | 13 | class SceneLoading : public cocos2d::Scene { 14 | public: 15 | SceneLoading(); 16 | virtual ~SceneLoading(); 17 | virtual bool init(); 18 | CREATE_FUNC(SceneLoading); 19 | 20 | private: 21 | void checkMusicReady(float dt); 22 | void preloadMusic(); 23 | 24 | bool mIsMusicReady; 25 | }; 26 | 27 | #endif /* SCENELOADING_H_ */ 28 | -------------------------------------------------------------------------------- /Classes/sceneScore/LayerScore.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerScore.cpp 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #include "LayerScore.h" 9 | 10 | LayerScore::LayerScore() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | LayerScore::~LayerScore() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/sceneScore/LayerScore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * LayerScore.h 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef LAYERSCORE_H_ 9 | #define LAYERSCORE_H_ 10 | 11 | class LayerScore { 12 | public: 13 | LayerScore(); 14 | virtual ~LayerScore(); 15 | }; 16 | 17 | #endif /* LAYERSCORE_H_ */ 18 | -------------------------------------------------------------------------------- /Classes/sceneScore/SceneScore.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneScore.cpp 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #include "SceneScore.h" 9 | 10 | SceneScore::SceneScore() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | SceneScore::~SceneScore() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/sceneScore/SceneScore.h: -------------------------------------------------------------------------------- 1 | /* 2 | * SceneScore.h 3 | * 4 | * Created on: 2015-10-28 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef SCENESCORE_H_ 9 | #define SCENESCORE_H_ 10 | 11 | class SceneScore { 12 | public: 13 | SceneScore(); 14 | virtual ~SceneScore(); 15 | }; 16 | 17 | #endif /* SCENESCORE_H_ */ 18 | -------------------------------------------------------------------------------- /Classes/score/ScoreManager.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * ScoreManager.cpp 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #include "ScoreManager.h" 9 | 10 | ScoreManager::ScoreManager() { 11 | // TODO Auto-generated constructor stub 12 | 13 | } 14 | 15 | ScoreManager::~ScoreManager() { 16 | // TODO Auto-generated destructor stub 17 | } 18 | 19 | -------------------------------------------------------------------------------- /Classes/score/ScoreManager.h: -------------------------------------------------------------------------------- 1 | /* 2 | * ScoreManager.h 3 | * 4 | * Created on: 2015-10-29 5 | * Author: hsy 6 | */ 7 | 8 | #ifndef SCOREMANAGER_H_ 9 | #define SCOREMANAGER_H_ 10 | 11 | class ScoreManager { 12 | public: 13 | ScoreManager(); 14 | virtual ~ScoreManager(); 15 | }; 16 | 17 | #endif /* SCOREMANAGER_H_ */ 18 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # AirWar 2 | ![Logo](https://github.com/cheyiliu/AirWar/blob/master/raw/icon.png) 3 | 4 | AirWar is an Open Source game based on Cocos3.x. Tense and exciting, try and see how long you can play? 5 | 6 | ## Features 7 | * Based on the latest cocos 3.8. 8 | * Use the physical engine to do the collision detection. 9 | * Use event to low coupling the codes. 10 | * More for you to explore. 11 | 12 | ## Architecture 13 | * ![Architecture](https://github.com/cheyiliu/AirWar/blob/master/raw/AirWar_Architecture.png) 14 | 15 | ## The physical settings 16 | * ![can hit](https://github.com/cheyiliu/AirWar/blob/master/raw/can_hit.png) 17 | * ![physics body](https://github.com/cheyiliu/AirWar/blob/master/raw/physics_body.png) 18 | 19 | ## The class diagram 20 | * ![class](https://github.com/cheyiliu/AirWar/blob/master/raw/class.jpg) 21 | 22 | ## Latest Downloads 23 | * **[see releases](https://github.com/cheyiliu/AirWar/releases)** 24 | 25 | ## Bugs Report 26 | If you find any bug when using AirWar, please report **[here](https://github.com/cheyiliu/AirWar/issues/new)**. Thanks for helping us building a better one. 27 | 28 | ## Developed By 29 | * cheyiliu - cheyiliu@gmail.com 30 | * blog - http://blog.csdn.net/cheyiliu 31 | * qq - 251561515 32 | 33 | ## Change logs 34 | * v0.5 all roles are ready 35 | * v0.3 the physical engine is work 36 | * v0.2 the loading scene is ready 37 | * v0.1 the blueprint is ready 38 | 39 | ### Thanks 40 | * Some code is from this [open project](https://github.com/fusijie/Airplane_3.0) 41 | 42 | ## License 43 | ``` 44 | Copyright (C) cheyiliu, AirWar Open Source Project 45 | 46 | Licensed under the Apache License, Version 2.0 (the "License"); 47 | you may not use this file except in compliance with the License. 48 | You may obtain a copy of the License at 49 | 50 | http://www.apache.org/licenses/LICENSE-2.0 51 | 52 | Unless required by applicable law or agreed to in writing, software 53 | distributed under the License is distributed on an "AS IS" BASIS, 54 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 55 | See the License for the specific language governing permissions and 56 | limitations under the License. 57 | ``` 58 | -------------------------------------------------------------------------------- /Resources/CloseNormal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/CloseNormal.png -------------------------------------------------------------------------------- /Resources/CloseSelected.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/CloseSelected.png -------------------------------------------------------------------------------- /Resources/HelloWorld.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/HelloWorld.png -------------------------------------------------------------------------------- /Resources/font/font.fnt: -------------------------------------------------------------------------------- 1 | info face="Deeko Comic Regular" size=40 bold=0 italic=0 charset="" unicode=0 stretchH=100 smooth=1 aa=1 padding=0,0,0,0 spacing=0,0 2 | common lineHeight=26 base=27 scaleW=512 scaleH=512 pages=1 packed=0 3 | page id=0 file="font.png" 4 | chars count=11 5 | char id=32 x=0 y=0 width=0 height=0 xoffset=0 yoffset=27 xadvance=12 page=0 chnl=0 6 | char id=52 x=0 y=0 width=30 height=40 xoffset=1 yoffset=-7 xadvance=30 page=0 chnl=0 7 | char id=51 x=30 y=0 width=27 height=38 xoffset=1 yoffset=-5 xadvance=27 page=0 chnl=0 8 | char id=88 x=57 y=0 width=30 height=34 xoffset=1 yoffset=-5 xadvance=30 page=0 chnl=0 9 | char id=56 x=87 y=0 width=33 height=34 xoffset=1 yoffset=-7 xadvance=34 page=0 chnl=0 10 | char id=57 x=120 y=0 width=30 height=33 xoffset=1 yoffset=-4 xadvance=30 page=0 chnl=0 11 | char id=50 x=150 y=0 width=29 height=33 xoffset=1 yoffset=-3 xadvance=30 page=0 chnl=0 12 | char id=48 x=179 y=0 width=27 height=31 xoffset=1 yoffset=-3 xadvance=28 page=0 chnl=0 13 | char id=54 x=206 y=0 width=31 height=31 xoffset=1 yoffset=0 xadvance=32 page=0 chnl=0 14 | char id=53 x=237 y=0 width=35 height=31 xoffset=1 yoffset=0 xadvance=36 page=0 chnl=0 15 | char id=49 x=272 y=0 width=6 height=31 xoffset=1 yoffset=-5 xadvance=7 page=0 chnl=0 16 | char id=55 x=278 y=0 width=33 height=30 xoffset=1 yoffset=-1 xadvance=34 page=0 chnl=0 17 | kernings count=-1 18 | -------------------------------------------------------------------------------- /Resources/font/font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/font/font.png -------------------------------------------------------------------------------- /Resources/fonts/Marker Felt.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/fonts/Marker Felt.ttf -------------------------------------------------------------------------------- /Resources/fonts/arial.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/fonts/arial.ttf -------------------------------------------------------------------------------- /Resources/fps_images-hd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/fps_images-hd.png -------------------------------------------------------------------------------- /Resources/fps_images-ipadhd.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/fps_images-ipadhd.png -------------------------------------------------------------------------------- /Resources/fps_images.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/fps_images.png -------------------------------------------------------------------------------- /Resources/res/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/res/.gitkeep -------------------------------------------------------------------------------- /Resources/sound/achievement.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/achievement.mp3 -------------------------------------------------------------------------------- /Resources/sound/big_spaceship_flying.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/big_spaceship_flying.mp3 -------------------------------------------------------------------------------- /Resources/sound/bullet.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/bullet.mp3 -------------------------------------------------------------------------------- /Resources/sound/button.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/button.mp3 -------------------------------------------------------------------------------- /Resources/sound/enemy1_down.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/enemy1_down.mp3 -------------------------------------------------------------------------------- /Resources/sound/enemy2_down.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/enemy2_down.mp3 -------------------------------------------------------------------------------- /Resources/sound/enemy3_down.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/enemy3_down.mp3 -------------------------------------------------------------------------------- /Resources/sound/game_music.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/game_music.mp3 -------------------------------------------------------------------------------- /Resources/sound/game_over.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/game_over.mp3 -------------------------------------------------------------------------------- /Resources/sound/get_bomb.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/get_bomb.mp3 -------------------------------------------------------------------------------- /Resources/sound/get_double_laser.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/get_double_laser.mp3 -------------------------------------------------------------------------------- /Resources/sound/out_porp.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/out_porp.mp3 -------------------------------------------------------------------------------- /Resources/sound/use_bomb.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/sound/use_bomb.mp3 -------------------------------------------------------------------------------- /Resources/ui/shoot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/ui/shoot.png -------------------------------------------------------------------------------- /Resources/ui/shoot_background.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | frames 6 | 7 | background.png 8 | 9 | frame 10 | {{2,856},{480,852}} 11 | offset 12 | {0,0} 13 | rotated 14 | 15 | sourceColorRect 16 | {{0,0},{480,852}} 17 | sourceSize 18 | {480,852} 19 | 20 | btn_finish.png 21 | 22 | frame 23 | {{2,1901},{140,48}} 24 | offset 25 | {0,0} 26 | rotated 27 | 28 | sourceColorRect 29 | {{5,0},{140,48}} 30 | sourceSize 31 | {150,48} 32 | 33 | game_loading1.png 34 | 35 | frame 36 | {{433,1710},{48,36}} 37 | offset 38 | {-69,0} 39 | rotated 40 | 41 | sourceColorRect 42 | {{0,1},{48,36}} 43 | sourceSize 44 | {186,38} 45 | 46 | game_loading2.png 47 | 48 | frame 49 | {{52,1901},{108,37}} 50 | offset 51 | {-35,0} 52 | rotated 53 | 54 | sourceColorRect 55 | {{4,0},{108,37}} 56 | sourceSize 57 | {186,37} 58 | 59 | game_loading3.png 60 | 61 | frame 62 | {{433,1748},{176,36}} 63 | offset 64 | {4,0} 65 | rotated 66 | 67 | sourceColorRect 68 | {{9,1},{176,36}} 69 | sourceSize 70 | {186,38} 71 | 72 | game_loading4.png 73 | 74 | frame 75 | {{484,2},{2,4}} 76 | offset 77 | {-51,-8} 78 | rotated 79 | 80 | sourceColorRect 81 | {{5,20},{2,4}} 82 | sourceSize 83 | {114,28} 84 | 85 | gameover.png 86 | 87 | frame 88 | {{2,2},{480,852}} 89 | offset 90 | {0,0} 91 | rotated 92 | 93 | sourceColorRect 94 | {{0,0},{480,852}} 95 | sourceSize 96 | {480,852} 97 | 98 | shoot_copyright.png 99 | 100 | frame 101 | {{2,1710},{429,189}} 102 | offset 103 | {-1,-15} 104 | rotated 105 | 106 | sourceColorRect 107 | {{5,33},{429,189}} 108 | sourceSize 109 | {441,225} 110 | 111 | 112 | metadata 113 | 114 | format 115 | 2 116 | realTextureFileName 117 | shoot_background.png 118 | size 119 | {512,2048} 120 | smartupdate 121 | $TexturePacker:SmartUpdate:a9ef8e0faf7f4b80e2bbef51fb847d9d$ 122 | textureFileName 123 | shoot_background.png 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /Resources/ui/shoot_background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/Resources/ui/shoot_background.png -------------------------------------------------------------------------------- /proj.android-studio/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | /.idea/workspace.xml 4 | /.idea/libraries 5 | .DS_Store 6 | /build 7 | /captures 8 | -------------------------------------------------------------------------------- /proj.android-studio/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | /jniLibs 3 | -------------------------------------------------------------------------------- /proj.android-studio/app/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 11 | 12 | 13 | 15 | 16 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /proj.android-studio/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "com.hsy.airwar" 9 | minSdkVersion 10 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | 15 | sourceSets.main { 16 | java.srcDir "src" 17 | res.srcDir "res" 18 | jniLibs.srcDir "libs" 19 | manifest.srcFile "AndroidManifest.xml" 20 | assets.srcDir "assets" 21 | } 22 | 23 | signingConfigs { 24 | 25 | release { 26 | if (project.hasProperty("RELEASE_STORE_FILE")) { 27 | storeFile file(RELEASE_STORE_FILE) 28 | storePassword RELEASE_STORE_PASSWORD 29 | keyAlias RELEASE_KEY_ALIAS 30 | keyPassword RELEASE_KEY_PASSWORD 31 | } 32 | } 33 | } 34 | 35 | buildTypes { 36 | release { 37 | minifyEnabled false 38 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 39 | if (project.hasProperty("RELEASE_STORE_FILE")) { 40 | signingConfig signingConfigs.release 41 | } 42 | } 43 | } 44 | } 45 | 46 | dependencies { 47 | compile fileTree(dir: 'libs', include: ['*.jar']) 48 | compile project(':libcocos2dx') 49 | } 50 | -------------------------------------------------------------------------------- /proj.android-studio/app/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d) 6 | $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external) 7 | $(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos) 8 | 9 | LOCAL_MODULE := cocos2dcpp_shared 10 | 11 | LOCAL_MODULE_FILENAME := libcocos2dcpp 12 | 13 | LOCAL_SRC_FILES := hellocpp/main.cpp \ 14 | ../../../Classes/AppDelegate.cpp \ 15 | ../../../Classes/HelloWorldScene.cpp 16 | 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../../Classes 18 | 19 | # _COCOS_HEADER_ANDROID_BEGIN 20 | # _COCOS_HEADER_ANDROID_END 21 | 22 | 23 | LOCAL_STATIC_LIBRARIES := cocos2dx_static 24 | 25 | # _COCOS_LIB_ANDROID_BEGIN 26 | # _COCOS_LIB_ANDROID_END 27 | 28 | include $(BUILD_SHARED_LIBRARY) 29 | 30 | $(call import-module,.) 31 | 32 | # _COCOS_LIB_IMPORT_ANDROID_BEGIN 33 | # _COCOS_LIB_IMPORT_ANDROID_END 34 | -------------------------------------------------------------------------------- /proj.android-studio/app/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | 3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char 4 | APP_LDFLAGS := -latomic 5 | 6 | 7 | ifeq ($(NDK_DEBUG),1) 8 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 9 | APP_OPTIM := debug 10 | else 11 | APP_CPPFLAGS += -DNDEBUG 12 | APP_OPTIM := release 13 | endif 14 | -------------------------------------------------------------------------------- /proj.android-studio/app/jni/hellocpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "cocos2d.h" 3 | #include "platform/android/jni/JniHelper.h" 4 | #include 5 | #include 6 | 7 | #define LOG_TAG "main" 8 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) 9 | 10 | using namespace cocos2d; 11 | 12 | void cocos_android_app_init (JNIEnv* env) { 13 | LOGD("cocos_android_app_init"); 14 | AppDelegate *pAppDelegate = new AppDelegate(); 15 | } 16 | -------------------------------------------------------------------------------- /proj.android-studio/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in E:\developSoftware\Android\SDK/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /proj.android-studio/app/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | -------------------------------------------------------------------------------- /proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android-studio/app/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android-studio/app/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android-studio/app/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android-studio/app/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /proj.android-studio/app/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | HelloCpp 3 | 4 | -------------------------------------------------------------------------------- /proj.android-studio/app/src/org/cocos2dx/cpp/AppActivity.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2015 Chukong Technologies Inc. 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | package org.cocos2dx.cpp; 25 | 26 | import org.cocos2dx.lib.Cocos2dxActivity; 27 | 28 | public class AppActivity extends Cocos2dxActivity { 29 | } 30 | -------------------------------------------------------------------------------- /proj.android-studio/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "ndk_module_path" :[ 3 | "../cocos2d", 4 | "../cocos2d/cocos", 5 | "../cocos2d/external" 6 | ], 7 | "copy_resources": [ 8 | { 9 | "from": "../Resources", 10 | "to": "" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /proj.android-studio/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.0' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /proj.android-studio/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true -------------------------------------------------------------------------------- /proj.android-studio/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android-studio/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /proj.android-studio/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Fri Jul 31 20:40:49 CST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /proj.android-studio/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /proj.android-studio/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /proj.android-studio/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':libcocos2dx' 2 | project(':libcocos2dx').projectDir = new File(settingsDir, '../cocos2d/cocos/platform/android/libcocos2dx') 3 | include ':AirWar' 4 | project(':AirWar').projectDir = new File(settingsDir, 'app') 5 | -------------------------------------------------------------------------------- /proj.android/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /proj.android/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /proj.android/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AirWar 4 | 5 | 6 | libcocos2dx 7 | 8 | 9 | 10 | com.android.ide.eclipse.adt.ResourceManagerBuilder 11 | 12 | 13 | 14 | 15 | com.android.ide.eclipse.adt.PreCompilerBuilder 16 | 17 | 18 | 19 | 20 | org.eclipse.jdt.core.javabuilder 21 | 22 | 23 | 24 | 25 | org.eclipse.ui.externaltools.ExternalToolBuilder 26 | full,incremental, 27 | 28 | 29 | LaunchConfigHandle 30 | <project>/.externalToolBuilders/org.eclipse.cdt.managedbuilder.core.genmakebuilder.launch 31 | 32 | 33 | 34 | 35 | com.android.ide.eclipse.adt.ApkBuilder 36 | 37 | 38 | 39 | 40 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 41 | full,incremental, 42 | 43 | 44 | 45 | 46 | 47 | com.android.ide.eclipse.adt.AndroidNature 48 | org.eclipse.jdt.core.javanature 49 | org.eclipse.cdt.core.cnature 50 | org.eclipse.cdt.core.ccnature 51 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 52 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 53 | 54 | 55 | 56 | Classes 57 | 2 58 | $%7BPARENT-1-PROJECT_LOC%7D/Classes 59 | 60 | 61 | cocos2d 62 | 2 63 | $%7BPARENT-1-PROJECT_LOC%7D/cocos2d 64 | 65 | 66 | libcocos2d 67 | 2 68 | PARENT-1-PROJECT_LOC/cocos2d/cocos/platform/android/java/src 69 | 70 | 71 | 72 | -------------------------------------------------------------------------------- /proj.android/.settings/org.eclipse.cdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | environment/project/0.1230402123/append=true 3 | environment/project/0.1230402123/appendContributed=true 4 | -------------------------------------------------------------------------------- /proj.android/.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /proj.android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | 10 | 11 | 13 | 14 | 15 | 17 | 18 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /proj.android/ant.properties: -------------------------------------------------------------------------------- 1 | # This file is used to override default values used by the Ant build system. 2 | # 3 | # This file must be checked into Version Control Systems, as it is 4 | # integral to the build system of your project. 5 | 6 | # This file is only used by the Ant script. 7 | 8 | # You can use this to override default values such as 9 | # 'source.dir' for the location of your java source folder and 10 | # 'out.dir' for the location of your output folder. 11 | 12 | # You can also use it define how the release builds are signed by declaring 13 | # the following properties: 14 | # 'key.store' for the location of your keystore and 15 | # 'key.alias' for the name of the key to use. 16 | # The password will be asked during the build when you use the 'release' target. 17 | 18 | -------------------------------------------------------------------------------- /proj.android/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "ndk_module_path" :[ 3 | "../cocos2d", 4 | "../cocos2d/cocos", 5 | "../cocos2d/external" 6 | ], 7 | "copy_resources": [ 8 | { 9 | "from": "../Resources", 10 | "to": "" 11 | } 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /proj.android/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | 29 | 30 | 31 | 40 | 41 | 42 | 43 | 47 | 48 | 60 | 61 | 62 | 80 | 81 | 82 | 83 | 84 | -------------------------------------------------------------------------------- /proj.android/build_native.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | # build_native.py 3 | # Build native codes 4 | # 5 | # Please use cocos console instead 6 | 7 | 8 | import sys 9 | import os, os.path 10 | import shutil 11 | from optparse import OptionParser 12 | 13 | def build(build_mode): 14 | 15 | 16 | current_dir = os.path.dirname(os.path.realpath(__file__)) 17 | cocos_root = os.path.join(current_dir, "../cocos2d") 18 | 19 | app_android_root = os.path.join(current_dir, "../") 20 | 21 | if build_mode is None: 22 | build_mode = 'debug' 23 | elif build_mode != 'release': 24 | build_mode = 'debug' 25 | 26 | command = 'cocos compile -p android -s %s -m %s' % (app_android_root, build_mode) 27 | if os.system(command) != 0: 28 | raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!") 29 | 30 | # -------------- main -------------- 31 | if __name__ == '__main__': 32 | 33 | parser = OptionParser() 34 | parser.add_option("-n", "--ndk", dest="ndk_build_param", help='it is not used', action="append") 35 | parser.add_option("-p", "--platform", dest="android_platform", 36 | help='it is not used') 37 | parser.add_option("-b", "--build", dest="build_mode", 38 | help='the build mode for java project,debug[default] or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html') 39 | (opts, args) = parser.parse_args() 40 | 41 | print "Please use cocos console instead.\n" 42 | 43 | build(opts.build_mode) 44 | -------------------------------------------------------------------------------- /proj.android/jni/Android.mk: -------------------------------------------------------------------------------- 1 | LOCAL_PATH := $(call my-dir) 2 | 3 | include $(CLEAR_VARS) 4 | 5 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d) 6 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/external) 7 | $(call import-add-path,$(LOCAL_PATH)/../../cocos2d/cocos) 8 | 9 | LOCAL_MODULE := cocos2dcpp_shared 10 | 11 | LOCAL_MODULE_FILENAME := libcocos2dcpp 12 | 13 | LOCAL_SRC_FILES := hellocpp/main.cpp \ 14 | ../../Classes/AppDelegate.cpp \ 15 | ../../Classes/HelloWorldScene.cpp 16 | 17 | LOCAL_C_INCLUDES := $(LOCAL_PATH)/../../Classes 18 | 19 | # _COCOS_HEADER_ANDROID_BEGIN 20 | # _COCOS_HEADER_ANDROID_END 21 | 22 | 23 | LOCAL_STATIC_LIBRARIES := cocos2dx_static 24 | 25 | # _COCOS_LIB_ANDROID_BEGIN 26 | # _COCOS_LIB_ANDROID_END 27 | 28 | include $(BUILD_SHARED_LIBRARY) 29 | 30 | $(call import-module,.) 31 | 32 | # _COCOS_LIB_IMPORT_ANDROID_BEGIN 33 | # _COCOS_LIB_IMPORT_ANDROID_END 34 | -------------------------------------------------------------------------------- /proj.android/jni/Application.mk: -------------------------------------------------------------------------------- 1 | APP_STL := gnustl_static 2 | 3 | APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char 4 | APP_LDFLAGS := -latomic 5 | 6 | 7 | ifeq ($(NDK_DEBUG),1) 8 | APP_CPPFLAGS += -DCOCOS2D_DEBUG=1 9 | APP_OPTIM := debug 10 | else 11 | APP_CPPFLAGS += -DNDEBUG 12 | APP_OPTIM := release 13 | endif 14 | -------------------------------------------------------------------------------- /proj.android/jni/hellocpp/main.cpp: -------------------------------------------------------------------------------- 1 | #include "AppDelegate.h" 2 | #include "cocos2d.h" 3 | #include "platform/android/jni/JniHelper.h" 4 | #include 5 | #include 6 | 7 | #define LOG_TAG "main" 8 | #define LOGD(...) __android_log_print(ANDROID_LOG_DEBUG,LOG_TAG,__VA_ARGS__) 9 | 10 | using namespace cocos2d; 11 | 12 | void cocos_android_app_init (JNIEnv* env) { 13 | LOGD("cocos_android_app_init"); 14 | AppDelegate *pAppDelegate = new AppDelegate(); 15 | } 16 | -------------------------------------------------------------------------------- /proj.android/proguard-project.txt: -------------------------------------------------------------------------------- 1 | # To enable ProGuard in your project, edit project.properties 2 | # to define the proguard.config property as described in that file. 3 | # 4 | # Add project specific ProGuard rules here. 5 | # By default, the flags in this file are appended to flags specified 6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt 7 | # You can edit the include path and order by changing the ProGuard 8 | # include property in project.properties. 9 | # 10 | # For more details, see 11 | # http://developer.android.com/guide/developing/tools/proguard.html 12 | 13 | # Add any project specific keep options here: 14 | 15 | # If your project uses WebView with JS, uncomment the following 16 | # and specify the fully qualified class name to the JavaScript interface 17 | # class: 18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 19 | # public *; 20 | #} 21 | -------------------------------------------------------------------------------- /proj.android/project.properties: -------------------------------------------------------------------------------- 1 | # This file is automatically generated by Android Tools. 2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED! 3 | # 4 | # This file must be checked in Version Control Systems. 5 | # 6 | # To customize properties used by the Ant build system use, 7 | # "ant.properties", and override values to adapt the script to your 8 | # project structure. 9 | 10 | # Project target. 11 | target=android-10 12 | 13 | android.library.reference.1=../cocos2d/cocos/platform/android/java 14 | -------------------------------------------------------------------------------- /proj.android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /proj.android/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | AirWar 4 | 5 | -------------------------------------------------------------------------------- /proj.android/src/org/cocos2dx/cpp/AppActivity.java: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2008-2010 Ricardo Quesada 3 | Copyright (c) 2010-2012 cocos2d-x.org 4 | Copyright (c) 2011 Zynga Inc. 5 | Copyright (c) 2013-2014 Chukong Technologies Inc. 6 | 7 | http://www.cocos2d-x.org 8 | 9 | Permission is hereby granted, free of charge, to any person obtaining a copy 10 | of this software and associated documentation files (the "Software"), to deal 11 | in the Software without restriction, including without limitation the rights 12 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 | copies of the Software, and to permit persons to whom the Software is 14 | furnished to do so, subject to the following conditions: 15 | 16 | The above copyright notice and this permission notice shall be included in 17 | all copies or substantial portions of the Software. 18 | 19 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 | THE SOFTWARE. 26 | ****************************************************************************/ 27 | package org.cocos2dx.cpp; 28 | 29 | import org.cocos2dx.lib.Cocos2dxActivity; 30 | 31 | public class AppActivity extends Cocos2dxActivity { 32 | } 33 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/AppController.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @class RootViewController; 4 | 5 | @interface AppController : NSObject { 6 | UIWindow *window; 7 | } 8 | 9 | @property(nonatomic, readonly) RootViewController* viewController; 10 | 11 | @end 12 | 13 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-568h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Default-568h@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-667h@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Default-667h@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default-736h@3x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Default-736h@3x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Default.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Default@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Default@2x.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-100.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-114.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-114.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-120.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-144.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-144.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-152.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-152.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-29.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-29.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-40.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-40.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-50.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-57.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-57.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-58.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-58.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-72.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-72.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-76.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Icon-80.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/ios/Icon-80.png -------------------------------------------------------------------------------- /proj.ios_mac/ios/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIconFile 12 | Icon-57.png 13 | CFBundleIconFiles 14 | 15 | Icon-29 16 | Icon-80 17 | Icon-58 18 | Icon-120 19 | Icon.png 20 | Icon@2x.png 21 | Icon-57.png 22 | Icon-114.png 23 | Icon-72.png 24 | Icon-144.png 25 | 26 | CFBundleIconFiles~ipad 27 | 28 | Icon-29 29 | Icon-50 30 | Icon-58 31 | Icon-80 32 | Icon-40 33 | Icon-100 34 | Icon-152 35 | Icon-76 36 | Icon-120 37 | Icon.png 38 | Icon@2x.png 39 | Icon-57.png 40 | Icon-114.png 41 | Icon-72.png 42 | Icon-144.png 43 | 44 | CFBundleIdentifier 45 | com.hsy.airwar 46 | CFBundleInfoDictionaryVersion 47 | 6.0 48 | CFBundleName 49 | ${PRODUCT_NAME} 50 | CFBundlePackageType 51 | APPL 52 | CFBundleShortVersionString 53 | 54 | CFBundleSignature 55 | ???? 56 | CFBundleVersion 57 | 1.0 58 | UILaunchImages 59 | 60 | 61 | UILaunchImageMinimumOSVersion 62 | 8.0 63 | UILaunchImageName 64 | Default 65 | UILaunchImageOrientation 66 | Portrait 67 | UILaunchImageSize 68 | {320, 480} 69 | 70 | 71 | UILaunchImageMinimumOSVersion 72 | 8.0 73 | UILaunchImageName 74 | Default 75 | UILaunchImageOrientation 76 | Landscape 77 | UILaunchImageSize 78 | {320, 480} 79 | 80 | 81 | UILaunchImageMinimumOSVersion 82 | 8.0 83 | UILaunchImageName 84 | Default-568h 85 | UILaunchImageOrientation 86 | Portrait 87 | UILaunchImageSize 88 | {320, 568} 89 | 90 | 91 | UILaunchImageMinimumOSVersion 92 | 8.0 93 | UILaunchImageName 94 | Default-568h 95 | UILaunchImageOrientation 96 | Landscape 97 | UILaunchImageSize 98 | {320, 568} 99 | 100 | 101 | UILaunchImageMinimumOSVersion 102 | 8.0 103 | UILaunchImageName 104 | Default-667h 105 | UILaunchImageOrientation 106 | Portrait 107 | UILaunchImageSize 108 | {375, 667} 109 | 110 | 111 | UILaunchImageMinimumOSVersion 112 | 8.0 113 | UILaunchImageName 114 | Default-667h 115 | UILaunchImageOrientation 116 | Landscape 117 | UILaunchImageSize 118 | {375, 667} 119 | 120 | 121 | UILaunchImageMinimumOSVersion 122 | 8.0 123 | UILaunchImageName 124 | Default-736h 125 | UILaunchImageOrientation 126 | Portrait 127 | UILaunchImageSize 128 | {414, 736} 129 | 130 | 131 | UILaunchImageMinimumOSVersion 132 | 8.0 133 | UILaunchImageName 134 | Default-736h 135 | UILaunchImageOrientation 136 | Landscape 137 | UILaunchImageSize 138 | {414, 736} 139 | 140 | 141 | LSRequiresIPhoneOS 142 | 143 | UIAppFonts 144 | 145 | UIPrerenderedIcon 146 | 147 | UISupportedInterfaceOrientations 148 | 149 | UIInterfaceOrientationLandscapeRight 150 | UIInterfaceOrientationLandscapeLeft 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/RootViewController.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2013 cocos2d-x.org 3 | Copyright (c) 2013-2014 Chukong Technologies Inc. 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | #import 27 | 28 | 29 | @interface RootViewController : UIViewController { 30 | 31 | } 32 | - (BOOL) prefersStatusBarHidden; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/RootViewController.mm: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2013 cocos2d-x.org 3 | Copyright (c) 2013-2014 Chukong Technologies Inc. 4 | 5 | http://www.cocos2d-x.org 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy 8 | of this software and associated documentation files (the "Software"), to deal 9 | in the Software without restriction, including without limitation the rights 10 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 11 | copies of the Software, and to permit persons to whom the Software is 12 | furnished to do so, subject to the following conditions: 13 | 14 | The above copyright notice and this permission notice shall be included in 15 | all copies or substantial portions of the Software. 16 | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 20 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 21 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 23 | THE SOFTWARE. 24 | ****************************************************************************/ 25 | 26 | #import "RootViewController.h" 27 | #import "cocos2d.h" 28 | #import "platform/ios/CCEAGLView-ios.h" 29 | 30 | @implementation RootViewController 31 | 32 | /* 33 | // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. 34 | - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { 35 | if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { 36 | // Custom initialization 37 | } 38 | return self; 39 | } 40 | */ 41 | 42 | /* 43 | // Implement loadView to create a view hierarchy programmatically, without using a nib. 44 | - (void)loadView { 45 | } 46 | */ 47 | 48 | /* 49 | // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. 50 | - (void)viewDidLoad { 51 | [super viewDidLoad]; 52 | } 53 | 54 | */ 55 | // Override to allow orientations other than the default portrait orientation. 56 | // This method is deprecated on ios6 57 | - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { 58 | return UIInterfaceOrientationIsLandscape( interfaceOrientation ); 59 | } 60 | 61 | // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead 62 | - (NSUInteger) supportedInterfaceOrientations{ 63 | #ifdef __IPHONE_6_0 64 | return UIInterfaceOrientationMaskAllButUpsideDown; 65 | #endif 66 | } 67 | 68 | - (BOOL) shouldAutorotate { 69 | return YES; 70 | } 71 | 72 | - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { 73 | [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; 74 | 75 | auto glview = cocos2d::Director::getInstance()->getOpenGLView(); 76 | 77 | if (glview) 78 | { 79 | CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView(); 80 | 81 | if (eaglview) 82 | { 83 | CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]); 84 | cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height); 85 | } 86 | } 87 | } 88 | 89 | //fix not hide status on ios7 90 | - (BOOL)prefersStatusBarHidden 91 | { 92 | return YES; 93 | } 94 | 95 | - (void)didReceiveMemoryWarning { 96 | // Releases the view if it doesn't have a superview. 97 | [super didReceiveMemoryWarning]; 98 | 99 | // Release any cached data, images, etc that aren't in use. 100 | } 101 | 102 | - (void)viewDidUnload { 103 | [super viewDidUnload]; 104 | // Release any retained subviews of the main view. 105 | // e.g. self.myOutlet = nil; 106 | } 107 | 108 | 109 | - (void)dealloc { 110 | [super dealloc]; 111 | } 112 | 113 | 114 | @end 115 | -------------------------------------------------------------------------------- /proj.ios_mac/ios/main.m: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | int main(int argc, char *argv[]) { 4 | 5 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 6 | int retVal = UIApplicationMain(argc, argv, nil, @"AppController"); 7 | [pool release]; 8 | return retVal; 9 | } 10 | -------------------------------------------------------------------------------- /proj.ios_mac/mac/Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.ios_mac/mac/Icon.icns -------------------------------------------------------------------------------- /proj.ios_mac/mac/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | Icon 11 | CFBundleIdentifier 12 | com.hsy.airwar 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSApplicationCategoryType 26 | public.app-category.games 27 | LSMinimumSystemVersion 28 | ${MACOSX_DEPLOYMENT_TARGET} 29 | NSHumanReadableCopyright 30 | Copyright © 2013. All rights reserved. 31 | NSMainNibFile 32 | MainMenu 33 | NSPrincipalClass 34 | NSApplication 35 | 36 | 37 | -------------------------------------------------------------------------------- /proj.ios_mac/mac/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | Copyright (c) 2010 cocos2d-x.org 3 | 4 | http://www.cocos2d-x.org 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in 14 | all copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 22 | THE SOFTWARE. 23 | ****************************************************************************/ 24 | 25 | #include "AppDelegate.h" 26 | #include "cocos2d.h" 27 | 28 | USING_NS_CC; 29 | 30 | int main(int argc, char *argv[]) 31 | { 32 | AppDelegate app; 33 | return Application::getInstance()->run(); 34 | } 35 | -------------------------------------------------------------------------------- /proj.linux/main.cpp: -------------------------------------------------------------------------------- 1 | #include "../Classes/AppDelegate.h" 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | USING_NS_CC; 9 | 10 | int main(int argc, char **argv) 11 | { 12 | // create the application instance 13 | AppDelegate app; 14 | return Application::getInstance()->run(); 15 | } 16 | -------------------------------------------------------------------------------- /proj.win10/App/AirWar.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 187d3e60-961a-41ee-bc18-c510a431d22e 6 | 7 | 8 | f8868b9a-1bec-48df-b4b6-294815dc7a5d 9 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 10 | 11 | 12 | {6b9ca606-5a38-4479-a7ec-01bdfeda67bc} 13 | 14 | 15 | {a18967bc-4fa1-4c67-bf7e-3f9c8b6a1129} 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | Cocos2dEngine 25 | 26 | 27 | Cocos2dEngine 28 | 29 | 30 | 31 | 32 | Classes 33 | 34 | 35 | Classes 36 | 37 | 38 | 39 | 40 | 41 | Cocos2dEngine 42 | 43 | 44 | Cocos2dEngine 45 | 46 | 47 | 48 | 49 | Classes 50 | 51 | 52 | Classes 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | Cocos2dEngine 72 | 73 | 74 | 75 | 76 | Assets 77 | 78 | 79 | Assets 80 | 81 | 82 | Assets 83 | 84 | 85 | Assets 86 | 87 | 88 | Assets 89 | 90 | 91 | Assets 92 | 93 | 94 | Assets 95 | 96 | 97 | -------------------------------------------------------------------------------- /proj.win10/App/AirWar_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/AirWar_TemporaryKey.pfx -------------------------------------------------------------------------------- /proj.win10/App/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | HelloCpp 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /proj.win10/App/App.xaml.cpp: -------------------------------------------------------------------------------- 1 | #include "App.xaml.h" 2 | #include "OpenGLESPage.xaml.h" 3 | 4 | using namespace Platform; 5 | using namespace Windows::ApplicationModel; 6 | using namespace Windows::ApplicationModel::Activation; 7 | using namespace Windows::Foundation; 8 | using namespace Windows::Foundation::Collections; 9 | using namespace Windows::UI::Xaml::Media::Animation; 10 | using namespace Windows::UI::Xaml; 11 | using namespace Windows::UI::Xaml::Controls; 12 | using namespace Windows::UI::Xaml::Controls::Primitives; 13 | using namespace Windows::UI::Xaml::Data; 14 | using namespace Windows::UI::Xaml::Input; 15 | using namespace Windows::UI::Xaml::Interop; 16 | using namespace Windows::UI::Xaml::Media; 17 | using namespace Windows::UI::Xaml::Navigation; 18 | using namespace cocos2d; 19 | using namespace CocosAppWinRT; 20 | 21 | App::App() 22 | { 23 | InitializeComponent(); 24 | Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); 25 | Resuming += ref new EventHandler(this, &App::OnResuming); 26 | } 27 | 28 | void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) 29 | { 30 | if (mPage == nullptr) 31 | { 32 | mPage = ref new OpenGLESPage(&mOpenGLES); 33 | } 34 | 35 | // Place the page in the current window and ensure that it is active. 36 | Windows::UI::Xaml::Window::Current->Content = mPage; 37 | Windows::UI::Xaml::Window::Current->Activate(); 38 | } 39 | 40 | /// 41 | /// Invoked when application execution is being suspended. Application state is saved 42 | /// without knowing whether the application will be terminated or resumed with the contents 43 | /// of memory still intact. 44 | /// 45 | void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) 46 | { 47 | (void)sender; // Unused parameter 48 | (void)e; // Unused parameter 49 | 50 | mPage->SetVisibility(false); 51 | } 52 | 53 | /// 54 | /// Invoked when application execution is being resumed. 55 | /// 56 | /// The source of the resume request. 57 | /// Details about the resume request. 58 | void App::OnResuming(Object ^sender, Object ^args) 59 | { 60 | (void)sender; // Unused parameter 61 | (void)args; // Unused parameter 62 | 63 | mPage->SetVisibility(true); 64 | } 65 | 66 | -------------------------------------------------------------------------------- /proj.win10/App/App.xaml.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "app.g.h" 4 | #include "OpenGLES.h" 5 | #include "openglespage.xaml.h" 6 | 7 | namespace CocosAppWinRT 8 | { 9 | ref class App sealed 10 | { 11 | public: 12 | App(); 13 | virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; 14 | 15 | private: 16 | void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); 17 | void OnResuming(Platform::Object ^sender, Platform::Object ^args); 18 | 19 | OpenGLESPage^ mPage; 20 | OpenGLES mOpenGLES; 21 | }; 22 | } 23 | -------------------------------------------------------------------------------- /proj.win10/App/Assets/LockScreenLogo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/LockScreenLogo.scale-200.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/SplashScreen.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/SplashScreen.scale-200.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/Square150x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/Square150x150Logo.scale-200.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/Square44x44Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/Square44x44Logo.scale-200.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/Square44x44Logo.targetsize-24_altform-unplated.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/Square44x44Logo.targetsize-24_altform-unplated.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/StoreLogo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/StoreLogo.png -------------------------------------------------------------------------------- /proj.win10/App/Assets/Wide310x150Logo.scale-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win10/App/Assets/Wide310x150Logo.scale-200.png -------------------------------------------------------------------------------- /proj.win10/App/Cocos2dEngine/Cocos2dRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #include "Cocos2dRenderer.h" 20 | #include "AppDelegate.h" 21 | #include "CCGLViewImpl-winrt.h" 22 | #include "CCApplication.h" 23 | #include "cocos2d.h" 24 | #include "renderer/CCTextureCache.h" 25 | 26 | // These are used by the shader compilation methods. 27 | #include 28 | #include 29 | #include 30 | 31 | using namespace Platform; 32 | using namespace Windows::UI::Core; 33 | using namespace Windows::UI::Xaml::Controls; 34 | using namespace Windows::Graphics::Display; 35 | using namespace cocos2d; 36 | 37 | Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, DisplayOrientations orientation, CoreDispatcher^ dispatcher, Panel^ panel) 38 | : m_app(nullptr) 39 | , m_width(width) 40 | , m_height(height) 41 | , m_dpi(dpi) 42 | , m_dispatcher(dispatcher) 43 | , m_panel(panel) 44 | , m_orientation(orientation) 45 | { 46 | m_app = new AppDelegate(); 47 | } 48 | 49 | Cocos2dRenderer::~Cocos2dRenderer() 50 | { 51 | delete m_app; 52 | } 53 | 54 | void Cocos2dRenderer::Resume() 55 | { 56 | auto director = cocos2d::Director::getInstance(); 57 | auto glview = director->getOpenGLView(); 58 | 59 | if (!glview) 60 | { 61 | GLViewImpl* glview = GLViewImpl::create("Test Cpp"); 62 | glview->setDispatcher(m_dispatcher.Get()); 63 | glview->setPanel(m_panel.Get()); 64 | glview->Create(static_cast(m_width), static_cast(m_height), m_dpi, m_orientation); 65 | director->setOpenGLView(glview); 66 | CCApplication::getInstance()->run(); 67 | } 68 | else 69 | { 70 | Application::getInstance()->applicationWillEnterForeground(); 71 | cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); 72 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); 73 | } 74 | } 75 | 76 | void Cocos2dRenderer::Pause() 77 | { 78 | if (Director::getInstance()->getOpenGLView()) { 79 | Application::getInstance()->applicationDidEnterBackground(); 80 | cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); 81 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent); 82 | } 83 | } 84 | 85 | bool Cocos2dRenderer::AppShouldExit() 86 | { 87 | return GLViewImpl::sharedOpenGLView()->AppShouldExit(); 88 | } 89 | 90 | void Cocos2dRenderer::DeviceLost() 91 | { 92 | Pause(); 93 | 94 | auto director = cocos2d::Director::getInstance(); 95 | if (director->getOpenGLView()) { 96 | cocos2d::GL::invalidateStateCache(); 97 | cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms(); 98 | cocos2d::DrawPrimitives::init(); 99 | cocos2d::VolatileTextureMgr::reloadAllTextures(); 100 | 101 | cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED); 102 | director->getEventDispatcher()->dispatchEvent(&recreatedEvent); 103 | director->setGLDefaultValues(); 104 | 105 | Application::getInstance()->applicationWillEnterForeground(); 106 | cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); 107 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); 108 | } 109 | } 110 | 111 | 112 | 113 | void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi, DisplayOrientations orientation) 114 | { 115 | auto glView = GLViewImpl::sharedOpenGLView(); 116 | 117 | if (orientation != m_orientation) 118 | { 119 | m_orientation = orientation; 120 | glView->UpdateOrientation(orientation); 121 | } 122 | 123 | if (width != m_width || height != m_height) 124 | { 125 | m_width = width; 126 | m_height = height; 127 | glView->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); 128 | } 129 | 130 | if (dpi != m_dpi) 131 | { 132 | m_dpi = dpi; 133 | glView->SetDPI(m_dpi); 134 | } 135 | 136 | glView->ProcessEvents(); 137 | glView->Render(); 138 | } 139 | 140 | void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) 141 | { 142 | GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); 143 | } 144 | 145 | void Cocos2dRenderer::QueueBackButtonEvent() 146 | { 147 | GLViewImpl::sharedOpenGLView()->QueueBackKeyPress(); 148 | } 149 | 150 | void Cocos2dRenderer::QueueKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args) 151 | { 152 | GLViewImpl::sharedOpenGLView()->QueueWinRTKeyboardEvent(type, args); 153 | } 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /proj.win10/App/Cocos2dEngine/Cocos2dRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | #pragma once 19 | 20 | #include 21 | 22 | #include "cocos2d.h" 23 | 24 | 25 | class AppDelegate; 26 | 27 | class Cocos2dRenderer 28 | { 29 | public: 30 | Cocos2dRenderer(int width, int height, float dpi, 31 | Windows::Graphics::Display::DisplayOrientations orientation, 32 | Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); 33 | ~Cocos2dRenderer(); 34 | void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); 35 | void QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); 36 | void QueueKeyboardEvent(cocos2d::WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); 37 | void QueueBackButtonEvent(); 38 | void Pause(); 39 | void Resume(); 40 | void DeviceLost(); 41 | bool AppShouldExit(); 42 | 43 | private: 44 | 45 | int m_width; 46 | int m_height; 47 | float m_dpi; 48 | 49 | // The AppDelegate for the Cocos2D app 50 | AppDelegate* m_app; 51 | Platform::Agile m_dispatcher; 52 | Platform::Agile m_panel; 53 | Windows::Graphics::Display::DisplayOrientations m_orientation; 54 | }; 55 | -------------------------------------------------------------------------------- /proj.win10/App/Cocos2dEngine/OpenGLES.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | // OpenGL ES includes 22 | #include 23 | #include 24 | 25 | // EGL includes 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class OpenGLES 32 | { 33 | public: 34 | OpenGLES(); 35 | ~OpenGLES(); 36 | 37 | EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize); 38 | void DestroySurface(const EGLSurface surface); 39 | void MakeCurrent(const EGLSurface surface); 40 | EGLBoolean SwapBuffers(const EGLSurface surface); 41 | void Reset(); 42 | void Cleanup(); 43 | 44 | private: 45 | void Initialize(); 46 | 47 | private: 48 | EGLDisplay mEglDisplay; 49 | EGLContext mEglContext; 50 | EGLConfig mEglConfig; 51 | }; 52 | -------------------------------------------------------------------------------- /proj.win10/App/Cocos2dEngine/OpenGLESPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /proj.win10/App/Cocos2dEngine/OpenGLESPage.xaml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "OpenGLES.h" 22 | #include "OpenGLESPage.g.h" 23 | #include 24 | #include 25 | #include 26 | 27 | #include "Cocos2dRenderer.h" 28 | 29 | namespace CocosAppWinRT 30 | { 31 | public ref class OpenGLESPage sealed 32 | { 33 | public: 34 | OpenGLESPage(); 35 | virtual ~OpenGLESPage(); 36 | void SetVisibility(bool isVisible); 37 | 38 | internal: 39 | OpenGLESPage(OpenGLES* openGLES); 40 | 41 | private: 42 | void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 43 | void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); 44 | void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); 45 | #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 46 | void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); 47 | #endif 48 | void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); 49 | void CreateRenderSurface(); 50 | void DestroyRenderSurface(); 51 | void RecoverFromLostDevice(); 52 | void TerminateApp(); 53 | void StartRenderLoop(); 54 | void StopRenderLoop(); 55 | 56 | OpenGLES* mOpenGLES; 57 | std::shared_ptr mRenderer; 58 | 59 | Windows::Foundation::Size mSwapChainPanelSize; 60 | Concurrency::critical_section mSwapChainPanelSizeCriticalSection; 61 | 62 | Windows::Foundation::Size mCustomRenderSurfaceSize; 63 | bool mUseCustomRenderSurfaceSize; 64 | 65 | EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page 66 | Concurrency::critical_section mRenderSurfaceCriticalSection; 67 | Windows::Foundation::IAsyncAction^ mRenderLoopWorker; 68 | 69 | // Track user input on a background worker thread. 70 | Windows::Foundation::IAsyncAction^ mInputLoopWorker; 71 | Windows::UI::Core::CoreIndependentInputSource^ mCoreInput; 72 | 73 | // Independent input handling functions. 74 | void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 75 | void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 76 | void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 77 | void OnKeyPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); 78 | void OnKeyReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); 79 | void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); 80 | 81 | void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); 82 | 83 | float mDpi; 84 | bool mDeviceLost; 85 | bool mVisible; 86 | Windows::Graphics::Display::DisplayOrientations mOrientation; 87 | 88 | std::mutex mSleepMutex; 89 | std::condition_variable mSleepCondition; 90 | }; 91 | } 92 | -------------------------------------------------------------------------------- /proj.win10/App/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AirWar 7 | "Microsoft Open Technologies, Inc." 8 | Assets\StoreLogo.png 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /proj.win10/App/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /proj.win10/App/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "cocos2d.h" 12 | #include "cocos-ext.h" 13 | 14 | 15 | -------------------------------------------------------------------------------- /proj.win10/App/resources.props: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | <_CustomResource Include="..\..\Resources\**\*"> 7 | Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) 8 | true 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /proj.win32/AirWar.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 2013 4 | VisualStudioVersion = 12.0.31101.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AirWar", "AirWar.vcxproj", "{76A39BB2-9B84-4C65-98A5-654D86B86F2A}" 7 | ProjectSection(ProjectDependencies) = postProject 8 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} = {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E} 9 | EndProjectSection 10 | EndProject 11 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos2d\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" 12 | EndProject 13 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbox2d", "..\cocos2d\external\Box2D\proj.win32\libbox2d.vcxproj", "{929480E7-23C0-4DF6-8456-096D71547116}" 14 | EndProject 15 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos2d\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" 16 | EndProject 17 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbullet", "..\cocos2d\external\bullet\proj.win32\libbullet.vcxproj", "{012DFF48-A13F-4F52-B07B-F8B9D21CE95B}" 18 | EndProject 19 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "librecast", "..\cocos2d\external\recast\proj.win32\librecast.vcxproj", "{41E34993-647E-4282-8384-4AB1AE31A452}" 20 | EndProject 21 | Global 22 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 23 | Debug|Win32 = Debug|Win32 24 | Release|Win32 = Release|Win32 25 | EndGlobalSection 26 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 27 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.ActiveCfg = Debug|Win32 28 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Debug|Win32.Build.0 = Debug|Win32 29 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.ActiveCfg = Release|Win32 30 | {76A39BB2-9B84-4C65-98A5-654D86B86F2A}.Release|Win32.Build.0 = Release|Win32 31 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32 32 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 33 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 34 | {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 35 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.ActiveCfg = Debug|Win32 36 | {929480E7-23C0-4DF6-8456-096D71547116}.Debug|Win32.Build.0 = Debug|Win32 37 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.ActiveCfg = Release|Win32 38 | {929480E7-23C0-4DF6-8456-096D71547116}.Release|Win32.Build.0 = Release|Win32 39 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32 40 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32 41 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32 42 | {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32 43 | {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.ActiveCfg = Debug|Win32 44 | {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Debug|Win32.Build.0 = Debug|Win32 45 | {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.ActiveCfg = Release|Win32 46 | {012DFF48-A13F-4F52-B07B-F8B9D21CE95B}.Release|Win32.Build.0 = Release|Win32 47 | {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.ActiveCfg = Debug|Win32 48 | {41E34993-647E-4282-8384-4AB1AE31A452}.Debug|Win32.Build.0 = Debug|Win32 49 | {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.ActiveCfg = Release|Win32 50 | {41E34993-647E-4282-8384-4AB1AE31A452}.Release|Win32.Build.0 = Release|Win32 51 | EndGlobalSection 52 | GlobalSection(SolutionProperties) = preSolution 53 | HideSolutionNode = FALSE 54 | EndGlobalSection 55 | EndGlobal 56 | -------------------------------------------------------------------------------- /proj.win32/AirWar.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {84a8ebd7-7cf0-47f6-b75e-d441df67da40} 6 | 7 | 8 | {715254bc-d70b-4ec5-bf29-467dd3ace079} 9 | 10 | 11 | {bb6c862e-70e9-49d9-81b7-3829a6f50471} 12 | 13 | 14 | 15 | 16 | win32 17 | 18 | 19 | src 20 | 21 | 22 | src 23 | 24 | 25 | 26 | 27 | win32 28 | 29 | 30 | src 31 | 32 | 33 | src 34 | 35 | 36 | 37 | 38 | resource 39 | 40 | 41 | -------------------------------------------------------------------------------- /proj.win32/AirWar.vcxproj.user: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(ProjectDir)..\Resources 5 | WindowsLocalDebugger 6 | 7 | 8 | $(ProjectDir)..\Resources 9 | WindowsLocalDebugger 10 | 11 | -------------------------------------------------------------------------------- /proj.win32/build-cfg.json: -------------------------------------------------------------------------------- 1 | { 2 | "copy_resources": [ 3 | { 4 | "from": "../Resources", 5 | "to": "" 6 | } 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /proj.win32/game.rc: -------------------------------------------------------------------------------- 1 | // Microsoft Visual C++ generated resource script. 2 | // 3 | #include "resource.h" 4 | 5 | #define APSTUDIO_READONLY_SYMBOLS 6 | ///////////////////////////////////////////////////////////////////////////// 7 | // 8 | // Generated from the TEXTINCLUDE 2 resource. 9 | // 10 | #define APSTUDIO_HIDDEN_SYMBOLS 11 | #include "windows.h" 12 | #undef APSTUDIO_HIDDEN_SYMBOLS 13 | ///////////////////////////////////////////////////////////////////////////// 14 | #undef APSTUDIO_READONLY_SYMBOLS 15 | 16 | ///////////////////////////////////////////////////////////////////////////// 17 | // English (U.S.) resources 18 | 19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 20 | #ifdef _WIN32 21 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US 22 | #pragma code_page(1252) 23 | #endif //_WIN32 24 | 25 | #ifdef APSTUDIO_INVOKED 26 | ///////////////////////////////////////////////////////////////////////////// 27 | // 28 | // TEXTINCLUDE 29 | // 30 | 31 | 1 TEXTINCLUDE 32 | BEGIN 33 | "resource.h\0" 34 | END 35 | 36 | #endif // APSTUDIO_INVOKED 37 | 38 | ///////////////////////////////////////////////////////////////////////////// 39 | // 40 | // Icon 41 | // 42 | 43 | // Icon with lowest ID value placed first to ensure application icon 44 | // remains consistent on all systems. 45 | GLFW_ICON ICON "res\\game.ico" 46 | 47 | ///////////////////////////////////////////////////////////////////////////// 48 | // 49 | // Version 50 | // 51 | 52 | VS_VERSION_INFO VERSIONINFO 53 | FILEVERSION 1,0,0,1 54 | PRODUCTVERSION 1,0,0,1 55 | FILEFLAGSMASK 0x3fL 56 | #ifdef _DEBUG 57 | FILEFLAGS 0x1L 58 | #else 59 | FILEFLAGS 0x0L 60 | #endif 61 | FILEOS 0x4L 62 | FILETYPE 0x2L 63 | FILESUBTYPE 0x0L 64 | BEGIN 65 | BLOCK "StringFileInfo" 66 | BEGIN 67 | BLOCK "040904B0" 68 | BEGIN 69 | VALUE "CompanyName", "\0" 70 | VALUE "FileDescription", "game Module\0" 71 | VALUE "FileVersion", "1, 0, 0, 1\0" 72 | VALUE "InternalName", "game\0" 73 | VALUE "LegalCopyright", "Copyright \0" 74 | VALUE "OriginalFilename", "game.exe\0" 75 | VALUE "ProductName", "game Module\0" 76 | VALUE "ProductVersion", "1, 0, 0, 1\0" 77 | END 78 | END 79 | BLOCK "VarFileInfo" 80 | BEGIN 81 | VALUE "Translation", 0x0409, 0x04B0 82 | END 83 | END 84 | 85 | ///////////////////////////////////////////////////////////////////////////// 86 | #endif // !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) 87 | -------------------------------------------------------------------------------- /proj.win32/main.cpp: -------------------------------------------------------------------------------- 1 | #include "main.h" 2 | #include "AppDelegate.h" 3 | #include "cocos2d.h" 4 | 5 | USING_NS_CC; 6 | 7 | int APIENTRY _tWinMain(HINSTANCE hInstance, 8 | HINSTANCE hPrevInstance, 9 | LPTSTR lpCmdLine, 10 | int nCmdShow) 11 | { 12 | UNREFERENCED_PARAMETER(hPrevInstance); 13 | UNREFERENCED_PARAMETER(lpCmdLine); 14 | 15 | // create the application instance 16 | AppDelegate app; 17 | return Application::getInstance()->run(); 18 | } 19 | -------------------------------------------------------------------------------- /proj.win32/main.h: -------------------------------------------------------------------------------- 1 | #ifndef __MAIN_H__ 2 | #define __MAIN_H__ 3 | 4 | #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers 5 | 6 | // Windows Header Files: 7 | #include 8 | #include 9 | 10 | // C RunTime Header Files 11 | #include "CCStdC.h" 12 | 13 | #endif // __MAIN_H__ 14 | -------------------------------------------------------------------------------- /proj.win32/res/game.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win32/res/game.ico -------------------------------------------------------------------------------- /proj.win32/resource.h: -------------------------------------------------------------------------------- 1 | //{{NO_DEPENDENCIES}} 2 | // Microsoft Visual C++ generated include file. 3 | // Used by game.RC 4 | // 5 | 6 | #define IDS_PROJNAME 100 7 | #define IDR_TESTJS 100 8 | 9 | #define ID_FILE_NEW_WINDOW 32771 10 | 11 | // Next default values for new objects 12 | // 13 | #ifdef APSTUDIO_INVOKED 14 | #ifndef APSTUDIO_READONLY_SYMBOLS 15 | #define _APS_NEXT_RESOURCE_VALUE 201 16 | #define _APS_NEXT_CONTROL_VALUE 1000 17 | #define _APS_NEXT_SYMED_VALUE 101 18 | #define _APS_NEXT_COMMAND_VALUE 32775 19 | #endif 20 | #endif 21 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/AirWar.Shared.vcxitems: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | e956c24b-f04e-47bf-bf00-746681ae1301 7 | {a3ad93e4-0b2f-4c58-9181-69bed2e42e3e} 8 | AirWar 9 | 10 | 11 | 12 | %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) 13 | 14 | 15 | 16 | 17 | Designer 18 | 19 | 20 | 21 | 22 | $(MSBuildThisFileDirectory)App.xaml 23 | 24 | 25 | 26 | 27 | $(MSBuildThisFileDirectory)OpenGLESPage.xaml 28 | 29 | 30 | 31 | 32 | $(MSBuildThisFileDirectory)App.xaml 33 | 34 | 35 | Create 36 | 37 | 38 | 39 | 40 | $(MSBuildThisFileDirectory)OpenGLESPage.xaml 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | <_CustomResource Include="$(MSBuildThisFileDirectory)..\..\Resources\**\*"> 49 | Assets\Resources\%(RecursiveDir)%(FileName)%(Extension) 50 | true 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/AirWar.Shared.vcxitems.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Classes 10 | 11 | 12 | Classes 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | {38ad799c-8c3c-44a2-8e41-516c8f62f556} 24 | 25 | 26 | 27 | 28 | Classes 29 | 30 | 31 | Classes 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml: -------------------------------------------------------------------------------- 1 |  7 | 8 | 9 | 10 | HelloCpp 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml.cpp: -------------------------------------------------------------------------------- 1 | #include "App.xaml.h" 2 | #include "OpenGLESPage.xaml.h" 3 | 4 | using namespace Platform; 5 | using namespace Windows::ApplicationModel; 6 | using namespace Windows::ApplicationModel::Activation; 7 | using namespace Windows::Foundation; 8 | using namespace Windows::Foundation::Collections; 9 | using namespace Windows::UI::Xaml::Media::Animation; 10 | using namespace Windows::UI::Xaml; 11 | using namespace Windows::UI::Xaml::Controls; 12 | using namespace Windows::UI::Xaml::Controls::Primitives; 13 | using namespace Windows::UI::Xaml::Data; 14 | using namespace Windows::UI::Xaml::Input; 15 | using namespace Windows::UI::Xaml::Interop; 16 | using namespace Windows::UI::Xaml::Media; 17 | using namespace Windows::UI::Xaml::Navigation; 18 | using namespace cocos2d; 19 | using namespace CocosAppWinRT; 20 | 21 | App::App() 22 | { 23 | InitializeComponent(); 24 | Suspending += ref new SuspendingEventHandler(this, &App::OnSuspending); 25 | Resuming += ref new EventHandler(this, &App::OnResuming); 26 | } 27 | 28 | /// 29 | /// Invoked when the application is launched normally by the end user. Other entry points 30 | /// will be used when the application is launched to open a specific file, to display 31 | /// search results, and so forth. 32 | /// 33 | /// Details about the launch request and process. 34 | void App::OnLaunched(LaunchActivatedEventArgs^ e) 35 | { 36 | auto rootFrame = dynamic_cast(Window::Current->Content); 37 | 38 | // Do not repeat app initialization when the Window already has content, 39 | // just ensure that the window is active. 40 | if (rootFrame == nullptr) 41 | { 42 | // Create a Frame to act as the navigation context and associate it with 43 | // a SuspensionManager key 44 | rootFrame = ref new Frame(); 45 | 46 | // TODO: Change this value to a cache size that is appropriate for your application. 47 | rootFrame->CacheSize = 1; 48 | 49 | if (e->PreviousExecutionState == ApplicationExecutionState::Terminated) 50 | { 51 | // TODO: Restore the saved session state only when appropriate, scheduling the 52 | // final launch steps after the restore is complete. 53 | } 54 | 55 | // Place the frame in the current Window 56 | Window::Current->Content = rootFrame; 57 | } 58 | 59 | if (rootFrame->Content == nullptr) 60 | { 61 | #if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP 62 | // Removes the turnstile navigation for startup. 63 | if (rootFrame->ContentTransitions != nullptr) 64 | { 65 | _transitions = ref new TransitionCollection(); 66 | for (auto transition : rootFrame->ContentTransitions) 67 | { 68 | _transitions->Append(transition); 69 | } 70 | } 71 | 72 | rootFrame->ContentTransitions = nullptr; 73 | _firstNavigatedToken = rootFrame->Navigated += ref new NavigatedEventHandler(this, &App::RootFrame_FirstNavigated); 74 | #endif 75 | 76 | // When the navigation stack isn't restored navigate to the first page, 77 | // configuring the new page by passing required information as a navigation 78 | // parameter. 79 | 80 | rootFrame->Content = mPage = ref new OpenGLESPage(&mOpenGLES); 81 | 82 | #if 0 83 | if (!rootFrame->Navigate(OpenGLESPage::typeid, e->Arguments)) 84 | { 85 | throw ref new FailureException("Failed to create initial page"); 86 | } 87 | #endif 88 | } 89 | 90 | // Ensure the current window is active 91 | Window::Current->Activate(); 92 | } 93 | 94 | #if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP 95 | /// 96 | /// Restores the content transitions after the app has launched. 97 | /// 98 | void App::RootFrame_FirstNavigated(Object^ sender, NavigationEventArgs^ e) 99 | { 100 | auto rootFrame = safe_cast(sender); 101 | 102 | TransitionCollection^ newTransitions; 103 | if (_transitions == nullptr) 104 | { 105 | newTransitions = ref new TransitionCollection(); 106 | newTransitions->Append(ref new NavigationThemeTransition()); 107 | } 108 | else 109 | { 110 | newTransitions = _transitions; 111 | } 112 | 113 | rootFrame->ContentTransitions = newTransitions; 114 | 115 | rootFrame->Navigated -= _firstNavigatedToken; 116 | } 117 | #endif 118 | 119 | /// 120 | /// Invoked when application execution is being suspended. Application state is saved 121 | /// without knowing whether the application will be terminated or resumed with the contents 122 | /// of memory still intact. 123 | /// 124 | void App::OnSuspending(Object^ sender, SuspendingEventArgs^ e) 125 | { 126 | (void) sender; // Unused parameter 127 | (void) e; // Unused parameter 128 | 129 | mPage->SetVisibility(false); 130 | } 131 | 132 | /// 133 | /// Invoked when application execution is being resumed. 134 | /// 135 | /// The source of the resume request. 136 | /// Details about the resume request. 137 | void App::OnResuming(Object ^sender, Object ^args) 138 | { 139 | (void)sender; // Unused parameter 140 | (void)args; // Unused parameter 141 | 142 | mPage->SetVisibility(true); 143 | } 144 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/App.xaml.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "app.g.h" 4 | #include "OpenGLES.h" 5 | #include "openglespage.xaml.h" 6 | 7 | namespace CocosAppWinRT 8 | { 9 | ref class App sealed 10 | { 11 | public: 12 | App(); 13 | virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ e) override; 14 | 15 | private: 16 | 17 | #if WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP 18 | Windows::UI::Xaml::Media::Animation::TransitionCollection^ _transitions; 19 | Windows::Foundation::EventRegistrationToken _firstNavigatedToken; 20 | 21 | void RootFrame_FirstNavigated(Platform::Object^ sender, Windows::UI::Xaml::Navigation::NavigationEventArgs^ e); 22 | #endif 23 | 24 | void OnSuspending(Platform::Object^ sender, Windows::ApplicationModel::SuspendingEventArgs^ e); 25 | void OnResuming(Platform::Object ^sender, Platform::Object ^args); 26 | 27 | OpenGLESPage^ mPage; 28 | OpenGLES mOpenGLES; 29 | }; 30 | } 31 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2dRenderer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #include "Cocos2dRenderer.h" 20 | #include "AppDelegate.h" 21 | #include "CCGLViewImpl-winrt.h" 22 | #include "CCApplication.h" 23 | #include "cocos2d.h" 24 | #include "renderer/CCTextureCache.h" 25 | 26 | // These are used by the shader compilation methods. 27 | #include 28 | #include 29 | #include 30 | 31 | using namespace Platform; 32 | using namespace Windows::UI::Core; 33 | using namespace Windows::UI::Xaml::Controls; 34 | using namespace Windows::Graphics::Display; 35 | using namespace cocos2d; 36 | 37 | Cocos2dRenderer::Cocos2dRenderer(int width, int height, float dpi, DisplayOrientations orientation, CoreDispatcher^ dispatcher, Panel^ panel) 38 | : m_app(nullptr) 39 | , m_width(width) 40 | , m_height(height) 41 | , m_dpi(dpi) 42 | , m_dispatcher(dispatcher) 43 | , m_panel(panel) 44 | , m_orientation(orientation) 45 | { 46 | m_app = new AppDelegate(); 47 | } 48 | 49 | Cocos2dRenderer::~Cocos2dRenderer() 50 | { 51 | delete m_app; 52 | } 53 | 54 | void Cocos2dRenderer::Resume() 55 | { 56 | auto director = cocos2d::Director::getInstance(); 57 | auto glview = director->getOpenGLView(); 58 | 59 | if (!glview) 60 | { 61 | GLViewImpl* glview = GLViewImpl::create("Test Cpp"); 62 | glview->setDispatcher(m_dispatcher.Get()); 63 | glview->setPanel(m_panel.Get()); 64 | glview->Create(static_cast(m_width), static_cast(m_height), m_dpi, m_orientation); 65 | director->setOpenGLView(glview); 66 | CCApplication::getInstance()->run(); 67 | } 68 | else 69 | { 70 | Application::getInstance()->applicationWillEnterForeground(); 71 | cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); 72 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); 73 | } 74 | } 75 | 76 | void Cocos2dRenderer::Pause() 77 | { 78 | if (Director::getInstance()->getOpenGLView()) { 79 | Application::getInstance()->applicationDidEnterBackground(); 80 | cocos2d::EventCustom backgroundEvent(EVENT_COME_TO_BACKGROUND); 81 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&backgroundEvent); 82 | } 83 | } 84 | 85 | bool Cocos2dRenderer::AppShouldExit() 86 | { 87 | return GLViewImpl::sharedOpenGLView()->AppShouldExit(); 88 | } 89 | 90 | void Cocos2dRenderer::DeviceLost() 91 | { 92 | Pause(); 93 | 94 | auto director = cocos2d::Director::getInstance(); 95 | if (director->getOpenGLView()) { 96 | cocos2d::GL::invalidateStateCache(); 97 | cocos2d::GLProgramCache::getInstance()->reloadDefaultGLPrograms(); 98 | cocos2d::DrawPrimitives::init(); 99 | cocos2d::VolatileTextureMgr::reloadAllTextures(); 100 | 101 | cocos2d::EventCustom recreatedEvent(EVENT_RENDERER_RECREATED); 102 | director->getEventDispatcher()->dispatchEvent(&recreatedEvent); 103 | director->setGLDefaultValues(); 104 | 105 | Application::getInstance()->applicationWillEnterForeground(); 106 | cocos2d::EventCustom foregroundEvent(EVENT_COME_TO_FOREGROUND); 107 | cocos2d::Director::getInstance()->getEventDispatcher()->dispatchEvent(&foregroundEvent); 108 | } 109 | } 110 | 111 | 112 | 113 | void Cocos2dRenderer::Draw(GLsizei width, GLsizei height, float dpi, DisplayOrientations orientation) 114 | { 115 | auto glView = GLViewImpl::sharedOpenGLView(); 116 | 117 | if (orientation != m_orientation) 118 | { 119 | m_orientation = orientation; 120 | glView->UpdateOrientation(orientation); 121 | } 122 | 123 | if (width != m_width || height != m_height) 124 | { 125 | m_width = width; 126 | m_height = height; 127 | glView->UpdateForWindowSizeChange(static_cast(width), static_cast(height)); 128 | } 129 | 130 | if (dpi != m_dpi) 131 | { 132 | m_dpi = dpi; 133 | glView->SetDPI(m_dpi); 134 | } 135 | 136 | glView->ProcessEvents(); 137 | glView->Render(); 138 | } 139 | 140 | void Cocos2dRenderer::QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args) 141 | { 142 | GLViewImpl::sharedOpenGLView()->QueuePointerEvent(type, args); 143 | } 144 | 145 | void Cocos2dRenderer::QueueBackButtonEvent() 146 | { 147 | GLViewImpl::sharedOpenGLView()->QueueBackKeyPress(); 148 | } 149 | 150 | void Cocos2dRenderer::QueueKeyboardEvent(WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args) 151 | { 152 | GLViewImpl::sharedOpenGLView()->QueueWinRTKeyboardEvent(type, args); 153 | } 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/Cocos2dRenderer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | #pragma once 19 | 20 | #include 21 | 22 | #include "cocos2d.h" 23 | 24 | 25 | class AppDelegate; 26 | 27 | class Cocos2dRenderer 28 | { 29 | public: 30 | Cocos2dRenderer(int width, int height, float dpi, 31 | Windows::Graphics::Display::DisplayOrientations orientation, 32 | Windows::UI::Core::CoreDispatcher^ dispathcer, Windows::UI::Xaml::Controls::Panel^ panel); 33 | ~Cocos2dRenderer(); 34 | void Draw(GLsizei width, GLsizei height, float dpi, Windows::Graphics::Display::DisplayOrientations orientation); 35 | void QueuePointerEvent(cocos2d::PointerEventType type, Windows::UI::Core::PointerEventArgs^ args); 36 | void QueueKeyboardEvent(cocos2d::WinRTKeyboardEventType type, Windows::UI::Core::KeyEventArgs^ args); 37 | void QueueBackButtonEvent(); 38 | void Pause(); 39 | void Resume(); 40 | void DeviceLost(); 41 | bool AppShouldExit(); 42 | 43 | private: 44 | 45 | int m_width; 46 | int m_height; 47 | float m_dpi; 48 | 49 | // The AppDelegate for the Cocos2D app 50 | AppDelegate* m_app; 51 | Platform::Agile m_dispatcher; 52 | Platform::Agile m_panel; 53 | Windows::Graphics::Display::DisplayOrientations m_orientation; 54 | }; 55 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLES.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | // OpenGL ES includes 22 | #include 23 | #include 24 | 25 | // EGL includes 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class OpenGLES 32 | { 33 | public: 34 | OpenGLES(); 35 | ~OpenGLES(); 36 | 37 | EGLSurface CreateSurface(Windows::UI::Xaml::Controls::SwapChainPanel^ panel, const Windows::Foundation::Size* renderSurfaceSize); 38 | void DestroySurface(const EGLSurface surface); 39 | void MakeCurrent(const EGLSurface surface); 40 | EGLBoolean SwapBuffers(const EGLSurface surface); 41 | void Reset(); 42 | void Cleanup(); 43 | 44 | private: 45 | void Initialize(); 46 | 47 | private: 48 | EGLDisplay mEglDisplay; 49 | EGLContext mEglContext; 50 | EGLConfig mEglConfig; 51 | }; 52 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLESPage.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/OpenGLESPage.xaml.h: -------------------------------------------------------------------------------- 1 | /* 2 | * cocos2d-x http://www.cocos2d-x.org 3 | * 4 | * Copyright (c) 2010-2014 - cocos2d-x community 5 | * 6 | * Portions Copyright (c) Microsoft Open Technologies, Inc. 7 | * All Rights Reserved 8 | * 9 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 10 | * You may obtain a copy of the License at 11 | * 12 | * http://www.apache.org/licenses/LICENSE-2.0 13 | * 14 | * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | * See the License for the specific language governing permissions and limitations under the License. 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "OpenGLES.h" 22 | #include "OpenGLESPage.g.h" 23 | #include 24 | #include 25 | #include 26 | 27 | #include "Cocos2dRenderer.h" 28 | 29 | namespace CocosAppWinRT 30 | { 31 | public ref class OpenGLESPage sealed 32 | { 33 | public: 34 | OpenGLESPage(); 35 | virtual ~OpenGLESPage(); 36 | void SetVisibility(bool isVisible); 37 | 38 | internal: 39 | OpenGLESPage(OpenGLES* openGLES); 40 | 41 | private: 42 | void OnPageLoaded(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e); 43 | void OnVisibilityChanged(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::VisibilityChangedEventArgs^ args); 44 | void OnSwapChainPanelSizeChanged(Platform::Object^ sender, Windows::UI::Xaml::SizeChangedEventArgs^ e); 45 | #if (WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP) || _MSC_VER >= 1900 46 | void OnBackButtonPressed(Platform::Object^ sender, Windows::Phone::UI::Input::BackPressedEventArgs^ args); 47 | #endif 48 | void GetSwapChainPanelSize(GLsizei* width, GLsizei* height); 49 | void CreateRenderSurface(); 50 | void DestroyRenderSurface(); 51 | void RecoverFromLostDevice(); 52 | void TerminateApp(); 53 | void StartRenderLoop(); 54 | void StopRenderLoop(); 55 | 56 | OpenGLES* mOpenGLES; 57 | std::shared_ptr mRenderer; 58 | 59 | Windows::Foundation::Size mSwapChainPanelSize; 60 | Concurrency::critical_section mSwapChainPanelSizeCriticalSection; 61 | 62 | Windows::Foundation::Size mCustomRenderSurfaceSize; 63 | bool mUseCustomRenderSurfaceSize; 64 | 65 | EGLSurface mRenderSurface; // This surface is associated with a swapChainPanel on the page 66 | Concurrency::critical_section mRenderSurfaceCriticalSection; 67 | Windows::Foundation::IAsyncAction^ mRenderLoopWorker; 68 | 69 | // Track user input on a background worker thread. 70 | Windows::Foundation::IAsyncAction^ mInputLoopWorker; 71 | Windows::UI::Core::CoreIndependentInputSource^ mCoreInput; 72 | 73 | // Independent input handling functions. 74 | void OnPointerPressed(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 75 | void OnPointerMoved(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 76 | void OnPointerReleased(Platform::Object^ sender, Windows::UI::Core::PointerEventArgs^ e); 77 | void OnKeyPressed(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); 78 | void OnKeyReleased(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::KeyEventArgs^ args); 79 | void OnCharacterReceived(Windows::UI::Core::CoreWindow^ sender, Windows::UI::Core::CharacterReceivedEventArgs^ args); 80 | 81 | void OnOrientationChanged(Windows::Graphics::Display::DisplayInformation^ sender, Platform::Object^ args); 82 | 83 | float mDpi; 84 | bool mDeviceLost; 85 | bool mVisible; 86 | Windows::Graphics::Display::DisplayOrientations mOrientation; 87 | 88 | std::mutex mSleepMutex; 89 | std::condition_variable mSleepCondition; 90 | }; 91 | } 92 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/pch.cpp: -------------------------------------------------------------------------------- 1 | #include "pch.h" 2 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Shared/pch.h: -------------------------------------------------------------------------------- 1 | // 2 | // pch.h 3 | // Header for standard system include files. 4 | // 5 | 6 | #pragma once 7 | 8 | #include 9 | #include 10 | 11 | #include "cocos2d.h" 12 | #include "cocos-ext.h" 13 | 14 | 15 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/AirWar.Windows.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {1a9fa652-867e-41d2-8588-962f108d2d8f} 6 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Assets 18 | 19 | 20 | Assets 21 | 22 | 23 | Assets 24 | 25 | 26 | Assets 27 | 28 | 29 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/AirWar.Windows_TemporaryKey.pfx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.Windows/AirWar.Windows_TemporaryKey.pfx -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/Logo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.Windows/Assets/Logo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/SmallLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.Windows/Assets/SmallLogo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/SplashScreen.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.Windows/Assets/SplashScreen.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Assets/StoreLogo.scale-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.Windows/Assets/StoreLogo.scale-100.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.Windows/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | AirWar.Windows 6 | msopentech 7 | Assets\StoreLogo.png 8 | 9 | 10 | 6.3.0 11 | 6.3.0 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/AirWar.WindowsPhone.vcxproj.filters: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | {c8beb60d-689b-4aaa-9749-99bd3e2dcf75} 6 | bmp;fbx;gif;jpg;jpeg;tga;tiff;tif;png 7 | 8 | 9 | Assets 10 | 11 | 12 | Assets 13 | 14 | 15 | Assets 16 | 17 | 18 | Assets 19 | 20 | 21 | Assets 22 | 23 | 24 | Assets 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/Logo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/SmallLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/SmallLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/SplashScreen.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/SplashScreen.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/Square71x71Logo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/Square71x71Logo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/StoreLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/StoreLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Assets/WideLogo.scale-240.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/proj.win8.1-universal/App.WindowsPhone/Assets/WideLogo.scale-240.png -------------------------------------------------------------------------------- /proj.win8.1-universal/App.WindowsPhone/Package.appxmanifest: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | AirWar.WindowsPhone 7 | msopentech 8 | Assets\StoreLogo.png 9 | 10 | 11 | 6.3.1 12 | 6.3.1 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /raw/AirWar.xmind: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/AirWar.xmind -------------------------------------------------------------------------------- /raw/AirWar_Architecture.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/AirWar_Architecture.png -------------------------------------------------------------------------------- /raw/can_hit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/can_hit.png -------------------------------------------------------------------------------- /raw/class.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/class.jpg -------------------------------------------------------------------------------- /raw/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/icon.png -------------------------------------------------------------------------------- /raw/physical param.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/physical param.xlsx -------------------------------------------------------------------------------- /raw/physics_body.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cheyiliu/AirWar/4e354cff23d4613fb76e9f7319aca1aeb16abb31/raw/physics_body.png --------------------------------------------------------------------------------