JNGL
Easy to use cross-platform 2D game library
Loading...
Searching...
No Matches
jngl
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
9
namespace
jngl
{
10
13
template
<
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
Vec2.hpp
Contains jngl::Vec2 class.
jngl::Vec2
Two-dimensional vector.
Definition
Vec2.hpp:36
jngl::Vec2::y
double y
y component
Definition
Vec2.hpp:48
jngl::Vec2::x
double x
x component
Definition
Vec2.hpp:45
jngl
JNGL's main namespace.
Definition
Achievement.hpp:10
jngl::setRightEdge
void setRightEdge(T &obj, jngl::Vec2 position)
Pass an object T that has methods setCenter(jngl::Vec2) and getWidth().
Definition
positioning.hpp:13