Archived
1
Fork 0
This repository has been archived on 2025-04-12. You can view files and clone it, but cannot push or open issues or pull requests.
prism/engine/utility/include/common.hpp
2020-08-13 07:48:50 -04:00

31 lines
849 B
C++
Executable file

#pragma once
#include <cstdint>
namespace prism {
/// A 2D extent.
struct Extent {
Extent() : width(0), height(0) {}
Extent(const uint32_t width, const uint32_t height) : width(width), height(height) {}
uint32_t width = 0, height = 0;
};
/// A 2D offset.
struct Offset {
Offset() : x(0), y(0) {}
Offset(const int32_t x, const int32_t y) : x(x), y(y) {}
int32_t x = 0, y = 0;
};
/// A 2D rectangle defined by a offset and an etent.
struct Rectangle {
Rectangle() {}
Rectangle(const Offset offset, const Extent extent) : offset(offset), extent(extent) {}
Rectangle(const int32_t x, const int32_t y, const uint32_t width, const uint32_t height) : offset(x, y), extent(width, height) {}
Offset offset;
Extent extent;
};
}