3 #include <BLIB/Render.hpp>
14 constexpr
float IntroLength = 1.6f;
15 bool pipelineCreated =
false;
17 struct FragmentUniform {
22 using Bindings = bl::rc::ds::Bindings<bl::rc::ds::GlobalUniformBuffer<FragmentUniform>>;
23 using Factory = bl::rc::ds::GenericDescriptorSetFactory<Bindings, VK_SHADER_STAGE_FRAGMENT_BIT>;
24 using Instance = bl::rc::ds::GenericDescriptorSetInstance<Bindings>;
32 if (!pipelineCreated) {
33 pipelineCreated =
true;
35 bl::rc::vk::PipelineParameters params;
36 params.withSimpleDepthStencil(
false)
37 .withPrimitiveType(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
38 .addDescriptorSet<bl::rc::ds::Scene2DFactory>()
39 .addDescriptorSet<bl::rc::ds::Object2DFactory>()
40 .addDescriptorSet<Factory>()
41 .withShaders(bl::rc::Config::ShaderIds::Vertex2D,
42 "Resources/Shaders/Battle/trainerIntro.frag.spv");
49 auto overlay = engine.renderer().getObserver().getOrCreateSceneOverlay();
55 background.setFillColor(sf::Color::Black);
56 background.addToSceneWithCustomPipeline(
59 ballTxtr = engine.renderer().texturePool().getOrLoadTexture(
61 ball.create(engine, ballTxtr);
62 ball.getTransform().setOrigin(ballTxtr->size() * 0.5f);
63 ball.getTransform().setPosition({screenCenter.x, screenCenter.y});
64 ball.getTransform().setScale(0.f, 0.f);
65 ball.setParent(background);
66 ball.addToScene(overlay, bl::rc::UpdateSpeed::Dynamic);
68 Instance& set = overlay->getDescriptorSet<Instance>();
69 uniform = &set.getBindingPayload<FragmentUniform>();
75 FragmentUniform* u =
static_cast<FragmentUniform*
>(uniform);
76 const sf::Vector2u ws = e->window().getSfWindow().getSize();
77 u->progress = time / IntroLength;
78 u->windowSize.x =
static_cast<float>(ws.x);
79 u->windowSize.y =
static_cast<float>(ws.y);
81 ball.getTransform().setScale(u->progress);
Parent namespace for all functionality unique to the game.
static sf::Vector2f WindowSize()
static constexpr std::uint32_t TrainerIntroPipelineId
static const std::string & ImagePath()
virtual void update(float dt) override
virtual bool finished() const override
virtual void start(bl::engine::Engine &engine) override