Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Ушкова Диана Петровна
Pacman
Commits
f478fc1d
Commit
f478fc1d
authored
2 months ago
by
Ушкова Диана Петровна
Browse files
Options
Download
Patches
Plain Diff
created menu
parent
ff847446
main
ui_disagn
1 merge request
!1
created menu
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CMakeLists.txt
+11
-11
CMakeLists.txt
source/application/State/IState.cpp
+4
-38
source/application/State/IState.cpp
source/application/State/IState.h
+8
-17
source/application/State/IState.h
source/application/app/app.h
+1
-0
source/application/app/app.h
with
24 additions
and
66 deletions
+24
-66
CMakeLists.txt
+
11
−
11
View file @
f478fc1d
...
@@ -5,17 +5,17 @@ include(FetchContent)
...
@@ -5,17 +5,17 @@ include(FetchContent)
set
(
BUILD_SHARED_LIBS OFF
)
set
(
BUILD_SHARED_LIBS OFF
)
FetchContent_Declare
(
SFML GIT_REPOSITORY https://github.com/SFML/SFML.git GIT_TAG 2.6.1
)
FetchContent_Declare
(
SFML GIT_REPOSITORY https://github.com/SFML/SFML.git GIT_TAG 2.6.1
)
FetchContent_MakeAvailable
(
SFML
)
FetchContent_MakeAvailable
(
SFML
)
#
file(GLOB_RECURSE SOURCE_CPP source/*.cpp)
file
(
GLOB_RECURSE SOURCE_CPP source/*.cpp
)
#
add_executable(pacman ${SOURCE_CPP})
add_executable
(
pacman
${
SOURCE_CPP
}
)
add_executable
(
pacman source/main.cpp
#
add_executable(pacman source/main.cpp
source/application/app/app.cpp
#
source/application/app/app.cpp
source/application/Drawable/SelectCommand/ISelectCommand.cpp
#
source/application/Drawable/SelectCommand/ISelectCommand.cpp
source/application/Drawable/idrawable.cpp
#
source/application/Drawable/idrawable.cpp
source/application/Drawable/Button/button.cpp
#
source/application/Drawable/Button/button.cpp
source/application/Drawable/Font/font.cpp
#
source/application/Drawable/Font/font.cpp
source/application/Event/IWindowKeeper.cpp
#
source/application/Event/IWindowKeeper.cpp
source/application/State/IState.cpp
#
source/application/State/IState.cpp
source/application/Drawable/Menu/menu.cpp
)
#
source/application/Drawable/Menu/menu.cpp)
target_link_libraries
(
pacman PRIVATE sfml-window sfml-graphics sfml-system
)
target_link_libraries
(
pacman PRIVATE sfml-window sfml-graphics sfml-system
)
target_compile_definitions
(
pacman PRIVATE ASSETS_PATH=
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/assets/"
)
target_compile_definitions
(
pacman PRIVATE ASSETS_PATH=
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/assets/"
)
...
...
This diff is collapsed.
Click to expand it.
source/application/State/IState.cpp
+
4
−
38
View file @
f478fc1d
...
@@ -2,41 +2,7 @@
...
@@ -2,41 +2,7 @@
#include
"../../../config/config.h"
#include
"../../../config/config.h"
SelectState
::
SelectState
(
IStateManager
&
state_manager
,
//GameState::GameState(IStateManager& state_manager,
const
sf
::
VideoMode
&
video_mode
,
// const sf::VideoMode& video_mode,
const
std
::
string
&
window_title
)
:
// const std::string& window_title) :
IState
(
state_manager
),
IWindowKeeper
(
video_mode
,
window_title
)
{}
// IState(state_manager), IWindowKeeper(video_mode, window_title) {}
void
SelectState
::
event_handling
()
{
sf
::
Event
event
;
while
(
m_window
.
pollEvent
(
event
))
{
if
(
event
.
type
==
sf
::
Event
::
Closed
)
{
m_window
.
close
();}
}
}
void
SelectState
::
update
()
{
const
sf
::
Vector2f
pos
=
m_window
.
mapPixelToCoords
(
sf
::
Mouse
::
getPosition
(
m_window
));
if
(
sf
::
Mouse
::
isButtonPressed
(
sf
::
Mouse
::
Left
))
{
m_menu
.
process_mouse
(
pos
,
true
);
return
;
}
m_menu
.
process_mouse
(
pos
,
false
);
}
void
SelectState
::
render
()
{
m_window
.
clear
(
config
::
SELECT_LEVEL_BACKGROUND_COLOR
);
m_menu
.
draw_into
(
m_window
);
m_window
.
display
();
}
bool
SelectState
::
do_step
()
{
event_handling
();
update
();
render
();
return
true
;
}
GameState
::
GameState
(
IStateManager
&
state_manager
,
const
sf
::
VideoMode
&
video_mode
,
const
std
::
string
&
window_title
)
:
IState
(
state_manager
),
IWindowKeeper
(
video_mode
,
window_title
)
{}
This diff is collapsed.
Click to expand it.
source/application/State/IState.h
+
8
−
17
View file @
f478fc1d
#pragma once
#pragma once
#include
"../Event/IWindowKeeper.h"
#include
"../Event/IWindowKeeper.h"
#include
"../Drawable/Menu/menu.h"
#include
<memory>
#include
<memory>
#include
<iostream>
#include
<iostream>
...
@@ -17,23 +16,15 @@ protected:
...
@@ -17,23 +16,15 @@ protected:
IStateManager
&
m_state_manager
;
IStateManager
&
m_state_manager
;
};
};
struct
SelectState
:
public
IState
,
public
IWindowKeeper
{
SelectState
(
IStateManager
&
state_manager
,
const
sf
::
VideoMode
&
video_mode
,
const
std
::
string
&
window_title
);
void
event_handling
()
override
;
void
update
()
override
;
void
render
()
override
;
bool
do_step
()
override
;
private:
Menu
m_menu
;
};
struct
GameState
:
IState
,
IWindowKeeper
{
GameState
(
IStateManager
&
state_manager
,
const
sf
::
VideoMode
&
video_mode
,
const
std
::
string
&
window_title
);
//struct GameState: IState, IWindowKeeper {
void
event_handling
()
override
;
// GameState(IStateManager& state_manager, const sf::VideoMode& video_mode, const std::string& window_title);
void
update
()
override
;
// void event_handling() override;
void
render
()
override
;
// void update() override;
bool
do_step
()
override
;
// void render() override;
};
// bool do_step() override;
//};
struct
ExitState
:
IState
{
struct
ExitState
:
IState
{
ExitState
(
IStateManager
&
state_manager
)
:
IState
(
state_manager
)
{}
ExitState
(
IStateManager
&
state_manager
)
:
IState
(
state_manager
)
{}
...
...
This diff is collapsed.
Click to expand it.
source/application/app/app.h
+
1
−
0
View file @
f478fc1d
#pragma once
#pragma once
#include
"../State/IState.h"
#include
"../State/IState.h"
#include
"../State/SelectState.h"
#include
<iostream>
#include
<iostream>
#include
<memory>
#include
<memory>
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets