1
1
#include " Entity.h"
2
2
3
3
namespace arena ::logic {
4
- tl::expected<Entity, std::string> Entity::create (pEntityData entity_data, Image entity_image)
5
- {
4
+ tl::expected<Entity, std::string> Entity::create (
5
+ pEntityData entity_data,
6
+ Image entity_image
7
+ ) {
6
8
EntityDataManager& entity_data_manager = EntityDataManager::getInstance ();
7
9
std::vector<std::shared_ptr<Entity>> spawn_entities;
8
10
bool spawn_entity_immediately = !entity_data->getSpawnCharacter ().empty () && !entity_data->getSpawnPauseTime ();
@@ -20,17 +22,6 @@ namespace arena::logic {
20
22
return Entity (entity_data, entity_image, spawn_entities);
21
23
}
22
24
23
- Entity::Entity (pEntityData entity_data, Image image, std::vector<std::shared_ptr<Entity>> spawn_entities) : entity_data(entity_data), image(image), spawn_entities(spawn_entities)
24
- {
25
- float scale = (this ->entity_data ->getScale () / 100 .0f );
26
- float entity_width = (this ->image .get_width () * scale) * Global::scale;
27
- float entity_height = (this ->image .get_height () * scale) * Global::scale;
28
-
29
- this ->size = { entity_width, entity_height };
30
-
31
- this ->rect = SkRect::MakeXYWH (0 , 0 , this ->size .x , this ->size .y );
32
- }
33
-
34
25
void Entity::setPosition (SkV2 position)
35
26
{
36
27
this ->position = position;
@@ -73,11 +64,18 @@ namespace arena::logic {
73
64
Canvas entity_canvas (this ->size .x , this ->size .y );
74
65
entity_canvas.draw_image (this ->image , SkRect{0 , 0 , this ->size .x , this ->size .y }, nullptr );
75
66
76
- SkPaint paint;
67
+ // Damage
68
+ /* SkPaint paint;
77
69
paint.setBlendMode(SkBlendMode::kPlus);
78
70
paint.setColor(SK_ColorRED);
79
- entity_canvas.draw_rect (SkRect{ 0 , 0 , this ->size .x , this ->size .y }, paint);
71
+ entity_canvas.draw_rect(SkRect{ 0, 0, this->size.x, this->size.y }, paint);*/
80
72
73
+ // Freeze
74
+ /* SkPaint paint;
75
+ paint.setBlendMode(SkBlendMode::kPlus);
76
+ paint.setColor(SkColorSetARGB(255, 0, 90, 255));
77
+ entity_canvas.draw_rect(SkRect{ 0, 0, this->size.x, this->size.y }, paint);*/
78
+
81
79
SkPaint normal ;
82
80
normal .setBlendMode (SkBlendMode::kDstIn );
83
81
entity_canvas.draw_image (this ->image , SkRect{0 , 0 , this ->size .x , this ->size .y }, & normal );
@@ -112,4 +110,13 @@ namespace arena::logic {
112
110
{
113
111
114
112
}
113
+
114
+ Entity::Entity (pEntityData entity_data, Image image, std::vector<std::shared_ptr<Entity>> spawn_entities) : entity_data(entity_data), image(image), spawn_entities(spawn_entities)
115
+ {
116
+ float scale = (this ->entity_data ->getScale () / 100 .0f );
117
+ float entity_width = (this ->image .get_width () * scale) * Global::scale;
118
+ float entity_height = (this ->image .get_height () * scale) * Global::scale;
119
+ this ->size = { entity_width, entity_height };
120
+ this ->rect = SkRect::MakeXYWH (0 , 0 , this ->size .x , this ->size .y );
121
+ }
115
122
}
0 commit comments