FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_quad.hpp
1/*
2 * Copyright 2024 Guillaume Guillet
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _FGE_C_QUAD_HPP_INCLUDED
18#define _FGE_C_QUAD_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "FastEngine/C_rect.hpp"
22#include "FastEngine/C_vector.hpp"
23#include <array>
24
25namespace fge
26{
27
28class FGE_API Quad
29{
30public:
31 constexpr Quad() = default;
32 constexpr explicit Quad(Vector2f const& fillValue);
33 constexpr explicit Quad(RectFloat const& rect);
34 constexpr Quad(Vector2f const& vec1, Vector2f const& vec2, Vector2f const& vec3, Vector2f const& vec4);
35
36 [[nodiscard]] constexpr bool operator==(Quad const& right) const;
37 [[nodiscard]] constexpr bool operator!=(Quad const& right) const;
38
39 [[nodiscard]] bool contains(Vector2f const& point) const;
40 [[nodiscard]] bool intersects(Quad const& quad) const;
41
42 [[nodiscard]] constexpr fge::Vector2f const& operator[](std::size_t index) const;
43 [[nodiscard]] constexpr fge::Vector2f& operator[](std::size_t index);
44
45 constexpr void fill(Vector2f const& fillValue);
46
47 std::array<fge::Vector2f, 4> _points{fge::Vector2f{0.0f}, fge::Vector2f{0.0f}, fge::Vector2f{0.0f},
48 fge::Vector2f{0.0f}};
49};
50
51constexpr fge::Quad operator*(glm::mat4 const& left, fge::Quad const& right);
52
53} // namespace fge
54
55#include "C_quad.inl"
56
57#endif //_FGE_C_QUAD_HPP_INCLUDED
Definition C_quad.hpp:29