FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
C_viewport.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_VULKAN_C_VIEWPORT_HPP_INCLUDED
18#define _FGE_VULKAN_C_VIEWPORT_HPP_INCLUDED
19
20#include "FastEngine/fge_extern.hpp"
21#include "volk.h"
22
23namespace fge::vulkan
24{
25
26class FGE_API Viewport
27{
28public:
29 Viewport();
30 Viewport(float x, float y, float width, float height);
31 ~Viewport() = default;
32
33 [[nodiscard]] bool operator==(Viewport const& r) const
34 {
35 return this->g_viewport.x == r.g_viewport.x && this->g_viewport.y == r.g_viewport.y &&
36 this->g_viewport.width == r.g_viewport.width && this->g_viewport.height == r.g_viewport.height;
37 }
38 [[nodiscard]] bool operator!=(Viewport const& r) const { return !this->operator==(r); }
39
40 void setPosition(float x, float y);
41 void setSize(float width, float height);
42
43 [[nodiscard]] float getPositionX() const;
44 [[nodiscard]] float getPositionY() const;
45
46 [[nodiscard]] float getWidth() const;
47 [[nodiscard]] float getHeight() const;
48
49 [[nodiscard]] VkViewport const& getViewport() const;
50
51private:
52 VkViewport g_viewport;
53};
54
55} // namespace fge::vulkan
56
57#endif //_FGE_VULKAN_C_VIEWPORT_HPP_INCLUDED
Definition C_viewport.hpp:27