Loading...
Searching...
No Matches
plugins/score-plugin-gfx/Gfx/Graph/Window.hpp
1#pragma once
2
3#include <Gfx/Graph/RenderState.hpp>
4
5#include <QTabletEvent>
6#include <QWindow>
7
8#include <score_plugin_gfx_export.h>
9
10#include <verdigris>
11namespace score::gfx
12{
13struct ScreenNode;
14
20class SCORE_PLUGIN_GFX_EXPORT Window : public QWindow
21{
22 friend ScreenNode;
23 W_OBJECT(Window)
24
25public:
26 explicit Window(GraphicsApi graphicsApi);
27 ~Window();
28
29 GraphicsApi api() const noexcept { return m_api; }
30
31 void init();
32
33 void resizeSwapChain();
34 void releaseSwapChain();
35 void render();
36
37 void exposeEvent(QExposeEvent*) override;
38 void mouseDoubleClickEvent(QMouseEvent* ev) override;
39
40 bool event(QEvent* e) override;
41
42 std::function<void()> onWindowReady;
43 std::function<void()> onUpdate;
44 std::function<void(QRhiCommandBuffer&)> onRender;
45 std::function<void()> onResize;
46
47 void tabletMove(QTabletEvent* ev) W_SIGNAL(tabletMove, ev);
48
49 void mouseMove(QPointF screen, QPointF win) W_SIGNAL(mouseMove, screen, win);
50
51 void interactiveEvent(QEvent* event)
52 E_SIGNAL(SCORE_PLUGIN_GFX_EXPORT, interactiveEvent, event);
53
54 void key(int key, const QString& t) W_SIGNAL(key, key, t);
55 void keyRelease(int key, const QString& t) W_SIGNAL(keyRelease, key, t);
56
57private:
58 std::shared_ptr<RenderState> state;
59 GraphicsApi m_api{};
60 QRhiSwapChain* m_swapChain{};
61
62 bool m_closed = false;
63 bool m_canRender = false;
64 bool m_running = false;
65 bool m_notExposed = false;
66 bool m_newlyExposed = false;
67 bool m_hasSwapChain = false;
68 bool m_embeddedFullscreen = false;
69};
70}
71
72W_REGISTER_ARGTYPE(QEvent*)
73W_REGISTER_ARGTYPE(QTabletEvent*)
A platform window in which the content is going to be rendered.
Definition plugins/score-plugin-gfx/Gfx/Graph/Window.hpp:21
Graphics rendering pipeline for ossia score.
Definition Filter/PreviewWidget.hpp:12
GraphicsApi
Available graphics APIs to use.
Definition RenderState.hpp:20
This node is used for rendering to a score::gfx::Window.
Definition ScreenNode.hpp:12