Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Space-Invaders/Space-Invaders.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@
<ClCompile Include="source\Enemy\EnemyModel.cpp" />
<ClCompile Include="source\Enemy\EnemyService.cpp" />
<ClCompile Include="source\Enemy\EnemyView.cpp" />
<ClCompile Include="source\Entity\Bullet.cpp" />
<ClCompile Include="source\Event\EventService.cpp" />
<ClCompile Include="source\Gameplay\GameplayController.cpp" />
<ClCompile Include="source\Gameplay\GameplayService.cpp" />
Expand Down Expand Up @@ -187,6 +188,7 @@
<ClCompile Include="source\UI\SplashScreen\SplashScreenUIController.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\Entity\Bullet.h" />
<ClInclude Include="header\Entity\EntityConfig.h" />
<ClInclude Include="header\Collision\CollisionService.h" />
<ClInclude Include="header\Collision\ICollider.h" />
Expand Down
2 changes: 2 additions & 0 deletions Space-Invaders/Space-Invaders.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
<ClCompile Include="source\UI\UIElement\TextView.cpp" />
<ClCompile Include="source\UI\UIElement\UIView.cpp" />
<ClCompile Include="source\UI\SplashScreen\SplashScreenUIController.cpp" />
<ClCompile Include="source\Entity\Bullet.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="header\Entity\EntityConfig.h" />
Expand Down Expand Up @@ -113,5 +114,6 @@
<ClInclude Include="header\UI\UIElement\TextView.h" />
<ClInclude Include="header\UI\UIElement\UIView.h" />
<ClInclude Include="header\UI\SplashScreen\SplashScreenUIController.h" />
<ClInclude Include="header\Entity\Bullet.h" />
</ItemGroup>
</Project>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.39.33519:TargetPlatformVersion=10.0.22621.0:
Debug|Win32|D:\SME test\SME-Assignment\Space-Invaders\|
Binary file added Space-Invaders/Space-Invaders/Debug/vc143.idb
Binary file not shown.
Binary file added Space-Invaders/Space-Invaders/Debug/vc143.pdb
Binary file not shown.
7 changes: 7 additions & 0 deletions Space-Invaders/header/Enemy/EnemyController.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../Collision/ICollider.h"
#include "../Entity/Bullet.h"

namespace Enemy
{
Expand Down Expand Up @@ -29,6 +30,10 @@ namespace Enemy
sf::Vector2f getRandomInitialPosition();
void handleOutOfBounds();
virtual void destroy();
private:
float bulletCooldown;
float elapsedBulletCooldown;
std::vector<Bullet::Bullet*> enemyBullets;

public:
EnemyController(EnemyType type);
Expand All @@ -46,5 +51,7 @@ namespace Enemy
virtual void onCollision(ICollider* other_collider) override;

virtual void processScore();
void fireBullet();
void updateEnemyBullets();
};
}
28 changes: 28 additions & 0 deletions Space-Invaders/header/Entity/Bullet.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Bullet
{
class Bullet
{
public:
Bullet();
Bullet(sf::Vector2f position, sf::Vector2f velocity); // Constructor with position and velocity
~Bullet();

void setPosition(sf::Vector2f position);
void setVelocity(sf::Vector2f velocity);
sf::Vector2f getPosition() const;
sf::Vector2f getVelocity() const;

void update();
void render(sf::RenderWindow& window); // Render method taking SFML window reference

bool isOutOfBounds(const sf::RenderWindow& window); // To check if the bullet leaves the screen

private:
sf::Vector2f m_position;
sf::Vector2f m_velocity;
sf::CircleShape m_shape; // For visual representation (circle in this case)
};
}
16 changes: 14 additions & 2 deletions Space-Invaders/header/Player/PlayerController.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include "../Collision/ICollider.h"
#include "../../header/Powerup/PowerupConfig.h"
#include "../../header/Player/PlayerModel.h"
#include "../../header/Player/PlayerView.h"
#include "../Entity/Bullet.h"

