Commit 920b8ccf authored by Сулимов Игорь Андреевич's avatar Сулимов Игорь Андреевич
Browse files

Partially completed the first item of lab work and started the second one

parent ffeb0cda
No related merge requests found
Showing with 77 additions and 20 deletions
+77 -20
......@@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.10)
set(CMAKE_CXX_STANDARD 17)
project(pac-man)
include(FetchContent)
set(BUILD_SHARED_LIBS FALSE)
include(FetchContent)
FetchContent_Declare(sfml GIT_REPOSITORY https://github.com/SFML/SFML.git GIT_TAG 2.6.1)
FetchContent_MakeAvailable(sfml)
......
#pragma once
#include "IDrawable.h"
class Button: public IDrawable {
public:
void set();
void select();
void unselect();
bool is_selected();
void is_position_in(sf::Vector2f pos);
void push();
void draw_into(sf::RenderWindow& window) const override;
private:
sf::Text m_text;
bool m_is_selected = false;
sf::RectangleShape m_rectangle;
};
\ No newline at end of file
#pragma once
#include <SFML/Graphics.hpp>
struct IDrawable {
virtual void draw_into(sf::RenderWindow& window) const = 0;
virtual ~IDrawable() = default;
};
\ No newline at end of file
#pragma once
#include "IDrawable.h"
#include "States/IState.h"
class Menu: public IDrawable {
public:
void process_mouse(sf::Vector2f pos, bool is_pressed);
public:
Menu(IStateManager& state_manager);
};
\ No newline at end of file
#pragma once
#pragma once
#include <SFML/Graphics/RenderWindow.hpp>
class IWindowKeeper {
protected:
virtual void event_handling() = 0;
virtual void update() = 0;
virtual void render() = 0;
public:
IWindowKeeper(const sf::VideoMode& video_mode, const std::string& window_title);
protected:
sf::RenderWindow m_window;
};
\ No newline at end of file
//
// Created by Игорь on 22.03.2025.
//
#pragma once
#ifndef PAC_MAN_EXITSTATE_H
#define PAC_MAN_EXITSTATE_H
#include "IState.h"
#endif //PAC_MAN_EXITSTATE_H
class ExitState: public IState {
public:
ExitState(IStateManager& state_manager);
bool do_step() override { return false; }
};
\ No newline at end of file
//
// Created by Игорь on 22.03.2025.
//
#pragma once
#ifndef PAC_MAN_GAMESTATE_H
#define PAC_MAN_GAMESTATE_H
#include "States/IState.h"
#include "IWindowKeeper.h"
#endif //PAC_MAN_GAMESTATE_H
class SelectState: public IState, public IWindowKeeper {
public:
SelectState(IStateManager& state_manager, const sf::VideoMode& video_mode, const std::string& window_title);
};
\ No newline at end of file
#pragma once
class SelectState: public IState {
#include "States/IState.h"
#include "IWindowKeeper.h"
class SelectState: public IState, public IWindowKeeper {
public:
SelectState(state_manager, video_mode, window_title);
SelectState(IStateManager& state_manager, const sf::VideoMode& video_mode, const std::string& window_title);
};
\ No newline at end of file
//
// Created by Игорь on 22.03.2025.
//
#include "SelectState.h"
\ No newline at end of file
#include "States/SelectState.h"
\ No newline at end of file
//#include "SFML/Graphics.hpp"
#include <Application.h>
#include "Application.h"
//int main() {
// sf::RenderWindow window(sf::VideoMode(500, 500), "SFML works!"); // создаем окно 500 на 500 пикселей
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment