Loading...
Searching...
No Matches
ScreenNode.hpp
1#pragma once
2#include <Gfx/Graph/OutputNode.hpp>
3#include <Gfx/Window/WindowSettings.hpp>
4
5class QScreen;
6class QTabletEvent;
7namespace score::gfx
8{
12struct SCORE_PLUGIN_GFX_EXPORT ScreenNode : OutputNode
13{
14 explicit ScreenNode(Configuration conf, bool embedded = false, bool startFullScreen = false);
15 virtual ~ScreenNode();
16
17 void startRendering() override;
18 void render() override;
19 void onRendererChange() override;
20 bool canRender() const override;
21 void stopRendering() override;
22
23 void setRenderer(std::shared_ptr<RenderList> r) override;
24 RenderList* renderer() const override;
25
26 void setScreen(QScreen*);
27 void setPosition(QPoint pos);
28 void setSize(QSize sz);
29 void setRenderSize(QSize sz);
30 void setFullScreen(bool);
31 void setCursor(bool);
32 void setTitle(QString);
33 void setConfiguration(Configuration);
34 void setSwapchainFlag(Gfx::SwapchainFlag flag);
35 void setSwapchainFormat(Gfx::SwapchainFormat format);
36
37 void createOutput(score::gfx::OutputConfiguration) override;
38 void destroyOutput() override;
39 void updateGraphicsAPI(GraphicsApi) override;
40 void setVSyncCallback(std::function<void()>) override;
41
42 std::shared_ptr<RenderState> renderState() const override;
43 score::gfx::OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override;
44 Configuration configuration() const noexcept override;
45
46 const std::shared_ptr<Window>& window() const noexcept { return m_window; }
47
48 std::function<void(QPointF)> onWindowMove;
49 std::function<void(QPointF, QPointF)> onMouseMove;
50 std::function<void(QTabletEvent*)> onTabletMove;
51 std::function<void(int, const QString&)> onKey;
52 std::function<void(int, const QString&)> onKeyRelease;
53 std::function<void(float)> onFps;
54
55private:
56 Configuration m_conf;
57 std::shared_ptr<Window> m_window{};
58 QRhiSwapChain* m_swapChain{};
59 QRhiRenderBuffer* m_depthStencil{};
60 QScreen* m_screen{};
61 QString m_title;
62 std::optional<QPoint> m_pos{};
63 std::optional<QSize> m_sz{};
64 std::optional<QSize> m_renderSz{};
65 std::function<void()> m_vsyncCallback;
66
67 Gfx::SwapchainFlag m_swapchainFlag{};
68 Gfx::SwapchainFormat m_swapchainFormat{};
69 bool m_embedded{};
70 bool m_fullScreen{};
71 bool m_ownsWindow{};
72};
73}
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition OutputNode.hpp:31
Definition OutputNode.hpp:18
List of nodes to be rendered to an output.
Definition RenderList.hpp:19
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:22
void setCursor(Qt::CursorShape c)
setCursor sets the cursor safely.
Definition ClearLayout.cpp:8
Definition OutputNode.hpp:11
Definition OutputNode.hpp:61
This node is used for rendering to a score::gfx::Window.
Definition ScreenNode.hpp:13