add: RenderTarget

This commit is contained in:
Simon Hardt
2022-03-03 19:43:37 +01:00
parent 02562095d8
commit 420d4c9dc1
7 changed files with 161 additions and 21 deletions

56
frame/src/Vector.hpp Normal file
View File

@@ -0,0 +1,56 @@
#pragma once
#include "Size.hpp"
namespace frame
{
struct Vector
{
int32_t x;
int32_t y;
Vector() = default;
Vector(int32_t x, int32_t)
: x(x)
, y(y)
{
}
Vector(Size const& size)
: x(size.width)
, y(size.width)
{
}
void operator=(Size const& size)
{
x = size.width;
y = size.height;
}
};
inline bool operator==(Vector const& a, Vector const& b)
{
return a.x == b.x && a.y == b.y;
}
inline bool operator!=(Vector const& a, Vector const& b)
{
return !(a == b);
}
inline Vector& operator+=(Vector& a, Vector const& b)
{
a.x += b.x;
a.y += b.y;
return a;
}
inline Vector& operator-=(Vector& a, Vector const& b)
{
a.x -= b.x;
a.y -= b.y;
return a;
}
} // namespace frame