diff --git a/assets/images/basket.bmp b/assets/images/basket.bmp index 40298a9..5680062 100644 Binary files a/assets/images/basket.bmp and b/assets/images/basket.bmp differ diff --git a/assets/images/fruits.bmp b/assets/images/fruits.bmp index f2afe47..de80919 100644 Binary files a/assets/images/fruits.bmp and b/assets/images/fruits.bmp differ diff --git a/assets/images/fruits.png b/assets/images/fruits.png deleted file mode 100644 index 9e338d3..0000000 Binary files a/assets/images/fruits.png and /dev/null differ diff --git a/assets/images/jungle.bmp b/assets/images/jungle.bmp index 76719cf..575c128 100644 Binary files a/assets/images/jungle.bmp and b/assets/images/jungle.bmp differ diff --git a/assets/images/jungle.png b/assets/images/jungle.png deleted file mode 100644 index 7fec4e2..0000000 Binary files a/assets/images/jungle.png and /dev/null differ diff --git a/assets/images/spiders.bmp b/assets/images/spiders.bmp index 5cb2954..aa87f2d 100644 Binary files a/assets/images/spiders.bmp and b/assets/images/spiders.bmp differ diff --git a/src/assets.cpp b/src/assets.cpp index 87b3db2..fa5e074 100644 --- a/src/assets.cpp +++ b/src/assets.cpp @@ -84,16 +84,16 @@ AssetModule::AssetModule(entt::registry& registry) // auto renderer = registry.ctx().get().renderer; // auto* background = load_texture(BACKGROUND_DATA, sizeof(BACKGROUND_DATA), renderer); - TextureAtlasLayout background_layout = {.width = 866, .height = 510, .rows = 1, .columns = 1}; + TextureAtlasLayout background_layout = {.width = 400, .height = 240, .rows = 1, .columns = 1}; // auto* fruits = load_texture(FRUITS_DATA, sizeof(FRUITS_DATA), renderer); - TextureAtlasLayout fruits_layout = {.width = 16, .height = 16, .rows = 6, .columns = 38}; + TextureAtlasLayout fruits_layout = {.width = 32, .height = 32, .rows = 6, .columns = 38}; // auto* spiders = load_texture(SPIDERS_DATA, sizeof(SPIDERS_DATA), renderer); - TextureAtlasLayout spiders_layout = {.width = 16, .height = 16, .rows = 2, .columns = 4}; + TextureAtlasLayout spiders_layout = {.width = 32, .height = 32, .rows = 2, .columns = 4}; // auto* basket = load_texture(BASKET_DATA, sizeof(BASKET_DATA), renderer); - TextureAtlasLayout basket_layout = {.width = 16, .height = 16, .rows = 1, .columns = 1}; + TextureAtlasLayout basket_layout = {.width = 64, .height = 32, .rows = 1, .columns = 1}; // registry.ctx().emplace(TextureAssets{ // .background = Texture{.sdl_texture = background, .texture_atlas_layout = diff --git a/src/level.cpp b/src/level.cpp index 21a50a7..62497ce 100644 --- a/src/level.cpp +++ b/src/level.cpp @@ -1,6 +1,35 @@ #include "level.hpp" #include "input.hpp" +LevelModule::LevelModule(entt::registry& registry) +{ + auto const* texture_assets = ®istry.ctx().get(); + + auto background = registry.create(); + registry.emplace(background, Position{.x = 0, .y = 0}); + registry.emplace( + background, Sprite{.texture = &texture_assets->background, .texture_atlas_index = 0}); + registry.emplace(background, Size{.w = WINDOW_WIDTH, .h = WINDOW_HEIGHT}); + registry.emplace(background); + + auto basket = registry.create(); + registry.emplace(basket); + registry.emplace(basket, + Position{.x = WINDOW_WIDTH / 2 - 32, .y = WINDOW_HEIGHT - 32}); + registry.emplace(basket, + Sprite{.texture = &texture_assets->basket, .texture_atlas_index = 0}); + registry.emplace(basket, Size{.w = 64, .h = 32}); + registry.emplace(basket); + + auto basket_cb = registry.create(); + registry.emplace(basket_cb); + registry.emplace(basket_cb, Position{.x = 0, .y = 16}); + registry.emplace(basket_cb, Size{.w = 64, .h = 16}); + registry.emplace(basket_cb); + registry.emplace(basket_cb, basket); + registry.emplace(basket_cb); +} + void LevelModule::MoveBasket(entt::registry& registry) { auto const& input = registry.ctx().get(); diff --git a/src/level.hpp b/src/level.hpp index 82951b1..093a6cc 100644 --- a/src/level.hpp +++ b/src/level.hpp @@ -32,34 +32,7 @@ struct BasketCollisionBox struct LevelModule { - LevelModule(entt::registry& registry) - { - auto const* texture_assets = ®istry.ctx().get(); - - auto background = registry.create(); - registry.emplace(background, Position{.x = 0, .y = 0}); - registry.emplace( - background, Sprite{.texture = &texture_assets->background, .texture_atlas_index = 0}); - registry.emplace(background, Size{.w = WINDOW_WIDTH, .h = WINDOW_HEIGHT}); - registry.emplace(background); - - auto basket = registry.create(); - registry.emplace(basket); - registry.emplace(basket, - Position{.x = WINDOW_WIDTH / 2 - 32, .y = WINDOW_HEIGHT - 32}); - registry.emplace( - basket, Sprite{.texture = &texture_assets->basket, .texture_atlas_index = 0}); - registry.emplace(basket, Size{.w = 64, .h = 32}); - registry.emplace(basket); - - auto basket_cb = registry.create(); - registry.emplace(basket_cb); - registry.emplace(basket_cb, Position{.x = 0, .y = 16}); - registry.emplace(basket_cb, Size{.w = 64, .h = 16}); - registry.emplace(basket_cb); - registry.emplace(basket_cb, basket); - registry.emplace(basket_cb); - } + LevelModule(entt::registry& registry); static void MoveBasket(entt::registry& registry); static void SpawnFruits(entt::registry& registry);