Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
9756614
Window
GR-tejas Jun 20, 2024
738edd7
Merge pull request #1 from GR-tejas/Feature-1-SFML
GR-tejas Jun 20, 2024
ae9627a
Update main.cpp
GR-tejas Jun 20, 2024
7492978
Merge pull request #2 from GR-tejas/Feature-1-SFML
GR-tejas Jun 20, 2024
5abb636
Update main.cpp
GR-tejas Jun 25, 2024
92f4fbe
Merge pull request #3 from GR-tejas/Feature-1-SFML
GR-tejas Jun 25, 2024
66e9bd2
Player Class
GR-tejas Jul 4, 2024
0633651
Update main.cpp
GR-tejas Jul 5, 2024
540dcca
Player Movement
GR-tejas Jul 5, 2024
0d45c91
Added header and source file
GR-tejas Jul 6, 2024
4918d6f
Added gameService in the main file
GR-tejas Jul 6, 2024
4ce1d67
Added service locator files
GR-tejas Jul 9, 2024
021e498
Organizing code
GR-tejas Jul 11, 2024
c0ab1c9
Added event service
GR-tejas Jul 11, 2024
436b2a5
Added player service
GR-tejas Jul 12, 2024
84c77d0
Temp
GR-tejas Jul 12, 2024
acb1182
Added TimeService
GR-tejas Jul 12, 2024
76d4f58
Added Player Model Class
GR-tejas Jul 13, 2024
98e9d89
Added Player controller and player view
GR-tejas Jul 14, 2024
94561ba
Forward Declaration
GR-tejas Jul 14, 2024
f71a244
Implemented namespace
GR-tejas Jul 14, 2024
f256d32
Added game state enum
GR-tejas Jul 14, 2024
33ea4c6
Implimented main menu controller
GR-tejas Jul 15, 2024
489a3b6
Implemented Main Menu Sprites
GR-tejas Jul 15, 2024
7f72037
Added buttons and other menu elements
GR-tejas Jul 15, 2024
833be80
Manage Button State
GR-tejas Jul 15, 2024
e118c62
temp
GR-tejas Jul 16, 2024
efca13f
Temp 2
GR-tejas Jul 22, 2024
b4f9742
Enemy Service
GR-tejas Jul 22, 2024
de1469c
Implement Enemy Movement
GR-tejas Jul 23, 2024
ad152df
Spawn Multiple Enemies
GR-tejas Jul 23, 2024
5af7057
Create Gameplay Service
GR-tejas Jul 23, 2024
857cc9a
Common Enemy Properties
GR-tejas Jul 24, 2024
7c5aac1
Unique Enemy Functionality
GR-tejas Jul 24, 2024
469c761
Movement Functionality
GR-tejas Jul 25, 2024
0340efc
Spawn Enemies
GR-tejas Jul 26, 2024
0c817e6
Create Barriers
GR-tejas Jul 26, 2024
6dec415
data for barriers
GR-tejas Jul 26, 2024
fecfead
Spawn Multiple Barriers
GR-tejas Jul 26, 2024
771f2ac
Config File Added
GR-tejas Jul 26, 2024
229ae00
Sound Service
GR-tejas Jul 26, 2024
cf94f83
Added Sounds and Music
GR-tejas Jul 26, 2024
e6e3f37
Create Projectile Interface
GR-tejas Jul 27, 2024
67f9fab
Bullet MVC
GR-tejas Jul 27, 2024
0f37aec
The Model And View
GR-tejas Jul 27, 2024
165af8e
Bullets Created
GR-tejas Jul 27, 2024
e41a287
Spawn Bullets
GR-tejas Jul 27, 2024
3d9b89b
Move The Bullets
GR-tejas Jul 27, 2024
62f71c3
Fire The Bullets
GR-tejas Jul 29, 2024
221ce22
Collectible Interface
GR-tejas Jul 29, 2024
a263aa7
Powerup Controllers
GR-tejas Jul 29, 2024
6eab029
Spawning Powerups
GR-tejas Jul 29, 2024
0fd6323
UI Interface
GR-tejas Jul 29, 2024
84b74da
Changed UI Service
GR-tejas Jul 30, 2024
2077669
Implemented Image View
GR-tejas Jul 30, 2024
14815c7
Text View
GR-tejas Jul 30, 2024
dba7736
Button View usage
GR-tejas Jul 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
17 changes: 17 additions & 0 deletions Space-Invaders/Header/Bullet/BulletConfig.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once

