ScreenNode.hpp
1 #pragma once
2 #include <Gfx/Graph/OutputNode.hpp>
3 
4 class QScreen;
5 class QTabletEvent;
6 namespace score::gfx
7 {
11 struct SCORE_PLUGIN_GFX_EXPORT ScreenNode : OutputNode
12 {
13  ScreenNode(bool embedded = false, bool startFullScreen = false);
14  ScreenNode(std::shared_ptr<Window>);
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 
32  void createOutput(
33  GraphicsApi graphicsApi, std::function<void()> onReady,
34  std::function<void()> onUpdate, std::function<void()> onResize) override;
35  void destroyOutput() override;
36  void updateGraphicsAPI(GraphicsApi) override;
37 
38  std::shared_ptr<RenderState> renderState() const override;
39  score::gfx::OutputNodeRenderer* createRenderer(RenderList& r) const noexcept override;
40  Configuration configuration() const noexcept override;
41 
42  const std::shared_ptr<Window>& window() const noexcept { return m_window; }
43 
44  std::function<void(QPointF, QPointF)> onMouseMove;
45  std::function<void(QTabletEvent*)> onTabletMove;
46  std::function<void(int, const QString&)> onKey;
47 
48 private:
49  class BasicRenderer;
50  class ScaledRenderer;
51  std::shared_ptr<Window> m_window{};
52  QRhiSwapChain* m_swapChain{};
53  QRhiRenderBuffer* m_depthStencil{};
54  QScreen* m_screen{};
55  std::optional<QPoint> m_pos{};
56  std::optional<QSize> m_sz{};
57  std::optional<QSize> m_renderSz{};
58 
59  bool m_embedded{};
60  bool m_fullScreen{};
61  bool m_ownsWindow{};
62 };
63 }
Base class for sink nodes (QWindow, spout, syphon, NDI output, ...)
Definition: OutputNode.hpp:23
Definition: OutputNode.hpp:11
List of nodes to be rendered to an output.
Definition: RenderList.hpp:19
Definition: ScreenNode.cpp:464
Definition: ScreenNode.cpp:493
Graphics rendering pipeline for ossia score.
Definition: Filter/PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition: RenderState.hpp:17
Definition: OutputNode.hpp:48
This node is used for rendering to a score::gfx::Window.
Definition: ScreenNode.hpp:12