Loading...
Searching...
No Matches
ScreenNode.hpp
1#pragma once
2#include <Gfx/Graph/OutputNode.hpp>
3
4class QScreen;
5class QTabletEvent;
6namespace score::gfx
7{
11struct SCORE_PLUGIN_GFX_EXPORT ScreenNode : OutputNode
12{
13 explicit ScreenNode(Configuration conf, bool embedded = false, bool startFullScreen = false);
14 virtual ~ScreenNode();
15
16 void startRendering() override;
17 void render() override;
18 void onRendererChange() override;
19 bool canRender() const override;
20 void stopRendering() override;
21
22 void setRenderer(std::shared_ptr<RenderList> r) override;
23 RenderList* renderer() const override;
24
25 void setScreen(QScreen*);
26 void setPosition(QPoint pos);
27 void setSize(QSize sz);
28 void setRenderSize(QSize sz);
29 void setFullScreen(bool);
30 void setCursor(bool);
31 void setTitle(QString);
32 void setConfiguration(Configuration);
33
34 void createOutput(score::gfx::OutputConfiguration) override;
35 void destroyOutput() override;
36 void updateGraphicsAPI(GraphicsApi) override;
37 void setVSyncCallback(std::function<void()>) override;
38
39 std::shared_ptr<RenderState> renderState() const override;
40 score::gfx::OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override;
41 Configuration configuration() const noexcept override;
42
43 const std::shared_ptr<Window>& window() const noexcept { return m_window; }
44
45 std::function<void(QPointF)> onWindowMove;
46 std::function<void(QPointF, QPointF)> onMouseMove;
47 std::function<void(QTabletEvent*)> onTabletMove;
48 std::function<void(int, const QString&)> onKey;
49 std::function<void(int, const QString&)> onKeyRelease;
50 std::function<void(float)> onFps;
51
52private:
53 Configuration m_conf;
54 std::shared_ptr<Window> m_window{};
55 QRhiSwapChain* m_swapChain{};
56 QRhiRenderBuffer* m_depthStencil{};
57 QScreen* m_screen{};
58 QString m_title;
59 std::optional<QPoint> m_pos{};
60 std::optional<QSize> m_sz{};
61 std::optional<QSize> m_renderSz{};
62 std::function<void()> m_vsyncCallback;
63
64 bool m_embedded{};
65 bool m_fullScreen{};
66 bool m_ownsWindow{};
67};
68}
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:20
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:12