project-kyoku/src/impl/sfml/classicmode/classicfactorysfml.cpp

37 lines
1.3 KiB
C++
Raw Normal View History

2021-12-29 15:59:18 +01:00
#include "classicfactorysfml.h"
#include "spritefactorysfml.h"
#include "graphics/classicscenegraphicsmanager.h"
#include "core/timeline.h"
#include "game/classicgame.h"
#include "editor/classiceditor.h"
ClassicFactorySFML::ClassicFactorySFML(sf::RenderTarget * const render_target) :
2021-12-29 15:59:18 +01:00
_render_target(render_target)
{}
std::unique_ptr<kku::Game> ClassicFactorySFML::getGame() const
{
// read offset from beatmap metadata
2021-12-29 15:59:18 +01:00
const kku::microsec visibility_offset = 1648648;
2021-12-29 15:59:18 +01:00
const auto factory = std::make_shared<ClassicSpriteFactorySFML>(_render_target);
const auto timeline = std::make_shared<kku::Timeline<ClassicNote>>();
const auto graphics_manager = std::make_shared<ClassicSceneGraphicsManager>(timeline, factory, visibility_offset);
return std::make_unique<ClassicGame>(timeline, graphics_manager);
}
2021-12-29 15:59:18 +01:00
std::unique_ptr<kku::Editor> ClassicFactorySFML::getEditor() const
{
// read offset from beatmap metadata
2021-12-29 15:59:18 +01:00
const kku::microsec visibility_offset = 1648648;
2021-12-29 15:59:18 +01:00
const auto factory = std::make_shared<ClassicSpriteFactorySFML>(_render_target);
const auto timeline = std::make_shared<kku::Timeline<ClassicNote>>();
const auto graphics_manager = std::make_shared<ClassicSceneGraphicsManager>(timeline, factory, visibility_offset);
return std::make_unique<ClassicEditor>(timeline, graphics_manager);
}