namespace Bullet
{
enum class BulletType
{
LASER_BULLET,
TORPEDO,
FROST_BULLET,
};

enum class MovementDirection
{
UP,
DOWN,
};
}
33 changes: 33 additions & 0 deletions Space-Invaders/Header/Bullet/BulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once
#include "../../Header/Projectile/IProjectile.h"
#include "../../Header/Bullet/BulletConfig.h"

namespace Bullet
{
class BulletView;
class BulletModel;
enum class BulletType;

class BulletController : public Projectile::IProjectile
{
protected:
BulletView* bullet_view;
BulletModel* bullet_model;

void updateProjectilePosition() override;
void moveUp();
void moveDown();
void handleOutOfBounds();

public:
BulletController(BulletType type);
virtual ~BulletController() override;

void initialize(sf::Vector2f position, Bullet::MovementDirection direction) override;
void update() override;
void render() override;

sf::Vector2f getProjectilePosition() override;
BulletType getBulletType();
};
}
37 changes: 37 additions & 0 deletions Space-Invaders/Header/Bullet/BulletModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Bullet
{
enum class BulletType;
enum class MovementDirection;

class BulletModel
{
private:
float movement_speed = 300.f;
sf::Vector2f bullet_position;

BulletType bullet_type;
MovementDirection movement_direction;

public:

BulletModel(BulletType type);
~BulletModel();

void initialize(sf::Vector2f position, MovementDirection direction);

sf::Vector2f getBulletPosition();
void setBulletPosition(sf::Vector2f position);

BulletType getBulletType();
void setBulletType(BulletType type);

MovementDirection getMovementDirection();
void setMovementDirection(MovementDirection direction);

float getMovementSpeed();
void setMovementSpeed(float speed);
};
}
31 changes: 31 additions & 0 deletions Space-Invaders/Header/Bullet/BulletService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#pragma once
#include <vector>
#include "SFML/System/Vector2.hpp"
#include "../../Header/Projectile/IProjectile.h"

