summary refs log tree commit diff stats
path: root/src/components.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/components.cpp')
-rw-r--r--src/components.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/components.cpp b/src/components.cpp index 26aa5d2..ba4fe72 100644 --- a/src/components.cpp +++ b/src/components.cpp
@@ -309,7 +309,7 @@ MapRenderComponent::MapRenderComponent(const Map& map)
309 309
310 for (int i=0; i<MAP_WIDTH*(MAP_HEIGHT-1); i++) 310 for (int i=0; i<MAP_WIDTH*(MAP_HEIGHT-1); i++)
311 { 311 {
312 int tile = map.mapdata()[i]; 312 int tile = map.getMapdata()[i];
313 int x = i % MAP_WIDTH; 313 int x = i % MAP_WIDTH;
314 int y = i / MAP_WIDTH; 314 int y = i / MAP_WIDTH;
315 Rectangle dst {x*TILE_WIDTH, y*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT}; 315 Rectangle dst {x*TILE_WIDTH, y*TILE_HEIGHT, TILE_WIDTH, TILE_HEIGHT};
@@ -322,7 +322,7 @@ MapRenderComponent::MapRenderComponent(const Map& map)
322 } 322 }
323 323
324 Texture font("../res/font.bmp"); 324 Texture font("../res/font.bmp");
325 const char* map_name = map.title(); 325 const char* map_name = map.getTitle();
326 int start_x = (40/2) - (strlen(map_name)/2); 326 int start_x = (40/2) - (strlen(map_name)/2);
327 for (size_t i=0; i<strlen(map_name); i++) 327 for (size_t i=0; i<strlen(map_name); i++)
328 { 328 {
@@ -348,7 +348,7 @@ MapCollisionComponent::MapCollisionComponent(const Map& map) : map(map)
348 { 348 {
349 int x = i % MAP_WIDTH; 349 int x = i % MAP_WIDTH;
350 int y = i / MAP_WIDTH; 350 int y = i / MAP_WIDTH;
351 int tile = map.mapdata()[i]; 351 int tile = map.getMapdata()[i];
352 352
353 if ((tile > 0) && (tile < 28) && (!((tile >= 5) && (tile <= 7)))) 353 if ((tile > 0) && (tile < 28) && (!((tile >= 5) && (tile <= 7))))
354 { 354 {
@@ -600,15 +600,15 @@ void StaticImageComponent::render(Game&, Entity& entity, Texture& buffer)
600 600
601// Simple collision 601// Simple collision
602 602
603SimpleColliderComponent::SimpleColliderComponent(std::function<void (Entity& collider)> callback) : callback(callback) 603SimpleColliderComponent::SimpleColliderComponent(std::function<void (Game& game, Entity& collider)> callback) : callback(callback)
604{ 604{
605 605
606} 606}
607 607
608void SimpleColliderComponent::receive(Game&, Entity&, const Message& msg) 608void SimpleColliderComponent::receive(Game& game, Entity&, const Message& msg)
609{ 609{
610 if (msg.type == Message::Type::collision) 610 if (msg.type == Message::Type::collision)
611 { 611 {
612 callback(*(msg.collisionEntity)); 612 callback(game, *(msg.collisionEntity));
613 } 613 }
614} 614}