-
Notifications
You must be signed in to change notification settings - Fork 0
/
RenderState.hh
36 lines (28 loc) · 1.24 KB
/
RenderState.hh
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
#pragma once
#include "CoordinateFrame.hh"
#include "Renderer.hh"
namespace pge {
/// @brief - Convenience structure defining the resources
/// that can be displayed in any app. It contains pointers
/// to the world's data, to the frames allowing to change
/// from screen coordinates to world coordinates and the UI.
struct RenderState
{
/// @brief - The coordinate frame to convert tiles to pixels.
CoordinateFrame &frame;
/// @brief - The renderer object to perform draw calls.
Renderer &renderer;
/// @brief - Convenience method allowing to determine if an item is visible
/// in the current viewport.
/// @param p - the position to check in tiles.
/// @param r - the radius of the item.
/// @return - `true` if the object is at least partially visible.
bool visible(const Vec2i &p, const float r = 1.0f) const noexcept;
/// @brief - Similar method to the above but for floating point position and
/// a size instead of a radius which allows for non square objects.
/// @param p - the position to check in tiles.
/// @param sz - the size of the object.
/// @return - `true` if the object is at least partially visible.
bool visible(const Vec2f &p, const Vec2f sz = Vec2f(1.0f, 1.0f)) const noexcept;
};
} // namespace pge