CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
TranslateShape.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
10#include "TransformShape.hpp"
12
14
16 template<typename Shape> class TranslateShape {
17 private:
20
21 public:
24 TranslateShape(Shape shape, const Vector2& delta)
25 : mTransformShape{std::move(shape), [delta](ShapeVertex& value) {
26 value.position += delta;
27 }} {}
28
29 using Edges = typename Impl::Edges;
30
31 [[nodiscard]] Edges edges() const noexcept { return mTransformShape.edges(); }
32
33 using Vertices = typename Impl::Vertices;
34
35 [[nodiscard]] Vertices vertices() const noexcept { return mTransformShape.vertices(); }
36 };
37
38 template<typename Shape> TranslateShape<Shape> translateShape(Shape shape, const Vector2& delta) { return TranslateShape<Shape>{std::move(shape), delta}; }
39
40} // namespace CeresEngine::MeshGenerator
A point on a path.
Definition ShapeVertex.hpp:16
Apply a mutator function to each vertex.
Definition TransformShape.hpp:18
typename Impl::Edges Edges
Definition TransformShape.hpp:50
Translates the position of each vertex by given amount.
Definition TranslateShape.hpp:16
typename Impl::Vertices Vertices
Definition TranslateShape.hpp:33
Vertices vertices() const noexcept
Definition TranslateShape.hpp:35
Impl mTransformShape
Definition TranslateShape.hpp:19
TranslateShape(Shape shape, const Vector2 &delta)
Definition TranslateShape.hpp:24
Edges edges() const noexcept
Definition TranslateShape.hpp:31
typename Impl::Edges Edges
Definition TranslateShape.hpp:29
A type that describes a conjunction of shapes that can be filled and stroked.
Definition Shape.hpp:198
Definition AnyGenerator.hpp:12
TranslateShape< Shape > translateShape(Shape shape, const Vector2 &delta)
Definition TranslateShape.hpp:38
auto move(Vector3 position)
Moves a entity to the given position.
Definition Helpers.hpp:22
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Span.hpp:668