forked from OpenLoco/OpenLoco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LabelFrame.h
38 lines (35 loc) · 862 Bytes
/
LabelFrame.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#pragma once
#include "ZoomLevel.hpp"
#include <OpenLoco/Engine/Ui/Rect.hpp>
namespace OpenLoco
{
#pragma pack(push, 1)
struct LabelFrame
{
int16_t left[ZoomLevel::max]{};
int16_t right[ZoomLevel::max]{};
int16_t top[ZoomLevel::max]{};
int16_t bottom[ZoomLevel::max]{};
[[nodiscard]] bool contains(const Ui::Rect& rec, uint8_t zoom) const
{
if (rec.top() > bottom[zoom])
{
return false;
}
if (rec.bottom() < top[zoom])
{
return false;
}
if (rec.left() > right[zoom])
{
return false;
}
if (rec.right() < left[zoom])
{
return false;
}
return true;
}
};
#pragma pack(pop)
}