File: geometry.hpp

package info (click to toggle)
ares 126-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 32,600 kB
  • sloc: cpp: 356,508; ansic: 20,394; makefile: 16; sh: 2
file content (42 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download | duplicates (3)
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
39
40
41
42
#if defined(Hiro_Geometry)
struct Geometry {
  using type = Geometry;

  Geometry();
  Geometry(Position position, Size size);
  Geometry(f32 x, f32 y, f32 width, f32 height);
  template<typename X, typename Y, typename W, typename H>
  Geometry(X x, Y y, W width, H height) : Geometry((f32)x, (f32)y, (f32)width, (f32)height) {}

  explicit operator bool() const;
  auto operator==(const Geometry& source) const -> bool;
  auto operator!=(const Geometry& source) const -> bool;

  auto height() const -> f32;
  auto position() const -> Position;
  auto reset() -> type&;
  auto setGeometry(Geometry geometry = {}) -> type&;
  auto setGeometry(Position position, Size size) -> type&;
  auto setGeometry(f32 x, f32 y, f32 width, f32 height) -> type&;
  auto setHeight(f32 height) -> type&;
  auto setPosition(Position position = {}) -> type&;
  auto setPosition(f32 x, f32 y) -> type&;
  auto setSize(Size size = {}) -> type&;
  auto setSize(f32 width, f32 height) -> type&;
  auto setWidth(f32 width) -> type&;
  auto setX(f32 x) -> type&;
  auto setY(f32 y) -> type&;
  auto size() const -> Size;
  auto width() const -> f32;
  auto x() const -> f32;
  auto y() const -> f32;

//private:
  struct State {
    f32 x;
    f32 y;
    f32 width;
    f32 height;
  } state;
};
#endif