forked from NaiJi/project-kyoku
Separate graphics from game and editor logic
This commit is contained in:
parent
7f7045c920
commit
b3bec61542
|
@ -4,8 +4,8 @@
|
|||
|
||||
struct BPMSection
|
||||
{
|
||||
int bpm = 0;
|
||||
int fraction = 1;
|
||||
int bpm = 120; // Hi, osu
|
||||
int fraction = 2;
|
||||
microsec offset_start = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -23,12 +23,12 @@ public:
|
|||
_bpm_sections = std::move(sections);
|
||||
}
|
||||
|
||||
inline void insertBPMSection(const BPMSection& section)
|
||||
void insertBPMSection(const BPMSection& section)
|
||||
{
|
||||
_bpm_sections.insert(section);
|
||||
}
|
||||
|
||||
inline void insertBPMSection(BPMSection&& section)
|
||||
void insertBPMSection(BPMSection&& section)
|
||||
{
|
||||
_bpm_sections.insert(std::move(section));
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||
include_directories(${CMAKE_SOURCE_DIR}/include)
|
||||
|
||||
file(GLOB_RECURSE HEADERS "shared/*.h" )
|
||||
file(GLOB_RECURSE SOURCES "editor/*.h" "editor/*.cpp" "game/*.h" "game/*.cpp" "./classicfactory.cpp")
|
||||
file(GLOB_RECURSE SOURCES "editor/*.h" "editor/*.cpp" "graphics/*.h" "graphics/*.cpp" "game/*.h" "game/*.cpp" "./classicfactory.cpp")
|
||||
|
||||
add_library(classicmode STATIC ${SOURCES} ${HEADERS})
|
||||
target_include_directories(classicmode PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/include)
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
#include "shared/classicmode/classicfactory.h"
|
||||
#include "game/classicgame.h"
|
||||
#include "game/classicgraphicsmanager.h"
|
||||
#include "graphics/classicgraphicsmanager.h"
|
||||
#include "tools/music.h"
|
||||
|
||||
#include "editor/classiceditor.h"
|
||||
|
||||
#include <SFML/Graphics/RenderWindow.hpp>
|
||||
|
||||
std::unique_ptr<Game> classic::init(sf::RenderWindow& game_window)
|
||||
std::unique_ptr<Game> classic::initGame(sf::RenderWindow& game_window)
|
||||
{
|
||||
return std::make_unique<ClassicGame>(std::make_unique<ClassicGraphicsManager>(game_window));
|
||||
}
|
||||
|
||||
std::unique_ptr<Editor> classic::initEditor(sf::RenderWindow& game_window)
|
||||
{
|
||||
return std::make_unique<ClassicEditor>(std::make_unique<ClassicGraphicsManager>(game_window));
|
||||
}
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "classicarrownote.h"
|
||||
#include "classicgraphicsmanager.h"
|
||||
#include "graphics/classicgraphicsmanager.h"
|
||||
#include "holdmanager.h"
|
||||
|
||||
// Replace with interface by dependency injection
|
||||
#include "classicflyinganimationscenario.h"
|
||||
#include "classicdyinganimationscenario.h"
|
||||
#include "graphics/classicflyinganimationscenario.h"
|
||||
#include "graphics/classicdyinganimationscenario.h"
|
||||
//
|
||||
|
||||
ClassicArrowNote::ClassicArrowNote(ArrowNoteInitializer&& init) :
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
|
||||
#include "context.h"
|
||||
#include "classicnote.h"
|
||||
#include "classicactions.h"
|
||||
|
||||
#include "classicmode/classicactions.h"
|
||||
|
||||
class ClassicGraphicsManager;
|
||||
class HoldManager;
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#include "classicarrownote.h"
|
||||
|
||||
// Replace with interface by dependency injection
|
||||
#include "classicflyinganimationscenario.h"
|
||||
#include "classicdyinganimationscenario.h"
|
||||
#include "graphics/classicflyinganimationscenario.h"
|
||||
#include "graphics/classicdyinganimationscenario.h"
|
||||
//
|
||||
|
||||
auto classic::createBeatmap(const std::string& filepath, const Context &context) -> Beatmap
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
#include "classicnote.h"
|
||||
#include "classicsprite.h"
|
||||
#include "classicgraphicsmanager.h"
|
||||
#include "graphics/classicsprite.h"
|
||||
#include "graphics/classicgraphicsmanager.h"
|
||||
|
||||
// Replace with interface by dependency injection
|
||||
#include "classicflyinganimationscenario.h"
|
||||
#include "classicdyinganimationscenario.h"
|
||||
#include "graphics/classicflyinganimationscenario.h"
|
||||
#include "graphics/classicdyinganimationscenario.h"
|
||||
//
|
||||
|
||||
ClassicNote::ClassicNote(NoteInitializer &&init) :
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "elementinitializer.h"
|
||||
#include "classicactions.h"
|
||||
#include "classicmode/classicactions.h"
|
||||
|
||||
struct ArrowElementInitializer
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include "spritecontainer.h"
|
||||
#include "classicactions.h"
|
||||
#include "classicmode/classicactions.h"
|
||||
#include "classicspritefactory.h"
|
||||
|
||||
#include <SFML/Graphics/RenderTarget.hpp>
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include "classicactions.h"
|
||||
#include "classicmode/classicactions.h"
|
||||
#include "classicsprite.h"
|
||||
|
||||
class ClassicSpriteFactory
|
|
@ -3,10 +3,13 @@
|
|||
#include <memory>
|
||||
|
||||
class Game;
|
||||
class Music;
|
||||
class Editor;
|
||||
|
||||
namespace sf { class RenderWindow; }
|
||||
|
||||
namespace classic
|
||||
{
|
||||
std::unique_ptr<Game> init(sf::RenderWindow &game_window);
|
||||
std::unique_ptr<Game> initGame(sf::RenderWindow& game_window);
|
||||
std::unique_ptr<Editor> initEditor(sf::RenderWindow& game_window);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include "widgets/group.h"
|
||||
#include "widgets/menubar.h"
|
||||
#include "widgets/window.h"
|
||||
#include "widgets/editorwidget.h"
|
||||
#include "widgets/bpmcalculatorwidget.h"
|
||||
#include "tools/bpmcalculator.h"
|
||||
|
||||
|
@ -98,6 +99,8 @@ void EditorState::enter()
|
|||
|
||||
menu_bar->setVisibility(true);
|
||||
|
||||
auto editor_widget = std::make_unique<EditorWidget>(_edito)
|
||||
|
||||
_group = std::make_shared<Group>();
|
||||
_group->addChild(menu_bar);
|
||||
_group->addChild(bpm_widget);
|
||||
|
|
Loading…
Reference in New Issue