OpenGothic
Open source reimplementation of Gothic I and II
Loading...
Searching...
No Matches
documentmenu.h
Go to the documentation of this file.
1#pragma once
2
3#include <Tempest/Widget>
4#include <Tempest/Texture2d>
5#include <Tempest/Timer>
6
7class KeyCodec;
8
9class DocumentMenu : public Tempest::Widget {
10 public:
11 DocumentMenu(const KeyCodec& key);
12
13 enum Flags : uint8_t {
17 F_Font =4
18 };
19
20 struct Page {
21 std::string img;
22 std::string text;
23 std::string font;
24 Tempest::Margin margins;
26 };
27
28 // TODO: set default values for these
29 struct Show {
30 std::vector<Page> pages;
31 std::string font;
32 Tempest::Margin margins;
33 std::string img;
34 // map
35 bool showPlayer=false;
36 Tempest::Rect wbounds;
37 };
38
39 void show(const Show& doc);
40 bool isActive() const { return active; }
41 void close();
42 void tick(uint64_t dt);
43
44 void keyDownEvent(Tempest::KeyEvent &e);
45 void keyUpEvent (Tempest::KeyEvent &e);
46
47 protected:
48 void paintEvent(Tempest::PaintEvent& e);
49
50 private:
51 DocumentMenu::Show document;
52 const KeyCodec& keycodec;
53 const Tempest::Texture2d* cursor = nullptr;
54 bool active = false;
55 };
56
void keyDownEvent(Tempest::KeyEvent &e)
void keyUpEvent(Tempest::KeyEvent &e)
void paintEvent(Tempest::PaintEvent &e)
void tick(uint64_t dt)
bool isActive() const
void show(const Show &doc)
Tempest::Margin margins
Tempest::Rect wbounds
Tempest::Margin margins
std::vector< Page > pages