OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
videowidget.h
Go to the documentation of this file.
1#pragma once
2
3#include <Tempest/Widget>
4
5#include <queue>
6
7#include "resources.h"
8
9class VideoWidget : public Tempest::Widget {
10 public:
13
14 void pushVideo(std::string_view filename);
15 bool isActive() const;
16
17 void tick();
18 void paint(Tempest::Device& device, uint8_t fId);
19 void paintEvent(Tempest::PaintEvent &event) override;
20
21 void keyDownEvent(Tempest::KeyEvent& event) override;
22 void keyUpEvent (Tempest::KeyEvent& event) override;
23
24 void mouseDownEvent(Tempest::MouseEvent& event) override;
25
26 private:
27 struct Input;
28 struct Sound;
29 struct SoundContext;
30 struct Context;
31
32 void stopVideo();
33
34 std::unique_ptr<Context> ctx;
35 Tempest::Texture2d tex[Resources::MaxFramesInFlight];
36 Tempest::Texture2d* frame = nullptr;
37 bool active = false;
38 bool restoreMusic = false;
39
40 std::atomic_bool hasPendingVideo{false};
41 std::mutex syncVideo;
42 std::queue<std::string> pendingVideo;
43 };
44
@ MaxFramesInFlight
Definition resources.h:48
void paintEvent(Tempest::PaintEvent &event) override
void keyUpEvent(Tempest::KeyEvent &event) override
void paint(Tempest::Device &device, uint8_t fId)
void keyDownEvent(Tempest::KeyEvent &event) override
bool isActive() const
void pushVideo(std::string_view filename)
void mouseDownEvent(Tempest::MouseEvent &event) override