diff --git a/assets/plain_menu_background.png b/assets/plain_menu_background.png index d864b219..9cb1e0e1 100644 Binary files a/assets/plain_menu_background.png and b/assets/plain_menu_background.png differ diff --git a/lib/Ray/sources/Drawables/Image.cpp b/lib/Ray/sources/Drawables/Image.cpp index 9676bc95..b9e3bd12 100644 --- a/lib/Ray/sources/Drawables/Image.cpp +++ b/lib/Ray/sources/Drawables/Image.cpp @@ -40,16 +40,22 @@ namespace RAY { drawable.drawOn(*this); } + void Image::resize(const RAY::Vector2 &dimensions) + { + ImageResize(*this, dimensions.x, dimensions.y); + this->setDimensions(dimensions); + } + void Image::drawOn(RAY::Window &) { //Since the image is a shared object, when it is resized, it mush be resized after to its previous dimensions - Vector2 oldDims = Vector2(this->_image->width, this->_image->height); + //Vector2 oldDims = Vector2(this->_image->width, this->_image->height); - ImageResize(*this, this->_dimensions.x, this->_dimensions.y); + //ImageResize(*this, this->_dimensions.x, this->_dimensions.y); Texture texture(*this); DrawTexture(texture, this->_position.x, this->_position.y, this->_color); - ImageResize(*this, oldDims.x, oldDims.y); + //ImageResize(*this, oldDims.x, oldDims.y); } void Image::drawOn(RAY::Image &image) diff --git a/lib/Ray/sources/Drawables/Image.hpp b/lib/Ray/sources/Drawables/Image.hpp index 840be518..104c968c 100644 --- a/lib/Ray/sources/Drawables/Image.hpp +++ b/lib/Ray/sources/Drawables/Image.hpp @@ -44,7 +44,9 @@ namespace RAY //! @brief Draw image on another image void drawOn(RAY::Image &image) override; - + + //! @brief Resize image; + void resize(const RAY::Vector2 &dimensions); private: //! @brief Image, really, that's just it... diff --git a/sources/Runner/Runner.cpp b/sources/Runner/Runner.cpp index 71a43980..7ee9b295 100644 --- a/sources/Runner/Runner.cpp +++ b/sources/Runner/Runner.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -59,7 +60,7 @@ namespace BBM void enableRaylib(WAL::Wal &wal) { RAY::TraceLog::setLevel(LOG_WARNING); - RAY::Window &window = RAY::Window::getInstance(600, 400, "Bomberman", FLAG_WINDOW_RESIZABLE); + RAY::Window &window = RAY::Window::getInstance(1920, 1080, "Bomberman"); wal.addSystem() .addSystem(window); } @@ -67,10 +68,29 @@ namespace BBM std::shared_ptr loadTitleScreenScene() { auto scene = std::make_shared(); + scene->addEntity("control") + .addComponent() + .addComponent(); + scene->addEntity("background") + .addComponent() + .addComponent("assets/plain_menu_background.png"); + scene->addEntity("logo") + .addComponent(320, 180, 0) + .addComponent("assets/logo_big.png"); + scene->addEntity("text_prompt") + .addComponent(1920 / 5, 1080 - 180, 0) + .addComponent("Press any button to continue", 70, RAY::Vector2(), WHITE) + .addComponent([](WAL::Entity &entity) + { + entity.getComponent().drawable->setColor(WHITE); + }, + [](WAL::Entity &entity) + { + entity.getComponent().drawable->setColor(ORANGE); + }, + ButtonComponent::emptyButtonCallback, + ButtonComponent::emptyButtonCallback); //needed material - //game logo - //plain background - //text "press to play" //music //sound return scene; @@ -79,9 +99,6 @@ namespace BBM std::shared_ptr loadMainMenuScene() { auto scene = std::make_shared(); - scene->addEntity("control") - .addComponent() - .addComponent(); scene->addEntity("first button") .addComponent(10, 10, 10) .addComponent(RAY::Vector2(0, 0), RAY::Vector2(100, 10), RED) @@ -96,23 +113,20 @@ namespace BBM ButtonComponent::emptyButtonCallback, ButtonComponent::emptyButtonCallback); - scene->addEntity("snd button") - .addComponent(10, 50, 50) - .addComponent(RAY::Vector2(0, 0), RAY::Vector2(100, 10), RED) - .addComponent( - [](WAL::Entity &entity) - { - entity.getComponent().drawable->setColor(RED); - }, - [](WAL::Entity &entity) - { - entity.getComponent().drawable->setColor(GREEN); - }, - ButtonComponent::emptyButtonCallback, - ButtonComponent::emptyButtonCallback); - scene->addEntity("background") - .addComponent() - .addComponent("assets/icon.png"); + //scene->addEntity("snd button") + // .addComponent(10, 50, 50) + // .addComponent(RAY::Vector2(0, 0), RAY::Vector2(100, 10), RED) + // .addComponent( + // [](WAL::Entity &entity) + // { + // entity.getComponent().drawable->setColor(RED); + // }, + // [](WAL::Entity &entity) + // { + // entity.getComponent().drawable->setColor(GREEN); + // }, + // ButtonComponent::emptyButtonCallback, + // ButtonComponent::emptyButtonCallback); //needed material //play button //play button assets @@ -191,7 +205,7 @@ namespace BBM WAL::Wal wal; addSystems(wal); enableRaylib(wal); - wal.scene = loadMainMenuScene(); + wal.scene = loadTitleScreenScene(); try { wal.run(updateState);