Loading...
Searching...
No Matches
ScreenLayout.h
Go to the documentation of this file.
1// Copyright (c) 2025 Dave R. Smith.
2// Malena Framework — Licensed under PolyForm Noncommercial 1.0.0; commercial use requires a paid license. See LICENSE.
3
4#pragma once
5#ifndef MALENA_SCREEN_LAYOUT_H
6#define MALENA_SCREEN_LAYOUT_H
7
11#include <cstddef>
12#include <cstdint>
14#include <string>
15
16namespace ml {
17
32class MALENA_API ScreenLayout : public Graphic<sf::RectangleShape>
33{
34public:
35 enum class Mode { Single, SideBySide, AboveBelow };
36
38
41 Mode mode() const;
42
44 void setRatio(float ratio01);
45 float ratio() const;
46
48 void setSource(int pane, const std::string& rtspUrl);
49
51 void setFrozen(int pane, bool frozen);
52
59 void pushFrame(int pane, const std::uint8_t* data, std::size_t size);
60
63
65 void start();
66 void stop();
67
68 void draw(sf::RenderTarget& target, sf::RenderStates states) const override;
69
70private:
71 void layoutPanes() const; // const: invoked from draw() to track live size
72
73 mutable ScreenReceiverBase _pane0;
74 mutable ScreenReceiverBase _pane1;
75 Mode _mode = Mode::Single;
76 float _ratio = 0.5f;
77 bool _running = false;
78};
79
80} // namespace ml
81
82#endif // MALENA_SCREEN_LAYOUT_H
void setScaleMode(ScreenReceiverBase::ScaleMode mode)
void setMode(Mode mode)
void setSource(int pane, const std::string &rtspUrl)
void pushFrame(int pane, const std::uint8_t *data, std::size_t size)
void setRatio(float ratio01)
Mode mode() const
void draw(sf::RenderTarget &target, sf::RenderStates states) const override
Draw this graphic to an SFML render target.
float ratio() const
void setFrozen(int pane, bool frozen)
Displays a live H.264 video stream pulled from an RTSP/RTP source.
#define MALENA_API
Definition Animate.h:25