From cf842903bec1cdcf7180a9b45a39f0296d72ddae Mon Sep 17 00:00:00 2001 From: "arthur.jamet" Date: Wed, 16 Jun 2021 20:59:16 +0200 Subject: [PATCH] add fullscreen button to settings --- screenshot000.png | Bin 82420 -> 0 bytes sources/Runner/SettingsMenuScene.cpp | 42 +++++++++++++++++++++------ 2 files changed, 33 insertions(+), 9 deletions(-) delete mode 100644 screenshot000.png diff --git a/screenshot000.png b/screenshot000.png deleted file mode 100644 index e4060bf1c23c5d11d6397ecd306201439e42a350..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 82420 zcmeI&KWkrA0LS5L37QlOj#5w%1aZqy(7~mDY#Y!b;w%9jy16)XaHtLiL2;<7lg_>Y z7ex?pkjX4;(zi@#&DE_Y%TGe&6%S<$n6som-bKUcR_(+ohA+H{Ra1 zr|xgt!K;T)p8e0CkAJwnJ#qEBlN(pxx%cjS@1LIj^Xu`&o7YdT9Gv^hgO3i6KmY0X zyN91W`2O5q{yO~l(a~>@zI^TSg|A;YKHrxgUp%<^(*0Wx|33Fmb@%Y;htE9w)%N_G zznuH0I{OB1Ts!^n!o4dmfAK$n9Utvr-vIlMzkk3Mf9rq&>+0FC#p4MWu!M-L2+6!6 zfdT8E1xkPMFC}2WIt|6JL0RyJ=d%7&Htd(6KO}QCV8B|h!gXGU>#beuk<@D-rn){PNGAHg`|5r z-U4jYm|N{vfdNzcJ&uKI$3wUZ*M3rjt8mR3Dl0y)O_glkCV zYQTUg{hlt1Ype8ub!e5o((kl*d&k>5i4GkWlJ4nv3$RgRZna+p22APqI2NuQ58*0Y z`$-Y5!Zl~8tO!Z>bi4)Fs4=$^u8UT{fHm^>que8ErQfwx`buBvFD?TxV4c#Ghtdzp zTn!ko)~j$`Tw7qkIt|6JL0RyJ=d%7&HtI&@e_x~JnUz($R^)qWKiFs0w)Sh#jPgsX7vCq=jl*PNlUA|&0@@fKjC#@tG{ zE?NNt*2v$Fa*wE$e%Ds%D}ANExD3F6bxKnnN9V-CN*`E|M^zl=xr;Q#;t diff --git a/sources/Runner/SettingsMenuScene.cpp b/sources/Runner/SettingsMenuScene.cpp index 8883bbeb..49a27031 100644 --- a/sources/Runner/SettingsMenuScene.cpp +++ b/sources/Runner/SettingsMenuScene.cpp @@ -35,7 +35,7 @@ namespace BBM .addComponent(1920 / 3, 180, 0) .addComponent("assets/logo_small.png"); auto &music = scene->addEntity("music text") - .addComponent(1920 / 2.5, 1080 - 540, 0) + .addComponent(1920 / 2.5, 1080 - 100 - 540, 0) .addComponent("Music Volume", 70, RAY::Vector2(), BLACK) .addComponent() .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -48,7 +48,7 @@ namespace BBM }); auto &musicUp = scene->addEntity("music up button") - .addComponent(1920 / 1.5, 1080 - 540, 0) + .addComponent(1920 / 1.5, 1080 - 100 - 540, 0) .addComponent("assets/buttons/button_plus.png") .addComponent("assets/musics/music_title.ogg") .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -71,7 +71,7 @@ namespace BBM }); auto &musicDown = scene->addEntity("music down button") - .addComponent(1920 / 3, 1080 - 540, 0) + .addComponent(1920 / 3, 1080 - 100 - 540, 0) .addComponent("assets/buttons/button_minus.png") .addComponent("assets/musics/music_title.ogg") .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -94,7 +94,7 @@ namespace BBM }); auto &sound = scene->addEntity("sound text") - .addComponent(1920 / 2.5, 1080 - 360, 0) + .addComponent(1920 / 2.5, 1080 - 100 - 360, 0) .addComponent("Sound Volume", 70, RAY::Vector2(), BLACK) .addComponent() .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -107,7 +107,7 @@ namespace BBM }); auto &soundUp = scene->addEntity("sound up button") - .addComponent(1920 / 1.5, 1080 - 360, 0) + .addComponent(1920 / 1.5, 1080 - 100 - 360, 0) .addComponent("assets/buttons/button_plus.png") .addComponent(sounds) .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -130,7 +130,7 @@ namespace BBM }); auto &soundDown = scene->addEntity("sound down button") - .addComponent(1920 / 3, 1080 - 360, 0) + .addComponent(1920 / 3, 1080 - 100 - 360, 0) .addComponent("assets/buttons/button_minus.png") .addComponent(sounds) .addComponent([](WAL::Entity &entity, WAL::Wal &) @@ -153,7 +153,7 @@ namespace BBM }); auto &debug = scene->addEntity("debug text") - .addComponent(1920 / 2.5, 1080 - 180, 0) + .addComponent(1920 / 2.5, 1080 - 100 - 180, 0) .addComponent("Debug Mode: Off", 70, RAY::Vector2(), BLACK) .addComponent([](WAL::Entity &entity, WAL::Wal &wal) { @@ -175,6 +175,29 @@ namespace BBM { entity.getComponent().drawable->setColor(ORANGE); }); + auto &fullscreen = scene->addEntity("fullscreen text") + .addComponent(1920 / 2.5, 1080 - 100 - 50, 0) + .addComponent("Fullscreen: On", 70, RAY::Vector2(), BLACK) + .addComponent([](WAL::Entity &entity, WAL::Wal &wal) + { + RAY2D::Text *text = dynamic_cast(entity.getComponent().drawable.get()); + + if (text->getString().find("Off") != std::string::npos) { + text->setText("Fullscreen: On"); + //do + } else { + text->setText("Fullscreen: Off"); + //do + } + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + entity.getComponent().drawable->setColor(BLACK); + }) + .addComponent([](WAL::Entity &entity, WAL::Wal &) + { + entity.getComponent().drawable->setColor(ORANGE); + }); auto &back = scene->addEntity("back to menu") .addComponent(10, 1080 - 85, 0) .addComponent("assets/buttons/button_back.png") @@ -204,8 +227,9 @@ namespace BBM sound.getComponent().setButtonLinks(&music, &debug, &soundDown, &soundUp); soundDown.getComponent().setButtonLinks(&music, &debug, nullptr, &sound); soundUp.getComponent().setButtonLinks(&music, &debug, &sound); - debug.getComponent().setButtonLinks(&sound, &back, &back); - back.getComponent().setButtonLinks(&debug, nullptr, nullptr, &debug); + debug.getComponent().setButtonLinks(&sound, &fullscreen); + fullscreen.getComponent().setButtonLinks(&debug, &back, &back); + back.getComponent().setButtonLinks(&fullscreen, nullptr, nullptr, &fullscreen); return scene; } } \ No newline at end of file