Add initializers for Mock notes in Editor

This commit is contained in:
NaiJi ✨ 2021-11-23 21:35:13 +03:00
parent b3bec61542
commit 0b1acd7697
11 changed files with 53 additions and 9 deletions

View File

@ -11,7 +11,6 @@ public:
virtual bool isActive() const = 0;
virtual void update(const microsec& music_offset) = 0;
virtual void input(PlayerInput&& inputdata) = 0;
virtual void draw() const = 0;
virtual void putToGame(const microsec& offset) = 0;

View File

@ -10,7 +10,6 @@ file(GLOB_RECURSE SOURCES "editor/*.h" "editor/*.cpp" "graphics/*.h" "graphics/*
add_library(classicmode STATIC ${SOURCES} ${HEADERS})
target_include_directories(classicmode PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(classicmode PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/game)
target_include_directories(classicmode PRIVATE ${CMAKE_SOURCE_DIR}/tools/shared)
target_include_directories(classicmode PRIVATE ${CMAKE_SOURCE_DIR}/core/shared)
target_link_libraries(classicmode tools core)

View File

@ -4,7 +4,6 @@
#include "core/editor.h"
#include "tools/music.h"
#include "core/timeline.h"
#include "game/classicnote.h"
class ClassicGraphicsManager;

View File

@ -0,0 +1,10 @@
#pragma once
#include "classicmode/noteinitializer.h"
#include "classicmode/elementinitializer.h"
struct MockArrowNoteInitializer
{
NoteInitializer initializer;
std::vector<ElementInitializer> elements;
};

View File

@ -0,0 +1,7 @@
#include "mockclassicnote.h"
MockClassicNote::MockClassicNote(MockArrowNoteInitializer&& init) :
Note(init.initializer)
{
}

View File

@ -0,0 +1,29 @@
#pragma once
#include "core/note.h"
#include "initializers/mockarrownoteinitializer.h"
class MockClassicNote : public Note
{
public:
enum State
{
NONE,
FLYING,
DYING,
DEAD
};
explicit MockClassicNote(MockArrowNoteInitializer&& init);
virtual ~MockClassicNote() = default;
virtual bool isActive() const override final;
virtual bool isInGame() const override final;
virtual bool shouldRemove() const override final;
virtual void putToGame(const microsec &music_offset) override = 0;
virtual void update(const microsec &music_offset) override = 0;
virtual void draw() const override = 0;
};

View File

@ -3,7 +3,7 @@
#include "context.h"
#include "core/note.h"
#include "core/precisionevaluator.h"
#include "initializers/noteinitializer.h"
#include "classicmode/noteinitializer.h"
class ClassicSprite;
class ClassicAnimationScenario;
@ -38,9 +38,10 @@ public:
virtual void putToGame(const microsec &music_offset) override = 0;
virtual void update(const microsec &music_offset) override = 0;
virtual void input(PlayerInput&& inputdata) override = 0;
virtual void draw() const override = 0;
virtual void input(PlayerInput&& inputdata) = 0;
protected:
const PrecisionEvaluator<Grade> _evaluator;

View File

@ -1,10 +1,12 @@
#pragma once
#include "elementinitializer.h"
#include "classicmode/elementinitializer.h"
#include "classicmode/classicactions.h"
struct ArrowElementInitializer
{
ElementInitializer element;
Type type = Type::NONE;
std::array<sf::Keyboard::Key, 2> keys;
};

View File

@ -1,6 +1,6 @@
#pragma once
#include "noteinitializer.h"
#include "classicmode/noteinitializer.h"
#include "arrowelementinitializer.h"
struct ArrowNoteInitializer

View File

@ -4,11 +4,9 @@
#include "tools/mathutils.h"
#include <vector>
#include <array>
struct ElementInitializer
{
Coordinates coordinates;
std::vector<Coordinates> falling_curve_interpolation;
std::array<sf::Keyboard::Key, 2> keys; // needs initialization
};