neoGFX
Cross-platform C++ app/game engine
Loading...
Searching...
No Matches
view.hpp
Go to the documentation of this file.
1// view.hpp
2/*
3 neogfx C++ App/Game Engine
4 Copyright (c) 2023 Leigh Johnston. All Rights Reserved.
5
6 This program is free software: you can redistribute it and / or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#pragma once
21
22#include <neogfx/neogfx.hpp>
25
26namespace neogfx
27{
28 class view
29 {
30 public:
31 enum class geometry_policy : std::uint32_t
32 {
33 Automatic = 0x00000001,
34 Specified = 0x00000002
35 };
36 public:
38 public:
44 void set_view_port(optional_rect const& aViewPort);
45 vec2 const& center() const;
46 void set_center(vec2 const& aCenter);
47 void move(vec2 const& aOffset);
48 vec2 const& size() const;
49 void set_size(vec2 const& aSize);
50 void zoom(scalar aFactor);
52 void set_rotation(scalar aAngle);
53 void rotate(scalar aAngle);
54 mat33 const& transformation() const;
55 private:
56 geometry_policy iViewPortGeometryPolicy = geometry_policy::Automatic;
57 geometry_policy iViewGeometryPolicy = geometry_policy::Automatic;
58 std::optional<quad> iViewPort;
59 vec2 iCenter;
60 vec2 iSize;
61 scalar iRotation = 0.0;
62 mutable cache<mat33> iTransformation;
63 };
64}
optional_rect view_port() const
geometry_policy view_port_geometry_policy() const
void rotate(scalar aAngle)
void move(vec2 const &aOffset)
void set_view_port_geometry_policy(geometry_policy aGeometryPolicy)
vec2 const & center() const
void set_size(vec2 const &aSize)
void set_rotation(scalar aAngle)
void set_view_geometry_policy(geometry_policy aGeometryPolicy)
void set_view_port(optional_rect const &aViewPort)
mat33 const & transformation() const
geometry_policy view_geometry_policy() const
scalar rotation() const
vec2 const & size() const
void set_center(vec2 const &aCenter)
void zoom(scalar aFactor)
@ Automatic
Parent widget moves/resizes the view port and/or view according to the widget's client rect.
@ Specified
View port and/or view's position/size is specified (i.e. set explicitly).
matrix33 mat33
double scalar
Definition numerical.hpp:63