// Forward declaration of PlayerView class
namespace Player {
class PlayerView;
}

namespace Player
{
Expand All @@ -14,9 +19,14 @@ namespace Player
float elapsed_rapid_fire_duration;
float elapsed_tripple_laser_duration;

float bulletCooldown;
float elapsedBulletCooldown;
std::vector<Bullet::Bullet*> playerBullets;


float elapsed_fire_duration;
float elapsed_freez_duration;

PlayerView* player_view;
PlayerModel* player_model;

Expand Down Expand Up @@ -61,5 +71,7 @@ namespace Player

const sf::Sprite& getColliderSprite() override;
void onCollision(ICollider* other_collider) override;
void fireBullet();
void updatePlayerBullets();
};
}
56 changes: 56 additions & 0 deletions Space-Invaders/sfml/include/SFML/Audio.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
//
////////////////////////////////////////////////////////////

#ifndef SFML_AUDIO_HPP
#define SFML_AUDIO_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////

#include <SFML/System.hpp>
#include <SFML/Audio/InputSoundFile.hpp>
#include <SFML/Audio/Listener.hpp>
#include <SFML/Audio/Music.hpp>
#include <SFML/Audio/OutputSoundFile.hpp>
#include <SFML/Audio/Sound.hpp>
#include <SFML/Audio/SoundBuffer.hpp>
#include <SFML/Audio/SoundBufferRecorder.hpp>
#include <SFML/Audio/SoundFileFactory.hpp>
#include <SFML/Audio/SoundFileReader.hpp>
#include <SFML/Audio/SoundFileWriter.hpp>
#include <SFML/Audio/SoundRecorder.hpp>
#include <SFML/Audio/SoundSource.hpp>
#include <SFML/Audio/SoundStream.hpp>


#endif // SFML_AUDIO_HPP

////////////////////////////////////////////////////////////
/// \defgroup audio Audio module
///
/// Sounds, streaming (musics or custom sources), recording,
/// spatialization.
///
////////////////////////////////////////////////////////////
70 changes: 70 additions & 0 deletions Space-Invaders/sfml/include/SFML/Audio/AlResource.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
//
////////////////////////////////////////////////////////////

#ifndef SFML_ALRESOURCE_HPP
#define SFML_ALRESOURCE_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Audio/Export.hpp>


namespace sf
{
////////////////////////////////////////////////////////////
/// \brief Base class for classes that require an OpenAL context
///
////////////////////////////////////////////////////////////
class SFML_AUDIO_API AlResource
{
protected:

////////////////////////////////////////////////////////////
/// \brief Default constructor
///
////////////////////////////////////////////////////////////
AlResource();

////////////////////////////////////////////////////////////
/// \brief Destructor
///
////////////////////////////////////////////////////////////
~AlResource();
};

} // namespace sf


#endif // SFML_ALRESOURCE_HPP

////////////////////////////////////////////////////////////
/// \class sf::AlResource
/// \ingroup audio
///
/// This class is for internal use only, it must be the base
/// of every class that requires a valid OpenAL context in
/// order to work.
///
////////////////////////////////////////////////////////////
48 changes: 48 additions & 0 deletions Space-Invaders/sfml/include/SFML/Audio/Export.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
////////////////////////////////////////////////////////////
//
// SFML - Simple and Fast Multimedia Library
// Copyright (C) 2007-2023 Laurent Gomila (laurent@sfml-dev.org)
//
// 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.
//
////////////////////////////////////////////////////////////

#ifndef SFML_AUDIO_EXPORT_HPP
#define SFML_AUDIO_EXPORT_HPP

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Config.hpp>


////////////////////////////////////////////////////////////
// Define portable import / export macros
////////////////////////////////////////////////////////////
#if defined(SFML_AUDIO_EXPORTS)

#define SFML_AUDIO_API SFML_API_EXPORT

#else

#define SFML_AUDIO_API SFML_API_IMPORT

#endif


#endif // SFML_AUDIO_EXPORT_HPP
Loading