diff --git a/Space-Invaders/Header/Event/EventService.h b/Space-Invaders/Header/Event/EventService.h new file mode 100644 index 000000000..6f5924392 --- /dev/null +++ b/Space-Invaders/Header/Event/EventService.h @@ -0,0 +1,34 @@ +#pragma once + +#include +#include + +namespace Event +{ + class EventService + { + private: + sf::Event game_event; //event var + sf::RenderWindow* game_window; //ptr to our game window + + bool isGameWindowOpen(); + bool gameWindowWasClosed(); //for the condition we already had - the title bar cross. + bool hasQuitGame(); //for our new 'ESC' condition + + + + public: + EventService(); + ~EventService(); + + void initialize(); + void update(); + void processEvents(); // while window is open we will check for events + bool pressedEscapeKey(); + bool isKeyboardEvent(); + bool pressedLeftKey(); // getting inputs for the player + bool pressedRightKey(); + + }; +} + diff --git a/Space-Invaders/Header/Global/ServiceLocator.h b/Space-Invaders/Header/Global/ServiceLocator.h new file mode 100644 index 000000000..a10386a92 --- /dev/null +++ b/Space-Invaders/Header/Global/ServiceLocator.h @@ -0,0 +1,44 @@ +#pragma once +#include "../../Header/Graphic/GraphicService.h" +#include "../../Header/Event/EventService.h" +#include "../../Header/Player/PlayerService.h" +#include "../../Header/Time/TimeService.h" + +// ServiceLocator Class Summary: This class manages access to various services in the application. +// include relevant headers files + +namespace Global +{ + class ServiceLocator + { + private: + + // Private Attributes: + Graphics::GraphicService* graphic_service; + Event::EventService* event_service; + Player::PlayerService* player_service; + Time::TimeService* time_service; + + // Public Methods + ServiceLocator(); + ~ServiceLocator(); + + // Private Methods: + void createServices(); + void clearAllServices(); + + public: + + // Public Methods: + static ServiceLocator* getInstance(); + void initialize(); // Initializes the ServiceLocator. + void update(); // Updates all services. + void render(); // Renders using the services. + + // Methods to Get Specific Services: + Event::EventService* getEventService(); // Retrieve the EventService instance + Graphics::GraphicService* getGraphicService(); // Retrieve the GraphicService instance + Player::PlayerService* getPlayerService(); // Retrieve the PlayerService instance + Time::TimeService* getTimeService(); // Retrieve the TimeService instance + }; +} \ No newline at end of file diff --git a/Space-Invaders/Header/Graphic/GraphicService.h b/Space-Invaders/Header/Graphic/GraphicService.h new file mode 100644 index 000000000..c87153f16 --- /dev/null +++ b/Space-Invaders/Header/Graphic/GraphicService.h @@ -0,0 +1,41 @@ +#pragma once +#include + +namespace Graphics +{ + class GraphicService + { + private: + + const std::string game_window_title = "Alien Invader"; + + const int game_window_width = 800; + const int game_window_height = 600; + + const int frame_rate = 60; + + const sf::Color window_color = sf::Color::Black; + + sf::VideoMode* video_mode; // ptr to video mode + sf::RenderWindow* game_window; // ptr to a RenderWindow + + void setVideoMode(); // Method for setting our video mode + void onDestroy(); // method to run when window is deleted + + public: + GraphicService(); + ~GraphicService(); //cleanup + + //method to create the game window. returns a pointer to an instance of the game window + sf::RenderWindow* createGameWindow(); + + + void initialize(); //lifecycle functions + void update(); //.. + void render(); //.. + bool isGameWindowOpen(); //check if the window is open + + sf::RenderWindow* getGameWindow(); //getter for the game window instance + sf::Color getWindowColor();//get the color + }; +} \ No newline at end of file diff --git a/Space-Invaders/Header/Main/GameService.h b/Space-Invaders/Header/Main/GameService.h new file mode 100644 index 000000000..a4bc449c7 --- /dev/null +++ b/Space-Invaders/Header/Main/GameService.h @@ -0,0 +1,30 @@ +#pragma once +#include +#include "../../header/Global/ServiceLocator.h" + +namespace Main +{ + class ServiceLocator; + + class GameService + { + private: + + Global::ServiceLocator* service_locator; + sf::RenderWindow* game_window; + + + void initialize(); // Handles game initialization. + void initializeVariables();// Handles game initialization. + void destroy(); // Handles cleanup tasks. + + public: + GameService(); // Constructor for initializing the GameService object. + ~GameService(); // Destructor for cleaning up resources upon object deletion. + + void ignite(); // Initiates the game. + void update(); // Updates the game logic and game state. + void render(); // Renders each frame of the game. + bool isRunning(); // Checks if the game is currently running. + }; +} \ No newline at end of file diff --git a/Space-Invaders/Header/Player/PlayerController.h b/Space-Invaders/Header/Player/PlayerController.h new file mode 100644 index 000000000..c3a12b538 --- /dev/null +++ b/Space-Invaders/Header/Player/PlayerController.h @@ -0,0 +1,31 @@ +#pragma once +#include + +namespace Player +{ + class PlayerView; + class PlayerModel; + enum class PlayerState; + + class PlayerController + { + private: + + PlayerView* player_view; + PlayerModel* player_model; + + void processPlayerInput(); + void moveLeft(); + void moveRight(); + + public: + PlayerController(); + ~PlayerController(); + + void initialize(); + void update(); + void render(); + + sf::Vector2f getPlayerPosition(); + }; +} \ No newline at end of file diff --git a/Space-Invaders/Header/Player/PlayerModel.h b/Space-Invaders/Header/Player/PlayerModel.h new file mode 100644 index 000000000..b76424d92 --- /dev/null +++ b/Space-Invaders/Header/Player/PlayerModel.h @@ -0,0 +1,46 @@ +#pragma once +#include + +namespace Player +{ + enum class PlayerState //Our Enum + { + ALIVE, + DEAD, + // we will add more states later + }; + + class PlayerModel + { + private: + const sf::Vector2f initial_player_position = sf::Vector2f(400.f, 400.f); + + sf::Vector2f player_position; + PlayerState player_state; //Declaration + int player_score; + + public: + const sf::Vector2f left_most_position = sf::Vector2f(50.f, 0.f); + const sf::Vector2f right_most_position = sf::Vector2f(700.f, 0.f); + + const float player_movement_speed = 300.0f; + + PlayerModel(); + ~PlayerModel(); + + void initialize(); + void reset(); + + sf::Vector2f getPlayerPosition(); + void setPlayerPosition(sf::Vector2f position); + + int getPlayerScore(); + void setPlayerScore(int score); + + //new getter and setter + PlayerState getPlayerState(); + void setPlayerState(PlayerState state); + + + }; +} diff --git a/Space-Invaders/Header/Player/PlayerService.h b/Space-Invaders/Header/Player/PlayerService.h new file mode 100644 index 000000000..a978d53c5 --- /dev/null +++ b/Space-Invaders/Header/Player/PlayerService.h @@ -0,0 +1,19 @@ +#pragma once +#include "../../Header/Player/PlayerController.h" + +namespace Player +{ + class PlayerService + { + private: + PlayerController* player_controller; + + public: + PlayerService(); + ~PlayerService(); + + void initialize(); + void update(); + void render(); + }; +} diff --git a/Space-Invaders/Header/Player/PlayerView.h b/Space-Invaders/Header/Player/PlayerView.h new file mode 100644 index 000000000..8e901f3f4 --- /dev/null +++ b/Space-Invaders/Header/Player/PlayerView.h @@ -0,0 +1,34 @@ +#pragma once +#include +#include "../../Header/Player/PlayerController.h" + +namespace Player +{ + class PlayerView + { + private: + + const sf::String player_texture_path = "assets/textures/player_ship.png"; + const float player_sprite_width = 60.f; + const float player_sprite_height = 60.f; + + sf::RenderWindow* game_window; + + sf::Texture player_texture; + sf::Sprite player_sprite; + + void initializePlayerSprite(); + void scalePlayerSprite(); + + PlayerController* player_controller; // ptr to player controller + + public: + PlayerView(); + ~PlayerView(); + + void initialize(); + void update(); + void render(); + void initialize(PlayerController* controller); + }; +} \ No newline at end of file diff --git a/Space-Invaders/Header/Time/TimeService.h b/Space-Invaders/Header/Time/TimeService.h new file mode 100644 index 000000000..71184c46e --- /dev/null +++ b/Space-Invaders/Header/Time/TimeService.h @@ -0,0 +1,32 @@ +#pragma once +#include + + // The TimeService class helps keep track of time in game and calculate delta time. + // Utilizes the library to calculate delta time. + +namespace Time +{ + class TimeService + { + private: + + // A point in time which indicates the starting time of previous frame. + std::chrono::time_point previous_time; + + float delta_time; //to store the detla time + + void updateDeltaTime(); // method to update time + float calculateDeltaTime(); //calculate time by subtracting the previous time from the current time + void updatePreviousTime(); // finally update the current time to be previous time + + public: + + //lifecycle methods + void initialize(); + void update(); + + //getter + float getDeltaTime(); + }; +} + diff --git a/Space-Invaders/Source/Event/EventService.cpp b/Space-Invaders/Source/Event/EventService.cpp new file mode 100644 index 000000000..f1622bcd5 --- /dev/null +++ b/Space-Invaders/Source/Event/EventService.cpp @@ -0,0 +1,51 @@ +#include "../../Header/Event/EventService.h" +#include "../../Header/Main/GameService.h" +#include "../../Header/Graphic/GraphicService.h" +#include "../../Header/Global/ServiceLocator.h" + +namespace Event +{ + + EventService::EventService() { game_window = nullptr; } + + EventService::~EventService() = default; //calls the default destructor + + using namespace Global; + + void EventService::initialize() + { + game_window = ServiceLocator::getInstance()->getGraphicService()->getGameWindow(); + } + + void EventService::update() + { + //for later + } + + void EventService::processEvents() + { + if (isGameWindowOpen()) { + while (game_window->pollEvent(game_event)) { + // Check for window closure + if (gameWindowWasClosed() || hasQuitGame()) + { + game_window->close(); + } + } + } + } + + bool EventService::hasQuitGame() { return (isKeyboardEvent() && pressedEscapeKey()); } // only true if the ESC key is pressed and a keyboard event has been registered + + //checks for if a keyboard key has been pressed + bool EventService::isKeyboardEvent() { return game_event.type == sf::Event::KeyPressed; } + + //control click on the SFML functions to see what they do internally + bool EventService::pressedEscapeKey() { return game_event.key.code == sf::Keyboard::Escape; } + bool EventService::isGameWindowOpen() { return game_window != nullptr; } + bool EventService::gameWindowWasClosed() { return game_event.type == sf::Event::Closed; } + + // Player inputs + bool EventService::pressedLeftKey() { return game_event.key.code == sf::Keyboard::Left; } + bool EventService::pressedRightKey() { return game_event.key.code == sf::Keyboard::Right; } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Global/ServiceLocator.cpp b/Space-Invaders/Source/Global/ServiceLocator.cpp new file mode 100644 index 000000000..e4fe451ee --- /dev/null +++ b/Space-Invaders/Source/Global/ServiceLocator.cpp @@ -0,0 +1,77 @@ +#include "../../Header/Global/ServiceLocator.h" +#include "../../header/Main/GameService.h" + +namespace Global +{ + using namespace Main; + using namespace Graphics; + using namespace Event; + using namespace Time; + using namespace Player; + + + ServiceLocator::ServiceLocator() + { + graphic_service = nullptr; + event_service = nullptr; + player_service = nullptr; + time_service = nullptr; + createServices(); + } + ServiceLocator::~ServiceLocator() + { + clearAllServices(); + } + + void ServiceLocator::createServices() + { + graphic_service = new GraphicService(); + event_service = new EventService(); + player_service = new PlayerService(); + time_service = new TimeService(); + } + + void ServiceLocator::clearAllServices() + { + delete(graphic_service); + delete(event_service); + delete(player_service); + delete(time_service); + } + + ServiceLocator* ServiceLocator::getInstance() + { + static ServiceLocator instance; + return &instance; + } + + void ServiceLocator::initialize() + { + graphic_service->initialize(); + event_service->initialize(); + player_service->initialize(); + time_service->initialize(); + } + + void ServiceLocator::update() + { + graphic_service->update(); + event_service->update(); + player_service->update(); + time_service->update(); + } + + void ServiceLocator::render() + { + graphic_service->render(); + player_service->render(); + //no event service because nothing to render + //no time service + } + + GraphicService* ServiceLocator::getGraphicService() { return graphic_service; } + EventService* ServiceLocator::getEventService() { return event_service; } + PlayerService* ServiceLocator::getPlayerService() { return player_service; } + TimeService* ServiceLocator::getTimeService() { return time_service; } + +} \ No newline at end of file diff --git a/Space-Invaders/Source/Graphic/GraphicService.cpp b/Space-Invaders/Source/Graphic/GraphicService.cpp new file mode 100644 index 000000000..b10897d5d --- /dev/null +++ b/Space-Invaders/Source/Graphic/GraphicService.cpp @@ -0,0 +1,59 @@ +#include "../../Header/Graphic/GraphicService.h" + +namespace Graphics +{ + // Constructor: Initializes game window and video mode pointers to null. + GraphicService::GraphicService() { + game_window = nullptr; // Initializes game window pointer to null + video_mode = nullptr; // Initializes video mode pointer to null + } + + // Destructor: Cleans up resources by calling onDestroy. + GraphicService::~GraphicService() { + onDestroy(); // Calls onDestroy method to clean up resources + } + + // Initializes the graphic service by creating a new game window. + void GraphicService::initialize() { + game_window = createGameWindow(); // Assigns a new game window + game_window->setFramerateLimit(frame_rate); // setting a frame rate limit + } + + // Creates a new SFML RenderWindow object with specified video mode and title. + sf::RenderWindow* GraphicService::createGameWindow() { + setVideoMode(); // Sets up the video mode for the window + return new sf::RenderWindow(*video_mode, game_window_title); // Creates and returns a new RenderWindow object + } + + // Sets up the video mode for the game window using specified dimensions and system's color depth. + void GraphicService::setVideoMode() { + video_mode = new sf::VideoMode(game_window_width, game_window_height, sf::VideoMode::getDesktopMode().bitsPerPixel); // Allocates and sets the video mode + } + + // Cleans up allocated memory for video mode and game window to avoid memory leaks. + void GraphicService::onDestroy() { + delete(video_mode); // Deletes the video mode object + delete(game_window); // Deletes the game window object + } + + // Placeholder function for game update logic. + void GraphicService::update() { } + + // Placeholder function for game rendering logic. + void GraphicService::render() { } + + // Checks if the game window is currently open. + bool GraphicService::isGameWindowOpen() { + return game_window->isOpen(); // Returns the open status of the game window + } + + // Returns a pointer to the game window object. + sf::RenderWindow* GraphicService::getGameWindow() { + return game_window; + } + + // Returns the configured window background color. + sf::Color GraphicService::getWindowColor() { + return window_color; + } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Main/GameService.cpp b/Space-Invaders/Source/Main/GameService.cpp new file mode 100644 index 000000000..d61c57973 --- /dev/null +++ b/Space-Invaders/Source/Main/GameService.cpp @@ -0,0 +1,67 @@ +#include "../../Header/Main/GameService.h" +#include "../../Header/Graphic/GraphicService.h" +#include "../../Header/Global/ServiceLocator.h" + +namespace Main +{ + using namespace Global; + using namespace Graphics; + using namespace Event; + // Constructor: Initializes pointers to null. + GameService::GameService() { + service_locator = nullptr; // Set service locator to null + game_window = nullptr; // Set game window to null + } + + // Destructor: Calls the destroy function to clean up resources. + GameService::~GameService() { + destroy(); // Clean up and release resources + } + + // Prepares the game service for use by obtaining the service locator instance and initializing services. + void GameService::ignite() { + service_locator = Global::ServiceLocator::getInstance(); // Get ServiceLocator + initialize(); // Initialize services. + } + + //initialize service locator and other variables + void GameService::initialize() + { + service_locator->initialize(); + initializeVariables(); + } + + void GameService::initializeVariables() + { + game_window = service_locator->getGraphicService()->getGameWindow(); //set game window (it was null before this) + } + + void GameService::destroy() + { + // don't need to do anything here for now. + } + + // Updates the game logic by delegating to the service locator's update method. + void GameService::update() { + + service_locator->getEventService()->processEvents(); + + service_locator->update(); // Call update on the service locator which then updates all its managed services + } + + // Clears the window then display it. + void GameService::render() { + // Clears the game window with the background color provided by the graphic service + game_window->clear(service_locator->getGraphicService()->getWindowColor()); + service_locator->render(); // Render the current frame using the service locator + game_window->display(); // Display the rendered frame on the game window + } + + // Checks if the game is still running by querying the graphic service's window open status. + bool GameService::isRunning() { + // Returns true if the game window is open, indicating the game is still running + return service_locator->getGraphicService()->isGameWindowOpen(); + } +} + + diff --git a/Space-Invaders/Source/Player/PlayerController.cpp b/Space-Invaders/Source/Player/PlayerController.cpp new file mode 100644 index 000000000..534114f48 --- /dev/null +++ b/Space-Invaders/Source/Player/PlayerController.cpp @@ -0,0 +1,81 @@ +#include "../../Header/Player/PlayerController.h" +#include "../../Header/Player/PlayerModel.h" +#include "../../Header/Player/PlayerView.h" +#include "../../Header/Event/EventService.h" +#include "../../Header/Global/ServiceLocator.h" +#include + +namespace Player +{ + using namespace Global; + using namespace Event; + using namespace Time; + + PlayerController::PlayerController() + { + player_view = new PlayerView(); + player_model = new PlayerModel(); + } + + PlayerController::~PlayerController() + { + delete (player_view); + delete (player_model); + } + //the controller is responsible for calling the lifecycle methods for the other two + void PlayerController::initialize() + { + player_model->initialize(); + + //This will give an error right now since we haven't included the controller in the view. + player_view->initialize(this); // 'this' refers to the class we are currently inside + } + + void PlayerController::update() + { + processPlayerInput(); + player_view->update(); // we update() the view + } + + void PlayerController::render() + { + player_view->render(); // render the view + } + + sf::Vector2f PlayerController::getPlayerPosition() + { + return player_model->getPlayerPosition(); + } + + void PlayerController::processPlayerInput() + { + // we will move this to event service at a later time + if ((sf::Keyboard::isKeyPressed(sf::Keyboard::Left))) + { + moveLeft(); + } + // we will move this to event service at a later time + if ((sf::Keyboard::isKeyPressed(sf::Keyboard::Right))) + { + moveRight(); + } + } + + void PlayerController::moveLeft() + { + sf::Vector2f currentPosition = player_model->getPlayerPosition(); + currentPosition.x -= player_model->player_movement_speed * ServiceLocator::getInstance()->getTimeService()->getDeltaTime(); + + currentPosition.x = std::max(currentPosition.x, player_model->left_most_position.x); + player_model->setPlayerPosition(currentPosition); + } + + void PlayerController::moveRight() + { + sf::Vector2f currentPosition = player_model->getPlayerPosition(); + currentPosition.x += player_model->player_movement_speed * ServiceLocator::getInstance()->getTimeService()->getDeltaTime(); + + currentPosition.x = std::min(currentPosition.x, player_model->right_most_position.x); + player_model->setPlayerPosition(currentPosition); + } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Player/PlayerModel.cpp b/Space-Invaders/Source/Player/PlayerModel.cpp new file mode 100644 index 000000000..3f519eb06 --- /dev/null +++ b/Space-Invaders/Source/Player/PlayerModel.cpp @@ -0,0 +1,48 @@ +#include "../../Header/Player/PlayerModel.h" + +namespace Player +{ + PlayerModel::PlayerModel() { } + + PlayerModel::~PlayerModel() { } + + void PlayerModel::initialize() { reset(); } // remember to call reset() + + void PlayerModel::reset() + { + player_state = PlayerState::ALIVE; // set state to alive + player_position = initial_player_position; + player_score = 0; + } + + sf::Vector2f PlayerModel::getPlayerPosition() + { + return player_position; + } + + void PlayerModel::setPlayerPosition(sf::Vector2f position) + { + player_position = position; + } + + int PlayerModel::getPlayerScore() + { + return player_score; + } + + void PlayerModel::setPlayerScore(int score) + { + player_score = score; + } + + //.. + PlayerState PlayerModel::getPlayerState() + { + return player_state; + } + + void PlayerModel::setPlayerState(PlayerState state) + { + player_state = state; + } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Player/PlayerService.cpp b/Space-Invaders/Source/Player/PlayerService.cpp new file mode 100644 index 000000000..e5ccd9d05 --- /dev/null +++ b/Space-Invaders/Source/Player/PlayerService.cpp @@ -0,0 +1,30 @@ +#include "../../Header/Player/PlayerService.h" +#include "../../Header/Player/PlayerController.h" + +namespace Player +{ + PlayerService::PlayerService() + { + player_controller = new PlayerController(); + } + + PlayerService::~PlayerService() + { + delete (player_controller); + } + + void PlayerService::initialize() + { + player_controller->initialize(); + } + + void PlayerService::update() + { + player_controller->update(); + } + + void PlayerService::render() + { + player_controller->render(); + } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Player/PlayerView.cpp b/Space-Invaders/Source/Player/PlayerView.cpp new file mode 100644 index 000000000..bab4189cc --- /dev/null +++ b/Space-Invaders/Source/Player/PlayerView.cpp @@ -0,0 +1,54 @@ +#include "../../Header/Player/PlayerView.h" +#include "../../Header/Global/ServiceLocator.h" + +namespace Player +{ + using namespace Global; + PlayerView::PlayerView() { } + + PlayerView::~PlayerView() { } + + void PlayerView::initialize() + { + + game_window = ServiceLocator::getInstance()->getGraphicService()->getGameWindow(); + initializePlayerSprite(); + } + + void PlayerView::initialize(PlayerController* controller) + { + player_controller = controller; //to later use it for setting position + game_window = ServiceLocator::getInstance()->getGraphicService()->getGameWindow(); + initializePlayerSprite(); + } + + void PlayerView::initializePlayerSprite() + { + if (player_texture.loadFromFile(player_texture_path)) + { + player_sprite.setTexture(player_texture); + scalePlayerSprite(); + } + } + + void PlayerView::scalePlayerSprite() + { + // setScale is an inbuilt method of the sprite class that takes two floats to scale the sprite. it scales the sprite to our desired height + player_sprite.setScale( + //Here we find the factor to scale our sprites with. Ignore the static_cast for now, we will discuss it later. + static_cast(player_sprite_width) / player_sprite.getTexture()->getSize().x, + static_cast(player_sprite_height) / player_sprite.getTexture()->getSize().y + ); + } + + void PlayerView::update() + { + //set the updated position before we render + player_sprite.setPosition(player_controller->getPlayerPosition()); + } + + void PlayerView::render() + { + game_window->draw(player_sprite); + } +} \ No newline at end of file diff --git a/Space-Invaders/Source/Time/TimeService.cpp b/Space-Invaders/Source/Time/TimeService.cpp new file mode 100644 index 000000000..718d1fa8c --- /dev/null +++ b/Space-Invaders/Source/Time/TimeService.cpp @@ -0,0 +1,42 @@ +#include "../../Header/Time/TimeService.h" + +namespace Time +{ + void TimeService::initialize() + { + previous_time = std::chrono::steady_clock::now(); + delta_time = 0; + } + + void TimeService::update() + { + updateDeltaTime(); + } + + float TimeService::getDeltaTime() + { + return delta_time; + } + + void TimeService::updateDeltaTime() + { + delta_time = calculateDeltaTime(); + updatePreviousTime(); + } + + float TimeService::calculateDeltaTime() + { + // Calculate time difference in microseconds between the current and previous frame. + int delta = std::chrono::duration_cast( + std::chrono::steady_clock::now() - previous_time).count(); + + // The cast is used to convert delta time from microseconds into seconds. + return static_cast(delta) / static_cast(1000000); + } + + // Update previous_time to the current time + void TimeService::updatePreviousTime() + { + previous_time = std::chrono::steady_clock::now(); + } +} diff --git a/Space-Invaders/Space-Invaders.vcxproj b/Space-Invaders/Space-Invaders.vcxproj index 6f7fa388d..3dd5235bd 100644 --- a/Space-Invaders/Space-Invaders.vcxproj +++ b/Space-Invaders/Space-Invaders.vcxproj @@ -1,140 +1,160 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - Debug - x64 - - - Release - x64 - - - - 17.0 - Win32Proj - {ab3664cd-9870-4359-8811-b481db3b55a0} - SpaceInvaders - 10.0 - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - - - - - - - - Level3 - true - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - - - - - Level3 - true - true - true - WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - - - Console - true - true - true - - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)sfml\include;%(AdditionalIncludeDirectories) - - - Console - true - $(SolutionDir)sfml\lib;%(AdditionalLibraryDirectories) - sfml-graphics-d.lib;sfml-window-d.lib;sfml-network-d.lib;sfml-audio-d.lib;sfml-system-d.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(SolutionDir)sfml\include;%(AdditionalIncludeDirectories) - - - Console - true - true - true - $(SolutionDir)sfml\lib;%(AdditionalLibraryDirectories) - - - - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 17.0 + Win32Proj + {ab3664cd-9870-4359-8811-b481db3b55a0} + SpaceInvaders + 10.0 + + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + Application + true + v143 + Unicode + + + Application + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + Level3 + true + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + true + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + Level3 + true + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)sfml\include;%(AdditionalIncludeDirectories) + + + Console + true + $(SolutionDir)sfml\lib;%(AdditionalLibraryDirectories) + sfml-graphics-d.lib;sfml-window-d.lib;sfml-network-d.lib;sfml-audio-d.lib;sfml-system-d.lib;%(AdditionalDependencies) + + + + + Level3 + true + true + true + NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + $(SolutionDir)sfml\include;%(AdditionalIncludeDirectories) + + + Console + true + true + true + $(SolutionDir)sfml\lib;%(AdditionalLibraryDirectories) + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Space-Invaders/Space-Invaders.vcxproj.filters b/Space-Invaders/Space-Invaders.vcxproj.filters index ce0c35ccf..8ae369c39 100644 --- a/Space-Invaders/Space-Invaders.vcxproj.filters +++ b/Space-Invaders/Space-Invaders.vcxproj.filters @@ -1,22 +1,78 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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 - - - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;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 + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + \ No newline at end of file diff --git a/Space-Invaders/Space-Invaders.vcxproj.user b/Space-Invaders/Space-Invaders.vcxproj.user index 966b4ffb6..429333de9 100644 --- a/Space-Invaders/Space-Invaders.vcxproj.user +++ b/Space-Invaders/Space-Invaders.vcxproj.user @@ -1,6 +1,6 @@ - - - - true - + + + + true + \ No newline at end of file diff --git a/Space-Invaders/main.cpp b/Space-Invaders/main.cpp index 7d5f90dff..db819e86b 100644 --- a/Space-Invaders/main.cpp +++ b/Space-Invaders/main.cpp @@ -1,5 +1,17 @@ - -int main() -{ - return 0; -} \ No newline at end of file +#include "../../header/Main/GameService.h" + +int main() +{ + using namespace Main; + + GameService* game_service = new GameService(); + game_service->ignite(); + + while (game_service->isRunning()) + { + game_service->update(); + game_service->render(); + } + + return 0; +}