namespace Bullet
{
class BulletController;
enum class BulletType;
enum class MovementDirection;

class BulletService
{
private:
std::vector<Projectile::IProjectile*> bullet_list;

BulletController* createBullet(BulletType bullet_type);
void destroy();

public:
BulletService();
virtual ~BulletService();

void initialize();
void update();
void render();

BulletController* spawnBullet(BulletType bullet_type, sf::Vector2f position, MovementDirection direction);
void destroyBullet(BulletController* bullet_controller);
};
}
32 changes: 32 additions & 0 deletions Space-Invaders/Header/Bullet/BulletView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Bullet
{
class BulletController;
enum class BulletType;

class BulletView
{
private:
const float bullet_sprite_width = 18.f;
const float bullet_sprite_height = 18.f;

sf::RenderWindow* game_window;
sf::Texture bullet_texture;
sf::Sprite bullet_sprite;

BulletController* bullet_controller;

void initializeImage(BulletType type);
void scaleImage();

public:
BulletView();
~BulletView();

void initialize(BulletController* controller);
void update();
void render();
};
}
20 changes: 20 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/FrostBulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class FrostBulletController : public BulletController
{
private:
const float torpedo_movement_speed = 200.f;

public:
FrostBulletController(BulletType type);
~FrostBulletController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
17 changes: 17 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/LaserBulletController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class LaserBulletController : public BulletController
{
public:
LaserBulletController(BulletType type);
~LaserBulletController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
20 changes: 20 additions & 0 deletions Space-Invaders/Header/Bullet/Controllers/TorpedoController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#pragma once
#include "../../Header/Bullet/BulletController.h"

namespace Bullet
{
namespace Controller
{
class TorpedoController : public BulletController
{
private:
const float torpedo_movement_speed = 200.f;

public:
TorpedoController(BulletType type);
~TorpedoController();

void initialize(sf::Vector2f position, MovementDirection direction) override;
};
}
}
17 changes: 17 additions & 0 deletions Space-Invaders/Header/Collectible/ICollectible.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#pragma once
#include <SFML/System/Vector2.hpp>

namespace Collectible
{
class ICollectible
{
public:
virtual void onCollected() = 0;
virtual void initialize(sf::Vector2f position) = 0;
virtual void update() = 0;
virtual void render() = 0;
virtual sf::Vector2f getCollectiblePosition() = 0;

virtual ~ICollectible() {};
};
}
28 changes: 28 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#pragma once
#include <SFML/Graphics.hpp>
#include "../../Header/Element/Bunker/BunkerModel.h"

namespace Element
{
namespace Bunker
{
class BunkerView;

class BunkerController
{
private:
BunkerView* bunker_view;
BunkerData bunker_data;

public:
BunkerController();
~BunkerController();

void initialize(BunkerData data);
void update();
void render();

sf::Vector2f getBunkerPosition();
};
}
}
15 changes: 15 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerModel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once
#include <SFML/System/Vector2.hpp>

namespace Element
{
namespace Bunker
{
struct BunkerData
{
sf::Vector2f position;
BunkerData();
BunkerData(sf::Vector2f position);
};
}
}
36 changes: 36 additions & 0 deletions Space-Invaders/Header/Element/Bunker/BunkerView.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#pragma once
#include <SFML/Graphics.hpp>

namespace Element
{
namespace Bunker
{
class BunkerController;

class BunkerView
{
private:
const float bunker_sprite_width = 80.f;
const float bunker_sprite_height = 80.f;

BunkerController* bunker_controller;
sf::RenderWindow* game_window;

sf::Texture bunker_texture;
sf::Sprite bunker_sprite;

const sf::String bunker_texture_path = "assets/textures/bunker.png";

void scaleSprite();
void initializeImage();

public:
BunkerView();
~BunkerView();

void initialize(BunkerController* controller);
void update();
void render();
};
}
}
29 changes: 29 additions & 0 deletions Space-Invaders/Header/Element/ElementService.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once
#include"../../Header/Element/Bunker/BunkerController.h"
#include"../../Header/Element/Bunker/BunkerView.h"
namespace Element
{
class BunkerController;

class ElementService
{
private:

const std::vector<Bunker::BunkerData> bunker_data_list = { Bunker::BunkerData(sf::Vector2f(130.f, 800.f)),
Bunker::BunkerData(sf::Vector2f(430.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(730.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1130.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1430.0f, 800.f)),
Bunker::BunkerData(sf::Vector2f(1730.0f, 800.f)) };
std::vector<Bunker::BunkerController*> bunker_list;
void destroy();

public:
ElementService();
~ElementService();

void initialize();
void update();
void render();
};
}
24 changes: 24 additions & 0 deletions Space-Invaders/Header/Enemy/Controllers/SubZeroController.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#pragma once
#include "../../header/Enemy/EnemyController.h"

namespace Enemy
{
namespace Controller
{
class SubzeroController : public EnemyController
{
private:
float vertical_movement_speed = 100.f;
float subzero_rate_of_fire = 150.f;

void move() override;
void moveDown();
public:
SubzeroController(EnemyType type);
~SubzeroController();

void fireBullet();
void initialize() override;
};
}
}
Loading