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
Чаадаев Алексей Константинович
3 laba
Commits
88e5ad6e
Commit
88e5ad6e
authored
3 weeks ago
by
Чаадаев Алексей Константинович
Browse files
Options
Download
Patches
Plain Diff
m_texture classes' fields deleting
parent
71db81b3
main
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Sources/Entities/Entities.cpp
+8
-10
Sources/Entities/Entities.cpp
Sources/Entities/Entities.h
+0
-2
Sources/Entities/Entities.h
Sources/Inventory/Inventory.cpp
+4
-6
Sources/Inventory/Inventory.cpp
Sources/Inventory/Inventory.h
+0
-1
Sources/Inventory/Inventory.h
with
12 additions
and
19 deletions
+12
-19
Sources/Entities/Entities.cpp
+
8
−
10
View file @
88e5ad6e
...
...
@@ -23,20 +23,20 @@ Enemy::Enemy() {
switch
(
ind
)
{
case
0
:
m_
t
exture
=
&
EnemyRedTexture
::
Instance
();
m_
sprite
.
setT
exture
(
EnemyRedTexture
::
Instance
()
.
get_texture
())
;
break
;
case
1
:
m_
t
exture
=
&
EnemyOrangeTexture
::
Instance
();
m_
sprite
.
setT
exture
(
EnemyOrangeTexture
::
Instance
()
.
get_texture
())
;
break
;
case
2
:
m_
t
exture
=
&
EnemyCyanTexture
::
Instance
();
m_
sprite
.
setT
exture
(
EnemyCyanTexture
::
Instance
()
.
get_texture
())
;
break
;
case
3
:
m_
t
exture
=
&
EnemyPinkTexture
::
Instance
();
m_
sprite
.
setT
exture
(
EnemyPinkTexture
::
Instance
()
.
get_texture
())
;
break
;
}
m_sprite
.
setOrigin
({
m_
texture
->
get
_t
exture
()
.
getSize
().
x
/
2.0
f
,
m_
texture
->
get
_t
exture
()
.
getSize
().
y
/
2.0
f
});
m_sprite
.
setOrigin
({
m_
sprite
.
get
T
exture
()
->
getSize
().
x
/
2.0
f
,
m_
sprite
.
get
T
exture
()
->
getSize
().
y
/
2.0
f
});
m_sprite
.
setScale
({
2.5
f
,
2.5
f
});
}
...
...
@@ -45,7 +45,6 @@ void Enemy::draw_into(sf::RenderWindow& window) const {
}
void
Enemy
::
prepare_for_drawing
()
{
//prep drawing проходит в конце set_pos
m_sprite
.
setTexture
(
m_texture
->
get_texture
());
m_sprite
.
setPosition
(
m_ptr_room
->
get_position
());
}
...
...
@@ -97,10 +96,9 @@ std::unique_ptr<IGameEvent> Food::accept(IVisitor* ptr_visitor) {
//INVISPOTION
InvisPotion
::
InvisPotion
()
{
m_
t
exture
=
&
PotionTexture
::
Instance
();
m_sprite
.
setOrigin
({
m_texture
->
get_texture
().
getSize
().
x
/
2.0
f
,
m_texture
->
get_texture
().
getSize
().
y
/
2.0
f
});
m_
sprite
.
setT
exture
(
PotionTexture
::
Instance
()
.
get_texture
())
;
m_sprite
.
setOrigin
({
PotionTexture
::
Instance
().
get_texture
().
getSize
().
x
/
2.0
f
,
PotionTexture
::
Instance
().
get_texture
().
getSize
().
y
/
2.0
f
});
m_sprite
.
setScale
({
0.11
f
,
0.11
f
});
m_sprite
.
setTexture
(
m_texture
->
get_texture
());
}
void
InvisPotion
::
catched
(
Inventory
&
inventory
)
{
...
...
This diff is collapsed.
Click to expand it.
Sources/Entities/Entities.h
+
0
−
2
View file @
88e5ad6e
...
...
@@ -67,7 +67,6 @@ public:
private:
sf
::
Clock
m_stopwatch
;
ITexture
*
m_texture
;
sf
::
Sprite
m_sprite
;
};
...
...
@@ -97,7 +96,6 @@ public:
std
::
unique_ptr
<
IGameEvent
>
accept
(
IVisitor
*
ptr_visitor
)
override
;
private:
ITexture
*
m_texture
;
sf
::
Sprite
m_sprite
;
};
...
...
This diff is collapsed.
Click to expand it.
Sources/Inventory/Inventory.cpp
+
4
−
6
View file @
88e5ad6e
...
...
@@ -88,21 +88,19 @@ Inventory::Inventory() {
m_circles
.
emplace_back
(
food_circle
);
//bottle
m_textures
.
push_back
(
&
PotionTexture
::
Instance
());
sf
::
Sprite
sprite
;
sprite
.
setOrigin
({
m_textures
.
at
(
0
)
->
get_texture
().
getSize
().
x
/
2.0
f
,
m_textures
.
at
(
0
)
->
get_texture
().
getSize
().
y
/
2.0
f
});
sprite
.
setTexture
(
PotionTexture
::
Instance
().
get_texture
());
sprite
.
setOrigin
({
sprite
.
getTexture
()
->
getSize
().
x
/
2.0
f
,
sprite
.
getTexture
()
->
getSize
().
y
/
2.0
f
});
sprite
.
setScale
({
0.13
f
,
0.13
f
});
sprite
.
setPosition
({
pos_cell2
.
x
,
pos_cell2
.
y
});
sprite
.
setTexture
(
m_textures
.
at
(
0
)
->
get_texture
());
m_sprites
.
push_back
(
sprite
);
//enemy killer
sf
::
Sprite
sprite2
;
m_textures
.
push_back
(
&
EnemyKillerTexture
::
Instance
());
sprite2
.
setOrigin
({
m_textures
.
at
(
1
)
->
get
_t
exture
()
.
getSize
().
x
/
2.0
f
,
m_textures
.
at
(
1
)
->
get
_t
exture
()
.
getSize
().
y
/
2.0
f
});
sprite2
.
setTexture
(
EnemyKillerTexture
::
Instance
()
.
get_texture
()
);
sprite2
.
setOrigin
({
sprite2
.
get
T
exture
()
->
getSize
().
x
/
2.0
f
,
sprite2
.
get
T
exture
()
->
getSize
().
y
/
2.0
f
});
sprite2
.
setScale
({
1.7
f
,
1.7
f
});
sprite2
.
setPosition
({
pos_cell3
.
x
,
pos_cell3
.
y
});
sprite2
.
setTexture
(
m_textures
.
at
(
1
)
->
get_texture
());
m_sprites
.
push_back
(
sprite2
);
}
...
...
This diff is collapsed.
Click to expand it.
Sources/Inventory/Inventory.h
+
0
−
1
View file @
88e5ad6e
...
...
@@ -35,5 +35,4 @@ private:
std
::
vector
<
sf
::
CircleShape
>
m_circles
;
std
::
vector
<
sf
::
Sprite
>
m_sprites
;
std
::
vector
<
ITexture
*>
m_textures
;
};
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