YCLIMP
Yandex Command Line Interface Music Player
Loading...
Searching...
No Matches
Primitives.hpp
1#pragma once
2
3#include <ncurses.h>
4#undef OK
5
6template <typename T>
7struct Vector2
8{
9public:
10 Vector2(T x, T y)
11 : x(x)
12 , y(y)
13 {
14 }
15
16public:
17 T x;
18 T y;
19};
20
21template <typename T>
22struct Rect
23{
24public:
25 Rect() = default;
26 Rect(T left, T top, T width, T height)
27 : left(left)
28 , top(top)
29 , width(width)
30 , height(height)
31 {
32 }
33
34public:
35 T left;
36 T top;
37 T width;
38 T height;
39};
40
41using Vector2f = Vector2<float>;
42using Vector2i = Vector2<int>;
43using Rectf = Rect<float>;
44using Recti = Rect<int>;
45
46struct Time
47{
48 Time(int sec);
49 Time(int min, int sec);
50 int min;
51 int sec;
52};
53
54enum class EEventKey
55{
56 Unknown = -1,
57 A = 'a',
58 B,
59 C,
60 D,
61 E,
62 F,
63 G,
64 H,
65 I,
66 J,
67 K,
68 L,
69 M,
70 N,
71 O,
72 P,
73 Q,
74 R,
75 S,
76 T,
77 U,
78 V,
79 W,
80 X,
81 Y,
82 Z,
83 EnumEnd,
84 KeyResize = KEY_RESIZE
85};
86
87struct Event
88{
89public:
90 Event(int eventKey);
91
92public:
93 EEventKey key;
94
95 int GetRawKey() const;
96
97private:
98 int rawKey;
99};
100
101bool isEventKeyValid(EEventKey eventKey);
102bool isEventKeyValid(int eventKey);
103bool isEventValid(const Event& event);
Definition Primitives.hpp:88
Definition Primitives.hpp:23
Definition Primitives.hpp:8