window-projector.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #pragma once
  2. #include <obs.hpp>
  3. #include "qt-display.hpp"
  4. #include "window-basic-main.hpp"
  5. class QMouseEvent;
  6. class OBSProjector : public OBSQTDisplay {
  7. Q_OBJECT
  8. private:
  9. OBSSource source;
  10. OBSSignal removedSignal;
  11. static void OBSRenderMultiview(void *data, uint32_t cx, uint32_t cy);
  12. static void OBSRender(void *data, uint32_t cx, uint32_t cy);
  13. static void OBSSourceRemoved(void *data, calldata_t *params);
  14. void mousePressEvent(QMouseEvent *event) override;
  15. void mouseDoubleClickEvent(QMouseEvent *event) override;
  16. int savedMonitor = 0;
  17. bool isWindow = false;
  18. ProjectorType type = ProjectorType::Source;
  19. OBSWeakSource multiviewScenes[8];
  20. OBSSource multiviewLabels[10];
  21. gs_vertbuffer_t *outerBox = nullptr;
  22. gs_vertbuffer_t *innerBox = nullptr;
  23. gs_vertbuffer_t *leftVLine = nullptr;
  24. gs_vertbuffer_t *rightVLine = nullptr;
  25. gs_vertbuffer_t *leftLine = nullptr;
  26. gs_vertbuffer_t *topLine = nullptr;
  27. gs_vertbuffer_t *rightLine = nullptr;
  28. bool ready = false;
  29. void UpdateMultiview();
  30. private slots:
  31. void EscapeTriggered();
  32. public:
  33. OBSProjector(QWidget *parent, obs_source_t *source, bool window);
  34. ~OBSProjector();
  35. void Init(int monitor, bool window, QString title,
  36. ProjectorType type = ProjectorType::Source);
  37. static void UpdateMultiviewProjectors();
  38. };