JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
positioning.hpp
Go to the documentation of this file.
1// Copyright 2026 Jan Niklas Hasse <jhasse@bixense.com>
2// For conditions of distribution and use, see copyright notice in LICENSE.txt
5#pragma once
6
7#include "Vec2.hpp"
8
9namespace jngl {
10
13template <class T> void setRightEdge(T& obj, jngl::Vec2 position) {
14 obj.setCenter(jngl::Vec2(position.x - obj.getWidth() / 2., position.y));
15}
16
17} // namespace jngl
Contains jngl::Vec2 class.
Two-dimensional vector.
Definition Vec2.hpp:36
double y
y component
Definition Vec2.hpp:48
double x
x component
Definition Vec2.hpp:45
JNGL's main namespace.
void setRightEdge(T &obj, jngl::Vec2 position)
Pass an object T that has methods setCenter(jngl::Vec2) and getWidth().