diff --git a/Fighter/Fighter.sln b/Fighter/Fighter.sln new file mode 100644 index 0000000..7409b06 --- /dev/null +++ b/Fighter/Fighter.sln @@ -0,0 +1,22 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.21005.1 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Fighter", "Fighter\Fighter.vcxproj", "{2A5B3CB4-1E6F-4AEA-8193-5382A519133C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2A5B3CB4-1E6F-4AEA-8193-5382A519133C}.Debug|Win32.ActiveCfg = Debug|Win32 + {2A5B3CB4-1E6F-4AEA-8193-5382A519133C}.Debug|Win32.Build.0 = Debug|Win32 + {2A5B3CB4-1E6F-4AEA-8193-5382A519133C}.Release|Win32.ActiveCfg = Release|Win32 + {2A5B3CB4-1E6F-4AEA-8193-5382A519133C}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/Fighter/Fighter/Bullet.cpp b/Fighter/Fighter/Bullet.cpp new file mode 100644 index 0000000..75597e3 --- /dev/null +++ b/Fighter/Fighter/Bullet.cpp @@ -0,0 +1,12 @@ +#include "Bullet.h" +#include "Texture.h" + +Bullet::Bullet(float x,float y){ + this->setTexture(Texture::BULLET); + + this->setPosition(x, y); +} + +void Bullet::heartBeat(){ + this->move(0,-10); +} diff --git a/Fighter/Fighter/Bullet.h b/Fighter/Fighter/Bullet.h new file mode 100644 index 0000000..ceca8a0 --- /dev/null +++ b/Fighter/Fighter/Bullet.h @@ -0,0 +1,12 @@ +#ifndef __Fighters__Bullet__ +#define __Fighters__Bullet__ + +#include "Sprite.h" + +class Bullet:public Sprite{ +public: + Bullet(float x,float y); + void heartBeat(); +}; + +#endif /* defined(__Fighters__Bullet__) */ diff --git a/Fighter/Fighter/Enemy.cpp b/Fighter/Fighter/Enemy.cpp new file mode 100644 index 0000000..f539b69 --- /dev/null +++ b/Fighter/Fighter/Enemy.cpp @@ -0,0 +1,56 @@ +#include "Enemy.h" +#include "Texture.h" +#include "Sound.h" +#include "Game.h" +#include +#include +using namespace std; + +Enemy::Enemy(){ + this->setTexture(Texture::ENEMY); + + uniform_int_distribution u(0,440); + uniform_int_distribution v(0,1); + std::default_random_engine random_engine; + this->setPosition(u(Game::random_engine), 20); + this->speed = 0.5+(double)(v(Game::random_engine)/1.5); + this->gun.setOwner(this); +} + +void Enemy::heartBeat(){ + float y; + switch(this->state){ + case 0: + y=this->getPosition().y; + if (y >= 700) this->state = 4; + else this->move(0,this->speed); + break; + case 1: + this->setTexture(Texture::ENEMY_DOWN_2); + this->state++; + break; + case 2: + this->setTexture(Texture::ENEMY_DOWN_3); + this->state++; + break; + case 3: + this->setTexture(Texture::ENEMY_DOWN_4); + this->state++; + break; + default:; + } +} + +void Enemy::hit(){ + this->state = 1; + this->setTexture(Texture::ENEMY_DOWN_1); + Sound::ENEMY_DOWN.play(); +} + +bool Enemy::needClear(){ + return this->state == 4; +} + +bool Enemy::isDead(){ + return this->state != 0; +} \ No newline at end of file diff --git a/Fighter/Fighter/Enemy.h b/Fighter/Fighter/Enemy.h new file mode 100644 index 0000000..ac0498f --- /dev/null +++ b/Fighter/Fighter/Enemy.h @@ -0,0 +1,18 @@ +#ifndef __Fighters__Enemy__ +#define __Fighters__Enemy__ + +#include "Plane.h" + +class Enemy:public Plane{ +public: + Enemy(); + void heartBeat(); + void hit(); + bool needClear(); + bool isDead(); +private: + int state=0; + double speed; +}; + +#endif /* defined(__Fighters__Enemy__) */ diff --git a/Fighter/Fighter/Fighter.vcxproj b/Fighter/Fighter/Fighter.vcxproj new file mode 100644 index 0000000..f22f504 --- /dev/null +++ b/Fighter/Fighter/Fighter.vcxproj @@ -0,0 +1,110 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {2A5B3CB4-1E6F-4AEA-8193-5382A519133C} + Fighter + + + + Application + true + v120 + MultiByte + + + Application + false + v120 + true + MultiByte + + + + + + + + + + + + + + + Level3 + Disabled + true + E:\Soft\SFML-2.1\include;%(AdditionalIncludeDirectories) + MultiThreadedDebugDLL + + + true + E:\Soft\SFML-2.1\lib;%(AdditionalLibraryDirectories) + sfml-audio-d.lib;sfml-system-d.lib;sfml-graphics-d.lib;sfml-window-d.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + Level3 + MaxSpeed + true + true + true + E:\Soft\SFML-2.1\include;%(AdditionalIncludeDirectories) + + + true + true + true + E:\Soft\SFML-2.1\lib;%(AdditionalLibraryDirectories) + sfml-audio.lib;sfml-system.lib;sfml-graphics.lib;sfml-window.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Designer + + + + + + \ No newline at end of file diff --git a/Fighter/Fighter/Fighter.vcxproj.filters b/Fighter/Fighter/Fighter.vcxproj.filters new file mode 100644 index 0000000..94a2dcd --- /dev/null +++ b/Fighter/Fighter/Fighter.vcxproj.filters @@ -0,0 +1,101 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/Fighter/Fighter/Fighters-Info.plist b/Fighter/Fighter/Fighters-Info.plist new file mode 100644 index 0000000..d22e329 --- /dev/null +++ b/Fighter/Fighter/Fighters-Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + + CFBundleIdentifier + uestc.cpp.edu.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + + diff --git a/Fighter/Fighter/Game.cpp b/Fighter/Fighter/Game.cpp new file mode 100644 index 0000000..7ee1025 --- /dev/null +++ b/Fighter/Fighter/Game.cpp @@ -0,0 +1,11 @@ +#include "Game.h" + +Game* Game::instance = nullptr; +std::default_random_engine Game::random_engine(time(0)); + +Game* Game::getInstance(){ + if(!instance){ + instance = new Game; + } + return instance; +} \ No newline at end of file diff --git a/Fighter/Fighter/Game.h b/Fighter/Fighter/Game.h new file mode 100644 index 0000000..5591882 --- /dev/null +++ b/Fighter/Fighter/Game.h @@ -0,0 +1,17 @@ +#ifndef __Fighters__Game__ +#define __Fighters__Game__ + +#include +#include + +class Game{ +public: + static Game* getInstance(); + static std::default_random_engine random_engine; +private: +// Game(); + + static Game* instance; +}; + +#endif /* defined(__Fighters__Game__) */ diff --git a/Fighter/Fighter/Gun.cpp b/Fighter/Fighter/Gun.cpp new file mode 100644 index 0000000..3e6f86e --- /dev/null +++ b/Fighter/Fighter/Gun.cpp @@ -0,0 +1,25 @@ +#include "Plane.h" +#include "Gun.h" + +#include "Sky.h" + +#include "Bullet.h" + +void Gun::fire(){ + sf::Vector2f pos = ((this->owner)->getPosition()); + Bullet* bullet1 = new Bullet(pos.x+15,pos.y+30); + Sky::getInstance()->add(bullet1); + Sky::getInstance()->addMyBullet(bullet1); + Bullet* bullet2 = new Bullet(pos.x+80,pos.y+30); + Sky::getInstance()->add(bullet2); + Sky::getInstance()->addMyBullet(bullet2); +} + +sf::Vector2f Gun::getPosition(){ + sf::Vector2f ff; + return ff;//this->owner->getPosition(); +} + +void Gun::setOwner(Plane * owner){ + this->owner = owner; +} \ No newline at end of file diff --git a/Fighter/Fighter/Gun.h b/Fighter/Fighter/Gun.h new file mode 100644 index 0000000..8e83d4d --- /dev/null +++ b/Fighter/Fighter/Gun.h @@ -0,0 +1,20 @@ +#ifndef __Fighters__Gun__ +#define __Fighters__Gun__ + +#include + +#include + +class Plane; + +class Gun{ +public: + void setOwner(Plane * owner); + void fire(); +private: + sf::Vector2f getPosition(); + + Plane* owner; +}; + +#endif /* defined(__Fighters__Gun__) */ diff --git a/Fighter/Fighter/Hero.cpp b/Fighter/Fighter/Hero.cpp new file mode 100644 index 0000000..70d4f4c --- /dev/null +++ b/Fighter/Fighter/Hero.cpp @@ -0,0 +1,40 @@ +#include "Hero.h" +#include "Texture.h" + +Hero::Hero(){ + this->setTexture(Texture::HERO); + + this->setPosition(180, 600); + + this->gun.setOwner(this); +} + +void Hero::move2left(){ + float x = this->getPosition().x; + if (x>0) this->move(-15,0); +} + +void Hero::move2right(){ + float x = this->getPosition().x; + if (x<400) this->move(15,0); +} + +void Hero::move2down(){ + float y = this->getPosition().y; + if (y<600) this->move(0,15); +} + +void Hero::move2up(){ + float y = this->getPosition().y; + if (y>20) this->move(0,-15); +} + +Rect Hero::Position(){ + Rect r; + r.x = this->getPosition().x-10; + r.y = this->getPosition().y+30; + r.w = this->getLocalBounds().width-20; + r.h = this->getLocalBounds().height-30; + + return r; +} \ No newline at end of file diff --git a/Fighter/Fighter/Hero.h b/Fighter/Fighter/Hero.h new file mode 100644 index 0000000..bf6240d --- /dev/null +++ b/Fighter/Fighter/Hero.h @@ -0,0 +1,18 @@ +#ifndef __Fighters__Hero__ +#define __Fighters__Hero__ + +#include + +#include "Plane.h" + +class Hero:public Plane{ +public: + Hero(); + Rect Position(); + void move2left(); + void move2right(); + void move2down(); + void move2up(); +}; + +#endif diff --git a/Fighter/Fighter/Plane.cpp b/Fighter/Fighter/Plane.cpp new file mode 100644 index 0000000..a50f472 --- /dev/null +++ b/Fighter/Fighter/Plane.cpp @@ -0,0 +1,5 @@ +#include "Plane.h" + +void Plane::fire(){ + this->gun.fire(); +} diff --git a/Fighter/Fighter/Plane.h b/Fighter/Fighter/Plane.h new file mode 100644 index 0000000..8a45079 --- /dev/null +++ b/Fighter/Fighter/Plane.h @@ -0,0 +1,20 @@ +#ifndef __Fighters__Plane__ +#define __Fighters__Plane__ + +#include + +#include "Sprite.h" +#include "Gun.h" + +#include +using std::cout; +using std::endl; + +class Plane:public Sprite{ +public: + void fire(); +protected: + Gun gun; +}; + +#endif /* defined(__Fighters__Plane__) */ diff --git a/Fighter/Fighter/Rect.cpp b/Fighter/Fighter/Rect.cpp new file mode 100644 index 0000000..5cbda1c --- /dev/null +++ b/Fighter/Fighter/Rect.cpp @@ -0,0 +1 @@ +#include "Rect.h" diff --git a/Fighter/Fighter/Rect.h b/Fighter/Fighter/Rect.h new file mode 100644 index 0000000..d0901a3 --- /dev/null +++ b/Fighter/Fighter/Rect.h @@ -0,0 +1,11 @@ +#ifndef __Fighters__Rect__ +#define __Fighters__Rect__ + +struct Rect{ + float x; + float y; + float w; + float h; +}; + +#endif diff --git a/Fighter/Fighter/ResourcePath.cpp b/Fighter/Fighter/ResourcePath.cpp new file mode 100644 index 0000000..bb8d435 --- /dev/null +++ b/Fighter/Fighter/ResourcePath.cpp @@ -0,0 +1,4 @@ +#include"ResourcePath.hpp" +std::string resourcePath(void){ + return "E:\\Documents\\Visual Studio 2013\\Projects\\Fighter\\Fighter\\resources\\"; +}; \ No newline at end of file diff --git a/Fighter/Fighter/ResourcePath.hpp b/Fighter/Fighter/ResourcePath.hpp new file mode 100644 index 0000000..9670f40 --- /dev/null +++ b/Fighter/Fighter/ResourcePath.hpp @@ -0,0 +1,5 @@ +#ifndef RESOURCE_PATH_HPP +#define RESOURCE_PATH_HPP +#include +std::string resourcePath(void); +#endif diff --git a/Fighter/Fighter/ResourcePath.mm b/Fighter/Fighter/ResourcePath.mm new file mode 100644 index 0000000..d25c1d3 --- /dev/null +++ b/Fighter/Fighter/ResourcePath.mm @@ -0,0 +1,52 @@ +//////////////////////////////////////////////////////////// +// +// SFML - Simple and Fast Multimedia Library +// Copyright (C) 2007-2013 Marco Antognini (antognini.marco@gmail.com), +// Laurent Gomila (laurent.gom@gmail.com), +// +// This software is provided 'as-is', without any express or implied warranty. +// In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it freely, +// subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; +// you must not claim that you wrote the original software. +// If you use this software in a product, an acknowledgment +// in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, +// and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. +// +//////////////////////////////////////////////////////////// + +//////////////////////////////////////////////////////////// +// Headers +//////////////////////////////////////////////////////////// +#include "ResourcePath.hpp" +#import + +//////////////////////////////////////////////////////////// +std::string resourcePath(void) +{ + NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; + + std::string rpath; + NSBundle* bundle = [NSBundle mainBundle]; + + if (bundle == nil) { +#ifdef DEBUG + NSLog(@"bundle is nil... thus no resources path can be found."); +#endif + } else { + NSString* path = [bundle resourcePath]; + rpath = [path UTF8String] + std::string("/"); + } + + [pool drain]; + + return rpath; +} diff --git a/Fighter/Fighter/Sky.cpp b/Fighter/Fighter/Sky.cpp new file mode 100644 index 0000000..17b683e --- /dev/null +++ b/Fighter/Fighter/Sky.cpp @@ -0,0 +1,118 @@ +#include "ResourcePath.hpp" + +#include "Sky.h" +#include "Enemy.h" +#include "Hero.h" +#include "Texture.h" + +Sky* Sky::instance = nullptr; + +Sky::Sky(){ + this->window = new sf::RenderWindow(sf::VideoMode(480, 800), L"飞机大战"); + + sf::Image icon; + if (icon.loadFromFile(resourcePath() + "image\\shoot.png")) { + this->window->setIcon(icon.getSize().x, icon.getSize().y, icon.getPixelsPtr()); + } + + this->background = new sf::Sprite(Texture::SKY); + this->gameover = new sf::Sprite(Texture::OVER); +} + +void Sky::add(Sprite* sprite){ + this->sprites.insert(sprite); +} + +void Sky::addMyBullet(Bullet * bullet){ + this->myBullets.insert(bullet); +} + +void Sky::refresh(){ + this->window->draw(*this->background); + this->clear(); + this->collision(); + this->isover(); + this->createEnemies(); + // Draw the sprite + for(auto &sprite : this->sprites){ + sprite->heartBeat(); + this->window->draw(*sprite); + } + + // Update the window + this->window->display(); +} + +void Sky::clear(){ + for(auto it_enemy= this->enemies.begin();it_enemy!=this->enemies.end();){ + if((*it_enemy)->needClear()){ + delete *it_enemy; + this->sprites.erase(*it_enemy); + + it_enemy = (this->enemies).erase(it_enemy); + }else{ + ++it_enemy; + } + } +} +void Sky::collision(){ + for(auto it_enemy= this->enemies.begin();it_enemy!=this->enemies.end();++it_enemy){ + if((*it_enemy)->isDead()) continue; + + for(auto it_bullet= this->myBullets.begin();it_bullet!=this->myBullets.end();++it_bullet){ + if(this->isCollision((*it_enemy)->getRect(), (*it_bullet)->getRect())){ + delete *it_bullet; + this->sprites.erase(*it_bullet); + (this->myBullets).erase(it_bullet); + + (*it_enemy)->hit(); + break; + } + + } + } +} +void Sky::isover(){ + for (auto it_enemy = this->enemies.begin(); it_enemy != this->enemies.end(); ++it_enemy){ + if (this->isCollision((*it_enemy)->getRect(), Position())){ + this->window->draw(*this->gameover); + this->window->display(); + for (int i = 0; i <= 1000000000; i++){} +// system("pasuse"); + exit(0); + } + } +} +bool Sky::isCollision(const Rect& r1,const Rect& r2){ + return (r2.x>=r1.x && r2.x<=(r1.x+r1.w) && r2.y>=r1.y && r2.y<=(r1.y+r1.h)) + || ((r2.x+r2.w)>=r1.x && (r2.x+r2.w)<=(r1.x+r1.w) && r2.y>=r1.y && r2.y<=(r1.y+r1.h)) + || (r2.x>=r1.x && r2.x<=(r1.x+r1.w) && (r2.y+r2.h)>=r1.y && (r2.y+r2.h)<=(r1.y+r1.h)) + || ((r2.x+r2.w)>=r1.x && (r2.x+r2.w)<=(r1.x+r1.w) && r2.y>=r1.y && r2.y<=(r1.y+r1.h)); +} + + +void Sky::createEnemies(){ + static int count=0; + int p = 0; + if ((150 - level) > 50) p = (150 - level); + else p = 50; + if(++count>=p){ + turn++; + Enemy* enemy = new Enemy; + this->sprites.insert(enemy); + this->enemies.insert(enemy); + + count = 0; + } + if (turn >= 10){ + turn = 0; + level++; + } +} + +Sky* Sky::getInstance(){ + if(!instance){ + instance = new Sky; + } + return instance; +} \ No newline at end of file diff --git a/Fighter/Fighter/Sky.h b/Fighter/Fighter/Sky.h new file mode 100644 index 0000000..0aaafd3 --- /dev/null +++ b/Fighter/Fighter/Sky.h @@ -0,0 +1,50 @@ +#ifndef __Fighters__Sky__ +#define __Fighters__Sky__ + +#include +#include "Sprite.h" +#include "Enemy.h" +#include "Bullet.h" +#include "Hero.h" + +#include "Rect.h" + +#include +#include +#include +using namespace std; + +class Sky:private Hero{ +public: + static Sky* getInstance(); + + sf::RenderWindow* getWindow(){ + return this->window; + } + void add(Sprite *); + + void addMyBullet(Bullet *); + + void refresh(); + void isover(); +private: + Sky(); + + sf::RenderWindow* window; + unordered_set sprites; + unordered_set enemies; + unordered_set myBullets; + + sf::Sprite* background=nullptr; + sf::Sprite* gameover=nullptr; + + static Sky* instance; + + void clear(); + void collision(); + bool isCollision(const Rect& r1,const Rect& r2); + void createEnemies(); + long turn,level; +}; + +#endif /* defined(__Fighters__Sky__) */ diff --git a/Fighter/Fighter/Sound.cpp b/Fighter/Fighter/Sound.cpp new file mode 100644 index 0000000..528fa87 --- /dev/null +++ b/Fighter/Fighter/Sound.cpp @@ -0,0 +1,9 @@ +#include "Sound.h" + +sf::Music Sound::BACK_GROUND; +sf::Music Sound::ENEMY_DOWN; + +void Sound::load(){ + BACK_GROUND.openFromFile(resourcePath() + "sound\\game_music.ogg"); + ENEMY_DOWN.openFromFile(resourcePath() + "sound\\enemy1_down.ogg"); +} diff --git a/Fighter/Fighter/Sound.h b/Fighter/Fighter/Sound.h new file mode 100644 index 0000000..8506875 --- /dev/null +++ b/Fighter/Fighter/Sound.h @@ -0,0 +1,16 @@ + +#ifndef __Fighters__Sound__ +#define __Fighters__Sound__ + +#include +#include "ResourcePath.hpp" + +class Sound{ +public: + static sf::Music BACK_GROUND; + static sf::Music ENEMY_DOWN; + + static void load(); +}; + +#endif /* defined(__Fighters__Sound__) */ diff --git a/Fighter/Fighter/Sprite.cpp b/Fighter/Fighter/Sprite.cpp new file mode 100644 index 0000000..09d0cdd --- /dev/null +++ b/Fighter/Fighter/Sprite.cpp @@ -0,0 +1,16 @@ +#include "Sprite.h" +#include "Sky.h" + +void Sprite::draw(){ + Sky::getInstance()->getWindow()->draw(*this); +} + +Rect Sprite::getRect(){ + Rect r; + r.x=this->getPosition().x; + r.y=this->getPosition().y; + r.w=this->getLocalBounds().width; + r.h=this->getLocalBounds().height; + + return r; +} \ No newline at end of file diff --git a/Fighter/Fighter/Sprite.h b/Fighter/Fighter/Sprite.h new file mode 100644 index 0000000..208dbac --- /dev/null +++ b/Fighter/Fighter/Sprite.h @@ -0,0 +1,17 @@ +#ifndef __Fighters__Sprite__ +#define __Fighters__Sprite__ + +#include + +#include +#include "Rect.h" + +class Sprite:public sf::Sprite{ +public: + virtual void heartBeat(){}; + void draw(); + Rect getRect(); + +}; + +#endif /* defined(__Fighters__Sprite__) */ diff --git a/Fighter/Fighter/Texture.cpp b/Fighter/Fighter/Texture.cpp new file mode 100644 index 0000000..f5b3368 --- /dev/null +++ b/Fighter/Fighter/Texture.cpp @@ -0,0 +1,31 @@ +#include "Texture.h" + +sf::Texture Texture::HERO; + +sf::Texture Texture::ENEMY; +sf::Texture Texture::ENEMY_DOWN_1; +sf::Texture Texture::ENEMY_DOWN_2; +sf::Texture Texture::ENEMY_DOWN_3; +sf::Texture Texture::ENEMY_DOWN_4; + +sf::Texture Texture::BULLET; + +sf::Texture Texture::SKY; +sf::Texture Texture::OVER; + +void Texture::load(){ + std::string path = resourcePath() + "image\\shoot.png"; + + HERO.loadFromFile(path, sf::IntRect(0, 99, 102, 126)); + + ENEMY.loadFromFile(path, sf::IntRect(534, 612, 57, 43)); + ENEMY_DOWN_1.loadFromFile(path, sf::IntRect(267, 347, 57, 51)); + ENEMY_DOWN_2.loadFromFile(path, sf::IntRect(873, 697, 57, 51)); + ENEMY_DOWN_3.loadFromFile(path, sf::IntRect(267, 296, 57, 51)); + ENEMY_DOWN_4.loadFromFile(path, sf::IntRect(930, 697, 57, 51)); + + BULLET.loadFromFile(path, sf::IntRect(1004, 987, 9, 21)); + + SKY.loadFromFile(resourcePath() + "image\\background.png"); + OVER.loadFromFile(resourcePath() + "image\\gameover.png"); +} diff --git a/Fighter/Fighter/Texture.h b/Fighter/Fighter/Texture.h new file mode 100644 index 0000000..5137e0d --- /dev/null +++ b/Fighter/Fighter/Texture.h @@ -0,0 +1,25 @@ +#ifndef __Fighters__Texture__ +#define __Fighters__Texture__ + +#include +#include "ResourcePath.hpp" + +class Texture{ +public: + static sf::Texture HERO; + + static sf::Texture ENEMY; + static sf::Texture ENEMY_DOWN_1; + static sf::Texture ENEMY_DOWN_2; + static sf::Texture ENEMY_DOWN_3; + static sf::Texture ENEMY_DOWN_4; + + static sf::Texture BULLET; + + static sf::Texture SKY; + static sf::Texture OVER; + + static void load(); +}; + +#endif /* defined(__Fighters__Texture__) */ diff --git a/Fighter/Fighter/main.cpp b/Fighter/Fighter/main.cpp new file mode 100644 index 0000000..3378a65 --- /dev/null +++ b/Fighter/Fighter/main.cpp @@ -0,0 +1,60 @@ +#include +#include + +#include "ResourcePath.hpp" + +#include "Sky.h" +#include "Texture.h" +#include "Hero.h" +#include "Sound.h" +int main() +{ + int num = 0; + Texture::load(); + Sound::load(); + + Sky* sky = Sky::getInstance(); + sf::RenderWindow* window = sky->getWindow(); + + Sound::BACK_GROUND.play(); + Hero hero; + sky->add(&hero); + while (window->isOpen()) + { + sf::Event event; + while (window->pollEvent(event)) + { + if (event.type == sf::Event::Closed) { + window->close(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape) { + window->close(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Left) { + hero.move2left(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Right) { + hero.move2right(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Up) { + hero.move2up(); + } + + if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Down) { + hero.move2down(); + } + } + if (++num >= 30){ + hero.fire(); + num = 0; + } + sky->refresh(); + + } + + return EXIT_SUCCESS; +} diff --git a/Fighter/Fighter/resources/font/STHeiti Light.ttc b/Fighter/Fighter/resources/font/STHeiti Light.ttc new file mode 100644 index 0000000..c1260a8 Binary files /dev/null and b/Fighter/Fighter/resources/font/STHeiti Light.ttc differ diff --git a/Fighter/Fighter/resources/image/background.png b/Fighter/Fighter/resources/image/background.png new file mode 100644 index 0000000..2be5fe8 Binary files /dev/null and b/Fighter/Fighter/resources/image/background.png differ diff --git a/Fighter/Fighter/resources/image/gameover.png b/Fighter/Fighter/resources/image/gameover.png new file mode 100644 index 0000000..105eebb Binary files /dev/null and b/Fighter/Fighter/resources/image/gameover.png differ diff --git a/Fighter/Fighter/resources/image/shoot.pack b/Fighter/Fighter/resources/image/shoot.pack new file mode 100644 index 0000000..f971c65 --- /dev/null +++ b/Fighter/Fighter/resources/image/shoot.pack @@ -0,0 +1,236 @@ + +shoot.png +format: RGBA8888 +filter: Nearest,Nearest +repeat: none +enemy3_down6 + rotate: false + xy: 0, 747 + size: 166, 261 + orig: 166, 261 + offset: 0, 0 + index: -1 +enemy3_hit + rotate: false + xy: 166, 750 + size: 169, 258 + orig: 169, 258 + offset: 0, 0 + index: -1 +enemy3_n1 + rotate: false + xy: 335, 750 + size: 169, 258 + orig: 169, 258 + offset: 0, 0 + index: -1 +enemy3_n2 + rotate: false + xy: 504, 750 + size: 169, 258 + orig: 169, 258 + offset: 0, 0 + index: -1 +enemy3_down1 + rotate: false + xy: 0, 486 + size: 165, 261 + orig: 165, 261 + offset: 0, 0 + index: -1 +enemy3_down2 + rotate: false + xy: 0, 225 + size: 165, 261 + orig: 165, 261 + offset: 0, 0 + index: -1 +enemy3_down5 + rotate: false + xy: 673, 748 + size: 166, 260 + orig: 166, 260 + offset: 0, 0 + index: -1 +enemy3_down3 + rotate: false + xy: 839, 748 + size: 165, 260 + orig: 165, 260 + offset: 0, 0 + index: -1 +enemy3_down4 + rotate: false + xy: 165, 486 + size: 165, 261 + orig: 165, 261 + offset: 0, 0 + index: -1 +hero1 + rotate: false + xy: 0, 99 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +hero2 + rotate: false + xy: 165, 360 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +hero_blowup_n1 + rotate: false + xy: 165, 234 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +hero_blowup_n2 + rotate: false + xy: 330, 624 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +hero_blowup_n3 + rotate: false + xy: 330, 498 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +hero_blowup_n4 + rotate: false + xy: 432, 624 + size: 102, 126 + orig: 102, 126 + offset: 0, 0 + index: -1 +enemy2 + rotate: false + xy: 0, 0 + size: 69, 99 + orig: 69, 99 + offset: 0, 0 + index: -1 +enemy2_hit + rotate: false + xy: 432, 525 + size: 69, 99 + orig: 69, 99 + offset: 0, 0 + index: -1 +ufo2 + rotate: false + xy: 102, 118 + size: 60, 107 + orig: 60, 107 + offset: 0, 0 + index: -1 +enemy2_down1 + rotate: false + xy: 534, 655 + size: 69, 95 + orig: 69, 95 + offset: 0, 0 + index: -1 +enemy2_down2 + rotate: false + xy: 603, 655 + size: 69, 95 + orig: 69, 95 + offset: 0, 0 + index: -1 +enemy2_down3 + rotate: false + xy: 672, 653 + size: 69, 95 + orig: 69, 95 + offset: 0, 0 + index: -1 +enemy2_down4 + rotate: false + xy: 741, 653 + size: 69, 95 + orig: 69, 95 + offset: 0, 0 + index: -1 +ufo1 + rotate: false + xy: 267, 398 + size: 58, 88 + orig: 58, 88 + offset: 0, 0 + index: -1 +bomb + rotate: false + xy: 810, 691 + size: 63, 57 + orig: 63, 57 + offset: 0, 0 + index: -1 +enemy1_down1 + rotate: false + xy: 267, 347 + size: 57, 51 + orig: 57, 51 + offset: 0, 0 + index: -1 +enemy1_down2 + rotate: false + xy: 873, 697 + size: 57, 51 + orig: 57, 51 + offset: 0, 0 + index: -1 +enemy1_down3 + rotate: false + xy: 267, 296 + size: 57, 51 + orig: 57, 51 + offset: 0, 0 + index: -1 +enemy1_down4 + rotate: false + xy: 930, 697 + size: 57, 51 + orig: 57, 51 + offset: 0, 0 + index: -1 +game_pause_nor + rotate: false + xy: 267, 251 + size: 60, 45 + orig: 60, 45 + offset: 0, 0 + index: -1 +game_pause_pressed + rotate: false + xy: 810, 646 + size: 60, 45 + orig: 60, 45 + offset: 0, 0 + index: -1 +enemy1 + rotate: false + xy: 534, 612 + size: 57, 43 + orig: 57, 43 + offset: 0, 0 + index: -1 +bullet1 + rotate: false + xy: 1004, 987 + size: 9, 21 + orig: 9, 21 + offset: 0, 0 + index: -1 +bullet2 + rotate: false + xy: 69, 78 + size: 9, 21 + orig: 9, 21 + offset: 0, 0 + index: -1 diff --git a/Fighter/Fighter/resources/image/shoot.png b/Fighter/Fighter/resources/image/shoot.png new file mode 100644 index 0000000..47d85ce Binary files /dev/null and b/Fighter/Fighter/resources/image/shoot.png differ diff --git a/Fighter/Fighter/resources/sound/achievement.ogg b/Fighter/Fighter/resources/sound/achievement.ogg new file mode 100644 index 0000000..1d459c2 Binary files /dev/null and b/Fighter/Fighter/resources/sound/achievement.ogg differ diff --git a/Fighter/Fighter/resources/sound/big_spaceship_flying.ogg b/Fighter/Fighter/resources/sound/big_spaceship_flying.ogg new file mode 100644 index 0000000..98cc00c Binary files /dev/null and b/Fighter/Fighter/resources/sound/big_spaceship_flying.ogg differ diff --git a/Fighter/Fighter/resources/sound/bullet.ogg b/Fighter/Fighter/resources/sound/bullet.ogg new file mode 100644 index 0000000..175f5b0 Binary files /dev/null and b/Fighter/Fighter/resources/sound/bullet.ogg differ diff --git a/Fighter/Fighter/resources/sound/button.ogg b/Fighter/Fighter/resources/sound/button.ogg new file mode 100644 index 0000000..87de5dd Binary files /dev/null and b/Fighter/Fighter/resources/sound/button.ogg differ diff --git a/Fighter/Fighter/resources/sound/enemy1_down.ogg b/Fighter/Fighter/resources/sound/enemy1_down.ogg new file mode 100644 index 0000000..7023b90 Binary files /dev/null and b/Fighter/Fighter/resources/sound/enemy1_down.ogg differ diff --git a/Fighter/Fighter/resources/sound/enemy2_down.ogg b/Fighter/Fighter/resources/sound/enemy2_down.ogg new file mode 100644 index 0000000..725c084 Binary files /dev/null and b/Fighter/Fighter/resources/sound/enemy2_down.ogg differ diff --git a/Fighter/Fighter/resources/sound/enemy3_down.ogg b/Fighter/Fighter/resources/sound/enemy3_down.ogg new file mode 100644 index 0000000..d7e982c Binary files /dev/null and b/Fighter/Fighter/resources/sound/enemy3_down.ogg differ diff --git a/Fighter/Fighter/resources/sound/game_music.ogg b/Fighter/Fighter/resources/sound/game_music.ogg new file mode 100644 index 0000000..9ef2e18 Binary files /dev/null and b/Fighter/Fighter/resources/sound/game_music.ogg differ diff --git a/Fighter/Fighter/resources/sound/game_over.ogg b/Fighter/Fighter/resources/sound/game_over.ogg new file mode 100644 index 0000000..5a7a507 Binary files /dev/null and b/Fighter/Fighter/resources/sound/game_over.ogg differ diff --git a/Fighter/Fighter/resources/sound/get_bomb.ogg b/Fighter/Fighter/resources/sound/get_bomb.ogg new file mode 100644 index 0000000..336a4c6 Binary files /dev/null and b/Fighter/Fighter/resources/sound/get_bomb.ogg differ diff --git a/Fighter/Fighter/resources/sound/get_double_laser.ogg b/Fighter/Fighter/resources/sound/get_double_laser.ogg new file mode 100644 index 0000000..50d4a40 Binary files /dev/null and b/Fighter/Fighter/resources/sound/get_double_laser.ogg differ diff --git a/Fighter/Fighter/resources/sound/out_porp.ogg b/Fighter/Fighter/resources/sound/out_porp.ogg new file mode 100644 index 0000000..1e20b58 Binary files /dev/null and b/Fighter/Fighter/resources/sound/out_porp.ogg differ diff --git a/Fighter/Fighter/resources/sound/use_bomb.ogg b/Fighter/Fighter/resources/sound/use_bomb.ogg new file mode 100644 index 0000000..2e2adc7 Binary files /dev/null and b/Fighter/Fighter/resources/sound/use_bomb.ogg differ diff --git a/Fighter/Fighters.xcodeproj/project.pbxproj b/Fighter/Fighters.xcodeproj/project.pbxproj new file mode 100644 index 0000000..974799a --- /dev/null +++ b/Fighter/Fighters.xcodeproj/project.pbxproj @@ -0,0 +1,384 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + F46CF3EA181B5861001ED527 /* ResourcePath.mm in Sources */ = {isa = PBXBuildFile; fileRef = F46CF3E9181B5861001ED527 /* ResourcePath.mm */; }; + F46CF3ED181B5861001ED527 /* main.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF3EC181B5861001ED527 /* main.cpp */; }; + F46CF43E181B5F28001ED527 /* font in Resources */ = {isa = PBXBuildFile; fileRef = F46CF43B181B5F28001ED527 /* font */; }; + F46CF43F181B5F28001ED527 /* image in Resources */ = {isa = PBXBuildFile; fileRef = F46CF43C181B5F28001ED527 /* image */; }; + F46CF440181B5F28001ED527 /* sound in Resources */ = {isa = PBXBuildFile; fileRef = F46CF43D181B5F28001ED527 /* sound */; }; + F46CF443181BB492001ED527 /* Plane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF441181BB492001ED527 /* Plane.cpp */; }; + F46CF449181BBFFE001ED527 /* Gun.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF447181BBFFE001ED527 /* Gun.cpp */; }; + F46CF44C181BC19D001ED527 /* Bullet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF44A181BC19D001ED527 /* Bullet.cpp */; }; + F46CF44F181BC418001ED527 /* Sky.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF44D181BC418001ED527 /* Sky.cpp */; }; + F46CF452181BD0DA001ED527 /* Sprite.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF450181BD0DA001ED527 /* Sprite.cpp */; }; + F46CF455181C0C21001ED527 /* Enemy.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF453181C0C21001ED527 /* Enemy.cpp */; }; + F46CF458181CA8E7001ED527 /* Rect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F46CF456181CA8E7001ED527 /* Rect.cpp */; }; + F479EC6A181E0D3A00A33FC4 /* Texture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F479EC68181E0D3A00A33FC4 /* Texture.cpp */; }; + F479EC6D181E0F5000A33FC4 /* Hero.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F479EC6B181E0F5000A33FC4 /* Hero.cpp */; }; + F479EC70181E32AB00A33FC4 /* Sound.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F479EC6E181E32AB00A33FC4 /* Sound.cpp */; }; + F479EC73181E392400A33FC4 /* Game.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F479EC71181E392400A33FC4 /* Game.cpp */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + F46CF3E4181B5861001ED527 /* Fighters.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Fighters.app; sourceTree = BUILT_PRODUCTS_DIR; }; + F46CF3E8181B5861001ED527 /* Fighters-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Fighters-Info.plist"; sourceTree = ""; }; + F46CF3E9181B5861001ED527 /* ResourcePath.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ResourcePath.mm; sourceTree = ""; }; + F46CF3EB181B5861001ED527 /* ResourcePath.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = ResourcePath.hpp; sourceTree = ""; }; + F46CF3EC181B5861001ED527 /* main.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = main.cpp; sourceTree = ""; }; + F46CF43B181B5F28001ED527 /* font */ = {isa = PBXFileReference; lastKnownFileType = folder; name = font; path = resources/font; sourceTree = ""; }; + F46CF43C181B5F28001ED527 /* image */ = {isa = PBXFileReference; lastKnownFileType = folder; name = image; path = resources/image; sourceTree = ""; }; + F46CF43D181B5F28001ED527 /* sound */ = {isa = PBXFileReference; lastKnownFileType = folder; name = sound; path = resources/sound; sourceTree = ""; }; + F46CF441181BB492001ED527 /* Plane.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Plane.cpp; sourceTree = ""; }; + F46CF442181BB492001ED527 /* Plane.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plane.h; sourceTree = ""; }; + F46CF447181BBFFE001ED527 /* Gun.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Gun.cpp; sourceTree = ""; }; + F46CF448181BBFFE001ED527 /* Gun.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Gun.h; sourceTree = ""; }; + F46CF44A181BC19D001ED527 /* Bullet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bullet.cpp; sourceTree = ""; }; + F46CF44B181BC19D001ED527 /* Bullet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bullet.h; sourceTree = ""; }; + F46CF44D181BC418001ED527 /* Sky.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sky.cpp; sourceTree = ""; }; + F46CF44E181BC418001ED527 /* Sky.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sky.h; sourceTree = ""; }; + F46CF450181BD0DA001ED527 /* Sprite.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sprite.cpp; sourceTree = ""; }; + F46CF451181BD0DA001ED527 /* Sprite.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sprite.h; sourceTree = ""; }; + F46CF453181C0C21001ED527 /* Enemy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Enemy.cpp; sourceTree = ""; }; + F46CF454181C0C21001ED527 /* Enemy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Enemy.h; sourceTree = ""; }; + F46CF456181CA8E7001ED527 /* Rect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Rect.cpp; sourceTree = ""; }; + F46CF457181CA8E7001ED527 /* Rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rect.h; sourceTree = ""; }; + F479EC68181E0D3A00A33FC4 /* Texture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Texture.cpp; sourceTree = ""; }; + F479EC69181E0D3A00A33FC4 /* Texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Texture.h; sourceTree = ""; }; + F479EC6B181E0F5000A33FC4 /* Hero.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Hero.cpp; sourceTree = ""; }; + F479EC6C181E0F5000A33FC4 /* Hero.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hero.h; sourceTree = ""; }; + F479EC6E181E32AB00A33FC4 /* Sound.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Sound.cpp; sourceTree = ""; }; + F479EC6F181E32AB00A33FC4 /* Sound.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Sound.h; sourceTree = ""; }; + F479EC71181E392400A33FC4 /* Game.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Game.cpp; sourceTree = ""; }; + F479EC72181E392400A33FC4 /* Game.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Game.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F46CF3E0181B5861001ED527 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + F46CF3DA181B5861001ED527 = { + isa = PBXGroup; + children = ( + F46CF3E6181B5861001ED527 /* Fighters */, + F46CF3E5181B5861001ED527 /* Products */, + ); + sourceTree = ""; + }; + F46CF3E5181B5861001ED527 /* Products */ = { + isa = PBXGroup; + children = ( + F46CF3E4181B5861001ED527 /* Fighters.app */, + ); + name = Products; + sourceTree = ""; + }; + F46CF3E6181B5861001ED527 /* Fighters */ = { + isa = PBXGroup; + children = ( + F46CF447181BBFFE001ED527 /* Gun.cpp */, + F46CF448181BBFFE001ED527 /* Gun.h */, + F46CF3E9181B5861001ED527 /* ResourcePath.mm */, + F46CF3EB181B5861001ED527 /* ResourcePath.hpp */, + F46CF3EC181B5861001ED527 /* main.cpp */, + F46CF441181BB492001ED527 /* Plane.cpp */, + F46CF442181BB492001ED527 /* Plane.h */, + F46CF3EE181B5861001ED527 /* Resources */, + F46CF3E7181B5861001ED527 /* Supporting Files */, + F46CF44A181BC19D001ED527 /* Bullet.cpp */, + F46CF44B181BC19D001ED527 /* Bullet.h */, + F46CF44D181BC418001ED527 /* Sky.cpp */, + F46CF44E181BC418001ED527 /* Sky.h */, + F46CF450181BD0DA001ED527 /* Sprite.cpp */, + F46CF451181BD0DA001ED527 /* Sprite.h */, + F46CF453181C0C21001ED527 /* Enemy.cpp */, + F46CF454181C0C21001ED527 /* Enemy.h */, + F46CF456181CA8E7001ED527 /* Rect.cpp */, + F46CF457181CA8E7001ED527 /* Rect.h */, + F479EC68181E0D3A00A33FC4 /* Texture.cpp */, + F479EC69181E0D3A00A33FC4 /* Texture.h */, + F479EC6B181E0F5000A33FC4 /* Hero.cpp */, + F479EC6C181E0F5000A33FC4 /* Hero.h */, + F479EC6E181E32AB00A33FC4 /* Sound.cpp */, + F479EC6F181E32AB00A33FC4 /* Sound.h */, + F479EC71181E392400A33FC4 /* Game.cpp */, + F479EC72181E392400A33FC4 /* Game.h */, + ); + path = Fighters; + sourceTree = ""; + }; + F46CF3E7181B5861001ED527 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + F46CF3E8181B5861001ED527 /* Fighters-Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + F46CF3EE181B5861001ED527 /* Resources */ = { + isa = PBXGroup; + children = ( + F46CF43B181B5F28001ED527 /* font */, + F46CF43C181B5F28001ED527 /* image */, + F46CF43D181B5F28001ED527 /* sound */, + ); + name = Resources; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + F46CF3E3181B5861001ED527 /* Fighters */ = { + isa = PBXNativeTarget; + buildConfigurationList = F46CF3F9181B5861001ED527 /* Build configuration list for PBXNativeTarget "Fighters" */; + buildPhases = ( + F46CF3DF181B5861001ED527 /* Sources */, + F46CF3E0181B5861001ED527 /* Frameworks */, + F46CF3E1181B5861001ED527 /* Resources */, + F46CF3E2181B5861001ED527 /* ShellScript */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Fighters; + productName = Fighters; + productReference = F46CF3E4181B5861001ED527 /* Fighters.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F46CF3DB181B5861001ED527 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0500; + ORGANIZATIONNAME = luckymark; + }; + buildConfigurationList = F46CF3DE181B5861001ED527 /* Build configuration list for PBXProject "Fighters" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = F46CF3DA181B5861001ED527; + productRefGroup = F46CF3E5181B5861001ED527 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + F46CF3E3181B5861001ED527 /* Fighters */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + F46CF3E1181B5861001ED527 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F46CF43F181B5F28001ED527 /* image in Resources */, + F46CF43E181B5F28001ED527 /* font in Resources */, + F46CF440181B5F28001ED527 /* sound in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + F46CF3E2181B5861001ED527 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "# This shell script simply copies required sfml dylibs/frameworks into the application bundle frameworks folder.\n# If you're using static libraries (which is not recommended) you should remove this script from your project.\n\n# Are we building a project that uses framework or dylibs ?\ncase \"$SFML_BINARY_TYPE\" in\n DYLIBS)\n frameworks=\"false\"\n ;;\n *)\n frameworks=\"true\"\n ;;\nesac\n\n# Echoes to stderr\nerror () # $* message to display\n{\n echo $* 1>&2\n exit 2\n}\n\nassert () # $1 is a boolean, $2...N is an error message\n{\n if [ $# -lt 2 ]\n then\n error \"Internal error in assert : not enough args\"\n fi\n\n if [ $1 -ne 0 ]\n then\n shift\n error \"$*\"\n fi\n}\n\nforce_remove () # $1 is a path\n{\n test $# -eq 1\n assert $? \"force_remove() requires one parameter\"\n rm -fr \"$1\"\n assert $? \"couldn't remove $1\"\n}\n\ncopy () # $1 is a source, $2 is a destination\n{\n test $# -eq 2\n assert $? \"copy() requires two parameters\"\n ditto \"$1\" \"$2\"\n assert $? \"couldn't copy $1 to $2\"\n}\n\nrequire () # $1 is a SFML module like 'system' or 'audio'\n{\n dest=\"$BUILT_PRODUCTS_DIR/$PRODUCT_NAME.app/Contents/Frameworks\"\n\n if [ -z \"$1\" ]\n then\n error \"require() requires one parameter!\"\n else\n # clean potentially old stuff\n force_remove \"$dest/libsfml-$1.2.dylib\"\n force_remove \"$dest/libsfml-$1-d.2.dylib\"\n force_remove \"$dest/sfml-$1.framework\"\n\n # copy SFML libraries\n if [ \"$frameworks\" = \"true\" ]\n then\n copy \"/Library/Frameworks/sfml-$1.framework\" \"$dest/sfml-$1.framework\"\n elif [ \"$SFML_LINK_DYLIBS_SUFFIX\" = \"-d\" ]\n then\n copy \"/usr/local/lib/libsfml-$1-d.2.dylib\" \"$dest/libsfml-$1-d.2.dylib\"\n else\n copy \"/usr/local/lib/libsfml-$1.2.dylib\" \"$dest/libsfml-$1.2.dylib\"\n fi\n\n if [ \"$1\" = \"audio\" ]\n then\n # copy sndfile framework too\n copy \"/Library/Frameworks/sndfile.framework\" \"$dest/sndfile.framework\"\n fi\n\n if [ \"$1\" = \"graphics\" ]\n then\n # copy freetype framework too\n copy \"/Library/Frameworks/freetype.framework\" \"$dest/freetype.framework\"\n fi\n fi\n}\n\nif [ -n \"$SFML_SYSTEM\" ]\nthen\n require \"system\"\nfi\n\nif [ -n \"$SFML_AUDIO\" ]\nthen\n require \"audio\"\nfi\n\nif [ -n \"$SFML_NETWORK\" ]\nthen\n require \"network\"\nfi\n\nif [ -n \"$SFML_WINDOW\" ]\nthen\n require \"window\"\nfi\n\nif [ -n \"$SFML_GRAPHICS\" ]\nthen\n require \"graphics\"\nfi\n\n "; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + F46CF3DF181B5861001ED527 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F46CF458181CA8E7001ED527 /* Rect.cpp in Sources */, + F46CF455181C0C21001ED527 /* Enemy.cpp in Sources */, + F479EC6D181E0F5000A33FC4 /* Hero.cpp in Sources */, + F46CF44C181BC19D001ED527 /* Bullet.cpp in Sources */, + F46CF443181BB492001ED527 /* Plane.cpp in Sources */, + F46CF3ED181B5861001ED527 /* main.cpp in Sources */, + F479EC6A181E0D3A00A33FC4 /* Texture.cpp in Sources */, + F479EC73181E392400A33FC4 /* Game.cpp in Sources */, + F46CF44F181BC418001ED527 /* Sky.cpp in Sources */, + F46CF449181BBFFE001ED527 /* Gun.cpp in Sources */, + F46CF452181BD0DA001ED527 /* Sprite.cpp in Sources */, + F46CF3EA181B5861001ED527 /* ResourcePath.mm in Sources */, + F479EC70181E32AB00A33FC4 /* Sound.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + F46CF3F7181B5861001ED527 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks/, + "$(inherited)", + ); + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/local/include/, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + /usr/local/lib/, + "$(inherited)", + ); + ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = ( + "$(inherited)", + "$(SFML_SYSTEM)", + "$(SFML_WINDOW)", + "$(SFML_GRAPHICS)", + "$(SFML_AUDIO)", + "$(SFML_NETWORK)", + ); + SFML_AUDIO = "$(SFML_LINK_PREFIX) sfml-audio$(SFML_LINK_SUFFIX)"; + SFML_BINARY_TYPE = FRAMEWORKS; + SFML_GRAPHICS = "$(SFML_LINK_PREFIX) sfml-graphics$(SFML_LINK_SUFFIX)"; + SFML_LINK_DYLIBS_PREFIX = "-l"; + SFML_LINK_DYLIBS_SUFFIX = ""; + SFML_LINK_FRAMEWORKS_PREFIX = "-framework"; + SFML_LINK_FRAMEWORKS_SUFFIX = ""; + SFML_LINK_PREFIX = "$(SFML_LINK_$(SFML_BINARY_TYPE)_PREFIX)"; + SFML_LINK_SUFFIX = "$(SFML_LINK_$(SFML_BINARY_TYPE)_SUFFIX)"; + SFML_NETWORK = ""; + SFML_SYSTEM = "$(SFML_LINK_PREFIX) sfml-system$(SFML_LINK_SUFFIX)"; + SFML_WINDOW = "$(SFML_LINK_PREFIX) sfml-window$(SFML_LINK_SUFFIX)"; + SUPPORTED_PLATFORMS = macosx; + }; + name = Debug; + }; + F46CF3F8181B5861001ED527 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_CXX_LANGUAGE_STANDARD = "c++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + COPY_PHASE_STRIP = YES; + FRAMEWORK_SEARCH_PATHS = ( + /Library/Frameworks/, + "$(inherited)", + ); + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + /usr/local/include/, + "$(inherited)", + ); + LIBRARY_SEARCH_PATHS = ( + /usr/local/lib/, + "$(inherited)", + ); + ONLY_ACTIVE_ARCH = NO; + OTHER_LDFLAGS = ( + "$(inherited)", + "$(SFML_SYSTEM)", + "$(SFML_WINDOW)", + "$(SFML_GRAPHICS)", + "$(SFML_AUDIO)", + "$(SFML_NETWORK)", + ); + SFML_AUDIO = "$(SFML_LINK_PREFIX) sfml-audio$(SFML_LINK_SUFFIX)"; + SFML_BINARY_TYPE = FRAMEWORKS; + SFML_GRAPHICS = "$(SFML_LINK_PREFIX) sfml-graphics$(SFML_LINK_SUFFIX)"; + SFML_LINK_DYLIBS_PREFIX = "-l"; + SFML_LINK_DYLIBS_SUFFIX = ""; + SFML_LINK_FRAMEWORKS_PREFIX = "-framework"; + SFML_LINK_FRAMEWORKS_SUFFIX = ""; + SFML_LINK_PREFIX = "$(SFML_LINK_$(SFML_BINARY_TYPE)_PREFIX)"; + SFML_LINK_SUFFIX = "$(SFML_LINK_$(SFML_BINARY_TYPE)_SUFFIX)"; + SFML_NETWORK = ""; + SFML_SYSTEM = "$(SFML_LINK_PREFIX) sfml-system$(SFML_LINK_SUFFIX)"; + SFML_WINDOW = "$(SFML_LINK_PREFIX) sfml-window$(SFML_LINK_SUFFIX)"; + SUPPORTED_PLATFORMS = macosx; + }; + name = Release; + }; + F46CF3FA181B5861001ED527 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "Fighters/Fighters-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + F46CF3FB181B5861001ED527 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = "Fighters/Fighters-Info.plist"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F46CF3DE181B5861001ED527 /* Build configuration list for PBXProject "Fighters" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F46CF3F7181B5861001ED527 /* Debug */, + F46CF3F8181B5861001ED527 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + F46CF3F9181B5861001ED527 /* Build configuration list for PBXNativeTarget "Fighters" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F46CF3FA181B5861001ED527 /* Debug */, + F46CF3FB181B5861001ED527 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = F46CF3DB181B5861001ED527 /* Project object */; +} diff --git a/Fighter/Fighters.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/Fighter/Fighters.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..e22b781 --- /dev/null +++ b/Fighter/Fighters.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + +