diff --git a/src/application/src/editorstate.cpp b/src/application/src/editorstate.cpp index b21635e..e4fe688 100644 --- a/src/application/src/editorstate.cpp +++ b/src/application/src/editorstate.cpp @@ -139,7 +139,7 @@ void EditorState::enter() test_menu->addPushButton(bpm_button); test_menu->addCascadeButton(test_cascade_button); - test_menu->addPushButton(quit_button); + //test_menu->addPushButton(quit_button); test_cascade_button->resetRect(); diff --git a/src/modes/classicmode/editor/editorcontext.cpp b/src/modes/classicmode/editor/editorcontext.cpp index b69ceb8..3d6b5b2 100644 --- a/src/modes/classicmode/editor/editorcontext.cpp +++ b/src/modes/classicmode/editor/editorcontext.cpp @@ -2,7 +2,7 @@ #include "game/classicarrownote.h" #include "graphics/animations/classicanimationscenario.h" #include "graphics/classicgraphicsmanager.h" -#include "graphics/classicnotegraphics.h" +#include "graphics/notegraphics/notegraphics.h" EditorContext::EditorContext(const std::shared_ptr>& selection_manager, std::vector>&& graphics_managers) : diff --git a/src/modes/classicmode/editor/selectionmanager.h b/src/modes/classicmode/editor/selectionmanager.h index 4be6c27..bbf406a 100644 --- a/src/modes/classicmode/editor/selectionmanager.h +++ b/src/modes/classicmode/editor/selectionmanager.h @@ -60,12 +60,6 @@ public: return _multiselection_enabled; } - void apply(const std::function& function) - { - for (auto& thing : _selected_things) - function(thing); - } - private: std::vector _selected_things; bool _multiselection_enabled; diff --git a/src/modes/classicmode/game/arrowelement.h b/src/modes/classicmode/game/arrowelement.h index 3eb43bd..3c101a0 100644 --- a/src/modes/classicmode/game/arrowelement.h +++ b/src/modes/classicmode/game/arrowelement.h @@ -3,18 +3,18 @@ #include "classicmode/classicactions.h" #include "core/gameevent.h" -#include "core/point.h" +#include "core/point.h" #include #include #include -class ClassicNoteGraphics; +class NoteGraphics; class ClassicAnimationScenario; struct ArrowElement { - std::shared_ptr sprite; + std::shared_ptr sprite; std::array, 5> animations; kku::SystemEvent::Key::Code pressed_as = kku::SystemEvent::Key::Code::Unknown; diff --git a/src/modes/classicmode/graphics/animations/classicanimationscenario.h b/src/modes/classicmode/graphics/animations/classicanimationscenario.h index aa001f7..903d8a4 100644 --- a/src/modes/classicmode/graphics/animations/classicanimationscenario.h +++ b/src/modes/classicmode/graphics/animations/classicanimationscenario.h @@ -4,19 +4,19 @@ #include -class ClassicNoteGraphics; +class NoteGraphics; class ClassicAnimationScenario { public: virtual ~ClassicAnimationScenario() = default; - virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) = 0; + virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) = 0; virtual void update(const kku::microsec& music_offset) = 0; virtual bool isDone() const = 0; protected: - std::shared_ptr _sprite; + std::shared_ptr _sprite; kku::microsec _time_begin; kku::microsec _time_end; }; diff --git a/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.cpp b/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.cpp index 117e164..e280c3c 100644 --- a/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.cpp +++ b/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.cpp @@ -1,7 +1,7 @@ #include "classicdyinganimationscenario.h" -#include "graphics/classicnotegraphics.h" +#include "graphics/notegraphics/notegraphics.h" -void ClassicDyingAnimationScenario::launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) +void ClassicDyingAnimationScenario::launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) { _sprite = sprite; _time_begin = time_begin; diff --git a/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.h b/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.h index 300f7ae..c8f1fb2 100644 --- a/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.h +++ b/src/modes/classicmode/graphics/animations/classicdyinganimationscenario.h @@ -5,7 +5,7 @@ class ClassicDyingAnimationScenario : public ClassicAnimationScenario { public: - virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec& time_end) override; + virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec& time_end) override; virtual void update(const kku::microsec& music_offset) override; virtual bool isDone() const override; }; diff --git a/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.cpp b/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.cpp index 0413986..0dfe286 100644 --- a/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.cpp +++ b/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.cpp @@ -1,7 +1,7 @@ #include "classicflyinganimationscenario.h" -#include "graphics/classicnotegraphics.h" +#include "graphics/notegraphics/notegraphics.h" -void ClassicFlyingAnimationScenario::launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) +void ClassicFlyingAnimationScenario::launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec &time_end) { _sprite = sprite; _time_begin = time_begin; diff --git a/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.h b/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.h index e001159..55bf44e 100644 --- a/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.h +++ b/src/modes/classicmode/graphics/animations/classicflyinganimationscenario.h @@ -6,7 +6,7 @@ class ClassicFlyingAnimationScenario : public ClassicAnimationScenario { public: - virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec& time_end) override; + virtual void launch(const std::shared_ptr sprite, const kku::microsec& time_begin, const kku::microsec& time_end) override; virtual void update(const kku::microsec& music_offset) override; virtual bool isDone() const override; diff --git a/src/modes/classicmode/graphics/classicgraphicsfactory.cpp b/src/modes/classicmode/graphics/classicgraphicsfactory.cpp index 0bb0c5b..bb43385 100644 --- a/src/modes/classicmode/graphics/classicgraphicsfactory.cpp +++ b/src/modes/classicmode/graphics/classicgraphicsfactory.cpp @@ -41,10 +41,10 @@ auto ClassicGraphicsFactory::generate(Type type) const -> SpriteData return SpriteData{shape, trail, color}; } -std::shared_ptr ClassicGraphicsFactory::createSprite(Type type) const +std::shared_ptr ClassicGraphicsFactory::createSprite(Type type) const { const auto data = generate(type); - return std::make_shared(ClassicNoteGraphics::Init{data.shape, data.trail, data.color}); + return std::make_shared(NoteGraphics::Init{data.shape, data.trail, data.color}); } std::shared_ptr ClassicGraphicsFactory::createSelection() const diff --git a/src/modes/classicmode/graphics/classicgraphicsfactory.h b/src/modes/classicmode/graphics/classicgraphicsfactory.h index cfe19e4..db0b448 100644 --- a/src/modes/classicmode/graphics/classicgraphicsfactory.h +++ b/src/modes/classicmode/graphics/classicgraphicsfactory.h @@ -3,7 +3,7 @@ #include #include "classicmode/classicactions.h" -#include "graphics/classicnotegraphics.h" +#include "graphics/notegraphics/notegraphics.h" #include "graphics/classicselectiongraphics.h" #include "core/rectangle.h" #include "core/corefactory.h" @@ -13,7 +13,7 @@ class ClassicGraphicsFactory public: explicit ClassicGraphicsFactory(const std::shared_ptr& core_factory); - std::shared_ptr createSprite(Type type) const; + std::shared_ptr createSprite(Type type) const; std::shared_ptr createSelection() const; private: diff --git a/src/modes/classicmode/graphics/classicnotegraphics.h b/src/modes/classicmode/graphics/classicnotegraphics.h deleted file mode 100644 index f0b5831..0000000 --- a/src/modes/classicmode/graphics/classicnotegraphics.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "core/sprite.h" -#include "core/point.h" -#include "core/color.h" -#include "core/rectangle.h" - -#include - -class ClassicNoteGraphics -{ -public: - - struct Init - { - std::shared_ptr shape; - std::shared_ptr trail; - kku::Color color; - }; - - ClassicNoteGraphics(ClassicNoteGraphics::Init&& init); - void reset(); - void display() const; - - void setPosition(const kku::Point &position); - void setTrailPosition(const kku::Point &position); - kku::Point getPosition() const; - kku::Point getTrailPosition() const; - - void setColor(const kku::Color& color); - void setTrailColor(const kku::Color& color); - kku::Color getColor() const; - kku::Color getTrailColor() const; - - std::shared_ptr getRectangle() const; - -protected: - kku::Color _reset_color; - std::shared_ptr _shape; - std::shared_ptr _trail; -}; diff --git a/src/modes/classicmode/graphics/classicscenegraphicsmanager.h b/src/modes/classicmode/graphics/classicscenegraphicsmanager.h index 552b129..51fe776 100644 --- a/src/modes/classicmode/graphics/classicscenegraphicsmanager.h +++ b/src/modes/classicmode/graphics/classicscenegraphicsmanager.h @@ -30,7 +30,7 @@ public: protected: - kku::SpriteContainer _sprite_container; + kku::SpriteContainer _sprite_container; const std::shared_ptr _factory; typedef typename std::set::const_iterator Iterator; diff --git a/src/modes/classicmode/graphics/classicselectiongraphics.cpp b/src/modes/classicmode/graphics/classicselectiongraphics.cpp index 8781425..58187c7 100644 --- a/src/modes/classicmode/graphics/classicselectiongraphics.cpp +++ b/src/modes/classicmode/graphics/classicselectiongraphics.cpp @@ -1,5 +1,5 @@ #include "classicselectiongraphics.h" -#include "classicnotegraphics.h" +#include "graphics/notegraphics/notegraphics.h" ClassicSelectionGraphics::ClassicSelectionGraphics(ClassicSelectionGraphics::Init&& init) : _fill_color(init.color), @@ -19,7 +19,7 @@ void ClassicSelectionGraphics::display() const _shape->display(); } -void ClassicSelectionGraphics::adjustTo(const std::shared_ptr& sprite) +void ClassicSelectionGraphics::adjustTo(const std::shared_ptr& sprite) { _shape->setRect(sprite->getRectangle()->getRect()); } diff --git a/src/modes/classicmode/graphics/classicselectiongraphics.h b/src/modes/classicmode/graphics/classicselectiongraphics.h index 1108fc1..e6e4740 100644 --- a/src/modes/classicmode/graphics/classicselectiongraphics.h +++ b/src/modes/classicmode/graphics/classicselectiongraphics.h @@ -6,7 +6,7 @@ #include -class ClassicNoteGraphics; +class NoteGraphics; class ClassicSelectionGraphics { @@ -22,7 +22,7 @@ public: void reset(); void display() const; - void adjustTo(const std::shared_ptr& sprite); + void adjustTo(const std::shared_ptr &sprite); protected: kku::Color _fill_color; diff --git a/src/modes/classicmode/graphics/classictimelinegraphicsmanager.h b/src/modes/classicmode/graphics/classictimelinegraphicsmanager.h index b84bd8a..1d21ff0 100644 --- a/src/modes/classicmode/graphics/classictimelinegraphicsmanager.h +++ b/src/modes/classicmode/graphics/classictimelinegraphicsmanager.h @@ -26,7 +26,7 @@ public: virtual void draw(const ClassicArrowNote * const note) const override; protected: - kku::SpriteContainer _sprite_container; + kku::SpriteContainer _sprite_container; const std::shared_ptr _factory; typedef typename std::set::const_iterator Iterator; diff --git a/src/modes/classicmode/graphics/classicnotegraphics.cpp b/src/modes/classicmode/graphics/notegraphics/notecontentgraphics.cpp similarity index 50% rename from src/modes/classicmode/graphics/classicnotegraphics.cpp rename to src/modes/classicmode/graphics/notegraphics/notecontentgraphics.cpp index 134e4e8..990759b 100644 --- a/src/modes/classicmode/graphics/classicnotegraphics.cpp +++ b/src/modes/classicmode/graphics/notegraphics/notecontentgraphics.cpp @@ -1,6 +1,6 @@ -#include "classicnotegraphics.h" +#include "graphics/notegraphics/notecontentgraphics.h" -ClassicNoteGraphics::ClassicNoteGraphics(ClassicNoteGraphics::Init&& init) : +NoteContentGraphics::NoteContentGraphics(NoteContentGraphics::Init&& init) : _reset_color(init.color), _shape(init.shape), _trail(init.trail) @@ -9,7 +9,7 @@ ClassicNoteGraphics::ClassicNoteGraphics(ClassicNoteGraphics::Init&& init) : _trail->setColor(init.color); } -void ClassicNoteGraphics::reset() +void NoteContentGraphics::reset() { _shape->setPosition(kku::Point{0, 0}); _trail->setPosition(kku::Point{0, 0}); @@ -18,53 +18,53 @@ void ClassicNoteGraphics::reset() _trail->setColor(_reset_color); } -void ClassicNoteGraphics::setPosition(const kku::Point& position) +void NoteContentGraphics::setPosition(const kku::Point& position) { _shape->setPosition(position); } -void ClassicNoteGraphics::setTrailPosition(const kku::Point &position) +void NoteContentGraphics::setTrailPosition(const kku::Point &position) { _trail->setPosition(position); } -kku::Point ClassicNoteGraphics::getPosition() const +kku::Point NoteContentGraphics::getPosition() const { return _shape->getPosition(); } -kku::Point ClassicNoteGraphics::getTrailPosition() const +kku::Point NoteContentGraphics::getTrailPosition() const { return _trail->getPosition(); } -void ClassicNoteGraphics::setColor(const kku::Color& color) +void NoteContentGraphics::setColor(const kku::Color& color) { _shape->setColor(color); } -void ClassicNoteGraphics::setTrailColor(const kku::Color& color) +void NoteContentGraphics::setTrailColor(const kku::Color& color) { _trail->setColor(color); } -kku::Color ClassicNoteGraphics::getColor() const +kku::Color NoteContentGraphics::getColor() const { return _shape->getColor(); } -kku::Color ClassicNoteGraphics::getTrailColor() const +kku::Color NoteContentGraphics::getTrailColor() const { return _trail->getColor(); } -void ClassicNoteGraphics::display() const +void NoteContentGraphics::display() const { _shape->display(); _trail->display(); } -std::shared_ptr ClassicNoteGraphics::getRectangle() const +std::shared_ptr NoteContentGraphics::getRectangle() const { return _shape; } diff --git a/src/modes/classicmode/graphics/notegraphics/notecontentgraphics.h b/src/modes/classicmode/graphics/notegraphics/notecontentgraphics.h new file mode 100644 index 0000000..09c245a --- /dev/null +++ b/src/modes/classicmode/graphics/notegraphics/notecontentgraphics.h @@ -0,0 +1,37 @@ +#pragma once + +#include "notegraphics.h" +#include + +class NoteContentGraphics : public NoteGraphics +{ +public: + + struct Init + { + std::shared_ptr shape; + std::shared_ptr trail; + kku::Color color; + }; + + explicit NoteContentGraphics(NoteContentGraphics::Init&& init); + virtual void reset() override; + virtual void display() const override; + + virtual void setPosition(const kku::Point &position) override; + virtual void setTrailPosition(const kku::Point &position) override; + virtual kku::Point getPosition() const override; + virtual kku::Point getTrailPosition() const override; + + virtual void setColor(const kku::Color& color) override; + virtual void setTrailColor(const kku::Color& color) override; + virtual kku::Color getColor() const override; + virtual kku::Color getTrailColor() const override; + + virtual std::shared_ptr getRectangle() const override; + +protected: + kku::Color _reset_color; + std::shared_ptr _shape; + std::shared_ptr _trail; +}; diff --git a/src/modes/classicmode/graphics/notegraphics/notedecoratorgraphics.h b/src/modes/classicmode/graphics/notegraphics/notedecoratorgraphics.h new file mode 100644 index 0000000..2627e2c --- /dev/null +++ b/src/modes/classicmode/graphics/notegraphics/notedecoratorgraphics.h @@ -0,0 +1,71 @@ +#pragma once + +#include "notegraphics.h" +#include + +class NoteDecoratorGraphics : public NoteGraphics +{ +public: + virtual ~NoteDecoratorGraphics() override = 0; + explicit NoteDecoratorGraphics(const std::shared_ptr& decorated_graphics) + : _decorated_graphics(decorated_graphics) + {} + + virtual void reset() override + { + _decorated_graphics->reset(); + } + + virtual void display() const override + { + _decorated_graphics->display(); + } + + virtual void setPosition(const kku::Point &position) override + { + _decorated_graphics->setPosition(position); + } + + virtual void setTrailPosition(const kku::Point &position) override + { + _decorated_graphics->setTrailPosition(position); + } + + virtual kku::Point getPosition() const override + { + return _decorated_graphics->getPosition(); + } + + virtual kku::Point getTrailPosition() const override + { + return _decorated_graphics->getTrailPosition(); + } + + virtual void setColor(const kku::Color& color) override + { + _decorated_graphics->setColor(color); + } + + virtual void setTrailColor(const kku::Color& color) override + { + _decorated_graphics->setTrailColor(color); + } + + virtual kku::Color getColor() const override + { + return _decorated_graphics->getColor(); + } + + virtual kku::Color getTrailColor() const override + { + return _decorated_graphics->getTrailColor(); + } + + virtual std::shared_ptr getRectangle() const override + { + return _decorated_graphics->getRectangle(); + } + +private: + const std::shared_ptr _decorated_graphics; +}; diff --git a/src/modes/classicmode/graphics/notegraphics/notegraphics.h b/src/modes/classicmode/graphics/notegraphics/notegraphics.h new file mode 100644 index 0000000..2223b2a --- /dev/null +++ b/src/modes/classicmode/graphics/notegraphics/notegraphics.h @@ -0,0 +1,27 @@ +#pragma once + +#include "core/point.h" +#include "core/color.h" +#include "core/rectangle.h" + +#include + +class NoteGraphics +{ +public: + virtual ~NoteGraphics() = default; + virtual void reset() = 0; + virtual void display() const = 0; + + virtual void setPosition(const kku::Point& position) = 0; + virtual void setTrailPosition(const kku::Point& position) = 0; + virtual kku::Point getPosition() const = 0; + virtual kku::Point getTrailPosition() const = 0; + + virtual void setColor(const kku::Color& color) = 0; + virtual void setTrailColor(const kku::Color& color) = 0; + virtual kku::Color getColor() const = 0; + virtual kku::Color getTrailColor() const = 0; + + virtual std::shared_ptr getRectangle() const = 0; +};